Integrate a new VRE into orka using docker - grnet/e-science GitHub Wiki

  1. Create public ~okeanos image
  • create VM with Deb8-Docker image & ssh as root
  • search for functional docker containers on the net, test and choose one (preferably from https://hub.docker.com/)
  • build and launch the VRE docker container
    • docker run -d --name {{local_container_name}} {{other_options}} {{remote_docker_repo}}
    • e.g., in dspace case:
    docker run -d --name dspace -p 8080:8080 quantumobject/docker-dspace
    
    • add proper environment vars as well as other cmd line options
      • --link {{container_name to be linked with}}:{{link_alias}}
        • first another docker run command is needed for link to be built and launched
        • e.g., in drupal case:
        docker run -d --name db -e MYSQL_ROOT_PASSWORD="{{mysql_root_password}}" mysql
        
      • -p {{host_port}}:{{container_port}}
      • -e {{env_var}}={{value}}
      • -v {{host_dir}}:{{container_path_to_be_mounted_into}}
  • follow the steps written in the readme in container's web site
    • docker exec -it container_name bash [access bash in container, can prove useful]
  • sometimes you need to step inside docker container to fix bugs
    • you may need to first start the container (which has stopped for some reason)
      • docker start {{container_name}}
    • find container's start script name
      • docker ps -a [start script is mentioned here]
    • step inside docker container
      • docker exec -it {{container_name}} bash
    • useful commands inside container
      • apt-get update
      • apt-get install -y nano
      • export TERM=xterm; nano {{container_start_script}}
      • [parameterization of env variables (e.g., SERVER_IP)]
      • export [shows all env vars]
  • create service to auto restart container on boot
    • nano /lib/systemd/system/{{service_name}}.service
      [Unit]
      Description={{description}}
      Requires=docker.service
      After=docker.service
      
      [Service]
      Restart=always
      ExecStart=/usr/bin/docker start -a {{container_name}}
      ExecStop=/usr/bin/docker stop -t 2 {{container_name}}
      
      [Install]
      WantedBy=multi-user.target
      
    • systemctl enable {{service_name}}
  • test, play around with image
    • reboot -f [forcible reboot]
    • docker ps -a
    • visit VRE gui on VM's IP [don't forget the special port, if needed]
  • create public okeanos VRE image using your VM
    • e.g., in dspace case:
    snf-mkimage --public --print-syspreps -f -u image_name -t e-science_token -a e-science_authentication_url -r image_name /
    
  1. Backend changes
    • In the event that the newly created VRE image requires a shell script for process initialization and credentials setup, then e-science scripts directory must be checked. If the new VRE image is not a later version of an existing image, then a new shell script must be created. If the new image is a later version of an existing image, then a new shell script could be created or an old one modified, depending on the image and its backward compatibility.

    • Update deploy/roles/webserver/files/backend_insert_tables.sql with a new row for the components of the new VRE (appearing on gui)

    • e.g., in dspace case:

INSERT INTO backend_vreimage (id, image_name, image_pithos_uuid, image_components, image_min_reqs, image_init_extra, image_category_id, image_access_url, image_faq_links, requires_script) VALUES (4, 'DSpace-5.3', 'c5850bc1-255d-4847-9b89-ce8e86667250', '{"Debian":{"version":"8.0","help":"https://www.debian.org/"}, "DSpace":{"version":"5.3","help":"http://www.dspace.org/introducing"}, "Docker":{"version":"1.6.2","help":"https://docs.docker.com/"}, "PostgreSQL":{"version":"9.4","help":"http://www.postgresql.org/"}, "Maven":{"version":"3.2.1","help":"https://maven.apache.org/"}, "Ant":{"version":"1.9.4","help":"http://ant.apache.org/"}, "Tomcat":{"version":"8.0.9","help":"http://tomcat.apache.org/"}}', '{"ram":2048}', '{admin_password,admin_email}', 4, '{8080/xmlui,8080/jspui}', '{"~Okeanos info for email port setup":"https://okeanos.grnet.gr/support/faq/cyclades-why-is-port-x-closed-is-it-blocked-by-design/","Info for docker operations":"https://github.com/grnet/e-science/blob/master/orka/VRE_README.md#general-docker-info"}', True); ```

  1. If required, update orka/VRE_README.md with important information regarding the new VRE image
  2. Run travis integration test, test VRE from cli and gui