From b910d66f07552d0a5ace0b78180152df26e50771 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Aillet Date: Thu, 16 Apr 2015 02:49:26 +0200 Subject: [PATCH] Migration from Fig to Docker-compose Documentation update --- README.md | 50 +++++++++++++-------------- docker/compose/README.md | 38 ++++++++++----------- docker/fig/Dockerfile | 20 ----------- docker/fig/README.md | 74 ---------------------------------------- fig.yml | 66 ----------------------------------- 5 files changed, 44 insertions(+), 204 deletions(-) delete mode 100755 docker/fig/Dockerfile delete mode 100644 docker/fig/README.md delete mode 100755 fig.yml diff --git a/README.md b/README.md index 48ff09c..acd1445 100755 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Developing and deploying CKAN with Docker # Intro -Dockerfiles, Fig service definition & Vagrantfile to develop & deploy CKAN, Postgres, Solr & datapusher using Docker. +Dockerfiles, Docker-compose service definition & Vagrantfile to develop & deploy CKAN, Postgres, Solr & datapusher using Docker. Docker containers included: @@ -59,7 +59,7 @@ Other contrib containers: ├── docker │   ├── ckan │   ├── data - │   ├── fig + │   ├── compose │   ├── nginx │   ├── insecure_key (baseimage insecure SSH key) │   ├── postgres @@ -122,7 +122,7 @@ The Solr container runs version 4.10.1. This can easily be changed by customisin By detault the `schema.xml` of the upstream version (2.3) is copied in the container. This can be overriden at runtime by mounting it as a volume. This default path of the volume is `/_src/ckan/ckan/config/solr/schema.xml` so it mounts the schema corresponding to your version of CKAN. -For example for Fig: +For example for Docker-compose: solr: build: docker/solr @@ -133,7 +133,7 @@ For example for Fig: volumes: - /_src/ckan/ckan/config/solr/schema.xml:/opt/solr/example/solr/ckan/conf/schema.xml -If you need a custom schema, put it in `/_solr` and change the path in the fig or vagrant file. +If you need a custom schema, put it in `/_solr` and change the path in the docker-compose or vagrant file. volumes: - /_solr/schema.xml:/opt/solr/example/solr/ckan/conf/schema.xml @@ -144,18 +144,18 @@ The container is cross version compatible. You need mount the appropriate `schem Read the [ckanext-spatial documentation](http://docs.ckan.org/projects/ckanext-spatial/en) to add the required fields to your Solr schema if you use ckanext-spatial -##### Fig Dockerfile -The Fig container runs Fig version `1.0.1` & the latest Docker within a container. +##### Docker-compose Dockerfile +The Docker-compose container runs the latests Docker-compose & Docker within a container. -The Docker socket needs to be mounted as a volume to control Docker on the host. A source folder must be mounted to access the fig definition +The Docker socket needs to be mounted as a volume to control Docker on the host. A source folder must be mounted to access the docker-compose definition -see docker/Fig/Readme to find out how to use +see docker/compose/Readme to find out how to use #### Vagrantfile Defines VMs provided by Docker, a Virtual Box docker-host is used if the host can't run Docker containers natively. This is an alternative to Boot2Docker. -#### fig.yml -Defines the set of services required to run CKAN. Read the [fig.yml reference](http://www.fig.sh/yml.html) to understand and edit. +#### docker-compose.yml +Defines the set of services required to run CKAN. Read the [docker-compose.yml reference](http://docs.docker.com/compose/yml/) to understand and edit. @@ -164,29 +164,29 @@ Defines the set of services required to run CKAN. Read the [fig.yml reference](h 1. Clone your code in the `_src` directory (see _src/README) 2. Clone the datapusher in `_service-provider` (see _service-provider/README) -3. Set the full path of the volumes in fig.yml -4. Run `up` with Fig or Vagrant +3. Set the full path of the volumes in docker-compose.yml +4. Run `up` with Docker-compose or Vagrant -## Using Fig (recommended) +## Using Docker-compose (recommended) -#### Option 1: Fig is installed on the Docker host -_If you have if >= 1.0 installed, just type_ +#### Option 1: Docker-compose is installed on the Docker host +_If you have it installed, just type_ - fig up + docker-compose up -#### Option 2: Using the fig container +#### Option 2: Using the docker-compose container _Otherwise, you can use the container provided_ -Build fig the fig container +Build the Docker-compose container - docker build --tag="fig_container" docker/fig + docker build --tag="dockercompose_container" docker/compose Run it - docker run -it -d --name="fig-ckan" -p 2375 -v /var/run/docker.sock:/tmp/docker.sock -v $(pwd):/src fig_container + docker run -it -d --name="dockercompose-ckan" -p 2375 -v /var/run/docker.sock:/tmp/docker.sock -v $(pwd):/src dockercompose_container -_In the fig container fig won't work with relative path, because the mount namespace is different, you need to change the relative path to absolute path_ +_In the Docker-compose container docker-compose won't work with relative path, because the mount namespace is different, you need to change the relative path to absolute path_ for example, change the `./`: @@ -198,9 +198,9 @@ to an absolute path to you ckan-docker directory: `/Users/username/git/ckan/cka volumes: - /Users/username/git/ckan/ckan-docker/_src:/usr/lib/ckan/default/src -Build & Run the services defined in `fig.yml` +Build & Run the services defined in `docker-compose.yml` - docker exec -it fig-ckan fig up + docker exec -it dockercompose-ckan docker-compose up If you are using boot2docker, add entries in your hosts file e.g. `192.168.59.103 ckan.localdomain` @@ -235,7 +235,7 @@ SSH insecure key can be disabled by removing the `--enable-insecure-key` option ## Managing Docker images & containers -You should use fig to manage your containers & images, this will ensure they are started/stopped in order +You should use docker-compose to manage your containers & images, this will ensure they are started/stopped in order If you want to quickly remove all untagged images: @@ -279,5 +279,5 @@ Both examples show that development dependencies should only be installed in the # Sources - [Docker](https://www.docker.com) -- [Fig](http://www.fig.sh) +- [Docker-compose](http://docs.docker.com/compose/) - [Vagrant Docker provider](https://docs.vagrantup.com/v2/docker/index.html) diff --git a/docker/compose/README.md b/docker/compose/README.md index 999c185..98055a3 100644 --- a/docker/compose/README.md +++ b/docker/compose/README.md @@ -1,11 +1,11 @@ -Fig -=== +Docker-compose +============== -The Fig container runs Fig version 1.0 & the latest Docker within a container. +The docker-compose container runs the latests docker-compose & Docker within a container. # Usage: -The Docker socket needs to be mounted as a volume to control Docker on the host. A source folder must be mounted to access the fig definition +The Docker socket needs to be mounted as a volume to control Docker on the host. A source folder must be mounted to access the docker-compose definition ## Build & Run @@ -14,19 +14,19 @@ _Move to the `ckan-docker` directory_ - Build it: -_Build the Docker image from `docker/fig/Dockerfile`, and call it "fig_container"_ +_Build the Docker image from `docker/compose/Dockerfile`, and call it "dockercompose_container"_ - docker build --tag="fig_container" docker/fig + docker build --tag="dockercompose_container" docker/fig - Run it: -_Start the a container based on the `fig_container` Docker image_ +_Start the a container based on the `dockercompose_container` Docker image_ - docker run -it -d --name="fig-ckan" -p 2375 -v /var/run/docker.sock:/tmp/docker.sock -v $(pwd):/src fig_container + docker run -it -d --name="dockercompose-ckan" -p 2375 -v /var/run/docker.sock:/tmp/docker.sock -v $(pwd):/src dockercompose_container - Set the source volume path to yours. -_In the fig container fig won't work with relative path, because the mount namespace is different, you need to change the relative path to absolute path_ +_In the docker-compose container docker-compose won't work with relative path, because the mount namespace is different, you need to change the relative path to absolute path_ for example, change the `./`: @@ -40,35 +40,35 @@ to an absolute path to you ckan-docker directory: `/Users/username/git/ckan/cka - Build the Docker images & run the containers: -Send the `fig up` command to the fig container +Send the `docker-compose up` command to the docker-compose container - docker exec -it fig-ckan fig up + docker exec -it dockercompose-ckan docker-compose up -## Using the Fig container +## Using the Docker-compose container -You can use amy fig command by pre-pending the `docker exec -it fig-ckan` command to any fig command +You can use any docker-compose command by pre-pending the `docker exec -it dockercompose-ckan` command to any docker-compose command ### build & start / recreate - docker exec -it fig-ckan fig up + docker exec -it dockercompose-ckan docker-compose up ### stop it - docker exec -it fig-ckan fig stop + docker exec -it dockercompose-ckan docker-compose stop ### start it - docker exec -it fig-ckan fig start + docker exec -it dockercompose-ckan docker-compose start ### delete the containers - docker exec -it fig-ckan fig rm + docker exec -it dockercompose-ckan docker-compose rm ### build new images - docker exec -it fig-ckan fig build + docker exec -it dockercompose-ckan docker-compose build ### logs - docker exec -it fig-ckan fig logs + docker exec -it dockercompose-ckan docker-compose logs diff --git a/docker/fig/Dockerfile b/docker/fig/Dockerfile deleted file mode 100755 index 83f9051..0000000 --- a/docker/fig/Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -FROM phusion/baseimage:0.9.16 -MAINTAINER Open Knowledge - -# set UTF-8 locale -RUN locale-gen en_US.UTF-8 && \ - echo 'LANG="en_US.UTF-8"' > /etc/default/locale - -RUN apt-get -qq update - -# Install required packages -RUN DEBIAN_FRONTEND=noninteractive apt-get -qq -y install curl - -RUN curl -sSL https://get.docker.com/ | sh -RUN curl -L https://github.com/docker/fig/releases/download/1.0.1/fig-`uname -s`-`uname -m` > /usr/local/bin/fig; chmod +x /usr/local/bin/fig -ENV DOCKER_HOST unix:///tmp/docker.sock - -WORKDIR /src -CMD ["/bin/bash"] - -RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* diff --git a/docker/fig/README.md b/docker/fig/README.md deleted file mode 100644 index 999c185..0000000 --- a/docker/fig/README.md +++ /dev/null @@ -1,74 +0,0 @@ -Fig -=== - -The Fig container runs Fig version 1.0 & the latest Docker within a container. - -# Usage: - -The Docker socket needs to be mounted as a volume to control Docker on the host. A source folder must be mounted to access the fig definition - - -## Build & Run - -_Move to the `ckan-docker` directory_ - -- Build it: - -_Build the Docker image from `docker/fig/Dockerfile`, and call it "fig_container"_ - - docker build --tag="fig_container" docker/fig - -- Run it: - -_Start the a container based on the `fig_container` Docker image_ - - docker run -it -d --name="fig-ckan" -p 2375 -v /var/run/docker.sock:/tmp/docker.sock -v $(pwd):/src fig_container - -- Set the source volume path to yours. - -_In the fig container fig won't work with relative path, because the mount namespace is different, you need to change the relative path to absolute path_ - -for example, change the `./`: - - volumes: - - ./_src:/usr/lib/ckan/default/src - -to an absolute path to you ckan-docker directory: `/Users/username/git/ckan/ckan-docker/` - - volumes: - - /Users/username/git/ckan/ckan-docker/_src:/usr/lib/ckan/default/src - -- Build the Docker images & run the containers: - -Send the `fig up` command to the fig container - - docker exec -it fig-ckan fig up - - -## Using the Fig container - -You can use amy fig command by pre-pending the `docker exec -it fig-ckan` command to any fig command - -### build & start / recreate - - docker exec -it fig-ckan fig up - -### stop it - - docker exec -it fig-ckan fig stop - -### start it - - docker exec -it fig-ckan fig start - -### delete the containers - - docker exec -it fig-ckan fig rm - -### build new images - - docker exec -it fig-ckan fig build - -### logs - - docker exec -it fig-ckan fig logs diff --git a/fig.yml b/fig.yml deleted file mode 100755 index 32f1301..0000000 --- a/fig.yml +++ /dev/null @@ -1,66 +0,0 @@ -data: - build: docker/data - hostname: data - domainname: localdomain - -postgres: - build: docker/postgres - hostname: postgres - domainname: localdomain - ports: - - "5432:5432" - volumes_from: - - data - environment: - - CKAN_PASS=ckan_pass - - DATASTORE_PASS=datastore_pass - -solr: - build: docker/solr - hostname: solr - domainname: localdomain - ports: - - "8983:8983" - volumes: - - ./_src/ckan/ckan/config/solr/schema.xml:/opt/solr/example/solr/ckan/conf/schema.xml - -datapusher: - build: _service-provider/_datapusher - hostname: datapusher - domainname: localdomain - ports: - - "8800:8800" - -ckan: - build: . - hostname: ckan - domainname: localdomain - ports: - - "2222:22" - - "5000:5000" - - "8080:80" - links: - - postgres:postgres - - solr:solr - - datapusher:datapusher - command: /sbin/my_init --enable-insecure-key - volumes_from: - - data - volumes: - - ./_src:/usr/lib/ckan/default/src - - ./_etc/ckan/custom_options.ini:/etc/ckan/default/custom_options.ini - - ./_etc/supervisor/conf.d:/etc/supervisor/conf.d - -nginx: - build: docker/nginx - hostname: nginx - domainname: localdomain - links: - - ckan:ckan - ports: - - "80:80" - volumes: - - ./docker/nginx/nginx.conf:/etc/nginx/nginx.conf - - -