[wp] Fix multisite installation

While there we also simplify DD by removing an the unnecessary wp-cli
container.
mejoras_instalacion
Evilham 2022-09-20 19:20:38 +02:00
parent 7d7c2ddfcf
commit 3c53a5aead
No known key found for this signature in database
GPG Key ID: AE3EE30D970886BF
3 changed files with 9 additions and 65 deletions

View File

@ -1,32 +0,0 @@
#!/bin/sh
#
# Copyright © 2021,2022 IsardVDI S.L.
#
# This file is part of DD
#
# DD is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# DD is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License
# along with DD. If not, see <https://www.gnu.org/licenses/>.
#
# SPDX-License-Identifier: AGPL-3.0-or-later
cat <<EOT >> multisite.cfg
define( 'WP_ALLOW_MULTISITE', true );
define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', false );
\$base = '/';
define( 'DOMAIN_CURRENT_SITE', '$WORDPRESS_DOMAIN_CURRENT_SITE' );
define( 'PATH_CURRENT_SITE', '/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );
EOT
sed -i '/Happy publishing/e cat multisite.cfg' /var/www/html/wp-config.php

View File

@ -26,7 +26,6 @@ x-volumes:
- ${SRC_FOLDER}/wordpress:/var/www/html
- ${BUILD_APPS_ROOT_PATH}/docker/wordpress/plugins:/plugins
- ${BUILD_APPS_ROOT_PATH}/docker/wordpress/.htaccess:/var/www/html/.htaccess:ro
- ${BUILD_APPS_ROOT_PATH}/docker/wordpress/multisite.sh:/multisite.sh:ro
- ${DATA_FOLDER}/wordpress:/var/www/html/wp-content/uploads
services:
@ -57,30 +56,3 @@ services:
retries: 5
networks:
- dd_net
dd-apps-wordpress-cli:
image: ${WORDPRESS_CLI_IMG}
container_name: dd-apps-wordpress-cli
volumes:
*wordpress-volumes
command: >
bash -c 'wp core install --path="/var/www/html" --url=wp.${DOMAIN} --title="${TITLE}" --admin_user=${WORDPRESS_ADMIN_USER} --admin_password=${WORDPRESS_ADMIN_PASSWORD} --admin_email=${SMTP_USER};
wp core multisite-convert;'
depends_on:
dd-apps-mariadb:
condition: service_healthy
dd-apps-wordpress:
condition: service_healthy
networks:
- dd_net
restart: "no"
environment:
WORDPRESS_DB_HOST: dd-apps-mariadb
WORDPRESS_DB_NAME: "wordpress"
WORDPRESS_DB_USER: ${WORDPRESS_MARIADB_USER}
WORDPRESS_DB_PASSWORD: ${WORDPRESS_MARIADB_PASSWORD}
DOMAIN: ${DOMAIN}
TITLE: ${TITLE}
SMTP_USER: ${SMTP_USER}

14
dd-ctl
View File

@ -448,10 +448,15 @@ setup_moodle(){
setup_wordpress(){
echo " --> Applying custom settings in wordpress"
## Multisite
docker exec -ti dd-apps-wordpress /bin/sh -c "/multisite.sh"
chown -R 33:33 "${DATA_FOLDER}/wordpress"
docker exec -i --user=33 dd-apps-wordpress sh -s <<-EOF
wp core install --path="/var/www/html" \
--url=wp.${DOMAIN} --title="${TITLE}" \
--admin_user=${WORDPRESS_ADMIN_USER} \
--admin_password=${WORDPRESS_ADMIN_PASSWORD} \
--admin_email=${SMTP_USER}
wp core multisite-convert
docker-compose run --user=33 dd-apps-wordpress-cli /bin/bash -s <<-EOF
wp plugin activate onelogin-saml-sso
wp plugin install generateblocks --activate
wp plugin activate generateblocks --network
@ -465,7 +470,6 @@ setup_wordpress(){
wp option set WPLANG ca
wp option set date_format "d/m/Y"
EOF
docker-compose run --user=root dd-apps-wordpress-cli /bin/bash -c 'chown -R 33:33 /var/www/html/wp-content/uploads;'
}
setup_keycloak(){
@ -663,7 +667,7 @@ upgrade_plugins_wp(){
else
sh -c "cd $SRC_FOLDER/wordpress/wp-content/mu-plugins; git pull"
fi
docker-compose run --user=root dd-apps-wordpress-cli /bin/bash -c 'chown -R 33:33 /var/www/html/wp-content/mu-plugins;'
chown -R 33:33 "${SRC_FOLDER}/wordpress/wp-content/mu-plugins"
# TODO: Fix this, check https://gitlab.com/DD-workspace/DD/-/issues/16
##install plugin gsite
docker exec -i dd-apps-wordpress sh -s <<-EOF