86 lines
2.0 KiB
Bash
86 lines
2.0 KiB
Bash
#!/bin/sh
|
|
|
|
# Set sendmail_path in php.ini for PHP 8.3 FPM
|
|
PHP_INI="/etc/php83/php.ini"
|
|
if [ -f "$PHP_INI" ]; then
|
|
sed -i '/^sendmail_path/d' "$PHP_INI"
|
|
echo 'sendmail_path = "/usr/sbin/sendmail -S mailhog:1025"' >> "$PHP_INI"
|
|
fi
|
|
|
|
# This script is used to install WordPress and configure it with a MariaDB database.
|
|
# It checks for the presence of a database and user, creates them if they don't exist,
|
|
# and sets up the WordPress configuration file with the database connection details.
|
|
echo "Installing WordPress..."
|
|
sleep 10
|
|
|
|
# Check if the database exists
|
|
|
|
echo "wp core download --allow-root --path=/var/www/html"
|
|
wp core download --allow-root --path=/var/www/html
|
|
|
|
echo "wp config create --allow-root"
|
|
wp config create --allow-root \
|
|
--dbname=$MYSQL_DATABASE \
|
|
--dbuser=$MYSQL_USER \
|
|
--dbpass=$MYSQL_PASSWORD \
|
|
--dbhost=$DB_HOST \
|
|
--path=/var/www/html
|
|
|
|
echo "wp core install --allow-root"
|
|
wp core install --allow-root \
|
|
--url=$DOMAIN_NAME \
|
|
--title=$WP_TITLE \
|
|
--admin_user=$WP_ADMIN \
|
|
--admin_password=$WP_ADMIN_PASSWORD \
|
|
--admin_email=$WP_ADMIN_EMAIL \
|
|
--path=/var/www/html
|
|
|
|
echo "wp user create --allow-root"
|
|
wp user create --allow-root \
|
|
$WP_USER \
|
|
$WP_USER_EMAIL \
|
|
--role=author \
|
|
--user_pass=$WP_USER_PASSWORD \
|
|
--path=/var/www/html
|
|
|
|
echo "wp theme install --allow-root"
|
|
wp theme install --allow-root \
|
|
$WP_THEME \
|
|
--activate \
|
|
--path=/var/www/html
|
|
|
|
wp plugin install --allow-root \
|
|
redis-cache \
|
|
--activate \
|
|
--path=/var/www/html
|
|
wp config set --allow-root \
|
|
WP_REDIS_HOST \
|
|
"redis" \
|
|
--type=constant \
|
|
--path=/var/www/html
|
|
|
|
wp config set --allow-root \
|
|
WP_REDIS_PORT \
|
|
6379 \
|
|
--type=constant \
|
|
--path=/var/www/html
|
|
|
|
wp redis enable --allow-root \
|
|
--path=/var/www/html
|
|
|
|
# wp config set --allow-root \
|
|
# SMTP_SERVER \
|
|
# "mailhog" \
|
|
# --type=constant \
|
|
# --path=/var/www/html
|
|
# wp config set --allow-root \
|
|
# SMTP_PORT \
|
|
# 1025 \
|
|
# --type=constant \
|
|
# --path=/var/www/html
|
|
|
|
echo "WordPress installation completed."
|
|
|
|
chown -R wordpress:wordpress /var/www/html
|
|
|
|
exec "$@" |