Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Docker] Docker workflow upgrade #197

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .env → .env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@ behat.yml
.php_cs.cache
auth.json
ide-twig.json
.env
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
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 @@ -55,14 +55,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=${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}
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=${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}
Expand Down