Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added docker-compose installation script and modified scripts #754

Merged
merged 2 commits into from
Dec 28, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions restart.sh

This file was deleted.

File renamed without changes.
6 changes: 3 additions & 3 deletions database-restore.sh → scripts/database-restore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
docker-compose -f ./docker-compose.production.yml up -d --remove-orphans
10 changes: 10 additions & 0 deletions scripts/docker-compose-latest.sh
Original file line number Diff line number Diff line change
@@ -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
28 changes: 28 additions & 0 deletions scripts/readme.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion reset.sh → scripts/reset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions scripts/restart.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
docker-compose -f ./docker-compose.production.yml down
docker-compose -f ./docker-compose.production.yml up
File renamed without changes.
2 changes: 2 additions & 0 deletions scripts/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
docker-compose -f ./docker-compose.production.yml up -d
5 changes: 5 additions & 0 deletions scripts/upgrade.sh
Original file line number Diff line number Diff line change
@@ -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
2 changes: 0 additions & 2 deletions start.sh

This file was deleted.

5 changes: 0 additions & 5 deletions upgrade.sh

This file was deleted.