Alot of these instructions are for local only, especially the windows sections and anything to do with permissions, these instructions are insecure but are fine in a local environment.
IMPORTANT! On windows this should be used inside the wsl file system, not directly inside windows file system. This is due to wsl2 running through docker being extremely slow. So we bypass wsl's need to connect to the windows file system by running through the wsl filesystem itself.
This guide is a lot more complicated for windows and you should follow the windows guide futher down first, then come back to this once finished.
- Rename env.sample to .env and change your confuration details
- Run docker-compose up -d
- To fix permissions, from the terminal run:
docker exec -it CONTAINER_ID chown -R www-data:www-data /var/www/html/wp-content/uploads
. Replace the CONTAINER_ID with the containers id which you can find by runningdocker ps
. IMPORTANT! this will need to be ran again if the volume is delete.
- Go to "turn windows features on and off", you can find this via the windows search.
- Enable "Windows subsystem for linux"
- Open a new terminal
- Run
wsl --install
This will install linux, you can specify a different distribution, usewsl --help
for more information - You should now be able to open a new ubuntu shell inside terminal by clicking the arrow next to the new tab button.
- Install the "WSL" Extension
- after that is done, in the bottom left corner, there should be a blue button, you can connect remotely to ubuntu through that.
- go to the docker desktop settings. Then go to
resources -> WSL integration
and enable the ubuntu distribution or whatever distributions you are using.
- Open a ubuntu terminal
- Create a directory for your project
- clone this repo into that directory (you may need to create an ssh key using ssh-keygen inside your ubuntu environment).
- now run the getting started steps at the top of the README
- You will likely need to run the steps at the "FILE PERMISSIONS" section in the notes.
- HTACCESS: You might need to create a .htaccess file, you can either add this into the volumes or copy one into the volume using docker copy commands. There is a basic .htaccess.sample in this root directory.
docker cp ./.htaccess CONTAINER_ID:/var/www/html/
- FILE PERMISSIONS: When running in linux, you may need to change the permissions of wp-content folder in docker or any directories you want to make changes to by running these commands:
This command adds write permissions to all files within the wp-content directory: docker exec -it CONTAINER_ID chmod -R g+w /var/www/html/wp-content
This command adds your current user to the www-data group sudo usermod -a -G www-data $USER
This should be fine since github doesnt recognise changed permissions unless using specific git config (filemode=true Link)