Skip to content
This repository has been archived by the owner on May 18, 2021. It is now read-only.

Tutorial Part 5

Henning Schmiedehausen edited this page Jun 29, 2014 · 1 revision

Previous: Configuring coordinator and agent

Installing and deploying snapshot and release configuration bundles

In the maven world, an artifact is installed when it is copied into the local maven repository (usually located in ~/.m2/repository. An installed artifact is only available on the same machine; this is used as a a fast local cache for accessing artifacts.

An artifact is deployed when it is sent to a remote repository server. From this server it can be retrieved from any machine that has network access to it.

For the purpose of this tutorial, configuration is only installed locally (when the configuration repository was set up, no remote repository references were given). Configuration bundles are not deployed to an actual repository server.

For production use of airship, a repository server should be available and when setting up the configuration repository, the releasesRepositoryUri and snapshotRepositoryUri will be used to deploy configuration bundles to allow access from many different servers.

Creating snapshot configuration bundles

Airship uses configuration bundles to configure services. To allow installation of the coordinator and the agent, the configurations that were created in the previous section of the tutorial, must now be turned into configuration bundles and installed (and possibly deployed).

To create a snapshot configuration bundle, the changed files must be added to git and committed. On a clean configuration repository, the asconfig snapshot command is run, which creates the snapshots of the configuration. The asconfig command will refuse to create a configuration bundle if the git repository has local changes.

A snapshot release is treated as mutable. Therefore, each subsequent run of asconfig snapshot will overwrite an existing 1-SNAPSHOT release for a given artifact that has the same groupId and artifactId. Snapshot configuration bundles should only be used for testing and development; once a configuration is deemed stable, it should be released.

Creating a snapshot configuration bundle for the coordinator

Using the asconfig snapshot command in the configuration repository creates a configuration bundle for the coordinator. The groupId given when the repository was created (io.airship.airlift.tutorial) is used, the artifactId is the name of the configuration itself (local-coordinator) and the version is 1-SNAPSHOT for the very first, not yet released, version of the configuration.

git checkout local-coordinator

asconfig snapshot
Installed io.airlift.airship.tutorial:local-coordinator-1-SNAPSHOT locally

The resulting configuration bundle is now stored in the local maven repository at the GAV coordinates io.airlift.airship.tutorial:local-coordinator:1-SNAPSHOT. As this is a configuration bundle, airship will refer to it with a leading ampersand (@) so the full name is @io.airlift.airship.tutorial:local-coordinator:1-SNAPSHOT.

Creating a snapshot configuration bundle for the agent

This is done analog to creating the configuration for the agent by using the asconfig snapshot command in the configuration repository.

It also uses the groupId given when the repository was created (io.airship.airlift.tutorial). However the artifactId is now local-agent. The version is also 1-SNAPSHOT for the very first, not yet released, version of the configuration.

git checkout local-agent

asconfig snapshot
Installed io.airlift.airship.tutorial:local-agent-1-SNAPSHOT locally

Creating release configuration bundles

A release configuration bundle is immutable. asconfig release will create the bundle only once and then refuse to create the same bundle again. It is assumed that a released configuration bundle is deployed to a repository server and is available from there indefinitely.

In the previous chapters, configuration bundles were created by checking out the appropriate git branch and running the asconfig command accordingly. Both asconfig snapshot and asconfig release which is used to build release configuration bundles have a a shortcut notation:

asconfig release local-agent
Installed io.airlift.airship.tutorial:local-agent-1 locally

asconfig release local-coordinator
Installed io.airlift.airship.tutorial:local-coordinator-1 locally

without having to check out the appropriate branch first. Once a release configuration bundle was created, the released version is actually reflected by a tag in the git repository:

git tag 
local-agent-1
local-coordinator-1

After running the asconfig release command for both the local-coordinator and the local-agent configuration, two tags now exist in the repository.

Any subsequent snapshot releases will now use 2-SNAPSHOT:

asconfig snapshot local-coordinator
Installed io.airlift.airship.tutorial:local-coordinator-2-SNAPSHOT locally

Note: Running the asconfig snapshot command on a configuration repository without any committed changes will result in the message

There are no pending changes for bundle io.airlift.airship.tutorial. Use released version local-agent:local-coordinator:1 instead

Next: Installing and starting the coordinator and the agent