Plugin to backup & restore your strapi installation (database + uploads) from admin panel.

Overview

Strapi Backup & Restore plugin

Add backup and restore features directly inside your strapi admin panel.

Alt text

Supported databases:

  • mysql
  • sqlite
  • postgre
  • mongodb (not implemented yet)

Installation

Install package from npm

npm i strapi-plugin-backup-restore --save
# or
yarn add strapi-plugin-backup-restore

Rebuild your admin ui

yarn build
# Or launch with admin watch enabled
yarn develop --watch-admin
npm run develop -- --watch-admin

Create a private/backups folder. This folder will be used to store your backups.

mkdir -p private/backups && touch private/backups/.gitkeep

Add this directory to your server config (otherwise in dev your server will restart on every new backup):

// config/server.js
module.exports = ({ env }) => ({
  host: env("HOST", "0.0.0.0"),
  port: env.int("PORT", 1337),
  admin: {
    auth: {
      secret: env("ADMIN_JWT_SECRET", "32a00a220c916908e0efca2b8117262f"),
    },
    // Add this line
    watchIgnoreFiles: ["**/private/**"],
  },
});

You should also add to your .gitignore the following:

private/backups/\*
!private/backups/.gitkeep

Usage

Prerequisites

MySQL

mysqldump command must be available in your environment.

Sqlite

Working out of the box.

Postgres

pg_dump must be available in path. libpq may be used to have it without a whole Postgres installation.

Manual backup

Navigate to your admin panel > plugins (left sidebar) > Backup & Restore

Click on Manual Backup to trigger a backup.

Scheduled backup

Edit config/functions/cron.js and add the following cron job.

// config/functions/cron.js
module.exports = {
  /**
   * Trigger a backup at 04:00 every day
   */
  "0 4 * * *": async () => {
    console.log("Starting backup from cron...");
    const backupID = Date.now().toString();

    await strapi.plugins["backup-restore"].services["backup-tools"].runBackup(
      backupID,
      false, // Tells if it's a manual backup, well it's not
      true, // Backup database
      true // Backup files
    );
    console.log(`Backup ${backupID} finished`);
  },
};

Backup structure

Your backup contains both database and uploaded files (content of public/uploads). It is a zip file where you'll find:

  • database.sql: a full backup of the database used by strapi
  • uploads.zip: your uploads folder content

Roadmap

Backup

  • Backup from mysql
  • Backup from postgre
  • Backup from sqlite
  • Backup from mongodb
  • Backup local uploads (from public/uploads)
  • Save backup to remote storage (Google drive, one drive, dropbox...) with a tool like rsync
  • Backup uploads from remote provider

Restore

  • Restore to mysql
  • Restore to postgre
  • Restore to sqlite
  • Restore to mongodb
  • Fetch backup from remote storage (Google drive, one drive, dropbox...) with a tool like rsync
  • Restore uploads to remote provider

Disclaimer

MIT license

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

I (or any contributor) could not be responsible for any data loss while using this plugin. Backup feature is quite simple and globally safe (if it fails then you only have a failed backup) but restore is more tricky and external factors involved during the process may break your installation.

Dependencies

There are not a lot of dump clients available on npm and I was in a hurry when creating this plugin so I picked mysqldump which has not been updated since june 2020. A better implementation would be to remove that package / contribute to its development.

You might also like...

Gatsby-Formik-contact-form-with-backend-panel - Full working contact form with backend GUI panel.

Gatsby minimal starter 🚀 Quick start Create a Gatsby site. Use the Gatsby CLI to create a new site, specifying the minimal starter. # create a new Ga

Jan 2, 2022

A modern client panel for the Pterodactyl® panel, made by Wrible Development.

A modern client panel for the Pterodactyl® panel, made by Wrible Development.

Dashboardsy A modern client panel for the Pterodactyl® panel, made by Wrible Development. Support Discord: https://discord.gg/zVcDkSZNu7 Screenshots S

Jan 1, 2023

DDG Email Panel is the open source unofficial DuckDuckGo Email Protection panel.

DDG Email Panel 简体中文 Open source unofficial DuckDuckGo Email Protection panel. ⭐ Features No need to install DuckDuckGo browser extension Supports all

Dec 28, 2022

Override the rich text editor in Strapi admin with ToastUI Editor.

Override the rich text editor in Strapi admin with ToastUI Editor.

strapi-plugin-wysiwyg-tui-editor ⚠️ This is a strapi v4 plugin which does not support any earlier version! A Strapi plugin to replace the default rich

Dec 23, 2022

AdminBro is an admin panel for apps written in node.js

