Skip to content

Commit

Permalink
Merge pull request #901 from matomo-org/localdev-woopiwik
Browse files Browse the repository at this point in the history
allow loading the woocommerce premium plugin in the local dev environment
  • Loading branch information
diosmosis authored Oct 16, 2023
2 parents 5db67bc + 609d616 commit 59c29a5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
22 changes: 13 additions & 9 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# to override the environment, you can configure environment variables in a .env file saved in this directory.
# the following environment variables are supported:
# - PHP_VERSION (defaults to 8.1, must be a version that has an official docker container available)
# - BACKEND ('mariadb' or 'mysql', defaults to 'mariadb')
# - WORDPRESS_VERSION (defaults to latest (defined below))
# - PORT (the port to expose wordpress on, defaults to 3000)
# - WP_ADMIN_USER (the admin wordpress username, defaults to 'root')
# - WP_ADMIN_EMAIL (the admin user's email, defaults to '[email protected]')
# - WOOCOMMERCE (if set, installs and sets up woocommerce)
# - STRIPE_PUBLISHABLE_KEY (the test publishable key to use with a woocommerce install)
# - STRIPE_SECRET_KEY (the test secret key to use with a woocommerce install)
# - PHP_VERSION - defaults to 8.1, must be a version that has an official docker container available
# - BACKEND - 'mariadb' or 'mysql', defaults to 'mariadb'
# - WORDPRESS_VERSION - defaults to latest (defined below)
# - PORT - the port to expose wordpress on, defaults to 3000
# - WP_ADMIN_USER - the admin wordpress username, defaults to 'root'
# - WP_ADMIN_EMAIL - the admin user's email, defaults to '[email protected]'
# - WOOCOMMERCE - if set, installs and sets up woocommerce
# - STRIPE_PUBLISHABLE_KEY - the test publishable key to use with a woocommerce install
# - STRIPE_SECRET_KEY - the test secret key to use with a woocommerce install
# - WOOCOMMERCE_PIWIK_ANALYTICS - path to woocommerce-piwik-analytics repo clone to link to in wordpress

services:
# basic apache service
Expand All @@ -25,6 +26,7 @@ services:
- /var/www/html/matomo-for-wordpress/app/tmp
- ./scripts/local-dev-entrypoint.sh:/usr/src/entrypoint.sh
- ./docker/wp-cli:/.wp-cli
- "${WOOCOMMERCE_PIWIK_ANALYTICS:-/dev/null}:/var/www/html/woocommerce-piwik-analytics"
ports:
- "${PORT:-3000}:80"
environment:
Expand Down Expand Up @@ -55,6 +57,7 @@ services:
- /var/www/html/matomo-for-wordpress/app/tmp
- ./scripts/local-dev-entrypoint.sh:/usr/src/entrypoint.sh
- ./docker/wp-cli:/.wp-cli
- "${WOOCOMMERCE_PIWIK_ANALYTICS:-/dev/null}:/var/www/html/woocommerce-piwik-analytics"
environment:
WP_DB_HOST: "${BACKEND:-mariadb}"
WOOCOMMERCE: "$WOOCOMMERCE"
Expand Down Expand Up @@ -96,6 +99,7 @@ services:
- .:/var/www/html/matomo-for-wordpress
- /var/www/html/matomo-for-wordpress/app/tmp
- ./docker/wp-cli:/.wp-cli
- "${WOOCOMMERCE_PIWIK_ANALYTICS:-/dev/null}:/var/www/html/woocommerce-piwik-analytics"
ports:
- "${PORT:-3000}:80"
environment:
Expand Down
4 changes: 4 additions & 0 deletions scripts/local-dev-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ if [ ! -d "/var/www/html/$WORDPRESS_VERSION/wp-content/plugins/matomo" ]; then
ln -s /var/www/html/matomo-for-wordpress "/var/www/html/$WORDPRESS_VERSION/wp-content/plugins/matomo"
fi

if [[ -d "/var/www/html/woocommerce-piwik-analytics" && ! -d "/var/www/html/$WORDPRESS_VERSION/wp-content/plugins/woocommerce-piwik-analytics" ]]; then
ln -s /var/www/html/woocommerce-piwik-analytics /var/www/html/$WORDPRESS_VERSION/wp-content/plugins/woocommerce-piwik-analytics
fi

/var/www/html/wp-cli.phar --allow-root --path=/var/www/html/$WORDPRESS_VERSION plugin activate matomo

# add index.php file listing available installs to root /var/www/html
Expand Down

0 comments on commit 59c29a5

Please sign in to comment.