From 60a18a88c7b22333faae14e4e1541d96a7c1e6b8 Mon Sep 17 00:00:00 2001 From: mhmdksh Date: Thu, 22 Dec 2022 10:11:44 +0000 Subject: [PATCH 1/2] Added docker-compose installation script and modified scripts --- restart.sh | 3 -- .../database-backup.sh | 0 .../database-restore.sh | 6 ++-- scripts/docker-compose-latest.sh | 10 +++++++ scripts/readme.md | 28 +++++++++++++++++++ reset.sh => scripts/reset.sh | 2 +- scripts/restart.sh | 3 ++ setup.sh => scripts/setup.sh | 0 scripts/start.sh | 2 ++ scripts/upgrade.sh | 5 ++++ start.sh | 2 -- upgrade.sh | 5 ---- 12 files changed, 52 insertions(+), 14 deletions(-) delete mode 100644 restart.sh rename database-backup.sh => scripts/database-backup.sh (100%) rename database-restore.sh => scripts/database-restore.sh (72%) create mode 100644 scripts/docker-compose-latest.sh create mode 100644 scripts/readme.md rename reset.sh => scripts/reset.sh (86%) create mode 100644 scripts/restart.sh rename setup.sh => scripts/setup.sh (100%) create mode 100644 scripts/start.sh create mode 100644 scripts/upgrade.sh delete mode 100644 start.sh delete mode 100644 upgrade.sh diff --git a/restart.sh b/restart.sh deleted file mode 100644 index 3c3b8937c..000000000 --- a/restart.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -docker compose -f ./docker-compose.production.yml down -docker compose -f ./docker-compose.production.yml up \ No newline at end of file diff --git a/database-backup.sh b/scripts/database-backup.sh similarity index 100% rename from database-backup.sh rename to scripts/database-backup.sh diff --git a/database-restore.sh b/scripts/database-restore.sh similarity index 72% rename from database-restore.sh rename to scripts/database-restore.sh index b23132830..24fab095a 100644 --- a/database-restore.sh +++ b/scripts/database-restore.sh @@ -4,8 +4,8 @@ if ! test -f "$1" ; then echo "Usage: database-restore.sh filename\n" fi export $(grep -v '^#' .env | xargs) -docker compose -f ./docker-compose.production.yml down +docker-compose -f ./docker-compose.production.yml down docker volume rm $(docker volume ls -q) -docker compose -f ./docker-compose.production.yml up mongodb -d --remove-orphans +docker-compose -f ./docker-compose.production.yml up mongodb -d --remove-orphans docker exec -i mongodb-praise sh -c 'mongorestore --authenticationDatabase admin --nsInclude=praise_db.* --uri="mongodb://$MONGO_INITDB_ROOT_USERNAME:$MONGO_INITDB_ROOT_PASSWORD@mongodb:27017/?authSource=admin" --drop --preserveUUID --archive' < $1 -docker compose -f ./docker-compose.production.yml up -d --remove-orphans \ No newline at end of file +docker-compose -f ./docker-compose.production.yml up -d --remove-orphans \ No newline at end of file diff --git a/scripts/docker-compose-latest.sh b/scripts/docker-compose-latest.sh new file mode 100644 index 000000000..1d5aeef83 --- /dev/null +++ b/scripts/docker-compose-latest.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +sudo apt remove docker-compose -y +sudo rm /usr/local/bin/docker-compose + +VERSION=$(curl --silent https://api.github.com/repos/docker/compose/releases/latest | grep -Po '"tag_name": "\K.*\d') +DESTINATION=/usr/local/bin/docker-compose +sudo curl -L https://github.com/docker/compose/releases/download/${VERSION}/docker-compose-$(uname -s)-$(uname -m) -o $DESTINATION +sudo chmod 755 $DESTINATION +docker-compose version diff --git a/scripts/readme.md b/scripts/readme.md new file mode 100644 index 000000000..1446f9622 --- /dev/null +++ b/scripts/readme.md @@ -0,0 +1,28 @@ +# Praise Scripts +Praise comes with a few bash scripts to simplify the management of a Praise installation. +Run scripts using: +``` +bash scriptname.sh +``` +## docker-compose-latest.sh +Installs the latest version of docker-compose automatically. +**Note:** This is a prerequisite to run all praise services +## setup.sh +Builds and runs the Praise setup script. Run this script before starting Praise the first time. +## start.sh +Starts all Praise services. +## restart.sh +Restarts all Praise services. Run this command after changing the server settings. +## upgrade.sh +Downloads new server images and restarts Praise to perform the upgrade. +## database-backup.sh +Makes a full backup of the database. Backup is saved as a file in the current folder. Script uses login information in .env. +## database-restore.sh +**Usage:** +``` +bash database-restore.sh [filename] +``` +Deletes the currently active database and replaces it with data from the backup. +## reset.sh +Shuts down all running Praise services, deletes all containers and images. +**Warning**: Use with caution. N.b. The server setting are not reset, all database passwords etc are left untouched. diff --git a/reset.sh b/scripts/reset.sh similarity index 86% rename from reset.sh rename to scripts/reset.sh index 3c3f60da6..ac47ffd1d 100644 --- a/reset.sh +++ b/scripts/reset.sh @@ -8,7 +8,7 @@ then echo echo "Shutting down containers..." echo - docker compose -f ./docker-compose.production.yml down + docker-compose -f ./docker-compose.production.yml down echo echo "Deleting images..." echo diff --git a/scripts/restart.sh b/scripts/restart.sh new file mode 100644 index 000000000..81cc32c32 --- /dev/null +++ b/scripts/restart.sh @@ -0,0 +1,3 @@ +#!/bin/bash +docker-compose -f ./docker-compose.production.yml down +docker-compose -f ./docker-compose.production.yml up \ No newline at end of file diff --git a/setup.sh b/scripts/setup.sh similarity index 100% rename from setup.sh rename to scripts/setup.sh diff --git a/scripts/start.sh b/scripts/start.sh new file mode 100644 index 000000000..7dd5d9b09 --- /dev/null +++ b/scripts/start.sh @@ -0,0 +1,2 @@ +#!/bin/bash +docker-compose -f ./docker-compose.production.yml up -d \ No newline at end of file diff --git a/scripts/upgrade.sh b/scripts/upgrade.sh new file mode 100644 index 000000000..8d188c112 --- /dev/null +++ b/scripts/upgrade.sh @@ -0,0 +1,5 @@ +#!/bin/bash +bash database-backup.sh +docker-compose -f ./docker-compose.production.yml pull +docker-compose -f ./docker-compose.production.yml down +docker-compose -f ./docker-compose.production.yml up -d --remove-orphans \ No newline at end of file diff --git a/start.sh b/start.sh deleted file mode 100644 index 6c346fa53..000000000 --- a/start.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -docker compose -f ./docker-compose.production.yml up -d \ No newline at end of file diff --git a/upgrade.sh b/upgrade.sh deleted file mode 100644 index 426899bb1..000000000 --- a/upgrade.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -bash database-backup.sh -docker compose -f ./docker-compose.production.yml pull -docker compose -f ./docker-compose.production.yml down -docker compose -f ./docker-compose.production.yml up -d --remove-orphans \ No newline at end of file From bbd46f27eba0e28ce748a2c1ecd2e6ec127424e6 Mon Sep 17 00:00:00 2001 From: mhmdksh Date: Mon, 26 Dec 2022 13:34:59 +0000 Subject: [PATCH 2/2] Added multi-site setup script and modified original scripts for the new folder --- scripts/database-backup.sh | 2 +- scripts/database-restore.sh | 11 ++- scripts/multi-setup.sh | 171 ++++++++++++++++++++++++++++++++++++ scripts/reset.sh | 8 +- scripts/restart.sh | 4 +- scripts/setup-new.sh | 158 +++++++++++++++++++++++++++++++++ scripts/setup-old.sh | 9 ++ scripts/start.sh | 2 +- scripts/upgrade.sh | 8 +- 9 files changed, 353 insertions(+), 20 deletions(-) create mode 100644 scripts/multi-setup.sh create mode 100644 scripts/setup-new.sh create mode 100644 scripts/setup-old.sh diff --git a/scripts/database-backup.sh b/scripts/database-backup.sh index 3077247b5..2e2bf74c8 100644 --- a/scripts/database-backup.sh +++ b/scripts/database-backup.sh @@ -1,3 +1,3 @@ #!/bin/bash -export $(grep -v '^#' .env | xargs) +export $(grep -v '^#' ../.env | xargs) docker exec -i mongodb-praise /usr/bin/mongodump --authenticationDatabase admin --archive -u $MONGO_INITDB_ROOT_USERNAME -p $MONGO_INITDB_ROOT_PASSWORD --db praise_db > database-backup-$(date +"%F-%T").archive \ No newline at end of file diff --git a/scripts/database-restore.sh b/scripts/database-restore.sh index 24fab095a..77ee33187 100644 --- a/scripts/database-restore.sh +++ b/scripts/database-restore.sh @@ -3,9 +3,8 @@ if ! test -f "$1" ; then echo "Could not find database backup" echo "Usage: database-restore.sh filename\n" fi -export $(grep -v '^#' .env | xargs) -docker-compose -f ./docker-compose.production.yml down -docker volume rm $(docker volume ls -q) -docker-compose -f ./docker-compose.production.yml up mongodb -d --remove-orphans -docker exec -i mongodb-praise sh -c 'mongorestore --authenticationDatabase admin --nsInclude=praise_db.* --uri="mongodb://$MONGO_INITDB_ROOT_USERNAME:$MONGO_INITDB_ROOT_PASSWORD@mongodb:27017/?authSource=admin" --drop --preserveUUID --archive' < $1 -docker-compose -f ./docker-compose.production.yml up -d --remove-orphans \ No newline at end of file +export $(grep -v '^#' ../.env | xargs) +docker-compose -f ../docker-compose.production.yml down -v +docker-compose -f ../docker-compose.production.yml up mongodb -d --remove-orphans +docker exec -i mongodb-praise sh -c 'mongorestore --authenticationDatabase admin --nsInclude=praise_db.* --uri="mongodb://$MONGO_INITDB_ROOT_USERNAME:$MONGO_INITDB_ROOT_PASSWORD@mongodb:$MONGO_PORT/?authSource=admin" --drop --preserveUUID --archive' < $1 +docker-compose -f ../docker-compose.production.yml up -d --remove-orphans \ No newline at end of file diff --git a/scripts/multi-setup.sh b/scripts/multi-setup.sh new file mode 100644 index 000000000..8f0096b10 --- /dev/null +++ b/scripts/multi-setup.sh @@ -0,0 +1,171 @@ +#!/bin/bash + +# Define Variables +WORKING_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +PRAISE_HOME="$(dirname "${WORKING_DIR}")" + +# Define Random Passwords +MONGO_INITDB_ROOT_PASSWORD=$(cat /dev/urandom | tr -dc '[:alpha:]' | fold -w ${1:-32} | head -n 1) +MONGO_PASSWORD=$(cat /dev/urandom | tr -dc '[:alpha:]' | fold -w ${1:-32} | head -n 1) +JWT_SECRET=$(cat /dev/urandom | tr -dc '[:alpha:]' | fold -w ${1:-32} | head -n 1) + +# Define Random Ports +MONGO_PORT=$(comm -23 <(seq 27017 27100 | sort) <(ss -Htan | awk '{print $4}' | cut -d':' -f2 | sort -u) | shuf | head -n 1) +API_PORT=$(comm -23 <(seq 8080 8180 | sort) <(ss -Htan | awk '{print $4}' | cut -d':' -f2 | sort -u) | shuf | head -n 1) +FRONTEND_PORT=$(comm -23 <(seq 3000 3100 | sort) <(ss -Htan | awk '{print $4}' | cut -d':' -f2 | sort -u) | shuf | head -n 1) + +installQuestions() { + + echo "Welcome to the Praise Setup!" + echo "I need to ask you a few questions before starting the setup." + + # Detect public IPv4 or IPv6 address and pre-fill for the user + PUBLIC_IP=$(curl ifconfig.me) + read -rp "IPv4 or IPv6 public address: " -e -i "${PUBLIC_IP}" PUBLIC_IP + + # Ask User for the Desirted Domain Name for the Praise Bot Server + HOST="" + read -rp "What would you like the Praise Bot Domain Name to be? " -e -i "${HOST}" HOST + # Ask the user for the DISCORD TOKEN + DISCORD_TOKEN="" + read -rp "What is your Discord Token? " -e -i "${DISCORD_TOKEN}" DISCORD_TOKEN + # Ask the user for the DISCORD CLIENT ID + DISCORD_CLIENT_ID="" + read -rp "What is your Discord Client ID? " -e -i "${DISCORD_CLIENT_ID}" DISCORD_CLIENT_ID + # Ask the user for the DISCORD GUILD ID + DISCORD_GUILD_ID="" + read -rp "What is your Discord Guild ID? " -e -i "${DISCORD_GUILD_ID}" DISCORD_GUILD_ID + # Ask the user for the ADMINS wallet Address + ADMINS="" + read -rp "What will your praise bot server admin wallet address be (Please insert the addresses separated by comma)? " -e -i "${ADMINS}" ADMINS + echo + echo "Okay, that was all I needed. We are ready to setup your Praise server now." + read -n1 -r -p "Press any key to continue..." +} + +## Configure Praise +configure_praise () { + echo " +########################################################################### +## GENERAL ## + +# Running through Docker: NODE_ENV=production +NODE_ENV=$PRAISE_ENV + +########################################################################### +## DATABASE ## + +# Running through Docker: MONGO_HOST=mongodb +# Running outside Docker: MONGO_HOST=localhost +MONGO_HOST=mongodb +MONGO_DB=praise_db +MONGO_PORT=$MONGO_PORT +MONGO_INITDB_ROOT_USERNAME=praiseDbRootUsername +MONGO_INITDB_ROOT_PASSWORD=$MONGO_INITDB_ROOT_PASSWORD +MONGO_USERNAME=praiseDbUsername +MONGO_PASSWORD=$MONGO_PASSWORD + + +########################################################################### +## HOST ## + +# The fully qualified domain name for the host where you are running Praise +# For development: HOST=localhost +HOST=$HOST + +########################################################################### +## API ## + +# Full URL to the host where the API is running. +# When running in development, the URL should also include API_PORT +API_URL=https://$HOST + +# The API is accessed on this port. In production this port is not exposed +# externally but API is accessed on {$API_URL}/api +API_PORT=$API_PORT + +# Comma separated list of ethereum addresses with admnin access to the API +ADMINS=$ADMINS + +# API authentication +JWT_SECRET=$JWT_SECRET +# expires after 1 hour of inactivity, or 3 days +JWT_ACCESS_EXP=3600 +JWT_REFRESH_EXP=25920000 + +########################################################################### +## FRONTEND ## + +# Full URL to the host (and optionally port) where frontend is being served +FRONTEND_URL=https://$HOST + +## FRONTEND - DEVELOPMENT ONLY ## + +# Full URL to host where API is running. This variable is not currently used in production. +# Why? The frontend is built as a static website and cannot easily accept +# env variables. There are workarounds but we haven't prioritised to implement them yet. +# +# https://jakobzanker.de/blog/inject-environment-variables-into-a-react-app-docker-on-runtime/ +REACT_APP_SERVER_URL=https://$HOST + +# Port number used when running frontend for development, outside of Docker +FRONTEND_PORT=$FRONTEND_PORT + +########################################################################### +## DISCORD_BOT ## + +DISCORD_TOKEN=$DISCORD_TOKEN +DISCORD_CLIENT_ID=$DISCORD_CLIENT_ID +DISCORD_GUILD_ID=$DISCORD_GUILD_ID + +########################################################################### +## LOGGING ## + +# options: error, warn, info, http, debug +LOGGER_LEVEL=warn" > $PRAISE_HOME/.env +} + +praise_env () { + echo "Please choose which env you want to install" + echo "1) production (Stable)" + echo "2) staging (Dev)" + read -rp "Please select which number [1/2]: " -e -i "1" env + until [[ "$env" =~ ^[12]*$ ]]; do + echo "$env: invalid selection." + read -rp "Confirm Praise env? [1/2]: " -e -i "1" env + done + if [[ "$env" =~ ^[1]$ ]]; then + export PRAISE_ENV=production + echo $PRAISE_ENV + sleep 1 + elif [[ "$env" =~ ^[2]$ ]]; then + export PRAISE_ENV=development + echo $PRAISE_ENV + sleep 1 + else + echo "Invalid Option, Praise Setup Aborted" + sleep 1 + exit 0 + fi +} + +configure_compose () { + # Create a different copy of the compose file that has modified configs for each instance + cp $PRAISE_HOME/docker-compose.$PRAISE_ENV.yml $PRAISE_HOME/docker-compose.multi.yml + + sed -i "s/- 80:80//" $PRAISE_HOME/docker-compose.multi.yml + sed -i "s/- 443:443/- \$FRONTEND_PORT:\$FRONTEND_PORT/" $PRAISE_HOME/docker-compose.multi.yml + sed -i "s/container_name: .*mongodb-praise/container_name: ${HOST}-mongodb-praise/" $PRAISE_HOME/docker-compose.multi.yml + sed -i "s/container_name: .*api-praise/container_name: ${HOST}-api-praise/" $PRAISE_HOME/docker-compose.multi.yml + sed -i "s/container_name: .*discord-bot-praise/container_name: ${HOST}-discord-bot-praise/" $PRAISE_HOME/docker-compose.multi.yml + sed -i "s/container_name: .*frontend-praise/container_name: ${HOST}-frontend-praise/" $PRAISE_HOME/docker-compose.multi.yml +} + +main () { + praise_env + installQuestions + configure_compose + configure_praise +} + +main \ No newline at end of file diff --git a/scripts/reset.sh b/scripts/reset.sh index ac47ffd1d..4da459ed1 100644 --- a/scripts/reset.sh +++ b/scripts/reset.sh @@ -6,15 +6,11 @@ echo if [[ $REPLY =~ ^[Yy]$ ]] then echo - echo "Shutting down containers..." + echo "Shutting down containers, and removing volumes..." echo - docker-compose -f ./docker-compose.production.yml down + docker-compose -f ../docker-compose.production.yml down -v echo echo "Deleting images..." echo docker rmi -f $(docker images -aq) - echo - echo "Deleting volumes..." - echo - docker volume rm $(docker volume ls -q) fi diff --git a/scripts/restart.sh b/scripts/restart.sh index 81cc32c32..afaea811b 100644 --- a/scripts/restart.sh +++ b/scripts/restart.sh @@ -1,3 +1,3 @@ #!/bin/bash -docker-compose -f ./docker-compose.production.yml down -docker-compose -f ./docker-compose.production.yml up \ No newline at end of file +docker-compose -f ../docker-compose.production.yml down +docker-compose -f ../docker-compose.production.yml up \ No newline at end of file diff --git a/scripts/setup-new.sh b/scripts/setup-new.sh new file mode 100644 index 000000000..07c9ee6c4 --- /dev/null +++ b/scripts/setup-new.sh @@ -0,0 +1,158 @@ +#!/bin/bash + +# Define Variables +WORKING_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +PRAISE_HOME="$(dirname "${WORKING_DIR}")" + +# Define Random Passwords +MONGO_INITDB_ROOT_PASSWORD=$(cat /dev/urandom | tr -dc '[:alpha:]' | fold -w ${1:-32} | head -n 1) +MONGO_PASSWORD=$(cat /dev/urandom | tr -dc '[:alpha:]' | fold -w ${1:-32} | head -n 1) +JWT_SECRET=$(cat /dev/urandom | tr -dc '[:alpha:]' | fold -w ${1:-32} | head -n 1) + +# Define Random Ports +MONGO_PORT=27017 +API_PORT=8080 +FRONTEND_PORT=3000 + +installQuestions() { + + echo "Welcome to the Praise Setup!" + echo "I need to ask you a few questions before starting the setup." + + # Detect public IPv4 or IPv6 address and pre-fill for the user + PUBLIC_IP=$(curl ifconfig.me) + read -rp "IPv4 or IPv6 public address: " -e -i "${PUBLIC_IP}" PUBLIC_IP + + # Ask User for the Desirted Domain Name for the Praise Bot Server + HOST="" + read -rp "What would you like the Praise Bot Domain Name to be? " -e -i "${HOST}" HOST + # Ask the user for the DISCORD TOKEN + DISCORD_TOKEN="" + read -rp "What is your Discord Token? " -e -i "${DISCORD_TOKEN}" DISCORD_TOKEN + # Ask the user for the DISCORD CLIENT ID + DISCORD_CLIENT_ID="" + read -rp "What is your Discord Client ID? " -e -i "${DISCORD_CLIENT_ID}" DISCORD_CLIENT_ID + # Ask the user for the DISCORD GUILD ID + DISCORD_GUILD_ID="" + read -rp "What is your Discord Guild ID? " -e -i "${DISCORD_GUILD_ID}" DISCORD_GUILD_ID + # Ask the user for the ADMINS wallet Address + ADMINS="" + read -rp "What will your praise bot server admin wallet address be (Please insert the addresses separated by comma)? " -e -i "${ADMINS}" ADMINS + echo + echo "Okay, that was all I needed. We are ready to setup your Praise server now." + read -n1 -r -p "Press any key to continue..." +} + +## Configure Praise +configure_praise () { + echo " +########################################################################### +## GENERAL ## + +# Running through Docker: NODE_ENV=production +NODE_ENV=$PRAISE_ENV + +########################################################################### +## DATABASE ## + +# Running through Docker: MONGO_HOST=mongodb +# Running outside Docker: MONGO_HOST=localhost +MONGO_HOST=mongodb +MONGO_DB=praise_db +MONGO_PORT=$MONGO_PORT +MONGO_INITDB_ROOT_USERNAME=praiseDbRootUsername +MONGO_INITDB_ROOT_PASSWORD=$MONGO_INITDB_ROOT_PASSWORD +MONGO_USERNAME=praiseDbUsername +MONGO_PASSWORD=$MONGO_PASSWORD + + +########################################################################### +## HOST ## + +# The fully qualified domain name for the host where you are running Praise +# For development: HOST=localhost +HOST=$HOST + +########################################################################### +## API ## + +# Full URL to the host where the API is running. +# When running in development, the URL should also include API_PORT +API_URL=https://$HOST + +# The API is accessed on this port. In production this port is not exposed +# externally but API is accessed on {$API_URL}/api +API_PORT=$API_PORT + +# Comma separated list of ethereum addresses with admnin access to the API +ADMINS=$ADMINS + +# API authentication +JWT_SECRET=$JWT_SECRET +# expires after 1 hour of inactivity, or 3 days +JWT_ACCESS_EXP=3600 +JWT_REFRESH_EXP=25920000 + +########################################################################### +## FRONTEND ## + +# Full URL to the host (and optionally port) where frontend is being served +FRONTEND_URL=https://$HOST + +## FRONTEND - DEVELOPMENT ONLY ## + +# Full URL to host where API is running. This variable is not currently used in production. +# Why? The frontend is built as a static website and cannot easily accept +# env variables. There are workarounds but we haven't prioritised to implement them yet. +# +# https://jakobzanker.de/blog/inject-environment-variables-into-a-react-app-docker-on-runtime/ +REACT_APP_SERVER_URL=https://$HOST + +# Port number used when running frontend for development, outside of Docker +FRONTEND_PORT=$FRONTEND_PORT + +########################################################################### +## DISCORD_BOT ## + +DISCORD_TOKEN=$DISCORD_TOKEN +DISCORD_CLIENT_ID=$DISCORD_CLIENT_ID +DISCORD_GUILD_ID=$DISCORD_GUILD_ID + +########################################################################### +## LOGGING ## + +# options: error, warn, info, http, debug +LOGGER_LEVEL=warn" > $PRAISE_HOME/.env +} + +praise_env () { + echo "Please choose which env you want to install" + echo "1) production (Stable)" + echo "2) staging (Dev)" + read -rp "Please select which number [1/2]: " -e -i "1" env + until [[ "$env" =~ ^[12]*$ ]]; do + echo "$env: invalid selection." + read -rp "Confirm Praise env? [1/2]: " -e -i "1" env + done + if [[ "$env" =~ ^[1]$ ]]; then + export PRAISE_ENV=production + echo $PRAISE_ENV + sleep 1 + elif [[ "$env" =~ ^[2]$ ]]; then + export PRAISE_ENV=development + echo $PRAISE_ENV + sleep 1 + else + echo "Invalid Option, Praise Setup Aborted" + sleep 1 + exit 0 + fi +} + +main () { + praise_env + installQuestions + configure_praise +} + +main \ No newline at end of file diff --git a/scripts/setup-old.sh b/scripts/setup-old.sh new file mode 100644 index 000000000..b1c3cea04 --- /dev/null +++ b/scripts/setup-old.sh @@ -0,0 +1,9 @@ +#!/bin/bash +IMAGE=$( docker images | grep ghcr.io/commons-stack/praise/setup:latest ) +if [ -z "$IMAGE" ] +then + echo "Pulling the setup image..." + docker image pull ghcr.io/commons-stack/praise/setup:latest +fi + +docker run -it -v $(pwd):/usr/praise ghcr.io/commons-stack/praise/setup:latest \ No newline at end of file diff --git a/scripts/start.sh b/scripts/start.sh index 7dd5d9b09..4428ca918 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -1,2 +1,2 @@ #!/bin/bash -docker-compose -f ./docker-compose.production.yml up -d \ No newline at end of file +docker-compose -f ../docker-compose.production.yml up -d \ No newline at end of file diff --git a/scripts/upgrade.sh b/scripts/upgrade.sh index 8d188c112..0554d9d18 100644 --- a/scripts/upgrade.sh +++ b/scripts/upgrade.sh @@ -1,5 +1,5 @@ #!/bin/bash -bash database-backup.sh -docker-compose -f ./docker-compose.production.yml pull -docker-compose -f ./docker-compose.production.yml down -docker-compose -f ./docker-compose.production.yml up -d --remove-orphans \ No newline at end of file +bash ./database-backup.sh +docker-compose -f ../docker-compose.production.yml pull +docker-compose -f ../docker-compose.production.yml down +docker-compose -f ../docker-compose.production.yml up -d --remove-orphans \ No newline at end of file