Skip to content

Deployment

Javier Lührs edited this page Jul 9, 2018 · 20 revisions

Deployment

This document describes how to build and deploy distributions of applications in ocs3.

Note: All the samples in this doc refer to the seqexec but this can be replaced by any other application

Applications

It is understood as an application, a set of libraries deployed as a unit with a specific configuration and launchers, that can be deployed independently. We should be able to run an application locally for testing/development and have the ability to produce distributions that can be installed.

In those cases we also want to include a suitable JRE and a specific configuration.

The applications are packaged using the sbt-native-packager plugin appropriately customized for our case. All the application deployments will contain the same file structure with changes for the different distributions

<approot>
├── bin // Launcher scripts
│   └── seqexec-server
├── conf // Logging, app, launcher configuration
│   ├── launcher.args
│   └── logging.properties
├── log // Log files
├── jre // Java Runtime Environment when appropriate
└── lib // Binaries and dependencies
    ├── edu.gemini.ocs.seqexec_server-0.1-SNAPSHOT.jar
    ├── ...

sbt config

Applications are defined as regular projects on sbt. These applications define the app and the configuration used for deployment. For example we have

seqexec_server // for development
seqexec_server_gs_test // for testing on GS
seqexec_server_gn_test // for testing on GN

We can have more applications for example containing different configuration for different developers

Development versions

For development versions we can produce a local staged version that can be executed locally or a tar ball containing the code, configuration and launchers.

Stage

For the staged version execute in sbt

seqexec_server/universal:stage

This will produce a distribution that can be run locally, by executing the launcher at:

./app/seqexec-server/target/universal/stage/bin/seqexec-server

Note that the stage dir becomes the home for the application, and it thus contains a configuration dir

tar ball

It is possible to deploy the same setup as stage but in a tar ball with the command below

seqexec_server/universal:packageZipTarball

This will package stage into a tar ball at

app/seqexec-server/target/universal/seqexec_server-0.1-SNAPSHOT.tgz

This tar ball can be distribute but not that it does not include the jre

Test versions

A test version is mean to be deployable but contain a test configuration. As such it contains a jre for the appropriate OS, e.g. Linux 64

JRE

To build you should have a proper JRE copy of the target OS on your system. By default the build expects it at $HOME/.jres8, however you can override that by having a jres.sbt file with content like

ocsJreDir in ThisBuild := file(<myjredir>)

it is expected that you have a structure of jres with one directory for system and links to the latest version of the jre, like:

.jres8
├── linux
│   ├── JRE32_1.8 -> jre_32_1.8.0_40/
│   ├── JRE64_1.8 -> jre_64_1.8.0_40/
│   ├── jre_32_1.8.0_40
│   └── jre_64_1.8.0_40
├── osx
│   ├── JRE1.7 -> jre1.8.0_40.jre/
│   ├── JRE1.8 -> jre1.8.0_40.jre/
│   └── jre1.8.0_40.jre
└── windows
    ├── JRE1.8 -> jre1.8.0_40/
    └── jre1.8.0_40

tar ball

To make a deployable tar ball execute

seqexec_server_test_l64/universal:packageZipTarball

The resulting tar ball can be placed on a target host and executed as a daemon, e.g. with the command

nohup <app>/bin/seqexec-server &

Build server

ocs3 is available to be built on the build server. The instructions are fairly simple

  • Login to the build machine
ssh software@sbfosxdev-mp1
cd dev/ocs3
  • Bring the latest changes
git fetch central
git pull central develop
  • Checkout the right tag

If building a specific release:

git checkout tags/v<version>
  • Build the correct configuration.

For Gemini South:

sbt app_seqexec_server_gs/universal:packageZipTarball

For Gemini North:

sbt app_seqexec_server_gn/universal:packageZipTarball
  • Copy the tarball to the correct host.

For Gemini South:

scp app/seqexec-server-gs/target/universal/app_seqexec_server_gs-<version>.tgz  software@seqexec.cl.gemini.edu:

For Gemini North:

scp app/seqexec-server-gn/target/universal/app_seqexec_server_gn-<version>.tgz  software@seqexec.hi.gemini.edu:

For Gemini South Test:

scp app/seqexec-server-gs-test/target/universal/app_seqexec_server_gs_test-<version>.tgz  software@seqexec-test.cl.gemini.edu:

For Gemini North:

scp app/seqexec-server-gn-test/target/universal/app_seqexec_server_gn_test-<version>.tgz  software@seqexec-test.hi.gemini.edu:

Automatized build and deployment

There is a script available in the build machine that automatizes the building and deployment of Seqexec, called buildSeqexec.sh. The script accepts a version number, and takes care of updating the working directory, checking out the right tag, building the packages, copying the packages in the target machines, unpacking the packages in the target machines, and updating the simlink to the unpackaged folder.

Usage: buildSeqexec.sh version [-t] [-b] [-d]

The script accept the following options:

   -t: Include the test packages (excluded by default)
   -b: Skip the build process
   -d: Skip the unpacking in the target machines

Please be aware that, in its current state, the script does not handle errors very well.

Clone this wiki locally