Skip to content

Commit

Permalink
chore: add update and backup scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
ehemmerlin committed Dec 26, 2020
1 parent 0d3a153 commit dbd2b6b
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 3 deletions.
30 changes: 27 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
# Up
# Tryton
## Up
Execute the following commands to clone the repository.
```
> git clone https://github.com/ehemmerlin/tryton
> cd tryton
```
Update .env file with your own values (for testing purpose, stay with the ones provided).

Then execute the following commands to start Postgres and Tryton.
```
> docker-compose up -d postgres
> docker-compose logs postgres
...
Expand All @@ -19,8 +26,25 @@ Navigate to http://localhost:8000

Enter user (admin) and password (secret)

# Down
## Backup
Execute the following command.
```
./backup.sh
```

## Update
Update Tryton tag in .env file with another Tryton version, then execute the following command.
```
./update.sh
```
The backup files should be in the ${HOME}/BACKUP folder.

## Down
Execute the following commands to clean everything.
```
> docker-compose stop
> docker-compose rm
```
```

## Credits
[Deploying Tryton with Docker by Cédric Krier](https://www.youtube.com/watch?v=S1JmgNbNeeo)
11 changes: 11 additions & 0 deletions backup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh
set -e

cd "$(dirname "$0")"

BACKUP=${HOME}/BACKUP
TRYTON=`docker-compose ps -q tryton | head -n 1`
mkdir -p ${BACKUP}

docker run --rm -w / --volumes-from $TRYTON -v ${BACKUP}:/backup busybox tar cf /backup/filestore.tar var/lib/trytond/db
docker-compose exec -T --user $(grep POSTGRES_USER .env | cut -d '=' -f 2-) postgres pg_dump $(grep POSTGRES_DB .env | cut -d '=' -f 2-) >${BACKUP}/db.dump
7 changes: 7 additions & 0 deletions update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh
set -e

cd "$(dirname "$0")"

docker-compose pull --quiet
docker-compose up -d 2>&1 | grep -v "is up to date" >&2

0 comments on commit dbd2b6b

Please sign in to comment.