[Transferring to Minio and SQLite](https://github.com/wekan/minio-metadata)
# Backup Docker
[Also see: Upgrading Synology with Wekan quay images](https://github.com/wekan/wekan/issues/3874#issuecomment-867526249)
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 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
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`
For below scheduled backup scripts, no info from above of this wiki page is required. Backup scripts below have the required settings.
This does backup of [Wekan+RocketChat snap databases](OAuth2) and php website etc.
If you need to backup some remote server or cloud, you can use scp, or read [rclone docs](https://rclone.org/docs/) about how to configure saving to some other remote server or cloud.
The following .sh bash scripts are added as root user to your `/root/` directory.
Backups are created to subdirectories of `/root/backups/`.
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.
```bash
sudo su
```
2. Use nano editor for editing cron. If you don't have it installed, type:
```bash
apt install nano
```
3. Then we set text editor to be nano. Otherwise it probably uses vi, that is harder to use.
```bash
export EDITOR=nano
```
4. Now we start editing cron scheduler.
```bash
crontab -e
```
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
echo "Backup is archived to .tar.gz file at $backupdir/${version}-${now}.tar.gz"
}
# Checks is the user is sudo/root
if [ "$UID" -ne "0" ]
then
echo "This program must be launched with sudo/root."
exit 1
fi
# Starts
makeDump
```
/var/snap/wekan/common/Caddyfile
```bash
chat.example.com {
proxy / localhost:3000 {
websocket
transparent
}
}
https://boards.example.com {
proxy / localhost:3001 {
websocket
transparent
}
}
example.com {
root /var/snap/wekan/common/example.com
fastcgi / /var/run/php/php7.0-fpm.sock php
}
matomo.example.com {
root /var/snap/wekan/common/matomo.example.com
fastcgi / /var/run/php/php7.0-fpm.sock php
}
# Example CloudFlare free wildcard SSL Origin Certificate, there is example.com.pem at certificates directory with private key at to and cert at bottom.
http://example.com https://example.com {
tls {
load /var/snap/wekan/common/certificates
alpn http/1.1
}
root /var/snap/wekan/common/example.com
browse
}
static.example.com {
root /var/snap/wekan/common/static.example.com
}
```
## Related talk about MongoDB backup
Related talk, search for "mongodb" this page:
https://fosdem.org/2020/schedule/events/
There is this:
Percona Backup for MongoDB: Status and Plans
Open Source solution for consistent backups of multi-shard MongoDB
- [Same Video mp4](https://video.fosdem.org/2020/UD2.119/perconamongodb.mp4)
## Related Sandstorm issue
[Creating a backup while the grain is running could cause corruption](https://github.com/sandstorm-io/sandstorm/issues/3186).
## Combining old and new Wekan version data
Note: Do mongodump/mongorestore only when Wekan is stopped: wekan.wekan (Snap) or wekan-app (Docker).
1. From new Wekan export all boards to Wekan JSON.
2. Backup new Wekan with mongodump.
3. Backup old Wekan with mongodump.
4. Restore old Wekan data to new Wekan with mongorestore.
5. Restore new Wekan JSON exported boards by importing them.
## Rescuing board that does not load
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:
```bash
sudo apt-get install xclip
cat board.json | xclip -se c
```
Then paste to webbrowser Wekan Add Board / Import / From previous export.
You can [save all MongoDB database content as JSON files](Export-from-Wekan-Sandstorm-grain-.zip-file). Files are base64 encoded in JSON files.
Export board to Wekan JSON, and import as Wekan JSON can make some part of board to load, but you should check is some data missing.
With Wekan Snap, you can use [nosqlbooster GUI](https://nosqlbooster.com/downloads) to login through SSH to Wekan server localhost port 27019 and browse data.
You could use [daff](https://github.com/paulfitz/daff) to compare tables.
Download Wekan grain with arrow down download button to .zip file. You can restore it later.
[Export data from Wekan Sandstorm grain .zip file](Export-from-Wekan-Sandstorm-grain-.zip-file)
## <a name="cloudron">Cloudron
If those [Backup](Backup) ways are not easily found at [Cloudron](Cloudron), one way is to install [Redash](https://redash.io/) and then backup this way:
Redash works with this kind of queries:
```json
{
"collection": "accountSettings",
"query": {
"type": 1
},
"fields": {
"_id": 1,
"booleanValue": 1,
"createdAt": 1,
"modifiedAt": 1,
}
}
```
So:
1) Create this kind of query:
```json
{
"collection": "boards"
}
```
Later when you modify query, you can remove text like boards with double-click-with-mouse and delete-key-at-keyboard (or select characters with mouse and delete-key-at-keyboard), and then click collection/table >> button to insert name of next collection/table.
2) Click Save
3) Click Execute. This will cache query for use with REST API.
Note: 1) Save 2) Execute => webbrowser can give this kind of timeout,
but downloading with API script still works:
> wekan
> Error running query: failed communicating with server. Please check your Internet connection and try again.
7) Repeat steps 1-4 and 6 for every collection/table like boards,cards, etc
8) Remove from downloaded .json files extra query related data, so that it is similar like [any other Wekan database backup JSON files](Export-from-Wekan-Sandstorm-grain-.zip-file)
9) Insert data to some other Wekan install with nosqlbooster like mentioned at page [Backup](Backup)