Skip to content

Instantly share code, notes, and snippets.

@crossi202
Last active June 19, 2018 09:03
Show Gist options
  • Save crossi202/07a3438df1b89d761221 to your computer and use it in GitHub Desktop.
Save crossi202/07a3438df1b89d761221 to your computer and use it in GitHub Desktop.

Application packaging and Github usage

Introduction

This procedure will guide you on the usage of automation tools, in order to build an Application suitable for the Terradue Cloud Platform (see these examples). Such applications have the main advantage to be self-contained. In other words, a single package (both in RPM and Docker image formats) contains the application resources and the dependencies specification. For this step, we will also add a new repository under your Github organization.

Prerequisites

  • A Github account. If you don't have it, you can request a new one here https://github.com/join,
  • An application name for the Github repository under your Github organization. We will add the dcs- prefix in order to be homogeneous with the existing repositories.

From now on, let's say that the repository name is identified as app-name.

When you will provide us your Github account name and app-name, we will setup your repository and provide you the app-url. Then you will be able to proceed with the next steps.

Application archetype

With this step you will create an Application structure compliant with the DCS family applications.

  • Logon on your Sandbox,
  • Type:
cd
mvn archetype:generate
  • Select the entry relative to the application archetype you want to use. Currently, archetypes are available for: python, bash. In this example, the option 1 (bash) is selected:
Choose archetype:
1: local -> com.terradue.app:dcs-bash-archetype (Archetype for Developer Cloud Sandbox Bash Applications - v2)
2: local -> com.terradue.app:dcs-python-archetype (Archetype for Developer Cloud Sandbox Python Applications - v2)
3: local -> com.terradue.app:dcs-R-archetype (Archetype for Developer Cloud Sandbox R Applications - BETA)
4: local -> com.terradue.app:dcs-snap-S1-one-to-one (Developer Cloud Sandbox Application example using SNAP and Sentinel-1 (one-to-one))
5: local -> com.terradue.app:dcs-snap-S1-pair (Developer Cloud Sandbox Application example using SNAP and Sentinel-1 (pair of products))
6: local -> com.terradue.app:dcs-snap-S1-stack (Developer Cloud Sandbox Application example using SNAP and Sentinel-1 (stack of products))
7: local -> com.terradue.app:dcs-snap-S2-one-to-one (Developer Cloud Sandbox Application example using SNAP and Sentinel-2 (one-to-one))
8: local -> com.terradue.app:dcs-snap-CSK-ifg (Developer Cloud Sandbox Application example using SNAP for COSMO-SkyMed interferogram generation)
9: local -> com.terradue.app:dcs-snap-RS2-ifg (Developer Cloud Sandbox Application example using SNAP for RADARSAT-2 interferogram generation)
10: local -> com.terradue.app:dcs-snap-TSX-ifg (Developer Cloud Sandbox Application example using SNAP for TerraSAR-X interferogram generation)
11: local -> com.terradue.app:dcs-otb-S1-one-to-one (Developer Cloud Sandbox Application example using OTB and Sentinel-1 (one-to-one))
12: local -> com.terradue.app:dcs-otb-S2-one-to-one (Developer Cloud Sandbox Application example using OTB and Sentinel-2 (one-to-one))
13: local -> com.terradue.app:dcs-otb-L8-one-to-one (Developer Cloud Sandbox Application example using OTB and Landsat-8 (one-to-one))
14: local -> com.terradue.app:dcs-otb-Pleiades-one-to-one (Developer Cloud Sandbox Application example using OTB and Pleiades (one-to-one))
15: local -> com.terradue.app:dcs-otb-K2-one-to-one (Developer Cloud Sandbox Application example using OTB and Kompsat2 (one-to-one))
16: local -> com.terradue.app:dcs-otb-K3-one-to-one (Developer Cloud Sandbox Application example using OTB and Kompsat3 (one-to-one))
17: local -> com.terradue.app:dcs-notebook-1 (Developer Cloud Sandbox Application example the notebook (no data stage-in, one-to-one))
18: local -> com.terradue.app:dcs-notebook-2 (Developer Cloud Sandbox Application example the notebook (no data stage-in, many-to-one))
19: local -> com.terradue.app:dcs-notebook-stagein-1 (Developer Cloud Sandbox Application example the notebook with data stage-in (one-to-one))
20: local -> com.terradue.app:dcs-notebook-stagein-2 (Developer Cloud Sandbox Application example the notebook with data stage-in (many-to-one))
21: local -> com.terradue.app:data-driven (Data driven LaunchPad)
Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): : 1
  • Set the group.id, artifact.id, version and package values for your project. For example:
Define value for property 'groupId': : com.terradue
Define value for property 'artifactId': : <app-name>
Define value for property 'version':  1.0-SNAPSHOT: :
Define value for property 'package':  : : <app-name>
Define value for property 'community': : <your community, for example geohazards-tep>
Define value for property 'description': : <a long description of your Application>
Define value for property 'summary': : <a short description of your Application>

NOTE 'version' will be set by default to '1.0-SNAPSHOT'.

Prepare your git working copy

With this step you will initialize your working copy as a git repository. Hereafter you will find the commands to proceed (best practice, managed under /home).

  • Configure your Sandbox for git credentials (your GitHub account credentials):
git config --global user.name "<Github user name>"
git config --global user.email <Github user email>
  • Configure your Sandox for git pushing strategy (it will push all the changed branches):
git config --global push.default matching
  • Set up the git repository:
cd
cd <app-name>
git init
git add -A .
git commit -am "Your commit message"

Setup the right sync between your Sandbox and your GitHub repository

git remote add origin <app-url>
git branch develop
git branch docker
git checkout develop
git push -u origin master develop docker

Test the Application

  • Install the Application in the /application path (Be aware that the 'clean' command deletes EVERYTHING under /application):
cd
cd <app-name>
mvn clean install
  • Execute it:
ciop-run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment