Transferring to Minio and SQLite
Also see: Upgrading Synology with Wekan quay images
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/.
This presumes your Wekan Docker is currently running with:
docker-compose up -d
Backup to directory dump:
docker stop wekan-app
docker exec wekan-db rm -rf /data/dump
docker exec wekan-db mongodump -o /data/dump
docker cp wekan-db:/data/dump .
docker start wekan-app
Copy dump directory to other server or to your backup.
docker stop wekan-app
docker exec wekan-db rm -rf /data/dump
docker cp dump wekan-db:/data/
docker exec wekan-db mongorestore --drop --dir=/data/dump
docker start wekan-app
https://github.com/wekan/wekan/discussions/5367
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/.
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
docker-compose up -d
sudo snap stop wekan.wekan
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/snap/wekan/current/lib/x86_64-linux-gnu
export PATH="/snap/wekan/current/bin:$PATH"
mongodump --port 27019
sudo snap get wekan > snap-settings.sh
NOTE for Arch Linux: Use this path instead. Source.
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH-}:/var/lib/snapd/snap/wekan/current/lib/x86_64-linux-gnu
username is your /home/username
sudo chown username:username snap-settings.sh
sudo snap start wekan.wekan
Modify snap-settings.sh so that it has commands like:
sudo snap set wekan root-url='http://localhost'
Set snap-settings.sh executeable:
chmod +x snap-settings.sh
sudo snap stop wekan.wekan
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/snap/wekan/current/lib/x86_64-linux-gnu
export PATH="$PATH:/snap/wekan/current/bin"
mongorestore --drop --port 27019
sudo snap start wekan.wekan
./snap-settings.sh
sudo snap refresh
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 PATH="$PATH:/snap/wekan-gantt-gpl/current/bin"
mongodump --port 27019
sudo snap get wekan-gantt-gpl > snap-settings.sh
username is your /home/username
sudo chown username:username snap-settings.sh
sudo snap start wekan-gantt-gpl.wekan
Modify snap-settings.sh so that it has command like:
sudo snap set wekan-gantt-gpl root-url='http://localhost'
Set snap-settings.sh executeable:
chmod +x snap-settings.sh
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 PATH="$PATH:/snap/wekan-gantt-gpl/current/bin"
mongorestore --drop --port 27019
sudo snap start wekan-gantt-gpl.wekan
./snap-settings.sh
https://dbgate.org - https://github.com/dbgate/dbgate
https://nosqlbooster.com/downloads
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 and php website etc.
If you need to backup some remote server or cloud, you can use scp, or read rclone 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.
To add bash scripts, you change to root user with this command, and your sudo or root password.
sudo su
Use nano editor for editing cron. If you don't have it installed, type:
apt install nano
Then we set text editor to be nano. Otherwise it probably uses vi, that is harder to use.
export EDITOR=nano
Now we start editing cron scheduler.
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
# m h dom mon dow command
0 4 * * * /root/backup.sh >> /root/backup.log.txt 2>&1
/root
directory, type: cd /root
nano backup.sh
chmod +x backup.sh
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,
you don't need to add those command lines at all.
cd /root
./backup-wekan.sh
./backup-rocketchat.sh
./backup-website.sh
rclone move backups cloudname:backup.example.com
More about rclone:
/root/rclone-ls-all.sh , shows directory contests at cloud:
rclone lsd cloudname:
In this example, cron does run backup scripts as root.
This is if you edit cron with command crontab -e
as root user,
so it edits the cron of root user.
If mongodump command works as normal user for you, you could instead
run backups as normal user, by exiting root user with exit
and
then as normal user editing cron with crontab -e
.
You can also list current cron with command crontab -l
.
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.
sudo snap get wekan > snap-settings.txt
This below is backup script for backing up Wekan.
/root/backup-wekan.sh
#!/bin/bash
makeDump()
{
# Backups will be created below this directory.
backupdir="/root/backups/wekan"
# Gets the version of the snap.
version=$(snap list | grep wekan | awk -F ' ' '{print $3}')
# Gets current time to variable "now"
now=$(date +'%Y-%m-%d_%H.%M.%S')
# Creates new backup directory like BACKUPDIR/BACKUPVERSIO-TIMENOW
mkdir -p $backupdir/$version-$now
# Targets the dump file.
#dump=$"/snap/wekan/$version/bin/mongodump"
# Changes to backup directory
cd $backupdir/$version-$now
# Backup Caddy settings
snap get wekan > snap-settings.txt
# Show text that database backup is in progress
printf "\nThe database backup is in progress.\n\n"
# Backup to current directory, creates subdirectory called "dump"
# with database dump files
mongodump --port 27019
# Change diretory (=cd) to parent directory
cd ..
# Show text "Makes the tar.gz archive file"
printf "\nMakes the tar.gz archive file.\n"
# Creates tar.gz archive file. This works similarly like creating .zip file.
tar -zcvf $version-$now.tar.gz $version-$now
# Delete temporary files that have already been
# compressed to above tar.gz file
rm -rf $version-$now
# Shows text "Backup done."
printf "\nBackup done.\n"
# Show where backup archive file is.
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
bash /root/backup-rocketchat.sh
#!/bin/bash
makeDump()
{
backupdir="/root/backups/rocketchat"
# Gets the version of the snap.
version=$(snap list | grep wekan | awk -F ' ' '{print $3}')
# Prepares.
now=$(date +'%Y-%m-%d_%H.%M.%S')
mkdir -p $backupdir/$version-$now
# Targets the dump file.
dump=$"/snap/wekan/$version/bin/mongodump"
# Makes the backup.
cd $backupdir/$version-$now
printf "\nThe database backup is in progress.\n\n"
$dump --port 27017
# Makes the tar.gz file.
cd ..
printf "\nMakes the tar.gz file.\n"
tar -zcvf $version-$now.tar.gz $version-$now
# Cleanups
rm -rf $version-$now
# End.
printf "\nBackup done.\n"
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
/root/backup-website.sh
#!/bin/bash
makeDump()
{
backupdir="/root/backups/example.com"
# Gets the version of the snap.
version=$(snap list | grep wekan | awk -F ' ' '{print $3}')
# Prepares.
now=$(date +'%Y-%m-%d_%H.%M.%S')
mkdir -p $backupdir/$version-$now
# Makes the backup.
cd $backupdir/$version-$now
printf "\nThe file backup is in progress.\n\n"
# Makes the tar.gz file.
cd ..
printf "\nMakes the tar.gz file.\n"
cp -pR /var/snap/wekan/common/example.com $version-$now
tar -zcvf $version-$now.tar.gz $version-$now
# Cleanups
rm -rf $version-$now
# End.
printf "\nBackup done.\n"
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
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, 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
Creating a backup while the grain is running could cause corruption.
Note: Do mongodump/mongorestore only when Wekan is stopped: wekan.wekan (Snap) or wekan-app (Docker).
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:
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. 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 to login through SSH to Wekan server localhost port 27019 and browse data.
You could use daff to compare tables.
Add to your ~/.bashrc
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/snap/wekan/current/lib/x86_64-linux-gnu
export PATH="$PATH:/snap/wekan/current/bin"
Then you can backup:
mongodump --port 27019
And restore:
mongorestore --drop --port 27019
mongoshell.sh
#/bin/bash
export LC_ALL=C
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/snap/wekan/current/lib/x86_64-linux-gnu
version=$(snap list | grep wekan | awk -F ' ' '{print $3}')
mongo=$"/snap/wekan/$version/bin/mongo"
$mongo --port 27019
Originally from https://github.com/wekan/wekan-snap/issues/62#issuecomment-470622601
wekan-backup.sh
#!/bin/bash
export LC_ALL=C
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/snap/wekan/current/lib/x86_64-linux-gnu
version=$(snap list | grep wekan | awk -F ' ' '{print $3}')
now=$(date +"%Y%m%d-%H%M%S")
parent_dir="/data/backups/wekan"
backup_dir="${parent_dir}/${now}"
log_file="${parent_dir}/backup-progress.log.${now}"
error () {
printf "%s: %s\n" "$(basename "${BASH_SOURCE}")" "${1}" >&2
exit 1
}
trap 'error "An unexpected error occurred."' ERR
take_backup () {
mkdir -p "${backup_dir}"
cd "${backup_dir}"
/snap/wekan/$version/bin/mongodump --quiet --port 27019
cd ..
tar -zcf "${now}.tar.gz" "${now}"
rm -rf "${now}"
}
printf "\n======================================================================="
printf "\nWekan Backup"
printf "\n======================================================================="
printf "\nBackup in progress..."
take_backup 2> "${log_file}"
if [[ -s "${log_file}" ]]
then
printf "\nBackup failure! Check ${log_file} for more information."
printf "\n=======================================================================\n\n"
else
rm "${log_file}"
printf "...SUCCESS!\n"
printf "Backup created at ${backup_dir}.tar.gz"
printf "\n=======================================================================\n\n"
fi
wekan-restore.sh
#!/bin/bash
export LC_ALL=C
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/snap/wekan/current/lib/x86_64-linux-gnu
makesRestore()
{
file=$1
ext=$"$(basename $file)"
parentDir=$"${file:0:${#file}-${#ext}}"
cd "${parentDir}"
printf "\nMakes the untar of the archive.\n"
tar -zxvf "${file}"
file="${file:0:${#file}-7}"
version=$(snap list | grep wekan | awk -F ' ' '{print $3}')
restore=$"/snap/wekan/${version}/bin/mongorestore"
printf "\nThe database restore is in progress.\n\n"
## Only if you get errors about existing indexes, use this below instead:
## $restore --quiet --drop --noIndexRestore -d wekan --port 27019 "${file}/dump/wekan"
$restore --quiet --drop -d wekan --port 27019 "${file}/dump/wekan"
rm -rf "${file}"
printf "\nRestore done.\n"
}
makesRestore $1
#!/bin/bash
makeDump()
{
# Gets the version of the snap.
version=$(snap list | grep wekan | awk -F ' ' '{print $3}')
# Prepares.
now=$(date +'%Y-%m-%d_%H.%M.%S')
mkdir -p /var/backups/wekan/$version-$now
# Targets the dump file.
dump=$"/snap/wekan/$version/bin/mongodump"
# Makes the backup.
cd /var/backups/wekan/$version-$now
printf "\nThe database backup is in progress.\n\n"
$dump --port 27019
# Makes the tar.gz file.
cd ..
printf "\nMakes the tar.gz file.\n"
tar -zcvf $version-$now.tar.gz $version-$now
# Cleanups
rm -rf $version-$now
# End.
printf "\nBackup done.\n"
echo "Backup is archived to .tar.gz file at /var/backups/wekan/${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
#!/bin/bash
makesRestore()
{
# Prepares the folder used for the backup.
file=$1
if [[ "$file" != *tar.gz* ]]
then
echo "The backup archive must be a tar.gz."
exit -1
fi
# Goes into the parent directory.
ext=$"$(basename $file)"
parentDir=$"${file:0:${#file}-${#ext}}"
cd $parentDir
# Untar the archive.
printf "\nMakes the untar of the archive.\n"
tar -zxvf $file
file="${file:0:${#file}-7}"
# Gets the version of the snap.
version=$(snap list | grep wekan | awk -F ' ' '{print $3}')
# Targets the dump file.
restore=$"/snap/wekan/$version/bin/mongorestore"
# Restores.
printf "\nThe database restore is in progress.\n\n"
## Only if you get errors about existing indexes, use this below instead:
## $restore --drop --noIndexRestore wekan --port 27019 $file/dump/wekan
$restore --drop wekan --port 27019 $file/dump/wekan
printf "\nRestore done.\n"
# Cleanups
rm -rf $file
}
# Checks is the user is sudo/root.
if [ "$UID" -ne "0" ]
then
echo "This program must be launched with sudo/root."
exit 1
fi
# Start.
makesRestore $1
Download Wekan grain with arrow down download button to .zip file. You can restore it later.
Export data from Wekan Sandstorm grain .zip file
If those Backup ways are not easily found at Cloudron, one way is to install Redash and then backup this way:
Redash works with this kind of queries:
{
"collection": "accountSettings",
"query": {
"type": 1
},
"fields": {
"_id": 1,
"booleanValue": 1,
"createdAt": 1,
"modifiedAt": 1,
}
}
So:
1) Create this kind of query:
{
"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.
4) Click at right top [...]
=> Show API key
It looks like this:
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
#!/bin/bash
# Example: ./dl.sh boards
export APIKEY=https://redash.example.com/api/queries/1/results.json?api_key=...
curl -o $1.json $APIKEY
6) Run save script like:
./dl.sh boards
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
9) Insert data to some other Wekan install with nosqlbooster like mentioned at page Backup