Admin Bro AdminBro is An automatic admin interface which can be plugged into your application. You, as a developer, provide database models (like post

Jan 2, 2023

Personal blog and portfolio with a admin panel and comment system.

Personal blog and portfolio with a admin panel and comment system.

Implementation of a Full Stack Blog With a Comment System And Admin Panel With PHP, React & MYSQL FULL DOCUMENTATION SITE LINK Contents Database Desig

Oct 21, 2022

NX workspace for running medusa backend, storefront and admin panel with marketplace functionalities

Medusa Marketplace Project status Assigned store_id to Order, Product to make them store specific Create and process payment for an order with multipl

Nov 13, 2022

This is admin panel for @MultiEmail

This is admin panel for @MultiEmail

Technologies Used React Tailwind Features Admin dashboard User settings and or user dashboard send emails recive emails Connections through other part

Dec 24, 2022

Admin UI Template is a modern, responsive, and customizable admin UI template for your business.

Admin UI Template is a modern, responsive, and customizable admin UI template for your business.

Admin UI Template is a modern, responsive, and customizable admin UI template for your business. It contains reusable components, theme color, and design support along with dark theme support.

Dec 18, 2022

Explore, create and deploy your SQLite databases right from your browser. Quick and easy, no installation required.

Explore, create and deploy your SQLite databases right from your browser. Quick and easy, no installation required.

SQLighter (under development, alpha code) SQLighter is a database explorer born for SQLite that helps you design and deploy your application database

Sep 20, 2022

Custom endpoint to backup the PG database and upload the `.dump` to Directus.

Custom endpoint to backup the PG database and upload the `.dump` to Directus.

Directus Backup Endpoint Custom Directus endpoint to backup Postgres database using pg_dump and upload the .dump file into Directus files. Usage Clone

Dec 21, 2022

Custom operation to backup the PG database and upload the .dump to Directus.

Custom operation to backup the PG database and upload the .dump to Directus.

Directus Backup Operation Custom Directus operation to backup Postgres database using pg_dump and upload the .dump file into Directus storage. Prerequ

Dec 21, 2022

Gmail-like client-side drafts and bit more. Plugin developed to save html forms data to LocalStorage to restore them after browser crashes, tabs closings and other disasters.

Sisyphus Plugin developed to save html forms data to LocalStorage to restore them after browser crashes, tabs closings and other disasters. Descriptio

Dec 8, 2022

:tada: A magical vue admin https://panjiachen.github.io/vue-element-admin

:tada: A magical vue admin                                                                https://panjiachen.github.io/vue-element-admin

English | 简体中文 | 日本語 | Spanish SPONSORED BY 活动服务销售平台 客户消息直达工作群 Introduction vue-element-admin is a production-ready front-end solution for admin inter

Dec 31, 2022

🎉 基于 reactjs 开发的可视化项目实战【https://wuli-admin.gitee.io/react-wuli-admin/#/workspace/fullscreen】

react-visual-data 介绍 🎉 基于 reactjs 开发的可视化项目实战 亮点 大屏设计器:自由拖拽大屏 报表设计器:自适应排列布局 动态表单:schema 设计模式 vue版本尝鲜:vue版本尝鲜 issues,欢迎提交~ 调试 git clone https://githu

Dec 13, 2022

A Turborepo with Strapi v4 (w/ postgres database) + Next.js powered by docker and docker-compose

A Turborepo with Strapi v4 (w/ postgres database) + Next.js powered by docker and docker-compose

Turborepo + Strapi + Next.js + Docker A Turborepo with Strapi v4 (w/ postgres database) + Next.js powered by docker and docker-compose. ⚠️ Prerequisit

Dec 29, 2022

Bookmarklet to remove sticky elements and restore scrolling to web pages!

Bookmarklet to remove sticky elements and restore scrolling to web pages!

Bookmarklet to remove sticky elements and restore scrolling to web pages!

Dec 29, 2022

Given an object and a property, replaces a property descriptor (or deletes it), and returns a thunk to restore it.

Given an object and a property, replaces a property descriptor (or deletes it), and returns a thunk to restore it.

Given an object and a property, replaces a property descriptor (or deletes it), and returns a thunk to restore it.

Apr 20, 2022

Simplify the installation of a Silverstripe Dev Environment.

silverstripe docker starter Simplify the installation of a Silverstripe Dev Environment. The silverstripe docker starter is based on the silverstripe/

Jul 7, 2022
Comments
  • [BUG] Error while dumping SQLite database: no such file or directory

    [BUG] Error while dumping SQLite database: no such file or directory

    Hi. I just try to use your plugin and encourter the following errors.

    Backup Failure

    Something went wrong while creating backup

    Starting sqlite3 backup from undefined Dumping to /home/$USER/strapi-project/private/backups/1626884931704/database.db Directory created successfully! Error: ENOENT: no such file or directory, copyfile '/home/$USER/strapi-project/undefined' -> '/home/$USER/strapi-project/private/backups/1626884931704/database.db'

    Thank you for explain :)

    Strapi Version │ 3.6.5 (node v14.17.0)

    bug In progress 
    opened by Kazdan1994 3
  • mysqldump is just creating schema not the data and uploads zip is empty

    mysqldump is just creating schema not the data and uploads zip is empty

    Hi,

    Thanks for creating such a lovely plugin, But we found some issue with the plugin when we run the manual backup it only generates schema of database and not the data. We are using mysqldump.

    Secondly I could see there is a uploads folder which is there in the zip but it is always empty.

    bug 
    opened by raees-digitalsalt 3
  • 'PGPASSWORD' is not recognized as an internal or external command

    'PGPASSWORD' is not recognized as an internal or external command

    Hi team,

    Thanks for the great plugin. it looks like the plugin is not working on windows machines and I am getting the below error.

    'PGPASSWORD' is not recognized as an internal or external command

    Would it be possible to support this for windows as well as strapi supports it.

    enhancement 
    opened by shivagouraram 3
  • Docker Deployment

    Docker Deployment

    This assumes that Postgres is physically installed on the machine. But what if I have both Strapi and Postgres running in docker containers. How do I get the plugin to see pg_dump

    question 
    opened by laportem 6
