mirror of
https://github.com/wekan/wekan.git
synced 2025-12-21 09:50:13 +01:00
Updated Backup (markdown)
parent
79015b3ffd
commit
3e6283f651
1 changed files with 44 additions and 42 deletions
86
Backup.md
86
Backup.md
|
|
@ -7,11 +7,11 @@ Note: Do not run `docker-compose down` without verifying your docker-compose fil
|
||||||
[docker-compose.yml](https://raw.githubusercontent.com/wekan/wekan/master/docker-compose.yml)
|
[docker-compose.yml](https://raw.githubusercontent.com/wekan/wekan/master/docker-compose.yml)
|
||||||
|
|
||||||
This presumes your Wekan Docker is currently running with:
|
This presumes your Wekan Docker is currently running with:
|
||||||
```
|
```bash
|
||||||
docker-compose up -d
|
docker-compose up -d
|
||||||
```
|
```
|
||||||
Backup to directory dump:
|
Backup to directory dump:
|
||||||
```
|
```bash
|
||||||
docker stop wekan-app
|
docker stop wekan-app
|
||||||
docker exec wekan-db rm -rf /data/dump
|
docker exec wekan-db rm -rf /data/dump
|
||||||
docker exec wekan-db mongodump -o /data/dump
|
docker exec wekan-db mongodump -o /data/dump
|
||||||
|
|
@ -21,7 +21,7 @@ docker start wekan-app
|
||||||
Copy dump directory to other server or to your backup.
|
Copy dump directory to other server or to your backup.
|
||||||
|
|
||||||
# Restore Docker
|
# Restore Docker
|
||||||
```
|
```bash
|
||||||
docker stop wekan-app
|
docker stop wekan-app
|
||||||
docker exec wekan-db rm -rf /data/dump
|
docker exec wekan-db rm -rf /data/dump
|
||||||
docker cp dump wekan-db:/data/
|
docker cp dump wekan-db:/data/
|
||||||
|
|
@ -30,41 +30,43 @@ docker start wekan-app
|
||||||
```
|
```
|
||||||
# Upgrade Docker Wekan version
|
# Upgrade Docker Wekan version
|
||||||
Note: Do not run `docker-compose down` without verifying your docker-compose file, it does not delete the data by default but caution is advised. Refer to https://docs.docker.com/compose/reference/down/.
|
Note: Do not run `docker-compose down` without verifying your docker-compose file, it does not delete the data by default but caution is advised. Refer to https://docs.docker.com/compose/reference/down/.
|
||||||
```
|
```bash
|
||||||
docker-compose stop
|
docker-compose stop
|
||||||
docker rm wekan-app
|
docker rm wekan-app
|
||||||
```
|
```
|
||||||
a) For example, if you in docker-compose.yml use `image: wekanteam/wekan` or `image: quay.io/wekan/wekan` for latest development version
|
a) For example, if you in docker-compose.yml use `image: wekanteam/wekan` or `image: quay.io/wekan/wekan` for latest development version
|
||||||
|
|
||||||
b) Or in docker-compose.yml change version tag, or use version tag like `image: wekanteam/wekan:v5.50` or `image: quay.io/wekan/wekan:v5.50`
|
b) Or in docker-compose.yml change version tag, or use version tag like `image: wekanteam/wekan:v5.50` or `image: quay.io/wekan/wekan:v5.50`
|
||||||
```
|
```bash
|
||||||
docker-compose up -d
|
docker-compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
# Backup Wekan Snap to directory dump
|
# Backup Wekan Snap to directory dump
|
||||||
```
|
```bash
|
||||||
sudo snap stop wekan.wekan
|
sudo snap stop wekan.wekan
|
||||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/snap/wekan/current/lib/x86_64-linux-gnu
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/snap/wekan/current/lib/x86_64-linux-gnu
|
||||||
export PATH="$PATH:/snap/wekan/current/bin"
|
export PATH="$PATH:/snap/wekan/current/bin"
|
||||||
mongodump --port 27019
|
mongodump --port 27019
|
||||||
sudo snap get wekan > snap-settings.sh
|
sudo snap get wekan > snap-settings.sh
|
||||||
```
|
```
|
||||||
|
NOTE for Arch: See correct snap paths for Arch at https://github.com/wekan/wekan/issues/3941
|
||||||
|
|
||||||
username is your /home/username
|
username is your /home/username
|
||||||
```
|
```bash
|
||||||
sudo chown username:username snap-settings.sh
|
sudo chown username:username snap-settings.sh
|
||||||
sudo snap start wekan.wekan
|
sudo snap start wekan.wekan
|
||||||
```
|
```
|
||||||
Modify snap-settings.sh so that it has commands like:
|
Modify snap-settings.sh so that it has commands like:
|
||||||
```
|
```bash
|
||||||
sudo snap set wekan root-url='http://localhost'
|
sudo snap set wekan root-url='http://localhost'
|
||||||
```
|
```
|
||||||
Set snap-settings.sh executeable:
|
Set snap-settings.sh executeable:
|
||||||
```
|
```bash
|
||||||
chmod +x snap-settings.sh
|
chmod +x snap-settings.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
# Restore Wekan Snap
|
# Restore Wekan Snap
|
||||||
```
|
```bash
|
||||||
sudo snap stop wekan.wekan
|
sudo snap stop wekan.wekan
|
||||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/snap/wekan/current/lib/x86_64-linux-gnu
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/snap/wekan/current/lib/x86_64-linux-gnu
|
||||||
export PATH="$PATH:/snap/wekan/current/bin"
|
export PATH="$PATH:/snap/wekan/current/bin"
|
||||||
|
|
@ -74,12 +76,12 @@ sudo snap start wekan.wekan
|
||||||
```
|
```
|
||||||
# Upgrade Snap manually immediately (usually it updates automatically)
|
# Upgrade Snap manually immediately (usually it updates automatically)
|
||||||
|
|
||||||
```
|
```bash
|
||||||
sudo snap refresh
|
sudo snap refresh
|
||||||
```
|
```
|
||||||
|
|
||||||
# Backup Wekan Gantt GPLv2 Snap to directory dump
|
# Backup Wekan Gantt GPLv2 Snap to directory dump
|
||||||
```
|
```bash
|
||||||
sudo snap stop wekan-gantt-gpl.wekan
|
sudo snap stop wekan-gantt-gpl.wekan
|
||||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/snap/wekan-gantt-gpl/current/lib/x86_64-linux-gnu
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/snap/wekan-gantt-gpl/current/lib/x86_64-linux-gnu
|
||||||
export PATH="$PATH:/snap/wekan-gantt-gpl/current/bin"
|
export PATH="$PATH:/snap/wekan-gantt-gpl/current/bin"
|
||||||
|
|
@ -87,21 +89,21 @@ mongodump --port 27019
|
||||||
sudo snap get wekan-gantt-gpl > snap-settings.sh
|
sudo snap get wekan-gantt-gpl > snap-settings.sh
|
||||||
```
|
```
|
||||||
username is your /home/username
|
username is your /home/username
|
||||||
```
|
```bash
|
||||||
sudo chown username:username snap-settings.sh
|
sudo chown username:username snap-settings.sh
|
||||||
sudo snap start wekan-gantt-gpl.wekan
|
sudo snap start wekan-gantt-gpl.wekan
|
||||||
```
|
```
|
||||||
Modify snap-settings.sh so that it has command like:
|
Modify snap-settings.sh so that it has command like:
|
||||||
```
|
```bash
|
||||||
sudo snap set wekan-gantt-gpl root-url='http://localhost'
|
sudo snap set wekan-gantt-gpl root-url='http://localhost'
|
||||||
```
|
```
|
||||||
Set snap-settings.sh executeable:
|
Set snap-settings.sh executeable:
|
||||||
```
|
```bash
|
||||||
chmod +x snap-settings.sh
|
chmod +x snap-settings.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
# Restore Wekan Gantt GPLv2 Snap
|
# Restore Wekan Gantt GPLv2 Snap
|
||||||
```
|
```bash
|
||||||
sudo snap stop wekan-gantt-gpl.wekan
|
sudo snap stop wekan-gantt-gpl.wekan
|
||||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/snap/wekan-gantt-gpl/current/lib/x86_64-linux-gnu
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/snap/wekan-gantt-gpl/current/lib/x86_64-linux-gnu
|
||||||
export PATH="$PATH:/snap/wekan-gantt-gpl/current/bin"
|
export PATH="$PATH:/snap/wekan-gantt-gpl/current/bin"
|
||||||
|
|
@ -141,25 +143,25 @@ Backups are created to subdirectories of `/root/backups/`.
|
||||||
Cron is used to schedule backups, for example once a day.
|
Cron is used to schedule backups, for example once a day.
|
||||||
|
|
||||||
1. To add bash scripts, you change to root user with this command, and your sudo or root password.
|
1. To add bash scripts, you change to root user with this command, and your sudo or root password.
|
||||||
```
|
```bash
|
||||||
sudo su
|
sudo su
|
||||||
```
|
```
|
||||||
2. Use nano editor for editing cron. If you don't have it installed, type:
|
2. Use nano editor for editing cron. If you don't have it installed, type:
|
||||||
```
|
```bash
|
||||||
apt install nano
|
apt install nano
|
||||||
```
|
```
|
||||||
3. Then we set text editor to be nano. Otherwise it probably uses vi, that is harder to use.
|
3. Then we set text editor to be nano. Otherwise it probably uses vi, that is harder to use.
|
||||||
```
|
```bash
|
||||||
export EDITOR=nano
|
export EDITOR=nano
|
||||||
```
|
```
|
||||||
4. Now we start editing cron scheduler.
|
4. Now we start editing cron scheduler.
|
||||||
```
|
```bash
|
||||||
crontab -e
|
crontab -e
|
||||||
```
|
```
|
||||||
For more info how to make cron time, see https://crontab.guru
|
For more info how to make cron time, see https://crontab.guru
|
||||||
|
|
||||||
In this example, we set backups every day at 04:00, then it runs backup.sh script, and saves output of the backup commands to the bottom of textfile backup.log.txt
|
In this example, we set backups every day at 04:00, then it runs backup.sh script, and saves output of the backup commands to the bottom of textfile backup.log.txt
|
||||||
```
|
```bash
|
||||||
# m h dom mon dow command
|
# m h dom mon dow command
|
||||||
0 4 * * * /root/backup.sh >> /root/backup.log.txt 2>&1
|
0 4 * * * /root/backup.sh >> /root/backup.log.txt 2>&1
|
||||||
```
|
```
|
||||||
|
|
@ -172,7 +174,7 @@ In this example, we set backups every day at 04:00, then it runs backup.sh scrip
|
||||||
This is content of `backup.sh` script. It runs all the other backup scripts.
|
This is content of `backup.sh` script. It runs all the other backup scripts.
|
||||||
If you do not need to backup rocketchat or website, or do not need to use rclone,
|
If you do not need to backup rocketchat or website, or do not need to use rclone,
|
||||||
you don't need to add those command lines at all.
|
you don't need to add those command lines at all.
|
||||||
```
|
```bash
|
||||||
cd /root
|
cd /root
|
||||||
./backup-wekan.sh
|
./backup-wekan.sh
|
||||||
./backup-rocketchat.sh
|
./backup-rocketchat.sh
|
||||||
|
|
@ -182,7 +184,7 @@ rclone move backups cloudname:backup.example.com
|
||||||
More about rclone:
|
More about rclone:
|
||||||
|
|
||||||
/root/rclone-ls-all.sh , shows directory contests at cloud:
|
/root/rclone-ls-all.sh , shows directory contests at cloud:
|
||||||
```
|
```bash
|
||||||
rclone lsd cloudname:
|
rclone lsd cloudname:
|
||||||
```
|
```
|
||||||
In this example, cron does run backup scripts as root.
|
In this example, cron does run backup scripts as root.
|
||||||
|
|
@ -196,14 +198,14 @@ You can also list current cron with command `crontab -l`.
|
||||||
|
|
||||||
If you like to backup Wekan snap settings with this command, then it
|
If you like to backup Wekan snap settings with this command, then it
|
||||||
only works with sudo at front, or as a root user without sudo at front.
|
only works with sudo at front, or as a root user without sudo at front.
|
||||||
```
|
```bash
|
||||||
sudo snap get wekan > snap-settings.txt
|
sudo snap get wekan > snap-settings.txt
|
||||||
```
|
```
|
||||||
|
|
||||||
This below is backup script for backing up Wekan.
|
This below is backup script for backing up Wekan.
|
||||||
|
|
||||||
/root/backup-wekan.sh
|
/root/backup-wekan.sh
|
||||||
```
|
```bash
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
makeDump()
|
makeDump()
|
||||||
|
|
@ -266,9 +268,9 @@ fi
|
||||||
|
|
||||||
# Starts
|
# Starts
|
||||||
makeDump
|
makeDump
|
||||||
```
|
```bash
|
||||||
/root/backup-rocketchat.sh
|
/root/backup-rocketchat.sh
|
||||||
```
|
```bash
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
makeDump()
|
makeDump()
|
||||||
|
|
@ -315,7 +317,7 @@ fi
|
||||||
makeDump
|
makeDump
|
||||||
```
|
```
|
||||||
/root/backup-website.sh
|
/root/backup-website.sh
|
||||||
```
|
```bash
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
makeDump()
|
makeDump()
|
||||||
|
|
@ -359,7 +361,7 @@ fi
|
||||||
makeDump
|
makeDump
|
||||||
```
|
```
|
||||||
/var/snap/wekan/common/Caddyfile
|
/var/snap/wekan/common/Caddyfile
|
||||||
```
|
```bash
|
||||||
chat.example.com {
|
chat.example.com {
|
||||||
proxy / localhost:3000 {
|
proxy / localhost:3000 {
|
||||||
websocket
|
websocket
|
||||||
|
|
@ -433,7 +435,7 @@ Note: Do mongodump/mongorestore only when Wekan is stopped: wekan.wekan (Snap) o
|
||||||
Wekan web UI Import/Export JSON does not have all content currently. To upgrade from old Wekan version, use mongodump/mongorestore to newest Wekan, like described below.
|
Wekan web UI Import/Export JSON does not have all content currently. To upgrade from old Wekan version, use mongodump/mongorestore to newest Wekan, like described below.
|
||||||
|
|
||||||
To import big JSON file, on Linux you can use xclip to copy textfile to clipboard:
|
To import big JSON file, on Linux you can use xclip to copy textfile to clipboard:
|
||||||
```
|
```bash
|
||||||
sudo apt-get install xclip
|
sudo apt-get install xclip
|
||||||
cat board.json | xclip -se c
|
cat board.json | xclip -se c
|
||||||
```
|
```
|
||||||
|
|
@ -450,16 +452,16 @@ You could use [daff](https://github.com/paulfitz/daff) to compare tables.
|
||||||
## Using Snap Mongo commands on your bash CLI
|
## Using Snap Mongo commands on your bash CLI
|
||||||
|
|
||||||
Add to your `~/.bashrc`
|
Add to your `~/.bashrc`
|
||||||
```
|
```bash
|
||||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/snap/wekan/current/lib/x86_64-linux-gnu
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/snap/wekan/current/lib/x86_64-linux-gnu
|
||||||
export PATH="$PATH:/snap/wekan/current/bin"
|
export PATH="$PATH:/snap/wekan/current/bin"
|
||||||
```
|
```
|
||||||
Then you can backup:
|
Then you can backup:
|
||||||
```
|
```bash
|
||||||
mongodump --port 27019
|
mongodump --port 27019
|
||||||
```
|
```
|
||||||
And restore:
|
And restore:
|
||||||
```
|
```bash
|
||||||
mongorestore --drop --port 27019
|
mongorestore --drop --port 27019
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -484,7 +486,7 @@ Originally from https://github.com/wekan/wekan-snap/issues/62#issuecomment-47062
|
||||||
## Backup
|
## Backup
|
||||||
|
|
||||||
wekan-backup.sh
|
wekan-backup.sh
|
||||||
```
|
```bash
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
export LC_ALL=C
|
export LC_ALL=C
|
||||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/snap/wekan/current/lib/x86_64-linux-gnu
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/snap/wekan/current/lib/x86_64-linux-gnu
|
||||||
|
|
@ -535,7 +537,7 @@ else
|
||||||
fi
|
fi
|
||||||
```
|
```
|
||||||
wekan-restore.sh
|
wekan-restore.sh
|
||||||
```
|
```bash
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
export LC_ALL=C
|
export LC_ALL=C
|
||||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/snap/wekan/current/lib/x86_64-linux-gnu
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/snap/wekan/current/lib/x86_64-linux-gnu
|
||||||
|
|
@ -578,7 +580,7 @@ makesRestore $1
|
||||||
|
|
||||||
## Backup script for MongoDB Data, if running Snap MongoDB at port 27019
|
## Backup script for MongoDB Data, if running Snap MongoDB at port 27019
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
makeDump()
|
makeDump()
|
||||||
|
|
@ -626,7 +628,7 @@ makeDump
|
||||||
|
|
||||||
## Restore script for MongoDB Data, if running Snap MongoDB at port 27019 with a tar.gz archive.
|
## Restore script for MongoDB Data, if running Snap MongoDB at port 27019 with a tar.gz archive.
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
makesRestore()
|
makesRestore()
|
||||||
|
|
@ -702,7 +704,7 @@ Download Wekan grain with arrow down download button to .zip file. You can resto
|
||||||
If those [Backup](https://github.com/wekan/wekan/wiki/Backup) ways are not easily found at [Cloudron](https://github.com/wekan/wekan/wiki/Cloudron), one way is to install [Redash](https://redash.io/) and then backup this way:
|
If those [Backup](https://github.com/wekan/wekan/wiki/Backup) ways are not easily found at [Cloudron](https://github.com/wekan/wekan/wiki/Cloudron), one way is to install [Redash](https://redash.io/) and then backup this way:
|
||||||
|
|
||||||
Redash works with this kind of queries:
|
Redash works with this kind of queries:
|
||||||
```
|
```json
|
||||||
{
|
{
|
||||||
"collection": "accountSettings",
|
"collection": "accountSettings",
|
||||||
"query": {
|
"query": {
|
||||||
|
|
@ -719,7 +721,7 @@ Redash works with this kind of queries:
|
||||||
So:
|
So:
|
||||||
|
|
||||||
1) Create this kind of query:
|
1) Create this kind of query:
|
||||||
```
|
```json
|
||||||
{
|
{
|
||||||
"collection": "boards"
|
"collection": "boards"
|
||||||
}
|
}
|
||||||
|
|
@ -731,14 +733,14 @@ Later when you modify query, you can remove text like boards with double-click-w
|
||||||
|
|
||||||
3) Click Execute. This will cache query for use with REST API.
|
3) Click Execute. This will cache query for use with REST API.
|
||||||
|
|
||||||
4) Click at right top [...] => Show API key
|
4) Click at right top `[...]` => `Show API key`
|
||||||
|
|
||||||
It looks like this:
|
It looks like this:
|
||||||
|
|
||||||
https://redash.example.com/api/queries/1/results.json?api_key=...
|
https://redash.example.com/api/queries/1/results.json?api_key=...
|
||||||
|
|
||||||
5) Only when saving first collection/table, Save API key to text file script like this `dl.sh`
|
5) Only when saving first collection/table, Save API key to text file script like this `dl.sh`
|
||||||
```
|
```bash
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Example: ./dl.sh boards
|
# Example: ./dl.sh boards
|
||||||
|
|
@ -749,7 +751,7 @@ curl -o $1.json $APIKEY
|
||||||
```
|
```
|
||||||
|
|
||||||
6) Run save script like:
|
6) Run save script like:
|
||||||
```
|
```bash
|
||||||
./dl.sh boards
|
./dl.sh boards
|
||||||
```
|
```
|
||||||
Note: 1) Save 2) Execute => webbrowser can give this kind of timeout,
|
Note: 1) Save 2) Execute => webbrowser can give this kind of timeout,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue