Developer: How to deploy SESAR REST API package - GeoSamples/sesar-rest-api GitHub Wiki

Preparation

Notes:

  1. you need to change the database configuration to connect to sesardb_dev in application.properties file
  2. You need to update image name in pom.xml, docker-compose.yml file to use sesar-rest-api-sesardev
  3. You need to update the version in pom.xml and SwaggerConfig.java file
  • Test newly built sesar-rest-api-sesardev on local machine. See Here

Deploy as Docker container

  • Set up upload permission for Docker Hub earthchemrepo account.
  • Upload the docker image Docker Hub from your local machine
    docker login
    docker push  earthchemrepo/sesar-rest-api-sesardev:version_num
    
  • Deploy the docker image as container on test Docker server
    • Login to your Test Docker Engine Server and do the following
    ssh username@docker_engine_server_name
    sudo -i
    docker login
    docker pull earthchemrepo/sesar-rest-api-sesardev:version_num
    
    • Create a docker-compose file as following and name it as 'docker-compose-sesardev.yml'
    version: '3'
    services:
      sesar:
        image: earthchemrepo/sesar-rest-api-sesardev:1.0.0
        container_name: sesar-rest-api-1.0.0
        ports:
         - "8082:8080"
        volumes:
         - $PWD:/tmp
    
    Check to see if any container is running on port 8082. If yes, kill it and rm it.
    docker ps -a
    docker stop container-name
    docker rm container-name
    
    The container will run on port 8082 and it binds to internal container port 8080.
    • Run the following command
    docker-compose -f docker-compose-sesardev.yml up &
    

Check the swagger documentation for the REST API below.

Deploy the production version

  • Notify the data curator to test the test API
  • After the data curator confirms it passing the tests, it is ready to build the production version. If it failed tests, the developer needs to fix the issues and deploy a test version again.
  • Build the production version Notes:
    1. Change the database configuration to connect to the production sesardb in application.properties file
    2. Update project name in pom.xml and docker-compose.yml file to 'sesar-rest-api'
    • Build the sesar-rest-api package.
  • Check in the source code to Github sesar-rest-api repo
git add pom.xml docker-compose.yml
git add ...
git commit -m "Some message here"
git push origin master
  • Push the earthchemdocker/sesar-rest-api:version_num to the Docker Hub
  • Create a new release on Github with the current version
  • Write release notes on Github for the current version
  • Notifiy the system admin to deploy the image to the production docker sever.