{"id":13621387,"url":"https://github.com/SavageSoftware/portainer-backup","last_synced_at":"2025-04-15T01:32:29.752Z","repository":{"id":41518725,"uuid":"465909968","full_name":"SavageSoftware/portainer-backup","owner":"SavageSoftware","description":"Portainer Backup Utility","archived":false,"fork":false,"pushed_at":"2023-12-10T21:54:05.000Z","size":582,"stargazers_count":156,"open_issues_count":16,"forks_count":14,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-30T05:56:49.428Z","etag":null,"topics":["backup","backup-script","docker","docker-compose","docker-container","docker-image","portainer","portainer-api","portainer-ce"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SavageSoftware.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-03-03T22:52:22.000Z","updated_at":"2024-10-22T22:08:11.000Z","dependencies_parsed_at":"2024-01-14T08:06:43.456Z","dependency_job_id":null,"html_url":"https://github.com/SavageSoftware/portainer-backup","commit_stats":{"total_commits":33,"total_committers":2,"mean_commits":16.5,"dds":0.4242424242424242,"last_synced_commit":"a27c856ab27246c111c46b2af10f57828a60c68b"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SavageSoftware%2Fportainer-backup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SavageSoftware%2Fportainer-backup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SavageSoftware%2Fportainer-backup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SavageSoftware%2Fportainer-backup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SavageSoftware","download_url":"https://codeload.github.com/SavageSoftware/portainer-backup/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223654634,"owners_count":17180548,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backup","backup-script","docker","docker-compose","docker-container","docker-image","portainer","portainer-api","portainer-ce"],"created_at":"2024-08-01T21:01:05.399Z","updated_at":"2024-11-08T08:30:45.649Z","avatar_url":"https://github.com/SavageSoftware.png","language":"JavaScript","readme":"[![Docker](https://img.shields.io/docker/v/savagesoftware/portainer-backup/latest?color=darkgreen\u0026logo=docker\u0026label=DockerHub%20Latest%20Image)](https://hub.docker.com/repository/docker/savagesoftware/portainer-backup/)\n[![NPM](https://img.shields.io/npm/v/portainer-backup?color=darkgreen\u0026logo=npm\u0026label=NPM%20Registry)](https://www.npmjs.com/package/portainer-backup)\n[![GitHub package.json version](https://img.shields.io/github/package-json/v/savagesoftware/portainer-backup?color=darkgreen\u0026label=GitHub%20Source\u0026logo=github)](https://github.com/SavageSoftware/portainer-backup)\n[![node-current](https://img.shields.io/node/v/portainer-backup)](https://www.npmjs.com/package/portainer-backup)\n[![portainer](https://img.shields.io/badge/Portainer-\u003e=v2.11.0-darkgreen)](https://www.portainer.io/)\n\n# Portainer Backup\n\n(Developed with ♥ by SavageSoftware, LLC.)\n\n---\n\n## Overview\n\nA utility for scripting or scheduling Portainer backups.  This utility can backup the entire Portainer database, optionally protect the archive file with a password and can additionally backup the `docker-compose` files for stacks created in the Portainer web interface.\n\n![SCREENSHOT](https://github.com/SavageSoftware/portainer-backup/raw/master/assets/screenshot.jpg)\n\n| Resources | URL |\n| --- | --- |\n| DockerHub Image | https://hub.docker.com/repository/docker/savagesoftware/portainer-backup/ |\n| NPM Package Registry | https://www.npmjs.com/package/portainer-backup | \n\n---\n\n## Table of Contents\n\n* [Overview](#overview)\n* [TL;DR](#tldr)\n* [Prerequisites](#prerequisites)\n* [Installation](#installation)\n* [Supported Commands \u0026 Operations](#supported-commands--operations)\n  * [Backup](#backup)\n  * [Test](#test)\n  * [Schedule](#schedule)\n  * [Info](#info)\n  * [Stacks](#stacks)\n  * [Restore](#restore)\n* [Return Value](#return-value)\n* [Command Line Options \u0026 Environment Variables](#command-line-options--environment-variables)\n* [Schedule Expression](#schedule-expression)\n* [Filename \u0026 Directory Date/Time Substituions](#filename--directory-datetime-substituions)\n  * [Supported Presets](#supported-presets)\n  * [Supported Tokens](#supported-tokens)\n* [Command Line Help](#command-line-help)\n* [Docker Compose](#docker-compose)\n\n---\n\n## TL;DR\n\n**NodeJS \u0026 NPM**\n\nCommand to install **portainer-backup** using node's **NPM** command:\n\n```shell\nnpm install --global portainer-backup   \n```\n\nCommand to launch **portainer-backup** after installing with NPM to perform a **backup** of your portainer server:\n\n```shell\nportainer-backup \\\n  backup \\\n  --url \"http://portainer:9000\" \\\n  --token \"PORTAINER_ACCESS_TOKEN\" \\\n  --directory $PWD/backup  \n```\n\n**NPX**\n\nCommand to install \u0026 launch **portainer-backup** using node's [NPX](https://nodejs.dev/learn/the-npx-nodejs-package-runner) command to perform a **backup** of your portainer server:\n\n```shell\nnpx portainer-backup \\\n  backup \\\n  --url \"http://portainer:9000\" \\\n  --token \"PORTAINER_ACCESS_TOKEN\" \\\n  --directory $PWD/backup  \n```\n\n**DOCKER**\n\nCommand to launch **portainer-backup** using a Docker container to perform a **backup** of your portainer server:\n\n```shell\ndocker run -it --rm \\\n  --name portainer-backup \\\n  --volume $PWD/backup:/backup \\\n  --env PORTAINER_BACKUP_URL=\"http://portainer:9000\" \\\n  --env PORTAINER_BACKUP_TOKEN=\"YOUR_ACCESS_TOKEN\" \\\n  savagesoftware/portainer-backup:latest \\\n  backup\n```\n\nSupported Docker platforms:\n  * `linux/amd64` (Intel/AMD x64)\n  * `linux/arm64` (ARMv8)\n  * `linux/arm` (ARMv7)\n\n---\n\n## Prerequisites\n\n**Portainer-backup** requires the following prerequisites:\n\n| Prerequisite | Version | Link |\n| ------------ | ------- | -------- |\n| NodeJS       | v16 (LTS) | https://nodejs.org |\n| Portainer    | v2.11.0 (and newer) | https://www.portainer.io |\n| Portainer Access Token | N/A | https://docs.portainer.io/v/ce-2.11/api/access |\n\n[![node-current](https://img.shields.io/node/v/portainer-backup)](https://www.npmjs.com/package/portainer-backup)\n[![portainer](https://img.shields.io/badge/Portainer-v2.11.0-darkgreen)](https://www.portainer.io/)\n\nThis utility has only been tested on Portainer **v2.11.0** and later.\n\n\u003e **NOTE:** If attempting to use with an older version of Portainer this utility will exit with an error message.  While it is untested, you can use the `--ignore-version` option to bypass the version validation/enforcement.\n\nYou will need to obtain a [Portiner Access Token](https://docs.portainer.io/v/ce-2.11/api/access) from your Portainer server from an adminstrative user account.\n\n---\n\n## Installation\n\nCommand to install **portainer-backup** using node's **NPM** command:\n\n```shell\nnpm install --global portainer-backup   \n```\n\n[![NPM](https://nodei.co/npm/portainer-backup.png?downloads=true\u0026downloadRank=false\u0026stars=false)](https://www.npmjs.com/package/portainer-backup)\n\n---\n\n## Supported Commands \u0026 Operations\n\nThis utility requires a single command to execute one of the built in operations.\n\n| Command    | Description |\n| ---------- | ----------- |\n| [`backup`](#backup)     | Backup portainer data archive    |\n| [`schedule`](#schedule) | Run scheduled portainer backups  |\n| [`stacks`](#stacks)     | Backup portainer stacks          |\n| [`test`](#test)         | Test backup (no files are saved) |\n| [`info`](#info)         | Get portainer server info        |\n| [`restore`](#restore)   | Restore portainer data           |\n\n\u003e **NOTE:** The `restore` command is not currently implemented due to issues with the Portainer API.\n\n### Backup\n\nThe **backup** operation will perform a single backup of the Portainer data from the specified server.  This backup file will be TAR.GZ archive and can optionally be protected with a password (`--password`).  The process will terminate immedately after the **backup** operation is complete.\n \nThe following command will perform a **backup** of the Portainer data.\n```shell\nportainer-backup \\\n  backup \\\n  --url \"http://portainer:9000\" \\\n  --token \"PORTAINER_ACCESS_TOKEN\" \\\n  --directory $PWD/backup \\\n  --overwrite\n``` \n\nThe following docker command will perform a **backup** of the Portainer data.\n```shell\ndocker run -it --rm \\\n  --name portainer-backup \\\n  --volume $PWD/backup:/backup \\\n  --env TZ=\"America/New_York\" \\\n  --env PORTAINER_BACKUP_URL=\"http://portainer:9000\" \\\n  --env PORTAINER_BACKUP_TOKEN=\"PORTAINER_ACCESS_TOKEN\" \\\n  --env PORTAINER_BACKUP_OVERWRITE=true  \\\n  --env PORTAINER_BACKUP_DIRECTORY=/backup \\\n  savagesoftware/portainer-backup:latest \\\n  backup\n``` \n\n### Test\n\nThe **test** operation will perform a single backup of the Portainer data from the specified server.  With the **test** operation, no data will be saved on the filesystem.  The **test** operation is the same as using the `--dryrun` option.  The process will terminate immedately after the **test** operation is complete.\n \nThe following command will perform a **test** of the Portainer data.\n```shell\nportainer-backup \\\n  test \\\n  --url \"http://portainer:9000\" \\\n  --token \"PORTAINER_ACCESS_TOKEN\" \\\n  --directory $PWD/backup\n``` \n\nThe following docker command will perform a **test** of the Portainer data.\n```shell\ndocker run -it --rm \\\n  --name portainer-backup \\\n  --volume $PWD/backup:/backup \\\n  --env TZ=\"America/New_York\" \\\n  --env PORTAINER_BACKUP_URL=\"http://portainer:9000\" \\\n  --env PORTAINER_BACKUP_TOKEN=\"PORTAINER_ACCESS_TOKEN\" \\\n  --env PORTAINER_BACKUP_DIRECTORY=/backup \\\n  savagesoftware/portainer-backup:latest \\\n  test\n``` \n\n\n### Schedule\n\nThe **schedule** operation will perform continious scheduled backups of the Portainer data from the specified server.  The `--schedule` option or `PORTAINER_BACKUP_SCHEDULE` environment variable takes a cron-like string expression to define the backup schedule.  The process will run continiously unless a validation step fails immediately after startup.\n \nThe following command will perform a **test** of the Portainer data.\n```shell\nportainer-backup \\\n  schedule \\\n  --url \"http://portainer:9000\" \\\n  --token \"PORTAINER_ACCESS_TOKEN\" \\\n  --directory $PWD/backup \\\n  --overwrite \\\n  --schedule \"0 0 0 * * *\"\n``` \n\nThe following docker command will perform a **schedule** of the Portainer data.\n```shell\ndocker run -it --rm \\\n  --name portainer-backup \\\n  --volume $PWD/backup:/backup \\\n  --env TZ=\"America/New_York\" \\\n  --env PORTAINER_BACKUP_URL=\"http://portainer:9000\" \\\n  --env PORTAINER_BACKUP_TOKEN=\"PORTAINER_ACCESS_TOKEN\" \\\n  --env PORTAINER_BACKUP_OVERWRITE=true  \\\n  --env PORTAINER_BACKUP_DIRECTORY=/backup \\\n  --env PORTAINER_BACKUP_SCHEDULE=\"0 0 0 * * *\" \\\n  savagesoftware/portainer-backup:latest \\\n  schedule\n``` \n\n### Info\n\nThe **info** operation will perform an information request to the specified Portainer server.  The process will terminate immedately after the **info** operation is complete.\n \nThe following command will perform a **info** from the Portainer server.\n```shell\nportainer-backup info --url \"http://portainer:9000\"\n``` \n\nThe following docker command will perform a **info** request from the Portainer data.\n```shell\ndocker run -it --rm \\\n  --name portainer-backup \\\n  --env PORTAINER_BACKUP_URL=\"http://portainer:9000\" \\\n  savagesoftware/portainer-backup:latest \\\n  info\n``` \n\n### Stacks\n\nThe **stacks** operation will perform a single backup of the Portainer stacks `docker-compose` data from the specified server.   This operation does not backup the Portainer database/data files, only the stacks.   Alternatively you can include stacks backups in the **backup** operation using the `--stacks` option.  The process will terminate immedately after the **stacks** operation is complete.\n \nThe following command will perform a **stacks** of the Portainer data.\n```shell\nportainer-backup \\\n  backup \\\n  --url \"http://portainer:9000\" \\\n  --token \"PORTAINER_ACCESS_TOKEN\" \\\n  --directory $PWD/backup \\\n  --stacks\n``` \n\nThe following docker command will perform a **stacks** of the Portainer data.\n```shell\ndocker run -it --rm \\\n  --name portainer-backup \\\n  --volume $PWD/backup:/backup \\\n  --env TZ=\"America/New_York\" \\\n  --env PORTAINER_BACKUP_URL=\"http://portainer:9000\" \\\n  --env PORTAINER_BACKUP_TOKEN=\"PORTAINER_ACCESS_TOKEN\" \\\n  --env PORTAINER_BACKUP_OVERWRITE=true  \\\n  --env PORTAINER_BACKUP_DIRECTORY=/backup \\\n  savagesoftware/portainer-backup:latest \\\n  stacks\n``` \n\n### Restore\n\nThe **restore** operation is not implemented at this time.  We encountered trouble getting the Portainer **restore** API (https://app.swaggerhub.com/apis/portainer/portainer-ce/2.11.1#/backup/Restore) to work properly and are investigating this issue further.\n\n---\n\n## Return Value\n\n**Portainer-backup** will return a numeric value after the process exits. \n\n| Value | Description |\n| ----- | ----------- |\n| 0     | Utility executed command successfully   |\n| 1     | Utility encountered an error and failed |\n\n---\n\n## Command Line Options \u0026 Environment Variables\n\n**Portainer-backup** supports both command line arguments and environment variables for all configuration options.\n\n| Option      | Environment Variable | Type | Description |\n| ----------- | -------------------- | ---- | ----------- |\n| `-t`, `--token`                     | `PORTAINER_BACKUP_TOKEN`          | string      | Portainer access token |\n| `-u`, `--url`                       | `PORTAINER_BACKUP_URL`            | string      | Portainer base url |\n| `-Z`, `--ignore-version`            | `PORTAINER_BACKUP_IGNORE_VERSION` | true\\|false | Bypass portainer version check/enforcement |\n| `-d`, `--directory`, `--dir`        | `PORTAINER_BACKUP_DIRECTORY`      | string      | Backup directory/path |\n| `-f`, `--filename`                  | `PORTAINER_BACKUP_FILENAME`       | string      | Backup filename |\n| `-p`, `--password`, `--pw`          | `PORTAINER_BACKUP_PASSWORD`       | string      | Backup archive password |\n| `-M`, `--mkdir`, `--make-directory` | `PORTAINER_BACKUP_MKDIR`          | true\\|false | Create backup directory path |\n| `-o`, `--overwrite`                 | `PORTAINER_BACKUP_OVERWRITE`      | true\\|false | Overwrite existing files |\n| `-s`, `--schedule`, `--sch`         | `PORTAINER_BACKUP_SCHEDULE`       | string      | Cron expression for scheduled backups |\n| `-i`, `--include-stacks`, `--stacks`| `PORTAINER_BACKUP_STACKS`         | true\\|false | Include stack files in backup |\n| `-q`, `--quiet`                     | `PORTAINER_BACKUP_QUIET`          | true\\|false | Do not display any console output |\n| `-D`, `--dryrun`                    | `PORTAINER_BACKUP_DRYRUN`         | true\\|false | Execute command task without persisting any data |\n| `-X`, `--debug`                     | `PORTAINER_BACKUP_DEBUG`          | true\\|false | Print stack trace for any errors encountered|\n| `-J`, `--json`                      | `PORTAINER_BACKUP_JSON`           | true\\|false | Print formatted/strucutred JSON data |\n| `-c`, `--concise`                   | `PORTAINER_BACKUP_CONCISE`        | true\\|false | Print concise/limited output |\n| `-v`, `--version`                   |  _(N/A)_                          |             | Show utility version number |\n| `-h`, `--help`                      |  _(N/A)_                          |             | Show help |\n\n\u003e **NOTE:** If both an environment variable and a command line option are configured for the same option, the command line option will take priority.\n\n---\n\n## Schedule Expression\n\n**Portainer-backup** accepts a cron-like expression via the `--schedule` option or `PORTAINER_BACKUP_SCHEDULE` environment variable \n\n\u003e **NOTE:** Additional details on the supported cron syntax can be found here: https://github.com/node-cron/node-cron/blob/master/README.md#cron-syntax\n\n\n```\nSyntax Format:\n\n    ┌──────────────────────── second (optional)\n    │   ┌──────────────────── minute\n    │   │   ┌──────────────── hour\n    │   │   │   ┌──────────── day of month\n    │   │   │   │   ┌──────── month\n    │   │   │   │   │   ┌──── day of week\n    │   │   │   │   │   │\n    │   │   │   │   │   │\n    *   *   *   *   *   *\n\nExamples:\n\n    0   0   0   *   *   *   Daily at 12:00am\n    0   0   5   1   *   *   1st day of month @ 5:00am\n    0 */15  0   *   *   *   Every 15 minutes\n```\n\n### Allowed field values\n\n|     field    |        value        |\n|--------------|---------------------|\n|    second    |         0-59        |\n|    minute    |         0-59        |\n|     hour     |         0-23        |\n| day of month |         1-31        |\n|     month    |     1-12 (or names) |\n|  day of week |     0-7 (or names, 0 or 7 are sunday)  |\n\n#### Using multiples values\n\n| Expression | Description |\n| ---------- | ----------- |\n| `0  0  4,8,12  *  *  *` | Runs at 4p, 8p and 12p |\n\n#### Using ranges\n\n| Expression | Description |\n| ---------- | ----------- |\n| `0  0  1-5  *  *  *` | Runs hourly from 1 to 5 |\n\n#### Using step values\n\nStep values can be used in conjunction with ranges, following a range with '/' and a number. e.g: `1-10/2` that is the same as `2,4,6,8,10`. Steps are also permitted after an asterisk, so if you want to say “every two minutes”, just use `*/2`.\n\n| Expression | Description |\n| ---------- | ----------- |\n| `0  0  */2  *  *  *` | Runs every 2 hours |\n\n#### Using names\n\nFor month and week day you also may use names or short names. e.g:\n\n| Expression | Description |\n| ---------- | ----------- |\n| `* * * * January,September Sunday` | Runs on Sundays of January and September |\n| `* * * * Jan,Sep Sun` | Runs on Sundays of January and September |\n\n---\n\n## Filename \u0026 Directory Date/Time Substituions\n\n**Portainer-backup** supports a substituion syntax for dynamically assigning date and time elements to the **directory** and **filename** options.\n\n| Command Line Option | Environment Variable |\n| ------------------- | -------------------- |\n| `-d`, `--directory`, `--dir` | `PORTAINER_BACKUP_DIRECTORY` |\n| `-f`, `--filename` | `PORTAINER_BACKUP_FILENAME` |\n\n\nAll substitution presets and/or tokens are included in between double curly braces: `{{ PRESET|TOKEN }}`\n\nExample:\n```\n  --filename \"portainer-backup-{{DATE}}.tar.gz\"\n```\n\n**Portainer-backup** uses the [Luxon](https://moment.github.io) library for parting date and time syntax.  Please see https://moment.github.io/luxon/#/formatting for more information.\n\nAll date and times are rendered in the local date/time of the system running the **portainer-backup** utility. Alternatively you can incude the `UTC_` prefix in front of any of the tokens below to use UTC time instead.\n\nFilenames are also processed through a `sanitize` funtion whick will strip characters that are not supported in filename.  The `:` character is replaced with `_` and the `/` character is replaced with `-`.\n\n### Supported Presets\n\nThe folllowing substition **presets** are defined by and supported in **portainer-backup**:\n\n| Token | Format | Example (US) |\n| ----- | ------ | ------------ |\n| `DATETIME`                    | `yyyy-MM-dd'T'HHmmss`            | 2022-03-05T231356               |\n| `TIMESTAMP`                   | `yyyyMMdd'T'HHmmss.SSSZZZ`       | 20220305T184827.445-0500        |\n| `DATE`                        | `yyyy-MM-dd`                     | 2022-03-05                      |\n| `TIME`                        | `HHmmss`                         | 231356                          |\n| `ISO8601`                     | `yyyy-MM-dd'T'hh_mm_ss.SSSZZ`    | 2017-04-20T11_32_00.000-04_00   |\n| `ISO`                         | `yyyy-MM-dd'T'hh_mm_ss.SSSZZ`    | 2017-04-20T11_32_00.000-04_00   |\n| `ISO_BASIC`                   | `yyyyMMdd'T'hhmmss.SSSZZZ`       | 20220305T191048.871-05_00       |\n| `ISO_NO_OFFSET`               | `yyyy-MM-dd'T'hh_mm_ss.SSS`      | 2022-03-05T19_12_43.296         |\n| `ISO_DATE`                    | `yyyy-MM-dd`                     | 2017-04-20                      |\n| `ISO_WEEKDATE`                | `yyyy-'W'kk-c`                   | 2017-W17-7                      |\n| `ISO_TIME`                    | `hh_mm_ss.SSSZZZ`                | 11_32_00.000-04_00              |\n| `RFC2822`                     | `ccc, dd LLL yyyy HH_mm_ss ZZZ`  | Thu, 20 Apr 2017 11_32_00 -0400 |\n| `HTTP`                        | `ccc, dd LLL yyyy HH_mm_ss ZZZZ` | Thu, 20 Apr 2017 03_32_00 GMT   |\n| `MILLIS`                      | `x`                              | 1492702320000                   |\n| `SECONDS`                     | `X`                              | 1492702320.000                  |\n| `UNIX`                        | `X`                              | 1492702320.000                  |\n| `EPOCH`                       | `X`                              | 1492702320.000                  |\n\nThe folllowing substition **presets** are provided my the [Luxon](https://moment.github.io) library and are supported in **portainer-backup**:\n(See the following Luxon docs for more information: https://moment.github.io/luxon/#/formatting?id=presets)\n\n(The following presets are using the October 14, 1983 at `13:30:23` as an example.)\n\n| Name                         | Description                                                        | Example in en_US                                             | Example in fr                                              |\n| ---------------------------- | ------------------------------------------------------------------ | ------------------------------------------------------------ | ---------------------------------------------------------- |\n| `DATE_SHORT`                 | short date                                                         | `10/14/1983`                                                 | `14/10/1983`                                               |\n| `DATE_MED`                   | abbreviated date                                                   | `Oct 14, 1983`                                               | `14 oct. 1983`                                             |\n| `DATE_MED_WITH_WEEKDAY`      | abbreviated date with abbreviated weekday                          | `Fri, Oct 14, 1983`                                          | `ven. 14 oct. 1983`                                             |\n| `DATE_FULL`                  | full date                                                          | `October 14, 1983`                                           | `14 octobre 1983`                                          |\n| `DATE_HUGE`                  | full date with weekday                                             | `Friday, October 14, 1983`                                   | `vendredi 14 octobre 1983`                                 |\n| `TIME_SIMPLE`                | time                                                               | `1:30 PM`                                                    | `13:30`                                                    |\n| `TIME_WITH_SECONDS`          | time with seconds                                                  | `1:30:23 PM`                                                 | `13:30:23`                                                 |\n| `TIME_WITH_SHORT_OFFSET`     | time with seconds and abbreviated named offset                     | `1:30:23 PM EDT`                                             | `13:30:23 UTC−4`                                           |\n| `TIME_WITH_LONG_OFFSET`      | time with seconds and full named offset                            | `1:30:23 PM Eastern Daylight Time`                           | `13:30:23 heure d’été de l’Est`                            |\n| `TIME_24_SIMPLE`             | 24-hour time                                                       | `13:30`                                                      | `13:30`                                                    |\n| `TIME_24_WITH_SECONDS`       | 24-hour time with seconds                                          | `13:30:23`                                                   | `13:30:23`                                                 |\n| `TIME_24_WITH_SHORT_OFFSET`  | 24-hour time with seconds and abbreviated named offset             | `13:30:23 EDT`                                               | `13:30:23 UTC−4`                                           |\n| `TIME_24_WITH_LONG_OFFSET`   | 24-hour time with seconds and full named offset                    | `13:30:23 Eastern Daylight Time`                             | `13:30:23 heure d’été de l’Est`                            |\n| `DATETIME_SHORT`             | short date \u0026 time                                                  | `10/14/1983, 1:30 PM`                                        | `14/10/1983 à 13:30`                                       |\n| `DATETIME_MED`               | abbreviated date \u0026 time                                            | `Oct 14, 1983, 1:30 PM`                                      | `14 oct. 1983 à 13:30`                                     |\n| `DATETIME_FULL`              | full date and time with abbreviated named offset                   | `October 14, 1983, 1:30 PM EDT`                              | `14 octobre 1983 à 13:30 UTC−4`                            |\n| `DATETIME_HUGE`              | full date and time with weekday and full named offset              | `Friday, October 14, 1983, 1:30 PM Eastern Daylight Time`    | `vendredi 14 octobre 1983 à 13:30 heure d’été de l’Est`    |\n| `DATETIME_SHORT_WITH_SECONDS`| short date \u0026 time with seconds                                     | `10/14/1983, 1:30:23 PM`                                     | `14/10/1983 à 13:30:23`                                    |\n| `DATETIME_MED_WITH_SECONDS`  | abbreviated date \u0026 time with seconds                               | `Oct 14, 1983, 1:30:23 PM`                                   | `14 oct. 1983 à 13:30:23`                                  |\n| `DATETIME_FULL_WITH_SECONDS` | full date and time with abbreviated named offset with seconds      | `October 14, 1983, 1:30:23 PM EDT`                           | `14 octobre 1983 à 13:30:23 UTC−4`                         |\n| `DATETIME_HUGE_WITH_SECONDS` | full date and time with weekday and full named offset with seconds | `Friday, October 14, 1983, 1:30:23 PM Eastern Daylight Time` | `vendredi 14 octobre 1983 à 13:30:23 heure d’été de l’Est` |\n\n\n### Supported Tokens\n\nIf one of the substitution presets does not meet your needs, you can build your own date/time string using the supported **tokens** listed below.\n(See the following Luxon docs for more information: https://moment.github.io/luxon/#/formatting?id=table-of-tokens)\n\nExample:\n\n```\n  --filename \"portainer-backup-{{yyyy-MM-dd}}.tar.gz\"\n```\n\n(Examples below given for `2014-08-06T13:07:04.054` considered as a local time in America/New_York.)\n\n| Standalone token | Format token | Description                                                    | Example                                                       |\n| ---------------- | ------------ | -------------------------------------------------------------- | ------------------------------------------------------------- |\n| S                |              | millisecond, no padding                                        | `54`                                                          |\n| SSS              |              | millisecond, padded to 3                                       | `054`                                                         |\n| u                |              | fractional seconds, functionally identical to SSS              | `054`                                                         |\n| uu               |              | fractional seconds, between 0 and 99, padded to 2              | `05`                                                          |\n| uuu              |              | fractional seconds, between 0 and 9                            | `0`                                                           |\n| s                |              | second, no padding                                             | `4`                                                           |\n| ss               |              | second, padded to 2 padding                                    | `04`                                                          |\n| m                |              | minute, no padding                                             | `7`                                                           |\n| mm               |              | minute, padded to 2                                            | `07`                                                          |\n| h                |              | hour in 12-hour time, no padding                               | `1`                                                           |\n| hh               |              | hour in 12-hour time, padded to 2                              | `01`                                                          |\n| H                |              | hour in 24-hour time, no padding                               | `9`                                                           |\n| HH               |              | hour in 24-hour time, padded to 2                              | `13`                                                          |\n| Z                |              | narrow offset                                                  | `+5`                                                          |\n| ZZ               |              | short offset                                                   | `+05:00`                                                      |\n| ZZZ              |              | techie offset                                                  | `+0500`                                                       |\n| ZZZZ             |              | abbreviated named offset                                       | `EST`                                                         |\n| ZZZZZ            |              | unabbreviated named offset                                     | `Eastern Standard Time`                                       |\n| z                |              | IANA zone                                                      | `America/New_York`                                            |\n| a                |              | meridiem                                                       | `AM`                                                          |\n| d                |              | day of the month, no padding                                   | `6`                                                           |\n| dd               |              | day of the month, padded to 2                                  | `06`                                                          |\n| c                | E            | day of the week, as number from 1-7 (Monday is 1, Sunday is 7) | `3`                                                           |\n| ccc              | EEE          | day of the week, as an abbreviate localized string             | `Wed`                                                         |\n| cccc             | EEEE         | day of the week, as an unabbreviated localized string          | `Wednesday`                                                   |\n| ccccc            | EEEEE        | day of the week, as a single localized letter                  | `W`                                                           |\n| L                | M            | month as an unpadded number                                    | `8`                                                           |\n| LL               | MM           | month as a padded number                                       | `08`                                                          |\n| LLL              | MMM          | month as an abbreviated localized string                       | `Aug`                                                         |\n| LLLL             | MMMM         | month as an unabbreviated localized string                     | `August`                                                      |\n| LLLLL            | MMMMM        | month as a single localized letter                             | `A`                                                           |\n| y                |              | year, unpadded                                                 | `2014`                                                        |\n| yy               |              | two-digit year                                                 | `14`                                                          |\n| yyyy             |              | four- to six- digit year, pads to 4                            | `2014`                                                        |\n| G                |              | abbreviated localized era                                      | `AD`                                                          |\n| GG               |              | unabbreviated localized era                                    | `Anno Domini`                                                 |\n| GGGGG            |              | one-letter localized era                                       | `A`                                                           |\n| kk               |              | ISO week year, unpadded                                        | `14`                                                          |\n| kkkk             |              | ISO week year, padded to 4                                     | `2014`                                                        |\n| W                |              | ISO week number, unpadded                                      | `32`                                                          |\n| WW               |              | ISO week number, padded to 2                                   | `32`                                                          |\n| o                |              | ordinal (day of year), unpadded                                | `218`                                                         |\n| ooo              |              | ordinal (day of year), padded to 3                             | `218`                                                         |\n| q                |              | quarter, no padding                                            | `3`                                                           |\n| qq               |              | quarter, padded to 2                                           | `03`                                                          |\n| D                |              | localized numeric date                                         | `9/4/2017`                                                    |\n| DD               |              | localized date with abbreviated month                          | `Aug 6, 2014`                                                 |\n| DDD              |              | localized date with full month                                 | `August 6, 2014`                                              |\n| DDDD             |              | localized date with full month and weekday                     | `Wednesday, August 6, 2014`                                   |\n| t                |              | localized time                                                 | `9:07 AM`                                                     |\n| tt               |              | localized time with seconds                                    | `1:07:04 PM`                                                  |\n| ttt              |              | localized time with seconds and abbreviated offset             | `1:07:04 PM EDT`                                              |\n| tttt             |              | localized time with seconds and full offset                    | `1:07:04 PM Eastern Daylight Time`                            |\n| T                |              | localized 24-hour time                                         | `13:07`                                                       |\n| TT               |              | localized 24-hour time with seconds                            | `13:07:04`                                                    |\n| TTT              |              | localized 24-hour time with seconds and abbreviated offset     | `13:07:04 EDT`                                                |\n| TTTT             |              | localized 24-hour time with seconds and full offset            | `13:07:04 Eastern Daylight Time`                              |\n| f                |              | short localized date and time                                  | `8/6/2014, 1:07 PM`                                           |\n| ff               |              | less short localized date and time                             | `Aug 6, 2014, 1:07 PM`                                        |\n| fff              |              | verbose localized date and time                                | `August 6, 2014, 1:07 PM EDT`                                 |\n| ffff             |              | extra verbose localized date and time                          | `Wednesday, August 6, 2014, 1:07 PM Eastern Daylight Time`    |\n| F                |              | short localized date and time with seconds                     | `8/6/2014, 1:07:04 PM`                                        |\n| FF               |              | less short localized date and time with seconds                | `Aug 6, 2014, 1:07:04 PM`                                     |\n| FFF              |              | verbose localized date and time with seconds                   | `August 6, 2014, 1:07:04 PM EDT`                              |\n| FFFF             |              | extra verbose localized date and time with seconds             | `Wednesday, August 6, 2014, 1:07:04 PM Eastern Daylight Time` |\n| X                |              | unix timestamp in seconds                                      | `1407287224`                                                  |\n| x                |              | unix timestamp in milliseconds                                 | `1407287224054`                                               |\n\n\n---\n\n## Command Line Help\n\nUse the `help` command or `--help` option to see a listing of command line options directly via the CLI.\n\n```\n  ___         _        _                ___          _             \n | _ \\___ _ _| |_ __ _(_)_ _  ___ _ _  | _ ) __ _ __| |___  _ _ __ \n |  _/ _ \\ '_|  _/ _` | | ' \\/ -_) '_| | _ \\/ _` / _| / / || | '_ \\\n |_| \\___/_|  \\__\\__,_|_|_||_\\___|_|   |___/\\__,_\\__|_\\_\\\\_,_| .__/\n                                                             |_|   \n┌──────────────────────────────────────────────────────────────────┐\n│   Made with ♥ by SavageSoftware, LLC © 2022    (Version 0.0.6)   │\n└──────────────────────────────────────────────────────────────────┘\n\nUsage: \u003ccommand\u003e [(options...)]\n\nCommands:\n  portainer-backup backup              Backup portainer data\n  portainer-backup schedule            Run scheduled portainer backups\n  portainer-backup stacks              Backup portainer stacks\n  portainer-backup info                Get portainer server info\n  portainer-backup test                Test backup data \u0026 stacks (backup --dryru\n                                       n --stacks)\n  portainer-backup restore \u003cfilename\u003e  Restore portainer data\n  portainer-backup help                Show help\n  portainer-backup version             Show version\n\nPortainer Options:\n  -t, --token           Portainer access token\n          [string]                                                 [default: \"\"]\n  -u, --url             Portainer base url\n                                     [string] [default: \"http://portainer:9000\"]\n  -Z, --ignore-version  Bypass portainer version check/enforcement\n                                                      [boolean] [default: false]\n\nBackup Options:  (applies only to 'backup' command)\n  -d, --directory, --dir          Backup directory/path\n                                                   [string] [default: \"/backup\"]\n  -f, --filename                  Backup filename\n                                   [string] [default: \"portainer-backup.tar.gz\"]\n  -p, --password, --pwd           Backup archive password [string] [default: \"\"]\n  -o, --overwrite                 Overwrite existing files\n                                                      [boolean] [default: false]\n  -M, --mkdir, --make-directory  Create backup directory path if needed\n                                                      [boolean] [default: false]\n  -s, --schedule, --sch           Cron expression for scheduled backups\n                                             [string] [default: \"0 0 0 * * * *\"]\n  -i, --include-stacks, --stacks  Include stack files in backup\n                                                      [boolean] [default: false]\n\nStacks Options:  (applies only to 'stacks' command)\n  -d, --directory, --dir  Backup directory/path    [string] [default: \"/backup\"]\n  -o, --overwrite         Overwrite existing files    [boolean] [default: false]\n  -M, --mkdir, --make-directory  Create backup directory path if needed\n                                                      [boolean] [default: false]\nRestore Options:  (applies only to 'restore' command)\n  -p, --password, --pwd  Backup archive password          [string] [default: \"\"]\n\nOptions:\n  -h, --help     Show help                                             [boolean]\n  -q, --quiet    Do not display any console output    [boolean] [default: false]\n  -D, --dryrun   Execute command task without persisting any data.\n                                                      [boolean] [default: false]\n  -X, --debug    Print details stack trace for any errors encountered\n                                                      [boolean] [default: false]\n  -J, --json     Print formatted/strucutred JSON data [boolean] [default: false]\n  -c, --concise  Print concise/limited output         [boolean] [default: false]\n  -v, --version  Show version number                                   [boolean]\n\nCommand Examples:\n  info     --url http://192.168.1.100:9000\n\n  backup   --url http://192.168.1.100:9000\n           --token XXXXXXXXXXXXXXXX\n           --overwrite\n           --stacks\n\n  stacks   --url http://192.168.1.100:9000\n           --token XXXXXXXXXXXXXXXX\n           --overwrite\n\n  restore  --url http://192.168.1.100:9000\n           --token XXXXXXXXXXXXXXXX\n           ./file-to-restore.tar.gz\n\n  schedule --url http://192.168.1.100:9000\n           --token XXXXXXXXXXXXXXXX\n           --schedule \"0 0 0 * * *\"\n\nSchedule Expression Examples: (cron syntax)\n\n    ┌──────────────────────── second (optional)\n    │   ┌──────────────────── minute\n    │   │   ┌──────────────── hour\n    │   │   │   ┌──────────── day of month\n    │   │   │   │   ┌──────── month\n    │   │   │   │   │   ┌──── day of week\n    │   │   │   │   │   │\n    │   │   │   │   │   │\n    *   *   *   *   *   *\n\n    0   0   0   *   *   *   Daily at 12:00am\n    0   0   5   1   *   *   1st day of month @ 5:00am\n    0 */15  0   *   *   *   Every 15 minutes\n\n    Additional Examples @ https://github.com/node-cron/node-cron#cron-syntax\n```\n\n---\n\n## Docker Compose\n\nAlternatively you can use a `docker-compose.yml` file to launch your **portainer-backup** container.  Below is a sample `docker-compose.yml` file you can use to get started:\n\n```yaml\nversion: '3.8'\nservices:\n  portainer-backup:\n    container_name: portainer-backup\n    image: savagesoftware/portainer-backup:latest\n    hostname: portainer-backup\n    restart: unless-stopped\n    command: schedule\n    environment:\n      TZ: America/New_York\n      PORTAINER_BACKUP_URL: \"http://portainer:9000\"\n      PORTAINER_BACKUP_TOKEN: \"PORTAINER_ACCESS_TOKEN\"\n      PORTAINER_BACKUP_PASSWORD: \"\"\n      PORTAINER_BACKUP_OVERWRITE: 1\n      PORTAINER_BACKUP_SCHEDULE: \"0 0 0 * * *\"\n      PORTAINER_BACKUP_STACKS: 1\n      PORTAINER_BACKUP_DRYRUN: 0\n      PORTAINER_BACKUP_CONCISE: 1\n      PORTAINER_BACKUP_DIRECTORY: \"/backup\"\n      PORTAINER_BACKUP_FILENAME: \"portainer-backup.tar.gz\"\n    volumes:\n      - /var/backup:/backup\n```\n\nJust run the `docker-compose up -d` command in the same directory as your `docker-compose.yml` file to launch the container instance.\n\nSupported Docker platforms:\n  * `linux/amd64` (Intel/AMD x64)\n  * `linux/arm64` (ARMv8)\n  * `linux/arm` (ARMv7)\n\n---\n","funding_links":[],"categories":["JavaScript","docker"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSavageSoftware%2Fportainer-backup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSavageSoftware%2Fportainer-backup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSavageSoftware%2Fportainer-backup/lists"}