Friday, February 21, 2014

Thursday, March 7, 2013

Test from blogsy

So I paid $3 or $5 dollars for this. Lets add a picture here

 

Tuesday, October 19, 2010

Migrating svn

Tried a hot copy, but the svn server was a different version.
This caused lots of problems while trying to checkout / compare via eclipse.

So, what finally saved me was dumping / loading commands:
* svnadmin dump (like svnadmin dump /svn/incentto/salesrocket/ > /svn/salesrocket.svn_dump)
* scp the dump file locally (like  scp root@64.57.246.169:/svn/salesrocket.svn_dump /svn/salesrocket.svn_dump)
* svnadmin load (like svnadmin load /svn/incentto/salesrocket/ < /svn/salesrocket.svn_dump)

Worked great.  Also, I used yum to install svn.  That got a much more recent version of svn going since I'm moving everything.  Followed this tutorial http://wiki.centos.org/HowTos/Subversion

The commands to install: 

yum install mod_dav_svn subversion

Then some fancy stuff so I could browse the repos - but this didn't work
cd /etc/httpd/conf.d/
vim subversion.conf

Set the user and password for svn:
 htpasswd -m /svn/dav-svn.password salesrocket

Commands to create the repo before loading the dump file:

mkdir /svn/incentto/salesrocket
cd /svn/incentto/salesrocket
svnadmin create salesrocket
chown -R apache.apache salesrocket

Did dump as above.


Created user access:
cd /svn/incentto/salesrocket/conf
vim svnserve.conf (specified the passwd file)
vim passwd (added my salesrocket = mysecretpassword)

Migrating Apache-Tomcat virtual hosts

I made several changes at once, so it's possible some of these aren't needed.  However, the system seems to be working now and here's what I put.


First, a symbolic link for index home page...
ln -s /home/salesrocket/incentto.com/html/index.shtml /var/www/vhosts/incentto.com/httpdocs/index.html


This is because they moved me from cpanel typical file setup to plesk.  Fun.


--------------------------
Then, what probably got the setup to work was modifying the apache files.
The command vim /opt/tomcat/conf/server.xml allowed me to add some host tags.


        <Host name="preview.incentto.com" appBase="/opt/tomcat/webapps/IncenttoPRE">
                <Context path="" docBase="/opt/tomcat/webapps/IncenttoPRE"/>
        </Host>

        <Host name="incentto.com" appBase="/opt/tomcat/webapps/IncenttoPROD">
                <Context path="" docBase="/opt/tomcat/webapps/IncenttoPROD"/>
        </Host>



Not 100% sure that both docbase and appbase are needed, but it's working.

Wednesday, September 1, 2010

migrating incentto to new server

This is a post to remind me of the checklist to migrate to a new server:
1) setup dns to point preview.incentto.com, etc. to the new ip addresses.
2) modify tomcat-users.xml located in  /opt/tomcat/conf/.  Make sure the entry looked something like this to make the tomcat manager work:


<tomcat-users>
  <role rolename="tomcat"/>
  <role rolename="manager"/>
  <role rolename="admin"/>
  <user username="admin" password="***" roles="tomcat,manager,admin"/>
</tomcat-users>

You can now build the ant file to preview.incentto.com and war file will install.

3) add user salesrocket to groups (ftpusers and salesrocket)
4) migrate svn over
5) modify virtual host file for apache at /etc/httpd/conf/httpd.conf to include preview.incentto.com mappings, etc. and to deal with the 8080 port
6) copy some valuable commands over from previous server
7) copy some jdbc files over

Tuesday, August 17, 2010

Blank incentto databases

This is just a note for myself about my incentto software...

When starting with a fresh database with no company, user, or catalog info... Remember to:
1) create admin user in db by hand to login
2) create at least one user
3) create a catalog.
4) create the company with that catalog
5) create a campaign adding that user
6) go back to company and add that user as a campaign manager

Switching from H2 to MySQL with iBatis

Consider your prototype technologies very carefully...

Well, always be careful when purchasing development code that uses any beta or 'prototype' tools to help the developer. You may just get stuck with them and it could hurt you during a customer launch.

My original launch of the software was plagued by my database going down a lot. This would happen when my virtual server provider would bounce my machine. No matter what script I came up with, H2 liked to either not start or start in a protected mode and not share its connections.

I will not have this problem with MySql because you get it hard-baked-in-as-a-service from any control panel you buy with a virtual server these days. It will also save me $15 per month because I can reduce my java processes I have to buy.

Hey, all these things add up when you're starting up.

