Renamed to Selig, combine scripts, plugin import
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
PROJECT_NAME=kenesaw
|
||||
PROJECT_NAME=selig
|
||||
|
||||
WORDPRESS_ADMIN_USER=
|
||||
WORDPRESS_ADMIN_EMAIL=
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
*.sql
|
||||
*.tgz
|
||||
.env
|
||||
*.zip
|
||||
|
||||
14
README.md
14
README.md
@@ -1,6 +1,6 @@
|
||||
# Kenesaw
|
||||
# Selig
|
||||
|
||||
Kenesaw is a Docker project to set-up two Wordpress servers, one for a league, one for a team. It uses Caddy for the webserver and a single MariaDB instance for the server.
|
||||
Selig is a Docker project to set-up two Wordpress servers, one for a league, one for a team. It uses Caddy for the webserver and a single MariaDB instance for the server.
|
||||
|
||||
Each Wordpress instance setups their own database within the MariaDB instance.
|
||||
|
||||
@@ -9,17 +9,19 @@ Each Wordpress instance setups their own database within the MariaDB instance.
|
||||
There are two environment files, one at the project root and one under each WordPress folder ([cmbabaseball](./cmbabaseball/.env), [chihounds](./chihounds/.env)).
|
||||
|
||||
### Init
|
||||
Each WordPress site has an `wp-install.sh` script ([cmbabaseball](./cmbabaseball/wp-install.sh), [chihounds](./chihounds/wp-install.sh)). It creates the database and install Wordpress using the common `wp-admin` user info provided in the project root via a ephemeral wp-cli container. (Theoretically, this can be changed by overwriting the environment variables in the website-specific env file, but I didn't test that and I don't know what the order would have to be).
|
||||
Each WordPress site has an `wp-install.sh` script ([cmbabaseball](./cmbabaseball/wp-install), [chihounds](./chihounds/wp-install)). It creates the database and install Wordpress using the common `wp-admin` user info provided in the project root via a ephemeral wp-cli container. (Theoretically, this probably can be changed by overwriting the environment variables in the website-specific env file, but I didn't test that and I don't know what the order would have to be). It also preinstalls a list of plugins as defined in the site's .env.
|
||||
|
||||
Currently, the scripts are exactly the same, so they are symbolic links to the shared directory.
|
||||
|
||||
```sh
|
||||
./cmbabaseball/init-wordpress.sh
|
||||
./chihounds/init-wordpress.sh
|
||||
./cmbabaseball/init-wordpress
|
||||
./chihounds/init-wordpress
|
||||
```
|
||||
|
||||
OR
|
||||
|
||||
```sh
|
||||
./*/init-wordpress.sh
|
||||
./*/init-wordpress
|
||||
```
|
||||
|
||||
### Import
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
cd "$(dirname "$0")"
|
||||
PROJECT_NAME=kenesaw
|
||||
PROJECT_NAME=selig
|
||||
CONTAINER_NAME=chihounds
|
||||
docker run --rm --user 33:33 --volume ${PROJECT_NAME}_${CONTAINER_NAME}-wpdata:/var/www/html --env-file ../.env --env-file .env --network ${PROJECT_NAME}_network "$@"
|
||||
@@ -1,2 +0,0 @@
|
||||
cd "$(dirname "$0")"
|
||||
./docker-run.sh wordpress:cli "$@"
|
||||
1
chihounds/wp-cli.sh
Symbolic link
1
chihounds/wp-cli.sh
Symbolic link
@@ -0,0 +1 @@
|
||||
../shared/wp-cli.sh
|
||||
@@ -1,27 +0,0 @@
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
./docker-run.sh \
|
||||
-v ./data/import.sql:/import.sql \
|
||||
-v ./data/import-uploads.tgz:/import-uploads.tgz \
|
||||
wordpress:cli sh -c '
|
||||
|
||||
if [ -f /import.sql ]; then
|
||||
echo "Importing Database..."
|
||||
wp db query < /import.sql
|
||||
echo "Replacing default site url (https://localhost->$WORDPRESS_SITEURL)"
|
||||
wp search-replace "https://localhost" "$WORDPRESS_SITEURL" --format=count
|
||||
echo "Re-adding the admin user"
|
||||
wp user create $WORDPRESS_ADMIN_USER $WORDPRESS_ADMIN_EMAIL --user_pass=$WORDPRESS_ADMIN_PASSWORD --role=administrator --porcelain
|
||||
echo "Done."
|
||||
fi && \
|
||||
if [ -f /import-uploads.tgz ]; then
|
||||
echo "Importing Uploads..."
|
||||
tar -xz --overwrite -f /import-uploads.tgz -C /var/www/html/wp-content/uploads .
|
||||
echo "Done."
|
||||
fi && \
|
||||
if [ -f /import-plugins.tgz ]; then
|
||||
echo "Importing Plugins..."
|
||||
tar -xzk--overwrite -f /import-plugins.tgz -C /var/www/html/wp-content/plugins .
|
||||
echo "Done."
|
||||
fi
|
||||
'
|
||||
1
chihounds/wp-import.sh
Symbolic link
1
chihounds/wp-import.sh
Symbolic link
@@ -0,0 +1 @@
|
||||
../shared/wp-import.sh
|
||||
@@ -1,7 +0,0 @@
|
||||
cd "$(dirname "$0")"
|
||||
./wp-cli.sh sh -c '
|
||||
wp db create || true && \
|
||||
wp core install --title="$WORDPRESS_TITLE" --url="$WORDPRESS_SITEURL" --admin_user=$WORDPRESS_ADMIN_USER --admin_email=$WORDPRESS_ADMIN_EMAIL --admin_password=$WORDPRESS_ADMIN_PASSWORD && \
|
||||
wp theme install $WP_THEMES --activate; \
|
||||
wp plugin install $WP_PLUGINS --activate
|
||||
'
|
||||
1
chihounds/wp-install.sh
Symbolic link
1
chihounds/wp-install.sh
Symbolic link
@@ -0,0 +1 @@
|
||||
../shared/wp-install.sh
|
||||
@@ -1,4 +1,4 @@
|
||||
cd "$(dirname "$0")"
|
||||
PROJECT_NAME=kenesaw
|
||||
PROJECT_NAME=selig
|
||||
CONTAINER_NAME=cmbabaseball
|
||||
docker run --rm --user 33:33 --volume ${PROJECT_NAME}_${CONTAINER_NAME}-wpdata:/var/www/html --env-file ../.env --env-file .env --network ${PROJECT_NAME}_network "$@"
|
||||
@@ -1,2 +0,0 @@
|
||||
cd "$(dirname "$0")"
|
||||
./docker-run.sh wordpress:cli "$@"
|
||||
1
cmbabaseball/wp-cli.sh
Symbolic link
1
cmbabaseball/wp-cli.sh
Symbolic link
@@ -0,0 +1 @@
|
||||
../shared/wp-cli.sh
|
||||
@@ -1,27 +0,0 @@
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
./docker-run.sh \
|
||||
-v ./data/import.sql:/import.sql \
|
||||
-v ./data/import-uploads.tgz:/import-uploads.tgz \
|
||||
wordpress:cli sh -c '
|
||||
|
||||
if [ -f /import.sql ]; then
|
||||
echo "Importing Database..."
|
||||
wp db query < /import.sql
|
||||
echo "Replacing default site url (https://localhost->$WORDPRESS_SITEURL)"
|
||||
wp search-replace "https://localhost" "$WORDPRESS_SITEURL" --format=count
|
||||
echo "Re-adding the admin user"
|
||||
wp user create $WORDPRESS_ADMIN_USER $WORDPRESS_ADMIN_EMAIL --user_pass=$WORDPRESS_ADMIN_PASSWORD --role=administrator --porcelain
|
||||
echo "Done."
|
||||
fi && \
|
||||
if [ -f /import-uploads.tgz ]; then
|
||||
echo "Importing Uploads..."
|
||||
tar -xz --overwrite -f /import-uploads.tgz -C /var/www/html/wp-content/uploads .
|
||||
echo "Done."
|
||||
fi && \
|
||||
if [ -f /import-plugins.tgz ]; then
|
||||
echo "Importing Plugins..."
|
||||
tar -xzk--overwrite -f /import-plugins.tgz -C /var/www/html/wp-content/plugins .
|
||||
echo "Done."
|
||||
fi
|
||||
'
|
||||
1
cmbabaseball/wp-import.sh
Symbolic link
1
cmbabaseball/wp-import.sh
Symbolic link
@@ -0,0 +1 @@
|
||||
../shared/wp-import.sh
|
||||
@@ -1,7 +0,0 @@
|
||||
cd "$(dirname "$0")"
|
||||
./wp-cli.sh sh -c '
|
||||
wp db create || true && \
|
||||
wp core install --title="$WORDPRESS_TITLE" --url="$WORDPRESS_SITEURL" --admin_user=$WORDPRESS_ADMIN_USER --admin_email=$WORDPRESS_ADMIN_EMAIL --admin_password=$WORDPRESS_ADMIN_PASSWORD && \
|
||||
wp theme install $WP_THEMES --activate; \
|
||||
wp plugin install $WP_PLUGINS --activate
|
||||
'
|
||||
1
cmbabaseball/wp-install.sh
Symbolic link
1
cmbabaseball/wp-install.sh
Symbolic link
@@ -0,0 +1 @@
|
||||
../shared/wp-install.sh
|
||||
2
shared/wp-cli.sh
Executable file
2
shared/wp-cli.sh
Executable file
@@ -0,0 +1,2 @@
|
||||
cd "$(dirname "$0")"
|
||||
./docker-run.sh wordpress:cli "$@"
|
||||
32
shared/wp-import.sh
Executable file
32
shared/wp-import.sh
Executable file
@@ -0,0 +1,32 @@
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
./docker-run.sh \
|
||||
-v ./data/import.sql:/import.sql \
|
||||
-v ./data/import-uploads.tgz:/import-uploads.tgz \
|
||||
-v ./data/plugins:/import-plugins \
|
||||
wordpress:cli sh -c '
|
||||
|
||||
if [ -f /import.sql ]; then
|
||||
echo "Importing Database..."
|
||||
wp db query < /import.sql
|
||||
echo "Replacing default site url (https://localhost->$WORDPRESS_SITEURL)"
|
||||
wp search-replace "https://localhost" "$WORDPRESS_SITEURL" --format=count
|
||||
echo "Re-adding the admin user"
|
||||
wp user create $WORDPRESS_ADMIN_USER $WORDPRESS_ADMIN_EMAIL --user_pass=$WORDPRESS_ADMIN_PASSWORD --role=administrator --porcelain
|
||||
echo "Done."
|
||||
fi && \
|
||||
if [ -f /import-uploads.tgz ]; then
|
||||
echo "Importing Uploads..."
|
||||
tar -xz --overwrite -f /import-uploads.tgz -C /var/www/html/wp-content/uploads .
|
||||
echo "Done."
|
||||
fi && \
|
||||
if [ -n "$(ls -A /import-plugins 2>/dev/null)" ]; then
|
||||
echo "Importing Plugins..."
|
||||
for I in /import-plugins/*.zip; do
|
||||
[ -f "$I" ] || continue
|
||||
echo "$I"
|
||||
wp plugin install "$I" --activate
|
||||
done
|
||||
echo "Done."
|
||||
fi
|
||||
'
|
||||
7
shared/wp-install.sh
Executable file
7
shared/wp-install.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
cd "$(dirname "$0")"
|
||||
./wp-cli.sh sh -c '
|
||||
wp db create || true && \
|
||||
wp core install --title="$WORDPRESS_TITLE" --url="$WORDPRESS_SITEURL" --admin_user=$WORDPRESS_ADMIN_USER --admin_email=$WORDPRESS_ADMIN_EMAIL --admin_password=$WORDPRESS_ADMIN_PASSWORD && \
|
||||
wp theme install $WP_THEMES --activate; \
|
||||
wp plugin install $WP_PLUGINS --activate
|
||||
'
|
||||
Reference in New Issue
Block a user