Here are the advantages of this processwire/docker combo
I'm using this on a Windows 10 Pro 64-bit machine. So I know it works on that.
Xdebug works! Included a working VS Code debug config example under .vscode/launch.json.
- Install the Xdebug helper chrome extension
- In the extensions's options, set the IDE Key to "Other" with a value of
chromeextension
- Now you can enable and disable debugging through a simple click.
- Uses a separate "shared" Nginx Proxy container that runs all the time, and automatically routes requests to correct Processwire app based on the hostname in URL.
- Each app has it's own PHP and MySql(MariaDb) containers
- Start the Nginx Proxy globally with one command (or just double-click the
proxy-up.cmd
file!). This needs to be done only once for all apps. - Copy the
docker-compose.yml
,Dockerfile-php
, andget-processwire.ps1
files into your project directory. (Repeat this step for each separate project). - Set
VIRTUAL_HOST
anddocker_hostip
variables in thedocker-compose.yml
file.
VIRTUAL_HOST
=myappname.localtest.me
(or whateveryouwant.localtest.me)docker_hostip
= Local IP address of your Physical Host Machine
- Run
docker-compose up -d
. - A
src
directory will be created. - Right-click on
app-install.ps1
and Run with Powershell. Or in Powershell terminal, type./app-install
. This copies latest dev version of Processwire AND the new Foundation 6 site profile right to the src folder. - In a browser, visit
myappname.localtest.me
(or whateveryouwant.localtest.me) and enjoy the Processwire Setup wizard!
A single Nginx Proxy app handles all requests to localhost (port 80) for all your processwire apps you will be developing.
Instructions
Run the Nginx Proxy by running proxy-up.cmd
. The Nginx Proxy must be running in order for everything else to work. Confirm it is running by typing docker ps
in a terminal.
By using a DNS->localhost service like localtest.me
, multiple apps can be assigned unique hostnames that route back to localhost (127.0.0.1) WITHOUT the need to touch the hosts file. (Especially on Windows, editing the hosts file is a pain, and wildcards cannot be used for subdomains.)
So in the docker-compose.yml
for each app, simply assign the VIRTUAL_HOST env variable with app1.localtest.me
or app2.localtest.me
, etc and Nginx Proxy will route those requests to the proper app. Like magic :)
For each processwire app you are developing, copy this docker-compose.yml
file into the app's root folder.
Upon running docker-compose up -d
from the root folder, a src
folder will be created if it doesn't already exist.
src
is the public root of your processwire app. Copy your processwire files here.
Don't forget to change site/config.php
to point to correct database/user/password (and add the right host).
The database name, user, and password are found in your app's docker-compose.yml
.
The database server name (hostname) is simply db
.
MySql Data Import
I need to create a subfolder mysql
where a database.sql
file with PW database dump can be saved. Then have a script somewhere that will import that file into the database if the database is empty when starting the container.
OR...if there is NO database and ./src/site/assets/backups/database
has .sql
files, get the most recent sql file and import it.