diff --git a/.env b/.env.dist similarity index 95% rename from .env rename to .env.dist index 285f98ee7b..1d76f39a4c 100644 --- a/.env +++ b/.env.dist @@ -17,6 +17,10 @@ MYSQL_IMAGE=mariadb:10.1 SELENIUM_IMAGE=selenium/standalone-firefox:2.53.1 REDIS_IMAGE=redis +# HTTP host and port +HTTP_HOST=localhost +HTTP_PORT=8080 + # App image name for use if you intend to push it to docker registry/hub. APP_PROD_IMAGE=my-ez-app APP_DOCKER_FILE=Dockerfile diff --git a/.gitignore b/.gitignore index 242e454818..3ed18e6a64 100644 --- a/.gitignore +++ b/.gitignore @@ -49,3 +49,4 @@ behat.yml .php_cs.cache auth.json ide-twig.json +.env diff --git a/.travis.yml b/.travis.yml index 62ef13a525..6ad1e7cd1d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,6 +34,8 @@ before_install: ./bin/.travis/trusty/update_docker.sh before_script: # Internal auth token dedicated to testing with travis+composer on ezsystems repos, not for reuse! - echo "{\"github-oauth\":{\"github.com\":\"d0285ed5c8644f30547572ead2ed897431c1fc09\"}}" > auth.json + # Initialize .env file for docker + - cp .env.dist .env # In case of dev mode we'll need to install composer packages first - docker-compose -f doc/docker-compose/install.yml up --abort-on-container-exit # Run (start containers and execute install command) diff --git a/bin/docker-compose-setup.sh b/bin/docker-compose-setup.sh new file mode 100755 index 0000000000..1c29c25198 --- /dev/null +++ b/bin/docker-compose-setup.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +cp -i .env.dist .env +docker-compose -f doc/docker-compose/install.yml up --abort-on-container-exit diff --git a/doc/docker-compose/README.md b/doc/docker-compose/README.md index 0e8e7763ff..41fca29c37 100644 --- a/doc/docker-compose/README.md +++ b/doc/docker-compose/README.md @@ -55,7 +55,9 @@ From root of your projects clone of this distribution, [setup composer auth.json #export COMPOSE_FILE=doc/docker-compose/base-prod.yml:doc/docker-compose/blackfire.yml BLACKFIRE_SERVER_ID= BLACKFIRE_SERVER_TOKEN= # First time: Install setup, and generate database dump: -docker-compose -f doc/docker-compose/install.yml up --abort-on-container-exit +bin/docker-compose-setup.sh + +# Edit the .env file! # Boot up full setup: docker-compose up -d --force-recreate @@ -63,6 +65,8 @@ docker-compose up -d --force-recreate After some 5-10 seconds you should be able to browse the site on `localhost:8080` and the backend on `localhost:8080/ez`. +> You can change the host and port in `.env` file. Edit the `HTTP_HOST` and the `HTTP_PORT` parameters. + ### Development "mount" use diff --git a/doc/docker-compose/base-dev.yml b/doc/docker-compose/base-dev.yml index de9bb1bc3a..6352bce2ac 100644 --- a/doc/docker-compose/base-dev.yml +++ b/doc/docker-compose/base-dev.yml @@ -25,14 +25,14 @@ services: volumes_from: - app:ro ports: - - "8080:80" + - "${HTTP_PORT}:80" environment: - SYMFONY_ENV=${SYMFONY_ENV-dev} - MAX_BODY_SIZE=20 - FASTCGI_PASS=app:9000 - TIMEOUT=190 - DOCKER0NET - command: /bin/bash -c "cd /var/www && cp -a doc/nginx/ez_params.d /etc/nginx && bin/vhost.sh --template-file=doc/nginx/vhost.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'" + command: /bin/bash -c "cd /var/www && cp -a doc/nginx/ez_params.d /etc/nginx && bin/vhost.sh --template-file=doc/nginx/vhost.template --host-name=${HTTP_HOST} > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'" db: image: ${MYSQL_IMAGE} diff --git a/doc/docker-compose/base-prod.yml b/doc/docker-compose/base-prod.yml index 8fc2816287..ce4a87556c 100644 --- a/doc/docker-compose/base-prod.yml +++ b/doc/docker-compose/base-prod.yml @@ -25,14 +25,14 @@ services: volumes_from: - app:ro ports: - - "8080:80" + - "${HTTP_PORT}:80" environment: - SYMFONY_ENV=${SYMFONY_ENV-prod} - MAX_BODY_SIZE=20 - FASTCGI_PASS=app:9000 - TIMEOUT=190 - DOCKER0NET - command: /bin/bash -c "cd /var/www && cp -a doc/nginx/ez_params.d /etc/nginx && bin/vhost.sh --template-file=doc/nginx/vhost.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'" + command: /bin/bash -c "cd /var/www && cp -a doc/nginx/ez_params.d /etc/nginx && bin/vhost.sh --template-file=doc/nginx/vhost.template --host-name=${HTTP_HOST} > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'" db: image: ${MYSQL_IMAGE}