Releases(0.5.2)
  • 0.5.2(Dec 28, 2021)

    This release is possible thanks to @rozaverta who submitted the following changes and fixes:

    1. Ability to backup from a docker container:
    module.exports = () => ({
    	"backup-restore": {
    		postgres: {
    			docker: "container-name", // eq. { mode: "local", container: "container-name" }
    			// or
    			docker: {
    				mode: "local",
    				container: "container-name",
    				path: "docker", // path to command. Not required, default = "docker"
    			},
    			// or
    			docker: {
    				mode: "socket",
    				container: "container-name",
    				socket: "http://socket-url", // not required, default = "/var/run/docker.sock"
    				file: true, // boolean or function (originPath: string) => string;
    			}
    		},
    	},
    });
    
    1. Added Russian translations
    2. Fixed issues and typos in current codebase
    Source code(tar.gz)
    Source code(zip)
  • 0.5.1(Aug 1, 2021)

    Enhancements

    Permissions

    Added permissions configuration per-scope. You can now decide which role is allowed to interact with your backups. Thanks @shivagouram for pointing out that permissions were more than expected when dealing with sensible data. image

    Config

    You can now manually set the path to pg_dump directly from config/plugins.js

    // config/plugins.js
    module.exports = () => ({
      "backup-restore": {
        postgres: {
          // Update with your path
          pathToPgDump: "/usr/local/opt/libpq/bin/pg_dump",
        },
      },
    });
    

    Minor ENHs

    • hide backups from content types list

    Bugfixes

    • Issue with postgres backups in windows tty (#3)
    Source code(tar.gz)
    Source code(zip)
  • 0.5.0(Jul 21, 2021)

  • 0.4.0(Jul 21, 2021)

  • 0.3.2(Jul 21, 2021)

Owner
Hugues BUREAU
Hugues BUREAU
Give your JS App some Backbone with Models, Views, Collections, and Events

____ __ __ /\ _`\ /\ \ /\ \ __ \ \ \ \ \ __ ___\ \ \/'\\ \ \_

Jeremy Ashkenas 28k Dec 27, 2022
Strengthening your Backbone

NOTICE: This repository has been archived and is not supported. NOTICE: SUPPORT FOR THIS PROJECT HAS ENDED This projected was owned and maintained by

Walmart Labs 1.3k Nov 15, 2022
A rugged, minimal framework for composing JavaScript behavior in your markup.

Alpine.js Alpine.js offers you the reactive and declarative nature of big frameworks like Vue or React at a much lower cost. You get to keep your DOM,

Alpine.js 22.5k Dec 30, 2022
Utility functions to increase your productivity.

Focus on being productive instead of busy. Installation npm i devstorm Example // import module import debounce from 'devstorm/debounce'; // debounce

Salokya Kumar 26 Aug 4, 2022
Docker Extension to backup and restore docker volumes.

vackup-docker-extension This repository contains a Docker Extension that backups Docker volumes. This extension is purely a demonstration of how it'd

Felipe Cruz Martinez 34 Dec 28, 2022
A GUI to browse and restore restic backup repositories.

A simple, cross-platform restic backup GUI for browsing and restoring restic repositories. Built with Wails2, based on leaanthony's Restoric PoC. Down

Eduard Müller / taktik 91 Dec 29, 2022
基于vue3.0-ts-Element集成的简洁/实用后台模板!《带预览地址》vue-admin;vue+admin;vue-element;vue+element;vue后台管理;vue3.0-admin;vue3.0-element。

一、基于vue3.0+ts+Element通用后台admin模板 二、在线预览地址:http://admin.yknba.cn/ 三、下载使用: 1、克隆代码 通过git将代码克隆到本地;或者使用下载安装包模式进行下载。 2、进入目录 进入项目的根目录:vue3.0-ts-admin 3、安装依

null 64 Dec 16, 2022
An Admin Panel developed for simplifying the process of CRUD operations in the database.

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

Chetan Thakral 6 Dec 15, 2022
A status monitor for Elite Dangerous, written in PHP. Designed for 1080p screens in the four-panel-view in panel.php, and for 7 inch screens with a resolution of 1024x600 connected to a Raspberry Pi.

EDStatusPanel A status monitor for Elite Dangerous, written in PHP. Designed for 1080p screens in the four-panel-view in panel.php, and for 7 inch scr

marcus-s 24 Oct 4, 2022