From db20ec9110c8fdd51beff32b45820738c14df970 Mon Sep 17 00:00:00 2001 From: kristoferlund Date: Wed, 1 Feb 2023 12:18:19 +0100 Subject: [PATCH] Move scripts back to root folder --- .../database-backup.sh => database-backup.sh | 0 ...database-restore.sh => database-restore.sh | 6 +-- scripts/reset.sh => reset.sh | 2 +- restart.sh | 3 ++ scripts/readme.md | 43 ------------------- scripts/restart.sh | 3 -- scripts/start.sh | 2 - scripts/upgrade.sh | 5 --- scripts/setup.sh => setup.sh | 0 start.sh | 2 + upgrade.sh | 5 +++ 11 files changed, 14 insertions(+), 57 deletions(-) rename scripts/database-backup.sh => database-backup.sh (100%) rename scripts/database-restore.sh => database-restore.sh (66%) rename scripts/reset.sh => reset.sh (83%) create mode 100644 restart.sh delete mode 100644 scripts/readme.md delete mode 100644 scripts/restart.sh delete mode 100644 scripts/start.sh delete mode 100644 scripts/upgrade.sh rename scripts/setup.sh => setup.sh (100%) create mode 100644 start.sh create mode 100644 upgrade.sh diff --git a/scripts/database-backup.sh b/database-backup.sh similarity index 100% rename from scripts/database-backup.sh rename to database-backup.sh diff --git a/scripts/database-restore.sh b/database-restore.sh similarity index 66% rename from scripts/database-restore.sh rename to database-restore.sh index d264159ae..0963e8a16 100644 --- a/scripts/database-restore.sh +++ b/database-restore.sh @@ -4,7 +4,7 @@ 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 -v -docker compose -f ../docker-compose.production.yml up mongodb -d --remove-orphans +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 +docker compose -f ./docker-compose.production.yml up -d --remove-orphans \ No newline at end of file diff --git a/scripts/reset.sh b/reset.sh similarity index 83% rename from scripts/reset.sh rename to reset.sh index 8caa348d1..72ed5568f 100644 --- a/scripts/reset.sh +++ b/reset.sh @@ -8,7 +8,7 @@ then echo echo "Shutting down containers, and removing volumes..." echo - docker compose -f ../docker-compose.production.yml down -v + docker compose -f ./docker-compose.production.yml down -v echo echo "Deleting images..." echo diff --git a/restart.sh b/restart.sh new file mode 100644 index 000000000..3c3b8937c --- /dev/null +++ b/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/scripts/readme.md b/scripts/readme.md deleted file mode 100644 index eb323f6a7..000000000 --- a/scripts/readme.md +++ /dev/null @@ -1,43 +0,0 @@ -# Praise Scripts - -Praise comes with a few bash scripts to simplify the management of a Praise installation. -Run scripts using: - -``` -bash [scriptname.sh] -``` - -## 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/scripts/restart.sh b/scripts/restart.sh deleted file mode 100644 index 75efbf406..000000000 --- a/scripts/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/scripts/start.sh b/scripts/start.sh deleted file mode 100644 index d61ca54e0..000000000 --- a/scripts/start.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -docker compose -f ../docker-compose.production.yml up -d diff --git a/scripts/upgrade.sh b/scripts/upgrade.sh deleted file mode 100644 index 1626e10cf..000000000 --- a/scripts/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 diff --git a/scripts/setup.sh b/setup.sh similarity index 100% rename from scripts/setup.sh rename to setup.sh diff --git a/start.sh b/start.sh new file mode 100644 index 000000000..1b3460ce5 --- /dev/null +++ b/start.sh @@ -0,0 +1,2 @@ +#!/bin/bash +docker compose -f ./docker-compose.production.yml up -d diff --git a/upgrade.sh b/upgrade.sh new file mode 100644 index 000000000..79bb4c9e1 --- /dev/null +++ b/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