Added wp-cli

This commit is contained in:
Ken Johnson 2020-11-02 14:57:43 -08:00
parent a3a6adf783
commit 75f0232503
1 changed files with 10 additions and 10 deletions

View File

@ -44,6 +44,11 @@ service nginx start 2>/dev/null
service php-fpm start 2>/dev/null service php-fpm start 2>/dev/null
service mysql-server start 2>/dev/null service mysql-server start 2>/dev/null
cd /tmp
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
#https://docs.nextcloud.com/server/13/admin_manual/installation/installation_wizard.html do not use the same name for user and db #https://docs.nextcloud.com/server/13/admin_manual/installation/installation_wizard.html do not use the same name for user and db
USER="dbadmin" USER="dbadmin"
DB="wordpress" DB="wordpress"
@ -71,6 +76,7 @@ CREATE USER '${USER}'@'localhost' IDENTIFIED BY '${PASS}';
GRANT ALL PRIVILEGES ON *.* TO '${USER}'@'localhost' WITH GRANT OPTION; GRANT ALL PRIVILEGES ON *.* TO '${USER}'@'localhost' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON ${DB}.* TO '${USER}'@'localhost'; GRANT ALL PRIVILEGES ON ${DB}.* TO '${USER}'@'localhost';
FLUSH PRIVILEGES; FLUSH PRIVILEGES;
CREATE DATABASE ${DB};
EOF EOF
# Make the default log directory # Make the default log directory
@ -90,6 +96,7 @@ CREATE USER '${USER}'@'localhost' IDENTIFIED BY '${PASS}';
GRANT ALL PRIVILEGES ON *.* TO '${USER}'@'localhost' WITH GRANT OPTION; GRANT ALL PRIVILEGES ON *.* TO '${USER}'@'localhost' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON ${DB}.* TO '${USER}'@'localhost'; GRANT ALL PRIVILEGES ON ${DB}.* TO '${USER}'@'localhost';
FLUSH PRIVILEGES; FLUSH PRIVILEGES;
CREATE DATABASE ${DB};
EOF EOF
fi fi
@ -99,21 +106,14 @@ if [ -e "/etc/iocage-env" ] ; then
echo "Using NAT Address: $IOCAGE_PLUGIN_IP" echo "Using NAT Address: $IOCAGE_PLUGIN_IP"
fi fi
#Use occ to complete Nextcloud installation #Use wp to complete the Wordpress installation
su -m www -c "php /usr/local/www/nextcloud/occ maintenance:install --database=\"mysql\" --database-name=\"nextcloud\" --database-user=\"$USER\" --database-pass=\"$PASS\" --database-host=\"localhost\" --admin-user=\"$NCUSER\" --admin-pass=\"$NCPASS\" --data-dir=\"/usr/local/www/nextcloud/data\"" su -m www -c "wp core config --dbname=$DB --dbuser=$USER --dbpass=$PASS"
su -m www -c "php /usr/local/www/nextcloud/occ config:system:set trusted_domains 1 --value=\"${IOCAGE_PLUGIN_IP}\"" su -m www -c "wp core install --title=$DB --admin_user=$WPUSER --admin_password=$WPPASS --admin_email=ken@blkdoor.com
#workaround for occ (in shell just use occ instead of su -m www -c "....")
echo >> .cshrc
echo alias occ ./occ.sh >> .cshrc
echo 'su -m www -c php\ ``/usr/local/www/nextcloud/occ\ "$*"``' > ~/occ.sh
chmod u+x ~/occ.sh
# create sessions tmp dir outside nextcloud installation # create sessions tmp dir outside nextcloud installation
mkdir -p /usr/local/www/wordpress-sessions-tmp >/dev/null 2>/dev/null mkdir -p /usr/local/www/wordpress-sessions-tmp >/dev/null 2>/dev/null
chmod o-rwx /usr/local/www/wordpress-sessions-tmp chmod o-rwx /usr/local/www/wordpress-sessions-tmp
chown -R www:www /usr/local/www/wordpress-sessions-tmp chown -R www:www /usr/local/www/wordpress-sessions-tmp
chmod -R o-rwx /usr/local/www/wordpress chmod -R o-rwx /usr/local/www/wordpress
#updater needs this #updater needs this