corrections

This commit is contained in:
Valentin 2024-11-30 19:13:58 +01:00
parent 0acb1646a8
commit 9ac022d030
1 changed files with 8 additions and 4 deletions

View File

@ -33,6 +33,11 @@ set_secrets() {
sed -i "s/^SECRET=.*/SECRET=${secret}/" "/home/${USERNAME}/cms.${DOMAIN_NAME}/.env" sed -i "s/^SECRET=.*/SECRET=${secret}/" "/home/${USERNAME}/cms.${DOMAIN_NAME}/.env"
} }
docker_up_create_db() {
docker compose -f "/home/${USERNAME}/cms.${DOMAIN_NAME}/docker-compose.yml" up -d
docker exec -i "${DOMAIN_NAME}_Directus_DB" mariadb -uroot -e "CREATE DATABASE directus; GRANT ALL PRIVILEGES ON directus.* TO 'root'@'%';"
}
wait_for_DB() { wait_for_DB() {
echo "Waiting for Directus database to be ready..." echo "Waiting for Directus database to be ready..."
until docker exec -i "${DOMAIN_NAME}_Directus_DB" mariadb -uroot -e "SELECT 1 FROM directus.directus_roles LIMIT 1" &> /dev/null until docker exec -i "${DOMAIN_NAME}_Directus_DB" mariadb -uroot -e "SELECT 1 FROM directus.directus_roles LIMIT 1" &> /dev/null
@ -50,9 +55,8 @@ if [[ "$answer" == "y" ]]; then
# do we really need the .env file ? # do we really need the .env file ?
set_port set_port
set_secrets set_secrets
docker-compose -f "/home/${USERNAME}/cms.${DOMAIN_NAME}/docker-compose.yml" up -d docker_up_create_db
docker exec -i "${DOMAIN_NAME}_Directus_DB" mariadb -uroot -e "CREATE DATABASE directus; GRANT ALL PRIVILEGES ON directus.* TO 'root'@'%';" wait_for_DB
wait_for_DBthe directus user
echo -e "${PURPLE}${BOLD}Import the .tar.gz archive from your local storage${RESET}" echo -e "${PURPLE}${BOLD}Import the .tar.gz archive from your local storage${RESET}"
echo -e "${PURPLE}The archive should contain the sql dump and the upload directory${RESET}" echo -e "${PURPLE}The archive should contain the sql dump and the upload directory${RESET}"
@ -75,7 +79,7 @@ else
set_admin_credentials set_admin_credentials
set_port set_port
set_secrets set_secrets
docker compose -f "/home/${USERNAME}/cms.${DOMAIN_NAME}/docker-compose.yml" up -d docker_up_create_db
docker exec -i "${DOMAIN_NAME}_Directus" sh -c "npx directus bootstrap" docker exec -i "${DOMAIN_NAME}_Directus" sh -c "npx directus bootstrap"
wait_for_DB wait_for_DB