From 917d12dba0925b67fdd2775fc430821de9a3be41 Mon Sep 17 00:00:00 2001 From: Fabio Date: Sat, 15 Oct 2016 19:46:03 +0200 Subject: [PATCH] added couchdb --- .env.composer | 5 +++++ .env.example | 5 +++++ README.md | 16 +++++++++++++--- TODO | 7 ++++++- docker-compose.yml | 13 +++++++++++++ docker/couchdb/Dockerfile | 13 +++++++++++++ 6 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 docker/couchdb/Dockerfile diff --git a/.env.composer b/.env.composer index 7b7749f..8b0480a 100644 --- a/.env.composer +++ b/.env.composer @@ -23,6 +23,11 @@ MONGODB_PORT=27017 # php version: v7.0 use Dockerfile-70, v5.6 use Dockerfile-56 PHP_DOCKERFILE=Dockerfile-70 +# couchdb +CONF_COUCHDB_USER=couch +CONF_COUCHDB_PASSWORD=secret +CONF_COUCHDB_PORT=5984 + # php-fpm and workspace environment variables INSTALL_XDEBUG=false INSTALL_MONGO=false diff --git a/.env.example b/.env.example index ad4ec3e..f61d8ac 100644 --- a/.env.example +++ b/.env.example @@ -23,6 +23,11 @@ MONGODB_PORT=27017 # php version: v7.0 use Dockerfile-70, v5.6 use Dockerfile-56 PHP_DOCKERFILE=Dockerfile-70 +# couchdb +CONF_COUCHDB_USER=couch +CONF_COUCHDB_PASSWORD=secret +CONF_COUCHDB_PORT=5984 + # php-fpm and workspace environment variables INSTALL_XDEBUG=true INSTALL_MONGO=true diff --git a/README.md b/README.md index 61ffe89..0c44166 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,19 @@ DESCRIPTION ----------------------- This project demonstrates how to use docker-compose to split a sample php application into docker containers. -Each container runs a component: apache2, php-fpm, mysql, mongodb, and finally one container for data (binding project directory and data directories to the container itself), and one container for the workspace (a special container you can use to run CLI commands). +Each container runs a component: apache2, php-fpm, mysql, mongodb, couchdb and finally one container for data (binding project directory and data directories to the container itself), and one container for the workspace (a special container you can use to run CLI commands). This project can be easily integrated into you existing webapp to permit you to deploy it faster on development machines, staging servers and production servers. +REQUIREMENTS +----------------------- +- docker-compose, min version 1.8 +- docker, min version 1.10 + +If you want to install via composer: +- composer +- php, min version 5.6 + + INSTALL ----------------------- @@ -75,8 +85,8 @@ START - execute this command ``` -docker-compose build apache2 mysql workspace mongo php-fpm -docker-compose up -d apache2 mysql mongo +docker-compose build apache2 mysql workspace mongo php-fpm couchdb +docker-compose up -d apache2 mysql mongo couchdb ``` - After these commands you'll have your containers up and running, use `docker ps` to see them diff --git a/TODO b/TODO index 214c295..5f6ea93 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,8 @@ - inserire nel readme i prerequisiti: docker, docker-compose, php e composer. Php e composer solo se si vuole installare via composer - inserire le versioni minime di docker e docker-compose (compose mi pare almeno 1.6 ma verificare meglio) -- inserire un mini troubleshooting per problemi, es se porta duplicata \ No newline at end of file +- inserire un mini troubleshooting per problemi, es se porta duplicata + +Comandi couchdb di esempio: + +curl -X GET http://127.0.0.1:5984/_all_dbs +curl -X PUT http://couch:secret@127.0.0.1:5984/baseball \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index cf1037f..33019a4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -94,7 +94,19 @@ services: - "${MONGODB_PORT}:27017" volumes_from: - volumes_data + +### CouchDB Container ####################################### + couchdb: + build: + context: ./${DOCKER_DIRECTORY}/couchdb + args: + - CONF_COUCHDB_USER + - CONF_COUCHDB_PASSWORD + ports: + - "${CONF_COUCHDB_PORT}:5984" + volumes_from: + - volumes_data ### Memcached Container ##################################### @@ -146,6 +158,7 @@ services: - ./${DOCKER_DATA_DIRECTORY}/memcached:/var/lib/memcached - ./${DOCKER_DATA_DIRECTORY}/mongo:/data/db - ./${DOCKER_DATA_DIRECTORY}/sessions:/sessions + - ./${DOCKER_DATA_DIRECTORY}/couchdb:/opt/couchdb/data # - ./data/postgres:/var/lib/postgresql/data # - ./data/redis:/data # - ./data/neo4j:/var/lib/neo4j/data diff --git a/docker/couchdb/Dockerfile b/docker/couchdb/Dockerfile new file mode 100644 index 0000000..e402608 --- /dev/null +++ b/docker/couchdb/Dockerfile @@ -0,0 +1,13 @@ +FROM klaemo/couchdb:latest + +ARG CONF_COUCHDB_USER=couchdb +ARG CONF_COUCHDB_PASSWORD=secret + +ENV COUCHDB_USER=$CONF_COUCHDB_USER +ENV COUCHDB_PASSWORD=$CONF_COUCHDB_PASSWORD + +EXPOSE 5984 + +WORKDIR /opt/couchdb/data + +