Skip to content

Commit

Permalink
Making docker orb friendly, customize locally (#179)
Browse files Browse the repository at this point in the history
* Making docker orb friendly, customize locally

* orb by default, but overrideble for local ports

* fixing mu-plugins

* no need to ignore mu-plugins

* connect gulp to orb by default
  • Loading branch information
ccorda authored Oct 4, 2023
1 parent ad87990 commit 1f0c07f
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 13 deletions.
21 changes: 18 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ composer.lock

# development-environment
tmp/
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
Expand Down Expand Up @@ -55,11 +56,25 @@ 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,
# 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
wp-content/plugins/akismet/
Expand Down
4 changes: 2 additions & 2 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
1 change: 1 addition & 0 deletions _build/.deploy_exclude.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ _init/
composer.json
composer.lock
docker-compose.yml
docker-compose.local.yml
gulpfile.mjs
package.json
README.md
Expand Down
22 changes: 22 additions & 0 deletions _init/docker-compose.local.yml
Original file line number Diff line number Diff line change
@@ -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);
2 changes: 1 addition & 1 deletion _init/gulpconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"debug": false
},
"bs": {
"proxy": "localhost:8000",
"proxy": "http://wordpress.bubstimber.orb.local",
"logLevel": "info",
"tunnel": "",
"open": false
Expand Down
1 change: 1 addition & 0 deletions _init/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 || :
Expand Down
9 changes: 7 additions & 2 deletions _init/local.sql
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
4 changes: 0 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ version: '3.3'
services:
db:
image: mariadb
ports:
- '3307:3306'
volumes:
- db_data:/var/lib/mysql
restart: 'no'
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion gulpfile.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ try {
debug: false,
},
bs: {
proxy: "http://localhost:8000",
proxy: "http://wordpress.bubstimber.orb.local",
logLevel: "info",
tunnel: "",
open: true,
Expand Down

0 comments on commit 1f0c07f

Please sign in to comment.