My situation I'd like to share is this, the original developer used the H2 database. While a very cool database, there are a couple of problems with it:

Problems with H2:
1) I'm not as familiar with it so it soaks up my time. Can't stress this enough - what entrepreneur has lots of time? If you love H2, don't flame me - I'm simply more skilled with mysql - you can even buy lots of books on it.

I know it's a cool database and there is an active group, and it's all java. But I've got to share my perspective from a CTO / entrepreneur that only has so many dollars to get a product off the ground.

2) Every person that tried to setup the H2 environment to help code wasted lots of hours struggling with it - many never made it, many had a different version that was incompatible.

- Remember, I said be careful of beta software - it has a high cost when the you or especially another outsource group uses beta releases. What tends to happen is that the code jar version evolves fast, and there is a cost to upgrading to the latest jar version. Usually, the developers cut ties with any backwards compatibility and you have to retool some API calls. This is costly when you have only a startup budget and annoying and time consuming at best.

In my case, sometimes my H2 database data wouldn't be compatible with previous H2 releases. Or my developer (the new ones trying to help) would run the H2 console with one version but checkout of svn the old jar, etc. It was a real drag keeping it all in sync.

3) My production environment was never stable with it.
As mentioned above, this was very painful for my first two customers. It caused a lot of problems and probably cost me a faster pace of growing my business. I intend to go back to those customers, but I can't do it in good conscience until I get my environment 110% stable.

4) The main developer decided not to support this app once past the fun stage
Don't underestimate the value of going with technology that everybody understands. Asking someone to setup MySql and run a script is an easy thing to find.

The MySQL conversion:
So, I've been chipping away for months trying to change our code over to MySQL. Here's what I had to do:

1) Use Squirrel plugin to read my old H2 database and create the MySql schema. Wish I would have taken better notes, but at least I've got you off to the right path.

2) Change my AbatorConfig.xml to point to the new JDBC connection.

3) Regen my artifacts with Abator Plugin for Eclipse (believe me, if starting a new project in 2010, you'd probably want to use Spring Roo or even a more modern version of iBatis).

4) Fixed by hand the Campaign class to include all methods that CampaignWithBlobs had (don't worry, this note is just for me to remember what the hell I did).  Needed to hunt down numerous call in DAO and XML and DAOImpl to remove calls to WithBlobs - very extensive change.

There is always risk with these fancy auto-gen type arrangements that many of us rely on. I must stress that if your developer uses a stack to make his life easy, make sure you have it all explained to you and documented. It's a real drag trying to go read about Abator plugin (which is the oldest one he could have used and isn't developed on anymore).

5) Fixed all the DAOImpl.java classes and SQLMap.xml to use lowercase.

Let's talk about #5 above. I kept getting some obtuse UnresolvedDependency errors when starting tomcat. Took me forever to realize that some of the DAO and XML sql files had extra methods not generated by Abator.

By the way SR32.exe from http://www.funduc.com/srshareware.htm rocks! I purchased it for $25 fifteen years ago and still use it today.

Here's the regex expression I used to search for: "+[A-Z_].
And replaced it with: "%1<.

This replaced all my uppercase stuff with lowercase.

These DAO's had UPPERCASE calls, but MySql likes to make lowercase table names. Compare:

return (User)getSqlMapClientTemplate().queryForObject("USER.searchByEmailAddress", emailAddress);

return (User)getSqlMapClientTemplate().queryForObject("user.searchByEmailAddress", emailAddress);

And my SQL.XML files had the same problem:
resultMap="COMPANY.abatorgenerated
resultMap="company.abatorgenerated

This resulted in obtuse errors like this: org.springframework.beans.factory.UnsatisfiedDependencyException: There is no result map named COMPANY.abatorgenerated_CompanyResult in this SqlMap

Just note, MySql is case-sensitive (for search engines myaql case sensitive mysql casesensitive).

6) Change the sequence nextval to max(id)+1
Unfortunately, MySql doesn't support seq.nextval from dual. In other words, I had to ask for the max value of my id columns, like so:
select max(campaign_data_id)+1 from campaign_data

I put these statements into my AbatorConfig.xml file to make sure the generatedKey statements would work. So, my class_SqlMap.xml files for iBatis have calls like:
select max(campaign_data_id)+1 from campaign_data

7) Turns out, I also have to look out for nulls if we're not using sequences. That is, my final generatedKeys will also need to include the mysql IFNULL() command.

So, we have something like:
select IFNULL(max(company_id)+1, 1) from company;

