-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #239 from OneSignal/add_docker_dev_setup
Add docker dev setup
- Loading branch information
Showing
6 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
CONTAINER=wordpress | ||
WORDPRESS_HTTP_PORT=8000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
## Setup | ||
1. Run `./docker.sh` | ||
2. Go to http://localhost:8000/ in your browser. | ||
3. Follow the WordPress page's setup guide create your user | ||
4. After logging in to the WordPress admin go to "Plugins" > "Add New" > "Upload Plugin" | ||
5. Zip up all file in this directory expect "docker-instance-files" | ||
6. Upload this on the page from step 4. above | ||
7. Make sure to active the plugin on the Plugins page | ||
8. Your done, happy editing! | ||
|
||
## Editing | ||
1. Test changes by editing files under docker-instance-files/plugins/ | ||
- Modify these directly on your host machine, changes take effect immediately! | ||
2. Make sure to get your changes in to the original source to commit | ||
- Careful not to re-upload your plugin, it will overwrite files docker-instance-files/plugins/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
version: '3.3' | ||
|
||
services: | ||
db: | ||
image: mysql:5.7 | ||
volumes: | ||
- db_data:/var/lib/mysql | ||
restart: always | ||
environment: | ||
MYSQL_ROOT_PASSWORD: somewordpress | ||
MYSQL_DATABASE: wordpress | ||
MYSQL_USER: wordpress | ||
MYSQL_PASSWORD: wordpress | ||
|
||
wordpress: | ||
depends_on: | ||
- db | ||
image: wordpress:latest | ||
ports: | ||
- "${WORDPRESS_HTTP_PORT}:80" | ||
restart: always | ||
container_name: "${CONTAINER}" | ||
environment: | ||
WORDPRESS_DB_HOST: db:3306 | ||
WORDPRESS_DB_USER: wordpress | ||
WORDPRESS_DB_PASSWORD: wordpress | ||
WORDPRESS_DB_NAME: wordpress | ||
WORDPRESS_DEBUG: 1 | ||
working_dir: /var/www/html | ||
volumes: | ||
- ./docker-instance-files/plugins:/var/www/html/wp-content/plugins | ||
- ./docker-instance-files/uploads.ini:/usr/local/etc/php/conf.d/uploads.ini | ||
volumes: | ||
db_data: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
file_uploads = On | ||
memory_limit = 64M | ||
upload_max_filesize = 64M | ||
post_max_size = 64M | ||
max_execution_time = 600 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# The purpose of this script is to provide write access to the wordpress plugins folder for | ||
# both the host machine and the docker container itself. | ||
# This makes plugin testing much easy as the the file in the plugins folder can be directly | ||
# edited on the host machine's IDE. | ||
# This means no more needing to copy files from host->container or using vim in the container! | ||
|
||
export $(xargs < .env) | ||
|
||
USER_ID=`id -u` | ||
GROUP_ID=`id -g` | ||
|
||
# Starting docker images without allowing them to execute anything yet. | ||
# This is so we can correctly set the permission below before it starts creating files | ||
echo "Starting $CONTAINER in --no-start mode" | ||
docker-compose up --no-start $CONTAINER | ||
docker-compose up --detach $CONTAINER | ||
|
||
echo "Wait for all wordpress files to be comes available" | ||
docker exec -ti $CONTAINER /bin/bash -c 'until [[ -f .htaccess ]]; do sleep 1; done' | ||
|
||
echo "Allowing Wordpress container to modify any files in the docker-instance-file/plugins folder" | ||
docker exec -ti $CONTAINER /bin/bash -c "usermod -u ${USER_ID} www-data" | ||
docker exec -ti $CONTAINER /bin/bash -c "groupmod -g ${GROUP_ID} www-data" | ||
echo "Restart container for permsision settings to take effect" | ||
docker container restart $CONTAINER | ||
|
||
echo "Updating '/var/www' folder ownership" | ||
docker exec -ti $CONTAINER /bin/bash -c 'chown -R www-data:www-data /var/www' | ||
|
||
echo "Started Scuessfully!" | ||
echo "──────────────────────────────────────────────────────" | ||
|
||
echo "Tailing logs" | ||
docker-compose up |