Merge branch 'docker-fix-mysql-and-permissions' into 'master'

Fix upload permissions and make database persistent

See merge request saburly/wiaas/new-wiaas!17
This commit was merged in pull request #17.
This commit is contained in:
Almira
2018-09-04 07:04:39 +00:00
6 changed files with 29 additions and 27 deletions

View File

@@ -35,7 +35,7 @@ ENV WP_LOGGED_IN_SALT ${WP_LOGGED_IN_SALT}
ENV WP_NONCE_SALT ${WP_NONCE_SALT}
ENV WP_JWT_AUTH_SECRET_KEY ${WP_JWT_AUTH_SECRET_KEY}
RUN apt-get update && apt-get install -y git unzip gnupg mysql-client
RUN apt-get update && apt-get install -y git unzip gnupg mysql-client sudo
COPY docker/php/composer.phar /usr/local/bin/composer
RUN chmod 755 /usr/local/bin/composer

View File

@@ -9,7 +9,6 @@ class Wiaas_DB_Update {
'20180801222206' => 'wiaas_db_update_setup_gravity',
'20180802222206' => 'wiaas_db_update_add_delivery_process_forms',
'20180807222206' => 'wiaas_db_update_setup_customer_capabilities',
'20180809134511' => 'wiaas_db_update_add_customer_read_permission',
'20180811134511' => 'wiaas_db_update_enable_orders_access_management',
'20180813134511' => 'wiaas_db_update_enable_order_numbers',
'20180826153509' => 'wiaas_create_broker_access_group'

View File

@@ -82,12 +82,10 @@ function wiaas_db_update_setup_customer_capabilities() {
$customer_role = get_role('customer');
$customer_role->add_cap('read_private_shop_orders');
$customer_role->add_cap('read_shop_order');
}
function wiaas_db_update_add_customer_read_permission() {
$role = get_role( 'customer' );
$role->add_cap( 'read_private_products' );
$customer_role->add_cap('read_private_products');
$customer_role->add_cap('read_shop_order');
$customer_role->add_cap('publish_shop_orders');
}
function wiaas_db_update_enable_orders_access_management() {

1
database/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
volume/*

View File

@@ -54,3 +54,5 @@ services:
- MYSQL_PASSWORD
ports:
- '23306:3306'
volumes:
- ./database/volume/:/var/lib/mysql

View File

@@ -8,27 +8,29 @@ while ! mysqladmin ping -h"db" --silent; do
done
echo "Ready...."
# Apply core database updates if needed
wp core update-db --allow-root
sudo -u www-data -s -- <<EOF
# Export variables for www-data user so they
# are accessible when running wp CLI
export WP_ENV="$WP_ENV"
export WP_HOME="$WP_HOME"
export WP_DB_HOST="$WP_DB_HOST"
export MYSQL_DATABASE="$MYSQL_DATABASE"
export MYSQL_USER="$MYSQL_USER"
export MYSQL_PASSWORD="$MYSQL_PASSWORD"
export WP_AUTH_KEY="$WP_AUTH_KEY"
export WP_SECURE_AUTH_KEY="$WP_SECURE_AUTH_KEY"
export WP_LOGGED_IN_KEY="$WP_LOGGED_IN_KEY"
export WP_NONCE_KEY="$WP_NONCE_KEY"
export WP_AUTH_SALT="$WP_AUTH_SALT"
export WP_SECURE_AUTH_SALT="$WP_SECURE_AUTH_SALT"
export WP_LOGGED_IN_SALT="$WP_LOGGED_IN_SALT"
export WP_NONCE_SALT="$WP_NONCE_SALT"
export WP_JWT_AUTH_SECRET_KEY="$WP_JWT_AUTH_SECRET_KEY"
# Activate plugins in desired order
# (if plugin is already activated command will do nothing)
wp plugin activate woocommerce-jetpack --allow-root
wp plugin activate groups --allow-root
wp plugin activate jwt-authentication-for-wp-rest-api --allow-root
wp plugin activate wiaas --allow-root
wp plugin activate gravityforms --allow-root
wp plugin activate gravityflow --allow-root
wp plugin activate capability-manager-enhanced --allow-root
wp plugin activate wp-user-groups --allow-root
# Execute database update
composer update-db
# Execute database update for updated plugins
# (if no changes detected command will do nothing)
wp wc update --allow-root
# Execute database update for wiaas
# (if no changes detected command will do nothing)
wp wiaas update-db --allow-root
EOF
echo "Done"