Skip to content
Akuket edited this page Jul 18, 2018 · 64 revisions

Backup script for MongoDB Data, if running Snap MongoDB at port 27019

#!/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/$now

    # Targets the dump file.
    dump=$"/snap/wekan/$version/bin/mongodump"

    # Makes the backup.
    cd /var/backups/wekan/$now
    printf "\nThe backup of the database is starting.\n\n"
    $dump --port 27019

    # Makes the zip file.
    cd ..
    printf "\nMakes the zip.\n"
    gzip -r $now.zip $now

    # Cleanups
    rm -rf $now

    # End.
    printf "\nBackup done.\n"
    echo "Backup is archived to .zip file at /var/backups/wekan/${now}.zip"
}

# 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

Restore script for MongoDB Data, if running Snap MongoDB at port 27019 with zip.

#!/bin/bash

makesRestore()
{
    # Prepares the folder used for the backup.
    file=$1
    if [[ "$file" != *zip* ]]
    then
        echo "The backup archive must be a zip."
        exit -1
    fi

    # Goes into the parent directory.
    ext=$"$(basename $file)"
    parentDir=$"${file:0:${#file}-${#ext}}"
    cd $parentDir

    # Unzip the archive.
    gunzip $file
    file="${file:0:${#file}-4}"
    
    # Gets the version of the snap.
    version=$(snap list | grep wekan | awk -F ' ' '{print $3}')

    # Targets the restore file.
    restore=$"/snap/wekan/$version/bin/mongorestore"

    # Restores.
    printf "\nThe database restore is in progress.\n\n"
    $restore -d 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


# Starts.
makesRestore $1

Docker Backup and Restore

Docker Backup and Restore

Wekan Docker Upgrade

Snap Backup

Snap Backup and Restore

Wekan Snap upgrade

Sandstorm Backup

Download Wekan grain with arrow down download button to .zip file. You can restore it later.

Export data from Wekan Sandstorm grain .zip file

Python Backup Script for Wekan Docker environment

Use Python to backup your Mongo Data, with automatic cleanup

Wekan

General

Security

Scaling

Migrating

Support priorities for new features and bugfixes

  1. Commercial Support
  2. Community Support
  3. Debugging

Backup

Repair

Themes

Markdown Syntax

Login Auth

Metrics, Logs, Stats

Integrations

Time

Features

Email

Required Settings

Download

Webservers

REST API Docs

REST API issue

REST API client code

Webhooks

Case Studies

Development

Issues

Clone this wiki locally