Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-11042

Create a Dockerfile for squash (monolith application still)

    XMLWordPrintable

    Details

    • Type: Story
    • Status: Done
    • Resolution: Done
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      After learning the basics of docker from https://www.safaribooksonline.com/library/view/learning-path-devops/9781786463937/ in this ticket I will create a Dockerfile for squash starting from the official image for python at https://hub.docker.com/_/python/

        Attachments

          Issue Links

            Activity

            Hide
            afausti Angelo Fausti added a comment - - edited

            Practice: Linking containers:

            I'm using the official container for mariadb on docker hub and linking this container with the squash application container.

             
            # Running mariadb 10.3 container in detached mode
             
            docker run --name squash-mariadb -e MYSQL_ROOT_PASSWORD=<password> -d mariadb:10.3
             
            # Now I link this container with the application container. Building on an existing python container  I just open a text terminal and install mariadb-client to test the connection
             
            docker run -it --link squash-mariadb python /bin/bash
             
            root@6613ebc328bb:/# apt-get update
            root@6613ebc328bb:/# apt-get install mysql-client
             
            # Note that the host in the mysql command is the name of the linked container running mariadb server
             
            root@6613ebc328bb:/# mysql -hsquash-mariadb -uroot -p
            Enter password:
            Welcome to the MySQL monitor.  Commands end with ; or \g.
            Your MySQL connection id is 11
            Server version: 5.5.5-10.3.0-MariaDB-10.3.0+maria~jessie mariadb.org binary distribution
             
            Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
             
            Oracle is a registered trademark of Oracle Corporation and/or its
            affiliates. Other names may be trademarks of their respective
            owners.
             
            Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
             
            mysql>
            

            I think it is important to appreciate what is happening here. Linking takes the exposed port on the squash-mariadb container and make it directly accessible to the second container. It also changes /etc/hosts and populates a number of environment variables that are used to discover how to connect to it.

            Note that these env variables are prefixed with the name of the first container.

             
            $ docker run -it --link squash-mariadb python /bin/bash
            root@b0d750aad389:/# env
            SQUASH_MARIADB_ENV_MYSQL_ROOT_PASSWORD=admin
            HOSTNAME=b0d750aad389
            GPG_KEY=0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D
            TERM=xterm
            SQUASH_MARIADB_PORT_3306_TCP=tcp://172.17.0.2:3306
            SQUASH_MARIADB_ENV_MARIADB_MAJOR=10.3
            SQUASH_MARIADB_ENV_no_proxy=*.local, 169.254/16
            SQUASH_MARIADB_PORT=tcp://172.17.0.2:3306
            SQUASH_MARIADB_ENV_GOSU_VERSION=1.7
            PYTHON_VERSION=3.6.1
            SQUASH_MARIADB_NAME=/relaxed_cori/squash-mariadb
            PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
            PWD=/
            LANG=C.UTF-8
            PYTHON_PIP_VERSION=9.0.1
            SQUASH_MARIADB_ENV_MARIADB_VERSION=10.3.0+maria~jessie
            SHLVL=1
            HOME=/root
            SQUASH_MARIADB_ENV_GPG_KEYS=199369E5404BD5FC7D2FE43BCBCB082A1BB943DB 	430BDF5C56E7C94E848EE60C1C4CBDCDCD2EFD2A 	4D1BB29D63D98E422B2113B19334A25F8507EFA5
            no_proxy=*.local, 169.254/16
            SQUASH_MARIADB_PORT_3306_TCP_PORT=3306
            SQUASH_MARIADB_PORT_3306_TCP_PROTO=tcp
            SQUASH_MARIADB_PORT_3306_TCP_ADDR=172.17.0.2
            _=/usr/bin/env
            

            Show
            afausti Angelo Fausti added a comment - - edited Practice: Linking containers: I'm using the official container for mariadb on docker hub and linking this container with the squash application container.   # Running mariadb 10.3 container in detached mode   docker run --name squash-mariadb -e MYSQL_ROOT_PASSWORD=<password> -d mariadb:10.3   # Now I link this container with the application container. Building on an existing python container I just open a text terminal and install mariadb-client to test the connection   docker run -it --link squash-mariadb python /bin/bash   root@6613ebc328bb:/# apt-get update root@6613ebc328bb:/# apt-get install mysql-client   # Note that the host in the mysql command is the name of the linked container running mariadb server   root@6613ebc328bb:/# mysql -hsquash-mariadb -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 11 Server version: 5.5.5-10.3.0-MariaDB-10.3.0+maria~jessie mariadb.org binary distribution   Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.   Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.   Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.   mysql> I think it is important to appreciate what is happening here. Linking takes the exposed port on the squash-mariadb container and make it directly accessible to the second container. It also changes /etc/hosts and populates a number of environment variables that are used to discover how to connect to it. Note that these env variables are prefixed with the name of the first container.   $ docker run -it --link squash-mariadb python /bin/bash root@b0d750aad389:/# env SQUASH_MARIADB_ENV_MYSQL_ROOT_PASSWORD=admin HOSTNAME=b0d750aad389 GPG_KEY=0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D TERM=xterm SQUASH_MARIADB_PORT_3306_TCP=tcp://172.17.0.2:3306 SQUASH_MARIADB_ENV_MARIADB_MAJOR=10.3 SQUASH_MARIADB_ENV_no_proxy=*.local, 169.254/16 SQUASH_MARIADB_PORT=tcp://172.17.0.2:3306 SQUASH_MARIADB_ENV_GOSU_VERSION=1.7 PYTHON_VERSION=3.6.1 SQUASH_MARIADB_NAME=/relaxed_cori/squash-mariadb PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin PWD=/ LANG=C.UTF-8 PYTHON_PIP_VERSION=9.0.1 SQUASH_MARIADB_ENV_MARIADB_VERSION=10.3.0+maria~jessie SHLVL=1 HOME=/root SQUASH_MARIADB_ENV_GPG_KEYS=199369E5404BD5FC7D2FE43BCBCB082A1BB943DB 430BDF5C56E7C94E848EE60C1C4CBDCDCD2EFD2A 4D1BB29D63D98E422B2113B19334A25F8507EFA5 no_proxy=*.local, 169.254/16 SQUASH_MARIADB_PORT_3306_TCP_PORT=3306 SQUASH_MARIADB_PORT_3306_TCP_PROTO=tcp SQUASH_MARIADB_PORT_3306_TCP_ADDR=172.17.0.2 _=/usr/bin/env
            Hide
            afausti Angelo Fausti added a comment - - edited

            As my understanding of docker progresses it becomes clearer that the current repo is not ideal for containerizing squash. We do want separate containers for nginx, squash-db, squash-api and squash-bokeh as illustrated in this figure and thus separate repositories.

            But still, for practicing docker commands, I could sell as part of this ticket a monolithic docker image for squash development.

            Show
            afausti Angelo Fausti added a comment - - edited As my understanding of docker progresses it becomes clearer that the current repo is not ideal for containerizing squash. We do want separate containers for nginx, squash-db, squash-api and squash-bokeh as illustrated in this figure and thus separate repositories. But still, for practicing docker commands, I could sell as part of this ticket a monolithic docker image for squash development.
            Hide
            afausti Angelo Fausti added a comment -

            Created a Dockerfile for squash development, it uses supervisord to manage mariadb (mysql), django and bokeh processes. It is a monolithic docker image more for practicing docker commands than anything else, but still useful. The Makefile has the docker command to build the image, and you should be able to run it with:

            docker run -it -p 5006:5006 -p 8000:8000 lsstsqre/squash

            then access squash at http://localhost:8000

            Show
            afausti Angelo Fausti added a comment - Created a Dockerfile for squash development, it uses supervisord to manage mariadb (mysql), django and bokeh processes. It is a monolithic docker image more for practicing docker commands than anything else, but still useful. The Makefile has the docker command to build the image, and you should be able to run it with: docker run -it -p 5006:5006 -p 8000:8000 lsstsqre/squash then access squash at http://localhost:8000
            Show
            afausti Angelo Fausti added a comment - See PR https://github.com/lsst-sqre/qa-dashboard/pull/49

              People

              Assignee:
              afausti Angelo Fausti
              Reporter:
              afausti Angelo Fausti
              Reviewers:
              Adam Thornton, Joshua Hoblitt
              Watchers:
              Adam Thornton, Angelo Fausti, Joshua Hoblitt
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Jenkins

                  No builds found.