Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Change Log

## v1.1.0

* Removed the `backups.postgres_backup` action (Mistral is being removed from StackStorm).
* The `backups.full_backup` action now only backs up the MongoDB database.

Contributed by Nick Maludy (@nmaludy Encore Technologies)

## v1.0.5

* Forced release to included hotfix for `backups.full_backup`
Expand Down
18 changes: 5 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Backups Pack

This pack backs up the MongoDB and PostgreSQL databases in a StackStorm deployment.
This pack backs up the MongoDB database in a StackStorm deployment.
It is currently best used on a single node deployment, but has the potential to be used
for HA setups.

Expand All @@ -10,7 +10,6 @@ The `st2actionrunner` node(s) that executes the actions must have the following
packages installed:

- `mongodb-org-tools` (for the `mongodump` tool)
- `postgresql` (for the `pg_dump` tool)

# Configuration

Expand All @@ -37,7 +36,7 @@ st2 key set mongodb.admin_username "admin"
st2 key set -e mongodb.admin_password "Secret!"

# set our mongodb host
st2 key set mongodb.mongodb_host "server01"
st2 key set mongodb.mongodb_host server01"
```

# Actions
Expand All @@ -47,9 +46,8 @@ is built on:

| Action | Description |
|-------------------|-------------|
| `full_backup` | Performs a backup of both MongoDB and PostgreSQL databases |
| `mongodb_backup` | Performs a backup of the StackStorm MongoDB database |
| `postgres_backup` | Performs a backup of the StackStorm PostgreSQL database |
| `full_backup` | Performs a backup of the MongoDB database |
| `mongodb_backup` | Performs a backup of the StackStorm MongoDB database |

## Example

Expand All @@ -59,9 +57,6 @@ st2 run backups.full_backup

# perform backup of mongodb
st2 run backups.mongodb_backup

# perform backup of postgres
st2 run backups.postgres_backup
```

# Rules
Expand Down Expand Up @@ -97,8 +92,5 @@ action:
# TODO

- Allow passwords and usernames to be set via config instead of being in the key/value store
- Allow PostgreSQL password to be passed in via parameters
- Allow MongoDB username/password to be read in from the /etc/st2/st2.conf
- Implement backups of PostgreSQL database (allow all credentials/configs to be passed in with
parameters)
- Investigate using Orchestra or ActionChains instead of Mistral
- Backup "content" in /opt/stackstorm/packs, /opt/stackstorm/virtualenvs, configs, etc
3 changes: 0 additions & 3 deletions actions/full_backup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ parameters:
path:
default: /opt/stackstorm/backups
type: string
mistral_config:
default: /etc/mistral/mistral.conf
type: string
mongodb_admin_username:
default: "{{ st2kv.system.mongodb.admin_username }}"
type: string
Expand Down
23 changes: 0 additions & 23 deletions actions/postgres_backup.yaml

This file was deleted.

40 changes: 7 additions & 33 deletions actions/workflows/full_backup.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
---
version: '1.0'
description: Workflow that backs up the StackStorm MongoDB and Postgres databases
description: Workflow that backs up the StackStorm MongoDB database
input:
- path
- mistral_config
- mongodb_admin_username
- mongodb_admin_password
- retention_days
Expand All @@ -12,11 +11,9 @@ input:

vars:
- mongo_backup_success: false
- postgres_backup_success: false

output:
- mongodb_dump_archive: '{{ ctx().mongodb_dump_archive }}'
- postgres_dump_archive: '{{ ctx().postgres_dump_archive }}'

tasks:
date:
Expand All @@ -29,7 +26,6 @@ tasks:
- date: '{{ result().stdout }}'
do:
- mongodb_backup
- postgres_backup

mongodb_backup:
action: backups.mongodb_backup
Expand All @@ -41,38 +37,16 @@ tasks:
mongodb_host: '{{ ctx().mongodb_host }}'
retention_days: '{{ ctx().retention_days }}'
backup_timeout: '{{ ctx().backup_timeout }}'

next:
- when: "{{ completed() }}"
- when: "{{ succeeded() }}"
publish:
- mongo_backup_success: "{{ true if succeeded() else false }}"
- mongo_backup_success: "{{ true }}"
- mongodb_dump_archive: '{{ result().output.mongodb_dump_archive }}'
do:
- end

postgres_backup:
action: backups.postgres_backup
input:
path: '{{ ctx().path }}'
date: '{{ ctx().date }}'
mistral_config: '{{ ctx().mistral_config }}'
retention_days: '{{ ctx().retention_days }}'
backup_timeout: '{{ ctx().backup_timeout }}'
next:
- when: "{{ completed() }}"
publish:
- postgres_backup_success: "{{ true if succeeded() else false }}"
- postgres_dump_archive: '{{ result().output.postgres_dump_archive }}'
do:
- end

end:
action: core.noop
join: all
next:
- when: "{{ succeeded() and (ctx().mongo_backup_success and ctx().postgres_backup_success) }}"
do:
- noop
- when: "{{ succeeded() and (not ctx().mongo_backup_success or not ctx().postgres_backup_success) }}"
- when: "{{ failed() }}"
publish:
- mongo_backup_success: "{{ false }}"
- mongodb_dump_archive: '{{ result().output.mongodb_dump_archive }}'
do:
- fail
89 changes: 0 additions & 89 deletions actions/workflows/postgres_backup.yaml

This file was deleted.

4 changes: 1 addition & 3 deletions pack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ description: Pack to backup StackStorm databases
keywords:
- backup
- database
- postgres
- postgresql
- mongo
- mongodb
version: 1.0.5
version: 1.1.0
author: Encore Technologies
email: code@encore.tech
python_versions:
Expand Down