Jump to content
webhoes

docker setup for local development

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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...