|
First we will set up a simple scenario in which Pigskin will be used to
update the version of a client program called foo application. This server
can be located anywhere on the internet.
foo installation then
run the (possibly newly updated) foo application.
We'll address each of these steps one at a time below.
/usr/local/pigskin . Make sure the apps directory is present in
the installation.foo application. In the /usr/local/pigskin/apps directory, create a directory
named foo . This directory will contain the executable files for versions of the
foo application. You should put each stored version of the application in its own
subdirectory. Each version has a version string which describes it. Let's say the
version string of the active version of foo is 110 (representing version 1.10).
So inside the /usr/local/pigskin/apps/foo directory we will make a directory named
110 . Inside the /usr/local/pigskin/apps/foo/100 directory, you should put all
the files needed to run the foo application version 110 (or possibly just the files
needed to update it to version 110). Finally, you must let Pigskin know what the
active version of the foo application is. Do this by creating a text file in the
/usr/local/pigskin/apps/foo directory called active . This file contains the active
version of the application on the first line. So in our example, the active file
will just have 110 on the first line and that's it. Now the server should be set up to update the
foo application. If you need an example of setting up the server, you can look at the apps/PIGSKIN directory.PigskinDriver class. To start the server,change into the /usr/local/pigskin
directory and run java pigskin.PigskinDriver -m server . This will start the server on the
default port. You will have to investigate platform specific methods for appropriately
running the server in your OS (such as running in the background in Unix or running as a
service in Windows).
C:\Program Files\Pigskin . Once the binary files are copied to the
client, Pigskin is ready to be run.
java -cp "C:\Program Files\Pigskin" pigskin.PigskinDriver -h mypigskinserver.com -a foo You must pass the -cp option to the JVM to tell java where to find the Pigskin executable files. The
-h option to Pigskin tells the client where to find the server (in this case we're saying our server
can be found at mypigskinserver.com ). The -a option to Pigskin specifies the application name.foo from the server.
foo Assuming, the foo program can be started with the command foo .
New in version 101a -- Pigskin Wrapper When Pigskin is run in "wrapper" mode, it will automatically start your application after updating it. Additionally, if your application terminates with error code 46, Pigskin will download the latest version of your application then re-start it. The idea behind this mode is that if your application determines that it is no longer running the same version as the server, it can terminate with error code 46 and Pigskin will update and restart it. To use wrapper mode, the batch file created above would now look like this: java -cp "C:\Program Files\Pigskin" pigskin.PigskinDriver -m wrapper -wrapper-command foo -h mypigskinserver.com -a foo The command above will automatically start foo , so there is no need to include an additonal command which starts the application.
PIGVER .
This file contains the active version of the application. Issues may arise if the application writes over this file or expects the file
to contain a different value. If this is the case, you should specify a different location for the PIGVER file or use Pigskin in a different
way.
|