This will replace the NULL with the value 1 to start my first inserts off in the right direction.

8) H2 uses sysdate and MySql uses sysdate()
Had to alter that in one hand created sql call.

Also, MySql uses BIT and H2 uses BOOLEAN.  This change was done by Abator correctly generating the right flavor.  Didn't know about BIT type.


Thursday, August 12, 2010

Roo Flex errors - maven dependencies

So, I followed the instructions to setup the Spring Roo Flex 1.5M, so I can type things like:
flex scaffold all

And cool mxml and .as code is made. @Service and @RemotingDestination happen.
BUT, I get a boat-load of maven dependencies squawking at me.

What worked. I finally took the build advice to go hunt down these .jar and .zip files it's after, then ran the correct maven command like:
mvn install:install-file -DgroupId=com.adobe.flex.compiler -DartifactId=asdoc -Dversion=3.2.0.3958 -Dclassifier=template -Dpackaging=zip -Dfile=c:\Temp\asdoc-3.2.0.3958-template.zip

Here are the other errors I'm going to download all the dependencies for. What I don't understand, is that my pom.xml has the repository I'm getting these from. It seems to be grabbing these from the wrong repository!

Is there a button I can hit to cause maven to try again, or try a certain repository?? I'm wondering if my switching from sprint card to LAN caused the problem and it doesn't know that it can try again...

Here are the problems I'm fixing...
8/12/10 5:16:12 PM CDT: Build errors for MyRoo1; org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.sonatype.flexmojos:flexmojos-maven-plugin:3.7.1:compile-swf (compile-scaffold-swf) on project MyRoo1: Execution compile-scaffold-swf of goal org.sonatype.flexmojos:flexmojos-maven-plugin:3.7.1:compile-swf failed: Plugin org.sonatype.flexmojos:flexmojos-maven-plugin:3.7.1 or one of its dependencies could not be resolved: Missing:
----------
1) com.adobe.flex.compiler:asdoc:zip:template:3.2.0.3958

Try downloading the file manually from the project website.

Then, install it using the command:
mvn install:install-file -DgroupId=com.adobe.flex.compiler -DartifactId=asdoc -Dversion=3.2.0.3958 -Dclassifier=template -Dpackaging=zip -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=com.adobe.flex.compiler -DartifactId=asdoc -Dversion=3.2.0.3958 -Dclassifier=template -Dpackaging=zip -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

Path to dependency:
1) org.sonatype.flexmojos:flexmojos-maven-plugin:maven-plugin:3.7.1
2) com.adobe.flex.compiler:asdoc:zip:template:3.2.0.3958

2) org.jvnet:animal-sniffer-annotation:jar:1.0

Try downloading the file manually from the project website.

Then, install it using the command:
mvn install:install-file -DgroupId=org.jvnet -DartifactId=animal-sniffer-annotation -Dversion=1.0 -Dpackaging=jar -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=org.jvnet -DartifactId=animal-sniffer-annotation -Dversion=1.0 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

Path to dependency:
1) org.sonatype.flexmojos:flexmojos-maven-plugin:maven-plugin:3.7.1
2) org.jvnet:animal-sniffer-annotation:jar:1.0

3) net.sf.saxon:saxon-dom:jar:9.0

Try downloading the file manually from the project website.

Then, install it using the command:
mvn install:install-file -DgroupId=net.sf.saxon -DartifactId=saxon-dom -Dversion=9.0 -Dpackaging=jar -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=net.sf.saxon -DartifactId=saxon-dom -Dversion=9.0 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

Path to dependency:
1) org.sonatype.flexmojos:flexmojos-maven-plugin:maven-plugin:3.7.1
2) net.sf.saxon:saxon-dom:jar:9.0

4) jgoogleanalytics:jgoogleanalytics:jar:0.2

Try downloading the file manually from the project website.

Then, install it using the command:
mvn install:install-file -DgroupId=jgoogleanalytics -DartifactId=jgoogleanalytics -Dversion=0.2 -Dpackaging=jar -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=jgoogleanalytics -DartifactId=jgoogleanalytics -Dversion=0.2 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

Path to dependency:
1) org.sonatype.flexmojos:flexmojos-maven-plugin:maven-plugin:3.7.1
2) jgoogleanalytics:jgoogleanalytics:jar:0.2

5) com.adobe.flex:compiler:pom:4.0.0.14159
Path to dependency:
1) org.sonatype.flexmojos:flexmojos-maven-plugin:maven-plugin:3.7.1
2) com.adobe.flex:compiler:pom:4.0.0.14159

