University of Colorado
The recommended way to install and run CoG in in development environment is to use Docker. Docker is a software containerization platform. Docker containers wrap software in a complete filesystem that contains everything needed to run: code, runtime, system tools, system libraries, etc. This guarantees that the software will always run the same, regardless of its environment.
CoG has been packaged to work with Docker and starting and running a Docker container based on one of the publicly available CoG Docker images is a simple process, and allows to CoG to be restared from a completely clean state (no projects or users), or upgrad an already populated CoG instance.
Figure 1: Mac Docker icon.
Images for several CoG versions are publicly available on DockerHub (project esgfhub/esgf-cog). To download a specific version issue the following command:
$ docker pull esgfhub/esgf-cog:<cog_version> For example: $ docker pull esgfhub/esgf-cog:v3.7.RC2
To download the latest development version (built at some unspecified time from the github 'devel' branch):
$ docker pull esgfhub/esgf-cog:latest
$ docker run -ti -p 8000:8000 --name mycog esgfhub/esgf-cog:<cog-version> `docker-machine ip` false true
The command line arguments are explained below:
By default, the Docker entrypoint script will start CoG from the installation directory $COG_INSTALL_DIR = /usr/local/cog/cog_install, and will run CoG as the non-privileged user "cogadmin" (instead of the "root" user).
After the container has started, you can access the CoG site at the following URL:
You can log in at http://<DOCKER_MACHINE_IP>:8000/login2/ with the temporary credentials:
To stop the CoG container, and the CoG application running within, simply type ^C in the Docker terminal window. This will stop but NOT delete the "mycog" container.
To restart the same CoG container, using the same configuration, database, and data, issue the following command at a Docker terminal:
$ docker start -ai mycog
To restart CoG from a completely clean slate, first delete the previous container:
$ docker rm mycog
If you are doing CoG development, you may want to startup CoG from your local source code directory, so that you can work with Git to commit and push changes to GitHub.
First, clone the CoG repository to a location on your system, here named $COG_SRC_DIR:
$ git clone https://github.com/EarthSystemCoG/COG.git # optionally, check out a branch or tag $ git checkout -b devel origin/devel $ export COG_SRC_DIR=`pwd`
Then run the CoG Docker container by mounting the local source directory on top of the image CoG installation directory:
$ docker run -ti -p 8000:8000 --name mycog -v $COG_SRC_DIR:/usr/local/cog/cog_install esgfhub/esgf-cog:<cog-version> `docker-machine ip` false true
Inside the container, CoG will still be started from $COG_INSTALL_DIR, but this directory is now a copy of the local source directory $COG_SRC_DIR. Any changes to the code in $COG_SRC_DIR will be immediately reflected onto the running web application. Additionally, using a local terminal, these changes can be committed to GitHub, if desired.
Note that every time the CoG container is restarted, the CoG installation is automatically upgraded to the latest database schema version, and all static files are collected into the standard directory tree.