Jump to content

docker setup for local development


webhoes
 Share

Recommended Posts

I have been working with docker the last few days and in the end created a simple but flexible docker setup for local development.

You can find the repository here

https://gitlab.com/webhoes/pw-docker.git

 

This is based on the work of undernewmanagement. The difference is that in that repository you had to put your files  in /src. Side effect is that all projects in PHPstorm are now referenced as src... So I changed it so that you can put your files in the root. Therefor the directory of your project is referenced in PHPstorm.

I also changed the docker-compose file and added a default config-dev.php. As long as there is a config-dev.php is will be used instead of config.php. This means you don't need to change you config.php on a local setup. Now it wil use config-dev.php. Ofcourse never upload config-dev.php to production. Add it to your .gitignore.

 

There are 2 flavors of using this repository:

1 with a new install

2 with an existing site

 

1 With a new install

git clone https://gitlab.com/webhoes/pw-docker.git <new project folder>
git remote remove origin
git remote add origin <your own git repository>

Make sure that Docker/db/ is empty.
copy the proceswire files in the root.
remove folder and file /site/config-dev.phpp

from a terminal make sure you are in your project folder and type docker-compose up.
Go through the installer. The database settings are in the docker-compose file. Note: database location is mysql (not localhost)

You now have a working local processwire on localhost

 

2 use a working copy from development

For this setup you need the database backup module by @ryan (ProcessDatabaseBackups). Make sure you only have one file in the default backups/database directory.

git clone https://gitlab.com/webhoes/pw-docker.git <new project folder>
git remote remove origin
git remote add origin <your own git repository>

Make sure that Docker/db/ is empty.
copy the proceswire files of your existing site in the root.

The config-dev.php will take care of the connection to your database. the database will be filled with the sql file (see steps)
 

disclaimer: I am not an expert of docker and stuff or processwire - just figured this out the last few days to make (my) life easier. If you find any mistakes or security issues, let me know.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...