----------
5 required artifacts are missing.

for artifact:
org.sonatype.flexmojos:flexmojos-maven-plugin:maven-plugin:3.7.1

from the specified remote repositories:
central (http://repo1.maven.org/maven2, releases=true, snapshots=false)


Wednesday, August 11, 2010

Spring Roo Flex video

Now I'm after using roo to generate the tedious xml files needed to keep up with blazeds remote destinations..

First, check out http://www.youtube.com/watch?v=R84O87HPCQU to setup the environment.

The only problem I'm having after following all the instructions is a Missing artifact commons-httpclient:commons-httpclient:jar:3.1:compile with maven.

Will have to solve after dinner....

STS SpringSource 2.3.3M2 - maven aspectj plugin error

When I downloaded the STS spring tools, I had this annoying error caused by the milestone repositories not being included.

So, add this to your pom.xml (didn't try this)

spring-maven-milestone
Spring Maven Milestone Repository
http://maven.springframework.org/milestone


This actually worked - you can manually download the .jar file needed and place it in your m2 (maven 2) local cache at C:\Documents and Settings\tsomerville\.m2\repository\org\aspectj\as pectjtools\1.6.10.M1\aspectjtools-1.6.10.M1.jar

The full bug report is available here, as it took me a while to find it... https://jira.springframework.org/browse/ROO-1111

Here was the error ...
1) org.aspectj:aspectjtools:jar:1.6.10.M1    Try downloading the file manually from the project website.    Then, install it using the command:        mvn install:install-file -DgroupId=org.aspectj -DartifactId=aspectjtools -Dversion=1.6.10.M1 -Dpackaging=jar -Dfile=/path/to/file    Alternatively, if you host your own repository you can deploy the file there:        mvn deploy:deploy-file -DgroupId=org.aspectj -DartifactId=aspectjtools -Dversion=1.6.10.M1 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]    Path to dependency:     1) org.codehaus.mojo:aspectj-maven-plugin:maven-plugin:1.0    2) org.aspectj:aspectjtools:jar:1.6.10.M1 ---------- 1 required artifact is missing.  for artifact:    org.codehaus.mojo:aspectj-maven-plugin:maven-plugin:1.0  from the specified remote repositories:   central (http://repo1.maven.org/maven2, releases=true, snapshots=false)

Monday, January 25, 2010

index.html welcome page

I believe this is what controls my www.incentto.com in the war
/home/salesrocket/IncenttoPROD/WEB-INF/web.xml
Or maybe /home/incentto/IncenttoPROD/WEB-INF/web.xml

The ultimate SalesRocket.html page to edit for www.incentto.com is:
/opt/tomcat/webapps/IncenttoPROD/SalesRocket.html

I used this to find it:
find /home | xargs grep SalesRocket.html

Need to figure out how to get full control over those pages. I want to install joomla but not sure how the main index page can ref the swf login within the joomla...

apache http conf - virtual server redirects

First, don't use control panel to add / edit sites. It will hose the /etc/httpd/conf/httpd.conf

Backups exist in that directory, but just in case, here are some settings.

# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#<VirtualHost *:80>
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>
NameVirtualHost 64.57.246.169:80
<VirtualHost 64.57.246.169:80>
Alias /myadmin /opt/phpmyadmin
Alias /pma /opt/phpmyadmin
ScriptAlias /cgi-bin/awstats /var/www/cgi-bin/awstats
Alias /awstats /var/www/html/awstats
ScriptAlias /mail /var/www/cgi-bin/openwebmail/openwebmail.pl
ScriptAlias /cgi-bin/openwebmail /var/www/cgi-bin/openwebmail
Alias /openwebmail /var/www/html/openwebmail
ServerName preview.incentto.com
DocumentRoot /home/salesrocket/incentto.com/html
SuexecUserGroup salesrocket salesrocket
ServerAlias "www.preview.incentto.com"
ServerAdmin "travis@fireleg.com"
ScriptAlias "/cgi-bin/" "/home/salesrocket/incentto.com/cgi-bin/"
CustomLog "/home/salesrocket/incentto.com/access_log" "combined"
ErrorLog "/home/salesrocket/incentto.com/error_log"
<Directory /home/salesrocket/incentto.com/html>
Options Includes FollowSymLinks
AllowOverride All
</Directory>
<Location />
ProxyPass http://64.57.246.169:8080/IncenttoPRE/
ProxyPassReverse http://64.57.246.169:8080/IncenttoPRE/
</Location>
</VirtualHost>
<VirtualHost 64.57.246.169:80>
Alias /myadmin /opt/phpmyadmin
Alias /pma /opt/phpmyadmin
ScriptAlias /cgi-bin/awstats /var/www/cgi-bin/awstats
Alias /awstats /var/www/html/awstats
ScriptAlias /mail /var/www/cgi-bin/openwebmail/openwebmail.pl
ScriptAlias /cgi-bin/openwebmail /var/www/cgi-bin/openwebmail
Alias /openwebmail /var/www/html/openwebmail
ServerName cmit.incentto.com
DocumentRoot /home/salesrocket/incentto.com/html
SuexecUserGroup salesrocket salesrocket
ServerAlias "www.cmit.incentto.com"
ServerAdmin "travis@fireleg.com"
ScriptAlias "/cgi-bin/" "/home/salesrocket/incentto.com/cgi-bin/"
CustomLog "/home/salesrocket/incentto.com/access_log" "combined"
ErrorLog "/home/salesrocket/incentto.com/error_log"
<Directory /home/salesrocket/incentto.com/html>
Options Includes FollowSymLinks
AllowOverride All
</Directory>
<Location />
ProxyPass http://64.57.246.169:8080/IncenttoPROD/
ProxyPassReverse http://64.57.246.169:8080/IncenttoPROD/
</Location>
</VirtualHost>
<VirtualHost 64.57.246.169:80>
Alias /myadmin /opt/phpmyadmin
Alias /pma /opt/phpmyadmin
ScriptAlias /cgi-bin/awstats /var/www/cgi-bin/awstats
Alias /awstats /var/www/html/awstats
ScriptAlias /mail /var/www/cgi-bin/openwebmail/openwebmail.pl
ScriptAlias /cgi-bin/openwebmail /var/www/cgi-bin/openwebmail
Alias /openwebmail /var/www/html/openwebmail
ServerName incentto.com
DocumentRoot /home/salesrocket/incentto.com/html
SuexecUserGroup salesrocket salesrocket
ServerAlias "www.incentto.com"
ServerAdmin "travis@fireleg.com"
ScriptAlias "/cgi-bin/" "/home/salesrocket/incentto.com/cgi-bin/"
CustomLog "/home/salesrocket/incentto.com/access_log" "combined"
ErrorLog "/home/salesrocket/incentto.com/error_log"
<Directory /home/salesrocket/incentto.com/html>
Options Includes FollowSymLinks
AllowOverride All
</Directory>
<Location />
ProxyPass http://64.57.246.169:8080/IncenttoPROD/
ProxyPassReverse http://64.57.246.169:8080/IncenttoPROD/
</Location>
</VirtualHost>

server startup again

tomcat wasn't coming up - nor was h2.

edited vi /etc/rc.d/rc.local
to have my startup scripts like so:


#start tomcat
service tomcat start

#start the h2 database
/home/incentto/database/start_h2.sh

Wednesday, November 4, 2009

adding ports to firewall and iptable

vi /etc/sysconfig/iptables
go down a ways and there is a user definable area to add new ports.

then make the changes happen by
service iptables restart

Wednesday, October 7, 2009

AIR amf Channel Remote Blazeds Testing

I normally test my flex client against blazeds on a locally running tomcat server.

However, the network calls are so fast, you don't get a real sense of how the application will perform in the real world. Ideally i'd like to test a locally running flex/air client against my remote server.

Finally, I found a setting in the beans.xml class that will control it! There are more advanced ways of doing this than hardcoding, which are mentioned here http://coenraets.org/blog/2009/03/externalizing-service-configuration-using-blazeds-and-lcds/

But the simple way, and a good way for flex or air is to change this (beans.xml):
<DynamicChannelSet id="myAmfChannel">

<serverPort>8080</serverPort>

<contextRoot>/SalesRocket</contextRoot>

</DynamicChannelSet>

To this:
<mx:ChannelSet id="myAmfChannel">

<mx:AMFChannel id="amf"url="http://incentto.com:8080/IncenttoPROD/messagebroker/amf"/>

</mx:ChannelSet>

Saturday, June 13, 2009

h2 console jdbc urls

preview.incentto.com/console
jdbc:h2:tcp://localhost/home/salesrocket/incentto_pre

incentto.com/console
jdbc:h2:tcp://fireleg.com/home/salesrocket/incentto_cmit

example incentto production build

see history > example_deployment.txt

Sunday, March 15, 2009

SVN server yum installation

got yum repaired and working. so, this great tutorial is key...

don't forget to possibly open port 3690 for svnserve -d to run.
i'm not quite there yet, but working on getting this thing to run in my environment...

accessing it via svn://fireleg.com:3690/incentto/salesrocket
or svn://fireleg.com/incentto/salesrocket doesn't seem to work.

maybe it's because i have nothing imported, but i doubt it...

to install follow this:

http://www.tonyspencer.com/2007/03/02/setup-a-subversion-server-in-4-minutes/
here's the text...
1. Create a Repository

svnadmin create /svnrepos

2. Create a SVN User

vi /svnrepos/conf/svnserve.conf

In that file add these three lines:

anon-access = none
auth-access = write
password-db = passwd

Create a password file:

vi /svnrepos/conf/passwd
in our case vi /svn/incentto/salesrocket/conf

In that file add a line for your user:

# add users in the format : user = password
tony = mypassword

3. Import Your Project

(assuming you’ve put your project files in /projects/myrailsproject)

svn import /projects/myrailsproject file:///svnrepos/myrailsproject

4. Start the SVN Server as Daemon

svnserve -d

Done! You should now have a svn server running with one project named myrailsproject.

Try checking it out of the repository:

svn co svn://192.168.0.2/svnrepos/myyrailsproject

Since we set anon-access to none you should be prompted for username and password which you created in the file /svnrepos/conf/passwd.

Monday, March 9, 2009

intalling svn

well, yum didn't work, but wget did...


Installing Subversion on CentOS

I’ve been using subversion a lot recently - from using repositories with client development companies to installing it for clients - it seems to be the SVN month.

Anywhere, here’s how I did it. Using CentOS 4.2. For anyone learning or using Subversion I highly recommend that you read the book.

First you need to get the package and install it.

# wget http://subversion.tigris.org/downloads/subversion-1.3.2.tar.gz
# gunzip subversion-1.3.2.tar.gz
# tar -xvf subversion-1.3.2.tar
# cd subversion-1.3.2
# ./configure
# make
# make install

Then you’ll need to setup at least one repository. I’m going to need multiple repositories that I can use for different clients so I have a bit of extra admin work ahead of me. You can setup as many repositories as you need, but no matter what you’ll need at least one. Here create the folders…

# mkdir /svn
# mkdir /svn/repo

Then we need to tell subversion to make our first repository.

# svnadmin create /svn/repo/myproject

For the time being, I’ll use the default svn server called svnserve. You can use apache to get a ton of extra features and better security. Click here for more information on using Apache with subversion. I need do some additional research for my multiple-repository setup before switching to apache though.

First, I need to setup a config file for svnserve.

# vi /svn/repo/conf/svnserve.conf

Then, look for variations of the following code and edit it as necessary. By default any anonymous user can access the code so to disable that you must include anon-access = none, just commenting the value out will not prevent anonymous access.

anon-access = none
password-db = passwdfile
realm = My SVN Repository
auth-access = write

The password-db is just a path to a file containing usernames and passwords. You’ll create this file especially for SVN. I create each file inside of the repository conf directory. So, save your changes and then we’ll create said user file.

# vi userfile

Enter in something like:

[users]
username = password

Yes, pretty basic. See what I meant about svnserve and security? The password is in plain text so if someone ever got your system or that file, they’ll have the passwords inside. That’s one more reason to move to apache.

Anyway, you’ll need to start the svn server.

# svnserve -d

One side note - svnserve just runs and doesn’t have a way to stop besides killing the process. If you make changes to the svnserve.conf or user file you’ll need to restart svnserve.

# killall svnserve

Then, go ahead and test (best to do so on a different machine).

# svn co --username=myusername svn://mydomain/svn/repo/myproject

The system should then ask you for your password and off you go!

Tuesday, February 24, 2009

java memory size

By default, we set the Java heap (min and max) values to 64 MB. This can easily be changed by performing the following steps.

1. SSH into your account using the root user (or SSH in as another user and 'su' to root).
2. Open the file /etc/profile.d/java.sh.
3. Edit the line that shows "export _JAVA_OPTIONS='-Xms64m -Xmx64m'". The value 64m stands for 64 MB of Heap.
4. Once you have made your changes, save the file and exit.
5. You can now either restart your VPS using the Control Panel or log off and back on. Then restart the necessary services.
6. To ensure the new value is being set, type 'echo $_JAVA_OPTIONS' at the command prompt. It should reflect the changes that were made.

Wednesday, July 9, 2008

Tomcat log levels

The "service tomcat start" uses a different logging level than the console you normally see.

Changed: /opt/tomcat/conf/wrapper.conf
wrapper.logfile.loglevel=NONE

To:
# Log Level for log file output. (See docs for log levels)
wrapper.logfile.loglevel=NONE

to:
# Log Level for log file output. (See docs for log levels)
wrapper.logfile.loglevel=INFO

# Maximum size that the log file will be allowed to grow to before
# the log is rolled. Size is specified in bytes. The default value
# of 0, disables log rolling. May abbreviate with the 'k' (kb) or
# 'm' (mb) suffix. For example: 10m = 10 megabytes.
wrapper.logfile.maxsize=2m

# Maximum number of rolled log files which will be allowed before old
# files are deleted. The default value of 0 implies no limit.
wrapper.logfile.maxfiles=2

# Log Level for sys/event log output. (See docs for log levels)
wrapper.syslog.loglevel=INFO

Tuesday, July 8, 2008

running tomcat

Where:
Travis Somerville (fireleg): where is tomcat installed on the system? where is tomcat-users.xml
Kevin Gray: It would be located in /opt/tomcat, the file would be in /opt/tomcat/conf/

Startup / Shutdown:
service tomcat start { console | start | stop | restart | status | dump }


Auto-Startup script:
ON = chkconfig tomcat on (to have it start when the VPS restarts).
LIST = chkconfig --list tomcat
OFF = chkconfig tomcat off

Sunday, June 22, 2008

VPS reboots and server stability

I've been fighting with the server mysteriously going down for some months.

Now I know why, and I'm silly to have not caught this before... my host occasionally reboots my machine. I usually think of linux machines as things that stay up for years, so it didn't occur to me right away.

Tomcat would come up and hog all the memory, and my server wasn't even in the list to start up.

So, I edited the reboot script:

vi /etc/rc.d/rc.local

(added)
rm -rf /travis/nohup.out-backup2
mv /travis/nohup.out-backup1 /travis/nohup.out-backup2
mv /travis/nohup.out /travis/nohup.out-backup1
cd /travis
nohup java -jar /travis/jags_server1.4m/dist/jags_server1.4m.jar &

Friday, February 1, 2008

Linux Command Downloading a file

So many articles talk about downloading a tar file or some file onto linux.
But how do you get it there?

Example:
lwp-download http://www.perl.com/CPAN/src/latest.tar.gz

Trying to get yum, so I can then get apt-get.

YUM Install on Hosted CentOS 4.4 (the virtual type of hosted OS)
(Didn't work, don't bother...)

lwp all these files to a tmp directory.

lwp-download
http://mirror.centos.org/centos/4/os/SRPMS/yum-2.4.3-4.el4.centos.src.rpm

lwp-download
http://mirror.centos.org/centos/4/os/SRPMS/python-sqlite-1.1.7-1.2.1.src.rpm

lwp-download http://mirror.centos.org/centos/4/os/SRPMS/sqlite-3.3.6-2.src.rpm

lwp-download http://mirror.centos.org/centos/4/os/SRPMS/python-elementtree-1.2.6-5.el4.centos.src.rpm

lwp-download http://mirror.centos.org/centos/4/os/SRPMS/python-urlgrabber-2.9.8-2.src.rpm

From that tmp directory: rpm -Uvh *.rpm

IMPORTANT:
Open /etc/yum.conf with your favourite editor and add the following line to the end of the [main] section:

exclude=kernel*

This will prevent yum from installing packages beginning with kernel and so your VPS kernel is safe from being overwritten.

Fireleg disk space

du -chS

The -S separates each subdirectory and gives its size.
The -h makes sizes human readable.

discus is another great command, but I don't have apt-get to install it.
If I had it I would "apt-get install discus"

In /travis/jags_server1.4/dist/ I found nohup.out at 489M.
This is what was sucking up my diskspace, must have left System.out.println turned on, and had to rm nohup.out

lsof is a very interesting command to find open files, or files related to processes.

It also helped me find the disk usage problem.

And don't forget ls.
ls -haltr makes for nice output.

Linux Commands

First, I want to save a link to my hosting site login.

I also want a record of my linux commands, as my hosting site edited some files, and I don't want to loose the clues.

Here is the history dump from day one.
1 ps -eH
2 exit
3 ls
4 cd vpsinfo/
5 ls
6 sh install_beanc.sh
7 ps -eH
8 ps -aux | grep java
9 ps -aux | grep [j]ava
10 ps -a | grep [j]ava
11 ps -eH
12 ps eH
13 ps -eH
14 ps -eH
15 ps -aux
16 lsof -i
17 ps -eH
18 ps -eH
19 ps -eH
20 ps -eH
21 ps -eH
22 ps -eH
23 ps -eH
24 ps -eH
25 cat /proc/user_beancounters
26 vi /etc/sysconfig/iptables
27 service iptables restart
28 vi /etc/sysconfig/iptables
29 service iptables restart
30 ps -eH
31 cat /etc/sysconfig/iptables
32 ps -eH
33 losf -i
34 lsof -i
35 cat /proc/user_beancounters
36 ls
37 sh install_beanc.sh
38 cp vpsinfo.txt /home/webadmin/fireleg.com/html/vpsinfo.php
39 free -m
40 vi /etc/profile.d/java.sh
41 vi /etc/profile.d/java.sh
42 ps- eH
43 ps -eH
44 cat /etc/profile.d/java.sh
45 ps -eH
46 pwd
47 dir
48 cd ..
49 pwd
50 dir
51 java
52 java -jar jags_server1.3.jar
53 ps
54 kill 3229
55 ps
56 ps
57 kill sdaf
58 kill /h
59 kill -h
60 /man
61 man kill
62 java -jar jags_server1.3.jar
63 java -jar jags_server1.3.jar
64 ps -A
65 ps fs
66 netstat
67 ps ux
68 free
69 java -jar jags_server1.3.jar
70 'cat /proc/user_beancounters
71 q
72 q
73 ps -eH
74 ps -eH
75 ps
76 kill -9 3229
77 ps
78 free
79 java -jar jags_server1.3.jar
80 ps
81 kill -9 12183
82 ps
83 ps
84 java -jar jags_server1.3.jar
85 ps
86 ps
87 who
88 w
89 ps -A
90 java -jar jags_server1.4.jar
91 ps
92 kill -9 26036
93 ps
94 java -jar jags_server1.4.jar
95 ps
96 java -jar jags_server1.4.jar
97 ps
98 ps
99 kill -9 5491
100 exit
101 ps
102 java -jar jags_server1.4.jar
103 ps
104 kill -9 java
105 kill -9 32301
106 ps
107 java -jar jags_server1.4.jar
108 ps
109 java -jar jags_server1.4.jar
110 kill -9 32502
111 java -jar jags_server1.4.jar
112 ps
113 cd /travis
114 dir
115 java -jar jags_server1.4
116 cd jags_server1.4/
117 dir
118 cd dist
119 dir
120 java -jar jags_server1.4
121 chmod 777 jags_server1.4.jar
122 java -jar jags_server1.4
123 exit
124 ps -e
125 java -jar jags_server1.4
126 pwd
127 man ps
128 ps a
129 ps -a
130 ps -e
131 ps Ax
132 ps ax
133 kill 7273
134 ps ax
135 ps
136 pwd
137 cd ..
138 tty
139 cd /travis/jags_server1.4/
140 cd dist/
141 pwd
142 dir
143 chown jags_server1.4.jar
144 chown --help
145 chown root jags_server1.4.jar
146 java -jar jags_server1.4.jar
147 ps
148 java -jar jags_server1.4.jar
149 ps
150 ps
151 kill -9 7566
152 ps
153 ps -e
154 java -jar jags_server1.4.jar
155 ps
156 kill -9 7631
157 ps
158 java -jar jags_server1.4.jar
159 ps
160 kill -9 7723
161 ps
162 java -jar jags_server1.4.jar
163 ps
164 kill -9 7830
165 java -jar jags_server1.4.jar
166 ps
167 tail 8043
168 ps
169 kill -9 8043
170 java -jar jags_server1.4.jar &
171 ps
172 kill -9 19656
173 nohup java -jar jags_server1.4.jar &
174 ps
175 discus
176 apt-get
177 ls -haltr
178 history

Tuesday, January 8, 2008

Here's another description of JAGS

JAGS is an actionscript 3.0 to Java game server platform.

This project is the type of project aspiring game developers might really want to look through. All source code is included, and a working demo is up on the site.

Have you ever tried making your first networked game? There is a lot to put together.

This project can serve as a learning template and connect the dots for others attempting to create a casual game using Actionscript 3.0.

Simple real world examples that put together all the tutorials are hard to find. In the JAGS project, you can see how to communicate over binary sockets between two Actionscript clients, how to assign groups to game members, handle game events like multiple key presses, draw sprites, detect collisions, and keep score.

see my blog for code download.