Skip to content

article(update-environment-docker-of-app-symfony-vue) #13

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

Open
wants to merge 2 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
27 changes: 0 additions & 27 deletions .env.dist

This file was deleted.

3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@
### PHPUnit
/phpunit.xml

### Docker
docker/logs/

### NodeJS - NPM - YARN
node_modules/
npm-debug.log*
Expand Down
4 changes: 2 additions & 2 deletions app/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ snc_redis:
type: predis
logging: false
alias: session_client
dsn: %redis_dsn%
options: %redis_options%
dsn: '%redis_dsn%'
options: '%redis_options%'
session:
client: session_client
prefix: app_session_
Expand Down
4 changes: 2 additions & 2 deletions app/config/parameters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ parameters:
database_password: '%env(POSTGRES_PASSWORD)%'

# Mailer parameters
mailer_transport: %env(SMTP_TRANSPORT)%
mailer_transport: '%env(SMTP_TRANSPORT)%'
mailer_host: '%env(SMTP_HOST)%'
mailer_user: '%env(SMTP_USER)%'
mailer_password: '%env(SMTP_PASSWORD)%'
Expand All @@ -16,6 +16,6 @@ parameters:
secret: '%env(SECRET)%'

# Redis parameters
redis_dsn: '%env(REDIS_DSN)%'
redis_dsn: 'redis://%env(REDIS_DSN)%'
redis_options: ~
session_ttl: 86400
13 changes: 6 additions & 7 deletions bin/app
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ init ()
echo ""

echo "----> Fix permission"
docker-compose exec -T php chmod 777 -R /var/www/symfony/var/cache
docker-compose exec -T php chmod 777 -R /var/www/symfony/var/logs
docker-compose exec -T php chmod 775 -R /var/www/symfony/var/*
echo " [OK] Permission fixed"

echo ""
Expand Down Expand Up @@ -53,10 +52,10 @@ stop ()
docker-compose stop
}

# run bash
bash ()
# run sh
sh ()
{
docker-compose exec --user www-data php bash
docker-compose exec --user www-data php sh
}

# exec a command into app container (as root)
Expand Down Expand Up @@ -105,7 +104,7 @@ usage ()
init Initialize project
start Start project
stop Stop project
bash Use bash inside the app container
sh Use sh inside the app container
exec Executes a command inside the app container
destroy Remove all the project Docker containers with their volumes
console Use the Symfony console
Expand All @@ -123,7 +122,7 @@ main ()
exit 0
fi

if [[ ! $1 =~ ^init|start|stop|bash|destroy|console|composer|exec|tests$ ]]; then
if [[ ! $1 =~ ^init|start|stop|sh|destroy|console|composer|exec|tests$ ]]; then
echo "$1 is not a supported command"
exit 1
fi
Expand Down
28 changes: 0 additions & 28 deletions bin/console

This file was deleted.

5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@
"@deploy-scripts"
],
"post-install-cmd": ["@symfony-scripts"],
"post-update-cmd": ["@symfony-scripts"]
"post-update-cmd": ["@symfony-scripts"],
"auto-scripts": {

}
},
"config": {
"sort-packages": true
Expand Down
80 changes: 38 additions & 42 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,44 @@
version: '2'
version: '3'

services:
postgres:
image: postgres:9.6
ports:
- ${POSTGRES_PORT}:5432
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
postgres:
image: postgres:10-alpine
env_file:
- .env
ports:
- ${POSTGRES_PORT}:5432

php:
build: docker/php7-fpm
env_file: ./.env
volumes:
- ${PWD}:/var/www/symfony
links:
- postgres
php:
build:
context: .
dockerfile: docker/php/Dockerfile
env_file:
- .env
user: www-data
working_dir: ${APP_DIR}
volumes:
- ${PWD}:${APP_DIR}

nginx:
build: docker/nginx
ports:
- ${WEB_PORT}:80
volumes_from:
- php
volumes:
- ${LOGS_DIR}/nginx/:/var/log/nginx
nginx:
build:
context: .
dockerfile: docker/nginx/Dockerfile
ports:
- ${WEB_PORT}:80
volumes:
- ${PWD}:${APP_DIR}

elk:
image: willdurand/elk
ports:
- ${ELK_PORT}:80
volumes:
- ./docker/elk/logstash:/etc/logstash
- ./docker/elk/logstash/patterns:/opt/logstash/patterns
volumes_from:
- php
- nginx
redis:
image: redis:4-alpine

redis:
image: redis:3.2.10

node:
build: docker/node
volumes:
- ${SYMFONY_APP_PATH}:/var/www/symfony
command: bash -c "yarn && yarn dev"
node:
build:
context: .
dockerfile: docker/node/Dockerfile
env_file:
- .env
user: node
working_dir: ${APP_DIR}
volumes:
- ${PWD}:${APP_DIR}
command: sh -c "yarn && yarn dev"
39 changes: 0 additions & 39 deletions docker/elk/logstash/logstash.conf

This file was deleted.

85 changes: 0 additions & 85 deletions docker/elk/logstash/patterns/default.conf

This file was deleted.

1 change: 0 additions & 1 deletion docker/elk/logstash/patterns/nginx.conf

This file was deleted.

Loading