Docker setup by Etribes
This docker setup was intended to be used with Shopware but as it is that generic you could run almost every PHP based web application that needs a webserver and database.
Feel free to contribute.
Important information: This setup is for local programing purposes only! It should not be used in a production environment.
Installation instructions
Getting started
- Set a host entry in your local hosts file to
127.0.0.1 dev.local
- Navigate to your projects root
- Execute
git clone https://github.com/eTribes-Connect-GmbH/docker-setup.git
- Navigate to the created folder with
cd docker-setup/
- Adjust the shopware release url in
docker-compose.yml
- Execute
docker-compose pull
to get the newest images - Change
FULL_WIPE_ON_REBOOT
indocker-compose.yml
to"false"
if you dont need the installation wizard. - Change the environment variable
COMPOSE_PROJECT_NAME=project
in.env
- Execute
docker-compose up
- If needed run your setup and change
FULL_WIPE_ON_REBOOT
indocker-compose.yml
to"true"
afterwards. Alternatively you can just import an SQL dump. - Open http://dev.local/ in your browser.
Additional setup instruction for OS X users
Because of a bug in Docker for Mac you have to setup SFTP deployment in your PhpStorm.
- Open your Project PhpStorm.
- Navigate to Tools > Deployment > Configuration...
- Add a new SFTP server and name it "Docker SFTP". Default credentials:
Host: dev.local User: root Password: password Port: 2200
- In the tab "Mapping", click on the most upper button to set the server as default server.
- Navigate to Tools > Deployment > Options...
- Change Upload changed files automatically to the default server to "Always".
Database credentials
Host: db
User: root
Password: root
Database: dev
Configuring Mailhog
- Navigate to the Shopware backend
- Open the Global Settings and search for "Mailer"
- Apply the following settings:
- Method: smtp
- Hostname for message id: mailhog.dev.local
- Mail hostname: mailfetcher
- Port: 1025
- Prefix:
- SMTP user: test
- SMTP password: test
- Connection auth: login
- Open the mailhog webinterface
- Send a mail from the Shopware backend (Settings -> Email Templates -> Choose a template -> Send test email to shop owner)
Configuring XDebug
- Open PhpStorm
- Click on "Run" and the sub element "Edit Configurations..."
- Add a new configuration with the type "PHP Remote Debug"
- Click the OK button
- Now read the following tutorial and you should be ready to use XDebug: Using the PhpStorm Debugger
Docker structure
Image layers
- datacontainer
- Image: netshops/dev_data_container_shopware:latest
- Description: This container holds a fresh installation of Shopware and extracts it on every "up".
- datasync
- Image: netshops/dev_data_sync:latest
- Description: This container syncs
/var/www/src
into/var/www/html
on "up" and after that constatly withinotify
on file changes.
- webserver
- Image: netshops/dev_webserver
- Description: Webserver to serve contents. Just configure it to your needs.
- db
- Image: percona:latest (MySQL Fork)
- Description: A MySQL container. Choose whatever you like (e.g. MySQL, MariaDB, Percona)
- mailfetcher
- Image: mailhog/mailhog:latest
- Description: A mail fetcher. Can be opened under http://dev.local:8025/
- sftp
- Image: netshops/docker_dev_sftp
- Description: A sFTP container.
Directory structure
- projectname/
- docker-setup/
- services/ (config files mounted as volumes)
- percona
- webserver
- src/
- config_dev.php (copy to ../../src/)
- services/ (config files mounted as volumes)
- src/ (changed files that are synced into a fresh shop-installation)
- custom/plugins/.../
- engine/Shopware/Plugins/.../
- themes/Frontend/YourThemeName/
- docker-setup/
Licence
This project uses the GNU General Public License v3.0.