From b0cabd8354450ad1ee1db920491e537030f07e63 Mon Sep 17 00:00:00 2001 From: Cameron Corda Date: Sat, 23 Sep 2023 07:12:11 -0700 Subject: [PATCH 1/5] Making docker orb friendly, customize locally --- .gitignore | 1 + .vscode/tasks.json | 2 +- _build/.deploy_exclude.txt | 1 + _init/local.sql | 9 +++++++-- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 433daccc..87ea0355 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ composer.lock # development-environment tmp/ +docker-compose.local.yml wp-content/themes/timber/dev/ wp-config-local.php /wp-content/mu-plugins/local-plugins.php diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 1f750bd8..8cafa3ed 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -31,7 +31,7 @@ { "label": "Wordpress Dev", "type": "shell", - "command": "docker-compose up --build" + "command": "docker-compose -f docker-compose.yml -f docker-compose.local.yml up --build" }, { "label": "Gulp Dev", diff --git a/_build/.deploy_exclude.txt b/_build/.deploy_exclude.txt index ddaed590..ec4f29ca 100644 --- a/_build/.deploy_exclude.txt +++ b/_build/.deploy_exclude.txt @@ -16,6 +16,7 @@ _init/ composer.json composer.lock docker-compose.yml +docker-compose.local.yml gulpfile.mjs package.json README.md diff --git a/_init/local.sql b/_init/local.sql index 29f6cb99..f93a761c 100644 --- a/_init/local.sql +++ b/_init/local.sql @@ -1,6 +1,11 @@ ## Update main site -UPDATE `wp_options` SET `option_value` = 'http://localhost:8000' WHERE `option_name` = 'siteurl'; -UPDATE `wp_options` SET `option_value` = 'http://localhost:8000' WHERE `option_name` = 'home'; +UPDATE `wp_options` SET `option_value` = 'http://wordpress.saltlaw.orb.local' WHERE `option_name` = 'siteurl'; +UPDATE `wp_options` SET `option_value` = 'http://wordpress.saltlaw.orb.local' WHERE `option_name` = 'home'; + +## Alternate if using localhost instead of orb +-- UPDATE `wp_options` SET `option_value` = 'http://localhost:8000' WHERE `option_name` = 'siteurl'; +-- UPDATE `wp_options` SET `option_value` = 'http://localhost:8000' WHERE `option_name` = 'home'; + ## Update multisites -- UPDATE `wp_site` SET `domain` = 'localhost:8000' WHERE `id` = '1'; From ddbf0e4074e03806556b92cfb98db43f419bb54c Mon Sep 17 00:00:00 2001 From: Cameron Corda Date: Mon, 25 Sep 2023 07:07:12 -0700 Subject: [PATCH 2/5] orb by default, but overrideble for local ports --- .gitignore | 17 +++++++++++++++-- .vscode/tasks.json | 2 +- _init/docker-compose.local.yml | 22 ++++++++++++++++++++++ docker-compose.yml | 4 ---- 4 files changed, 38 insertions(+), 7 deletions(-) create mode 100644 _init/docker-compose.local.yml diff --git a/.gitignore b/.gitignore index 87ea0355..d9a60dfd 100644 --- a/.gitignore +++ b/.gitignore @@ -8,10 +8,11 @@ composer.lock # development-environment tmp/ +wp-content/mu-plugins/local-plugins.php docker-compose.local.yml +!_init/docker-compose.local.yml wp-content/themes/timber/dev/ wp-config-local.php -/wp-content/mu-plugins/local-plugins.php _data/ /gulpconfig.json info.php @@ -59,7 +60,19 @@ wp-includes/ # ignore everything in the "plugins" directory, # except the plugins you specify # wp-content/plugins/* -#!wp-content/plugins/stop-emails/ +#!wp-content/plugins/stop-emails/# ignore everything in the "mu-plugins" directory, +# except the mu-plugins you specify +wp-content/mu-plugins/* +!wp-content/mu-plugins/local-plugins.php + +# ignore specific theme assets +wp-content/themes/timber/assets/vendor +wp-content/themes/timber/static +wp-content/themes/timber/dist + +# ignore specific files in the root directory +.gitattributes +.gitignore # ignore certain plugins wp-content/plugins/hello.php diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 8cafa3ed..a81d01da 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -46,7 +46,7 @@ { "label": "Wordpress Docker Recreate", "type": "shell", - "command": "docker-compose up --build --force-recreate --no-deps" + "command": "docker-compose -f docker-compose.yml -f docker-compose.local.yml up --build --force-recreate --no-deps" }, { "label": "Wordpress Composer Install", diff --git a/_init/docker-compose.local.yml b/_init/docker-compose.local.yml new file mode 100644 index 00000000..2cca22c5 --- /dev/null +++ b/_init/docker-compose.local.yml @@ -0,0 +1,22 @@ +# copy this to the root of your project if you wan to customize the docker-compose.yml file defaults +# common usage are to change the ports or to add environment variables +# make sure when you run docker, you incorporate -- see .vscode/tasks.json for an example + +# version: '3.3' + +# services: +# db: +# ports: +# - '3307:3306' + +# wordpress: +# ports: +# - '8000:80' +# environment: +# WORDPRESS_CONFIG_EXTRA: | +# define('WP_ENV', 'development'); +# define('WP_LOCAL_DEV', true); +# define('WP_THEME', 'timber'); +# define('WP_DEBUG_LOG', true ); +# define('WP_DEBUG_DISPLAY', false); +# @ini_set('display_errors', 0); diff --git a/docker-compose.yml b/docker-compose.yml index f80a2fb6..c02e2fe9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,8 +3,6 @@ version: '3.3' services: db: image: mariadb - ports: - - '3307:3306' volumes: - db_data:/var/lib/mysql restart: 'no' @@ -18,8 +16,6 @@ services: depends_on: - db image: wordpress:6.3 - ports: - - '8000:80' volumes: - ./.htaccess:/var/www/html/.htaccess - ./wp-content:/var/www/html/wp-content From 17845744a2770fef0db983da0063a2710bb36637 Mon Sep 17 00:00:00 2001 From: Cameron Corda Date: Tue, 26 Sep 2023 07:23:40 -0700 Subject: [PATCH 3/5] fixing mu-plugins --- .gitignore | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index d9a60dfd..0020f487 100644 --- a/.gitignore +++ b/.gitignore @@ -57,13 +57,15 @@ wp-content/plugins/hello.php wp-admin/ wp-includes/ -# ignore everything in the "plugins" directory, -# except the plugins you specify +# ignore everything in the "plugins" directory, except the plugins you specify +# this is for a site that uses composer to manage plugins and not track them in source # wp-content/plugins/* -#!wp-content/plugins/stop-emails/# ignore everything in the "mu-plugins" directory, +#!wp-content/plugins/stop-emails/ + +# ignore everything in the "mu-plugins" directory, # except the mu-plugins you specify -wp-content/mu-plugins/* -!wp-content/mu-plugins/local-plugins.php +!wp-content/mu-plugins/* +wp-content/mu-plugins/local-plugins.php # ignore specific theme assets wp-content/themes/timber/assets/vendor From b41b0135ddd197a1c6333324ad71114be0eeb1a6 Mon Sep 17 00:00:00 2001 From: Cameron Corda Date: Wed, 27 Sep 2023 05:38:24 -0700 Subject: [PATCH 4/5] no need to ignore mu-plugins --- .gitignore | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 0020f487..691161a8 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,6 @@ composer.lock # development-environment tmp/ -wp-content/mu-plugins/local-plugins.php docker-compose.local.yml !_init/docker-compose.local.yml wp-content/themes/timber/dev/ @@ -64,7 +63,7 @@ wp-includes/ # ignore everything in the "mu-plugins" directory, # except the mu-plugins you specify -!wp-content/mu-plugins/* +# !wp-content/mu-plugins/* wp-content/mu-plugins/local-plugins.php # ignore specific theme assets From a914101d820931126621995029e6cdef3859c215 Mon Sep 17 00:00:00 2001 From: Cameron Corda Date: Wed, 27 Sep 2023 06:27:08 -0700 Subject: [PATCH 5/5] connect gulp to orb by default --- _init/gulpconfig.json | 2 +- _init/init.sh | 1 + gulpfile.mjs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/_init/gulpconfig.json b/_init/gulpconfig.json index 0e823be9..9e514b05 100644 --- a/_init/gulpconfig.json +++ b/_init/gulpconfig.json @@ -5,7 +5,7 @@ "debug": false }, "bs": { - "proxy": "localhost:8000", + "proxy": "http://wordpress.bubstimber.orb.local", "logLevel": "info", "tunnel": "", "open": false diff --git a/_init/init.sh b/_init/init.sh index b5647a2b..6941a9e4 100644 --- a/_init/init.sh +++ b/_init/init.sh @@ -16,6 +16,7 @@ rm -rf wp-content/plugins/hello.php # init files if they don't exist mkdir -p wp-content/mu-plugins cp -n _init/local-plugins.php wp-content/mu-plugins/local-plugins.php 2>/dev/null || : +cp -n _init/docker-compose.local.yml docker-compose.local.yml 2>/dev/null || : cp -n _init/gulpconfig.json gulpconfig.json 2>/dev/null || : cp -n _init/local.sql _data/local.sql 2>/dev/null || : cp -n _init/local-plugins.php wp-content/mu-plugins/local-plugins.php 2>/dev/null || : diff --git a/gulpfile.mjs b/gulpfile.mjs index ab58200c..77476941 100644 --- a/gulpfile.mjs +++ b/gulpfile.mjs @@ -41,7 +41,7 @@ try { debug: false, }, bs: { - proxy: "http://localhost:8000", + proxy: "http://wordpress.bubstimber.orb.local", logLevel: "info", tunnel: "", open: true,