Skip to content

Commit

Permalink
Change docker workflow
Browse files Browse the repository at this point in the history
- Rename .env to .env.dist
- Add host and port support
- Update the README.md
  • Loading branch information
fchris82 committed Aug 15, 2017
1 parent df80b3b commit 7196141
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 5 deletions.
29 changes: 29 additions & 0 deletions .env.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Allows us to set default values of env variables, see: https://docs.docker.com/compose/env-file/
# On Docker Compose v1.7.0 file separator if defining several is different from Win and nix, so we just use one for default prod setup
COMPOSE_FILE=doc/docker-compose/base-prod.yml
COMPOSE_DIR=.

# You'll need to adjust this for Windows and XDB Linux systems: https://getcomposer.org/doc/03-cli.md#composer-home
COMPOSER_HOME=~/.composer
DATABASE_USER=ezp
DATABASE_PASSWORD=SetYourOwnPassword
DATABASE_NAME=ezp

## Docker images (name and version)
PHP_IMAGE=ezsystems/php:7.1-v1
PHP_IMAGE_DEV=ezsystems/php:7.1-v1-dev
NGINX_IMAGE=nginx:stable
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

# Install config, used by .platform.app.yaml among others
INSTALL_EZ_INSTALL_TYPE=clean
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,4 @@ composer.lock
behat.yml
.php_cs.cache
auth.json
.env
4 changes: 4 additions & 0 deletions bin/docker-compose-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

cp -i .env.dist .env
docker-compose -f doc/docker-compose/install.yml up --abort-on-container-exit
6 changes: 5 additions & 1 deletion doc/docker-compose/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,18 @@ 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=<id> BLACKFIRE_SERVER_TOKEN=<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
```

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


Expand Down
4 changes: 2 additions & 2 deletions doc/docker-compose/base-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ services:
volumes_from:
- app:ro
ports:
- "8080:80"
- "${HTTP_PORT}:80"
environment:
- SYMFONY_ENV
- 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}
Expand Down
4 changes: 2 additions & 2 deletions doc/docker-compose/base-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ services:
volumes_from:
- app:ro
ports:
- "8080:80"
- "${HTTP_PORT}:80"
environment:
- SYMFONY_ENV
- 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}
Expand Down

0 comments on commit 7196141

Please sign in to comment.