This repository has been archived on 2024-08-08. You can view files and clone it, but cannot push or open issues or pull requests.
joomla/bin/joomla_install.sh

45 lines
1.2 KiB
Bash

#!/bin/bash
PROJECTNAME=$(basename "$(pwd)")
# Are you root?
if [ "$EUID" -ne 0 ]; then
echo -e "\033[0;31mThis script must be run as root.\033[0m"
exit 1
fi
##################################################################
# ENV file
##################################################################
# Verify the .env file exists
if [ ! -f ".env" ]; then
echo "Error: The .env file does not exist."
exit 1
fi
# Load environment variables from .env file
set -o allexport
source .env
set +o allexport
##################################################################
# non interactive install
#
# https://docs.joomla.org/J4.x:Joomla_CLI_Installation
##################################################################
DB_PREFIX=$(LC_CTYPE=C tr -dc '[:alpha:]' < /dev/urandom | head -c 3)_
docker-compose exec -u www-data joomla php installation/joomla.php install \
--site-name=$PROJECTNAME \
--admin-email=$EMAIL \
--admin-user="$JOOMLA_USER" \
--admin-username=$JOOMLA_USERNAME \
--admin-password=$JOOMLA_PASSWORD \
--db-type=mysqli \
--db-host=mariadb-joomla \
--db-user=$MYSQL_USER \
--db-pass=$MYSQL_PASSWORD \
--db-name=$MYSQL_DATABASE \
--db-prefix=$DB_PREFIX \
--db-encryption=0