Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Currently, the ansible tasks for the deployment of the docker container for Emodnet Chemistry 2 are here. However, sometimes just a few little changes to the services are needed. In that case, here you find summarized 7 8 steps to tackle in order to have a successful interaction with a docker container. The examples below are based on Emodnet Chemistry 2 and the server in use is ogs02.cineca.it, though the instructions below are valid in general.

  1. Work on local or Project folder:
    svn Commit functions in OpenEarthTools (...\python\applications\wps\processes\ and ...\python\OpenEarthTools\openearthtools\io\pyodv\ ) OR/AND in the project folder (...\1207195\B. Measurements and calculations\wps_processes\ and \1207195\B. Measurements and calculations\docker\ ).

  2. Access the server via WinSCP:
    Copy the changes from local (or Project folder) to /home/deltares02/docker_images/ in the cloud server (ogs02.cineca.it).

  3. Access the server via Putty:

    Check the running containers and the docker images available.

    Code Block
    docker ps # list running docker containers. For instance:
    CONTAINER ID        IMAGE                        COMMAND                CREATED             STATUS              PORTS                      NAMES
    6d04327023d0        wps_emodnet:pandas_upgrade   "/bin/sh -c '/home/r   4 months ago        Up 4 days           127.0.0.1:8081->8081/tcp   boring_hopper
    Code Block
    deltares02@ogs02:~$ docker images # list running docker images. For instance:
    REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
    wps_emodnet         new_pyodv_pywps4    566e2e24daec        3 months ago        1.296 GB
    wps_emodnet         new_pyodv_pywps3    6c2f08bb04be        3 months ago        1.295 GB
    wps_emodnet         new_pyodv_pywps2    f55ddb6bd287        3 months ago        1.294 GB
    ...
  4. Execute commands in the docker machine:

    Code Block
    deltares02@ogs02:~$ docker exec -it 6d04327023d0 bash # execute "bash" command in the container
    root@6d04327023d0:/tmp/emodnet# # The "bash" of the container is open and we can run commands in it.

    During the previous docker run command the VOLUME (shared filesystems) option  was triggered: "-v /home/deltares02/docker_images:/mnt" (see http://docs.docker.com/reference/run/ )
    Therefore we are now able to access the main machine via the docker container, and copy files from the mounted folder to the directory where the processes run. Then exit:

    Code Block
    root@6d04327023d0:/tmp/emodnet# cp /mnt/pyodv/odv2orm_query.py  /root/src/wps/processes/pyodv/odv2orm_query.py # copy files from mounted folder
    root@6d04327023d0:/tmp/emodnet# exit # exit docker container
  5. Commit the docker container by saving the image:
    Check again what docker containers are running by typing docker ps and the saved images by typing docker images. Then commit the changes. A long file name is returned as output:

    Code Block
    deltares02@ogs02:~$ docker commit 6d04327023d0 wps_emodnet:new_pyodv_pywps5
    f31658a70624ce1c75c7fcf43689ffeab64fa1ed6d1b34c3c513e59f80bbe698


    After that we can check if our new image is there:

    Code Block
    deltares02@ogs02:~$ docker images
    REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
    wps_emodnet         new_pyodv_pywps5    f31658a70624        40 seconds ago      1.252 GB
    wps_emodnet         new_pyodv_pywps4    566e2e24daec        3 months ago        1.296 GB
    ...
  6. Stop the former docker container and run the newly created image:

    Code Block
    deltares02@ogs02:~$ docker stop 6d04327023d0
    6d04327023d0


    Now, typing docker ps again will give an empty list of running containers. Let's docker run the newly created image:

    Code Block
    docker run -p 8081:8081 -e "PYWPS_CFG=/root/pywps.cfg" -e "PYWPS_PROCESSES=/root/src/wps/processes" -v /home/deltares02/docker_images:/mnt  --restart=always f31658a70624
    
    [2015-09-03 16:12:05 +0000] [9] [INFO] Starting gunicorn 19.3.0
    [2015-09-03 16:12:05 +0000] [9] [INFO] Listening at: http://0.0.0.0:8081 (9)
    [2015-09-03 16:12:05 +0000] [9] [INFO] Using worker: sync
    [2015-09-03 16:12:05 +0000] [14] [INFO] Booting worker with pid: 14
    
    
  7. Testing:
    Test the processes on the Web server via the brower. For instance:

    http://emodnet02.cineca.it/wps?service=wps&request=Execute&Identifier=bbox_plot_timeprofile&DataInputs=[bbox=18.8,19.2,57.2,57.8;parameter=EPC00007;z=ADEPZZ01;zlim0=0;zlim1=100;starttime=2000-01-01T00:00:00Z;endtime=2002-01-01T00:00:00Z;markersize=13.0;marker=o;alpha=0.5]&version=1.0.0

    http://emodnet02.cineca.it/wps?DataInputs=[z=ADEPZZ01;bbox=20.0225341796875,20.0774658203125,57.305864179687504,57.360795820312504;parameter=EPC00004;starttime=2000-01-01T00:00:00Z;endtime=2000-12-31T00:00:00Z;zlim0=0;zlim1=10;log10=0;markersize=12.0;alpha=1]&service=wps&request=Execute&Identifier=bbox_plot_timeseries&version=1.0.0

    If the result is good, you can exit Putty window. If you open Putty again and access ogs02.cineca.it, you will get the new running container:

    Code Block
    deltares02@ogs02:~$ docker ps
    CONTAINER ID        
    IMAGE                          COMMAND                
    CREATED             STATUS              PORTS                      NAMES
    8ea44d2ce787        wps_emodnet:new_pyodv_pywps5   "/bin/sh -c '/home/r   6 minutes ago       Up 6 minutes        127.0.0.1:8081->8081/tcp   sleepy_mestormestorf
  8. Save the image (and load it in a new machine):
    Saving the Docker image is not always necessary but it's good practice. Saving the Docker image allows the loading and deployment on another machine.
    Save the image as a tarball, zip the image, and copy it on a new machine:

    Code Block
    deltares02@ogs02:~$ docker save wps_emodnet:new_pyodv_pywps5 > /home/deltares02/docker_images/wps_emodnet_new_pyodv_pywps5.tar # Save as tarball. This might take some time if the image is large
    deltares02@ogs02:~$ gzip /home/deltares02/docker_images/wps_emodnet_new_pyodv_pywps5.tar # Zip the image. This can also take some time

    The Docker image can now be copied to a new machine, loaded by unzipping the file, then "docker load" the image, find it and tag it:

    Code Block
    deltares02@ogs02:~$ scp wps_emodnet_new_pyodv_pywps5.tar.gz <foreign machine> # Copy the tarball to the new machine.
    $ gunzip wps_emodnet_new_pyodv_pywps5.tar.gz # Unzip The tarball
    $ docker load < wps_emodnet_new_pyodv_pywps5.tar # Load the docker image
    $ docker images # Find the Image ID
    $ docker tag repositoryname:tag # Tag the image