-
Notifications
You must be signed in to change notification settings - Fork 346
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
Isolate all containers configuration #572
base: 1.12
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,50 @@ $ php bin/console server:start | |
$ open http://localhost:8000/ | ||
``` | ||
|
||
### For Docker installation | ||
|
||
Running the local environment with containers: | ||
|
||
```bash | ||
$ docker-compose pull | ||
$ docker-compose build | ||
$ docker-compose -f docker-compose.yml -f docker/docker-compose.setup.yml run setup | ||
$ docker-compose up -d | ||
``` | ||
|
||
> follow the installation instructions to setup the application | ||
> database. Also you may add sample data. | ||
|
||
> You may check if php-fpm is ready executing the command: | ||
> `docker-composer ps`. When it is ready, the State will be | ||
> **Up (healthy)** | ||
|
||
Write the command on terminal or just click on [localhost](http://localhost) | ||
to open the Sylius Shop | ||
``` | ||
$ open http://localhost/ | ||
``` | ||
|
||
or [localhost/admin](http://localhost/admin) to open the Sylius Backoffice | ||
``` | ||
$ open http://localhost/admin | ||
``` | ||
|
||
If the pages not load the assets, just run the below commands: | ||
|
||
```bash | ||
$ docker-compose run assets yarn install | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
$ docker-compose run assets yarn build | ||
``` | ||
|
||
If you want to see any php information or run any command from | ||
`bin/console`, you can run one of below commands: | ||
```bash | ||
$ docker-compose run php php -i | ||
$ docker-compose run php php-fpm -tt | ||
$ docker-compose run php php bin/console | ||
``` | ||
|
||
Troubleshooting | ||
--------------- | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,101 +1,89 @@ | ||
version: '3.4' | ||
|
||
services: | ||
php: | ||
build: | ||
context: . | ||
target: sylius_php | ||
# Quay does not work, should be replaced in future with f.e. ghcr.io | ||
# cache_from: | ||
# - quay.io/sylius/php:latest | ||
# - quay.io/sylius/nodejs:latest | ||
# - quay.io/sylius/nginx:latest | ||
image: php:latest | ||
depends_on: | ||
- mysql | ||
environment: | ||
- APP_ENV=dev | ||
- APP_DEBUG=1 | ||
- APP_SECRET=EDITME | ||
- DATABASE_URL=mysql://sylius:nopassword@mysql/sylius | ||
- MAILER_URL=smtp://mailhog:1025 | ||
- PHP_DATE_TIMEZONE=${PHP_DATE_TIMEZONE:-UTC} | ||
volumes: | ||
- .:/srv/sylius:rw,cached | ||
# if you develop on Linux, you may use a bind-mounted host directory instead | ||
# - ./var:/srv/sylius/var:rw | ||
- ./public:/srv/sylius/public:rw,delegated | ||
# if you develop on Linux, you may use a bind-mounted host directory instead | ||
# - ./public/media:/srv/sylius/public/media:rw | ||
- public-media:/srv/sylius/public/media:rw | ||
sylius: | ||
build: | ||
context: . | ||
target: sylius_server | ||
dockerfile: docker/sylius/Dockerfile | ||
image: sylius/server:latest | ||
healthcheck: | ||
interval: 10s | ||
timeout: 3s | ||
retries: 3 | ||
start_period: 30s | ||
depends_on: | ||
- mysql | ||
env_file: | ||
- .env | ||
volumes: | ||
- .:/srv/sylius:rw,cached | ||
- ./public:/srv/sylius/public:rw,delegated | ||
- public-media:/srv/sylius/public/media:rw | ||
- sylius-vendor:/srv/sylius/vendor | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Creating a named volume makes the vendor folder empty on the host machine. It's a problem, because your IDE can't see and the installed dependencies. |
||
- sylius-node_modules:/srv/sylius/node_modules | ||
|
||
mysql: | ||
image: percona:5.7 | ||
environment: | ||
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-nopassword} | ||
- MYSQL_DATABASE=sylius | ||
- MYSQL_USER=sylius | ||
- MYSQL_PASSWORD=${MYSQL_PASSWORD:-nopassword} | ||
volumes: | ||
- mysql-data:/var/lib/mysql:rw | ||
# you may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data! | ||
# - ./docker/mysql/data:/var/lib/mysql:rw,delegated | ||
ports: | ||
- "3306:3306" | ||
assets: | ||
build: | ||
context: . | ||
dockerfile: docker/assets/Dockerfile | ||
target: sylius_assets | ||
args: | ||
- APP_ENV=${APP_ENV} | ||
image: sylius/assets:latest | ||
depends_on: | ||
- sylius | ||
env_file: | ||
- .env | ||
volumes: | ||
- .:/srv/sylius:rw,cached | ||
- ./public:/srv/sylius/public:rw,delegated | ||
- public-media:/srv/sylius/public/media:rw | ||
- sylius-node_modules:/srv/sylius/node_modules | ||
ports: | ||
- "35729:35729" | ||
|
||
node: | ||
build: | ||
context: . | ||
target: sylius_node | ||
# Quay does not work, should be replaced in future with f.e. ghcr.io | ||
# cache_from: | ||
# - quay.io/sylius/php:latest | ||
# - quay.io/sylius/nodejs:latest | ||
# - quay.io/sylius/nginx:latest | ||
image: node:latest | ||
depends_on: | ||
- php | ||
environment: | ||
- GULP_ENV=dev | ||
- PHP_HOST=php | ||
- PHP_PORT=9000 | ||
volumes: | ||
- .:/srv/sylius:rw,cached | ||
- ./public:/srv/sylius/public:rw,delegated | ||
ports: | ||
- "35729:35729" | ||
webserver: | ||
build: | ||
context: . | ||
target: sylius_nginx | ||
dockerfile: docker/nginx/Dockerfile | ||
image: nginx:latest | ||
env_file: | ||
- .env | ||
depends_on: | ||
- sylius | ||
- assets | ||
volumes: | ||
- ./public:/srv/sylius/public:ro | ||
- public-media:/srv/sylius/public/media:ro,delegated | ||
ports: | ||
- "80:80" | ||
|
||
nginx: | ||
build: | ||
context: . | ||
target: sylius_nginx | ||
image: nginx:latest | ||
# Quay does not work, should be replaced in future with f.e. ghcr.io | ||
# cache_from: | ||
# - quay.io/sylius/php:latest | ||
# - quay.io/sylius/nodejs:latest | ||
# - quay.io/sylius/nginx:latest | ||
depends_on: | ||
- php | ||
- node # to ensure correct build order | ||
volumes: | ||
- ./public:/srv/sylius/public:ro | ||
# if you develop on Linux, you may use a bind-mounted host directory instead | ||
# - ./public/media:/srv/sylius/public/media:ro | ||
- public-media:/srv/sylius/public/media:ro,nocopy | ||
ports: | ||
- "80:80" | ||
mysql: | ||
image: percona:5.7 | ||
environment: | ||
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-nopassword} | ||
- MYSQL_DATABASE=sylius_${APP_ENV} | ||
- MYSQL_USER=${MYSQL_USER:-sylius} | ||
- MYSQL_PASSWORD=${MYSQL_PASSWORD:-nopassword} | ||
volumes: | ||
- mysql-data:/var/lib/mysql:rw | ||
ports: | ||
- "3306:3306" | ||
|
||
mailhog: | ||
# do not use in production! | ||
image: mailhog/mailhog:latest | ||
environment: | ||
- MH_STORAGE=maildir | ||
# volumes: | ||
# - ./docker/mailhog/maildir:/maildir:rw,delegated | ||
ports: | ||
- "8025:8025" | ||
mailhog: | ||
# do not use in production! | ||
image: mailhog/mailhog:latest | ||
environment: | ||
- MH_STORAGE=maildir | ||
# volumes: | ||
# - ./docker/mailhog/maildir:/maildir:rw,delegated | ||
ports: | ||
- "8025:8025" | ||
|
||
volumes: | ||
mysql-data: | ||
public-media: | ||
mysql-data: | ||
public-media: | ||
sylius-vendor: | ||
sylius-node_modules: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
--rm
switch should be added tot he run command in order to remove the created container after finishing the setup. Currently if setup is run multiple times, it will create as many containers, leaving mess behind.