works to a full install

This commit is contained in:
Nick Yeoman 2023-05-20 16:06:24 -07:00
parent 6ffd91151e
commit 44413a17df
5 changed files with 80 additions and 19 deletions

View File

@ -10,4 +10,7 @@ Make sure the projectName is set correctly, it's very important.
1. Prepare your project for git ```bash bin/new_project.sh```
1. Run the containers to initialize ```sudo bash bin/docker_up.sh```
1. Prepare the installer ```bash bin/setup_joomla_installer.sh```
1. Go to ```http://localhost:8000``` and follow the installation steps
1. Manually set Site Meta Description in [Administrator](http://localhost:8000/administrator)
1. Run ```sudo bash bin/finalize.sh```

View File

@ -1,5 +1,6 @@
#!/bin/bash
# Are you root?
if [ "$EUID" -ne 0 ]; then
echo -e "\033[0;31mThis script must be run as root.\033[0m"
exit 1

28
bin/finalize.sh Normal file
View File

@ -0,0 +1,28 @@
#!/bin/bash
# Are you root?
if [ "$EUID" -ne 0 ]; then
echo -e "\033[0;31mThis script must be run as root.\033[0m"
exit 1
fi
PROJECTNAME=$(basename "$(pwd)")
# Remove crap files
rm -f html/web.config.txt
rm -f html/htaccess.txt
rm -f html/LICENSE.txt
# Set configuration.php
docker-compose exec -u www-data joomla php cli/joomla.php config:set error_reporting=none
docker-compose exec -u www-data joomla php cli/joomla.php config:set offset=America/Vancouver
docker-compose exec -u www-data joomla php cli/joomla.php config:set sef_rewrite=true
# remove unused files from install
rm -rf bin/inc_new_project
rm -rf bin/new_project.sh
rm -rf bin/setup_joomla_installer.sh
# Git
git add .
git commit -m"ran finalize"

View File

@ -26,26 +26,54 @@ set +o allexport
# create json file
##################################################################
DB_PREFIX=$(echo $RANDOM | md5sum | awk '{print substr($1, 1, 3)}')_
#DB_PREFIX=$(echo $RANDOM | md5sum | awk '{print substr($1, 1, 3)}')_
docker-compose exec -u www-data joomla sh -c "echo '{
\"language\":\"en-GB\",
\"site_name\":\"$PROJECTNAME\",
\"admin_email\":\"$EMAIL\",
\"admin_user\":\"$JOOMLA_USER\",
\"admin_password\":\"$JOOMLA_PASSWORD\",
\"db_type\":\"mysql\",
\"db_host\":\"mariadb\",
\"db_user\":\"$MYSQL_USER\",
\"db_pass\":\"$MYSQL_PASSWORD\",
\"db_name\":\"$MYSQL_DATABASE\",
\"db_prefix\":\"$DB_PREFIX\",
\"db_old\":\"remove\",
\"helpurl\":\"https://joomla.org\"
}' > config.json"
# docker-compose exec -u www-data joomla sh -c "echo '{
# \"language\":\"en-GB\",
# \"site_name\":\"$PROJECTNAME\",
# \"admin_email\":\"$EMAIL\",
# \"admin_user\":\"$JOOMLA_USER\",
# \"admin_password\":\"$JOOMLA_PASSWORD\",
# \"db_type\":\"mysql\",
# \"db_host\":\"mariadb\",
# \"db_user\":\"$MYSQL_USER\",
# \"db_pass\":\"$MYSQL_PASSWORD\",
# \"db_name\":\"$MYSQL_DATABASE\",
# \"db_prefix\":\"$DB_PREFIX\",
# \"db_old\":\"remove\",
# \"helpurl\":\"https://joomla.org\"
# }' > config.json"
# docker-compose exec -u www-data joomla php cli/joomla.php core:install --file=config.json
##################################################################
# run the installer
# EASY GUI SETUP
##################################################################
docker-compose exec -u www-data joomla php cli/joomla.php core:install --file=config.json
# Site Name
xmlstarlet ed -L -s '//field[@name="site_name"]' -t attr -n default -v "$PROJECTNAME" html/installation/forms/setup.xml
# Super User Full Name
xmlstarlet ed -L -s '//field[@name="admin_user"]' -t attr -n default -v "$JOOMLA_USER" html/installation/forms/setup.xml
# Super User username
xmlstarlet ed -L -s '//field[@name="admin_username"]' -t attr -n default -v "$JOOMLA_USER" html/installation/forms/setup.xml
# Super User Password
xmlstarlet ed -L -s '//field[@name="admin_password"]' -t attr -n default -v "$JOOMLA_PASSWORD" html/installation/forms/setup.xml
# Super User email
xmlstarlet ed -L -s '//field[@name="admin_email"]' -t attr -n default -v "$EMAIL" html/installation/forms/setup.xml
# Database host
xmlstarlet ed -L -u '//field[@name="db_host"]/@default' -v 'mariadb' html/installation/forms/setup.xml
# Database user
xmlstarlet ed -L -s '//field[@name="db_user"]' -t attr -n default -v "$MYSQL_USER" html/installation/forms/setup.xml
# Database password
xmlstarlet ed -L -s '//field[@name="db_pass"]' -t attr -n default -v "$MYSQL_PASSWORD" html/installation/forms/setup.xml
# Database name
xmlstarlet ed -L -u '//field[@name="db_name"]/@default' -v "$MYSQL_DATABASE" html/installation/forms/setup.xml

View File

@ -17,4 +17,5 @@ ACCESS_TOKEN=REPLACEME
# Joomla
EMAIL=noreply@example.com
JOOMLA_USER=admin
JOOMLA_PASSWORD=REPLACEME
# Passwords must be 12 characters long
JOOMLA_PASSWORD=REPLACEME123