https://github.com/codefresh-io/cf-backup-consul
https://github.com/codefresh-io/cf-backup-consul
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/codefresh-io/cf-backup-consul
- Owner: codefresh-io
- Created: 2016-07-13T05:39:50.000Z (almost 10 years ago)
- Default Branch: develop
- Last Pushed: 2023-06-21T03:17:42.000Z (almost 3 years ago)
- Last Synced: 2025-04-25T14:59:40.730Z (about 1 year ago)
- Language: JavaScript
- Size: 12.7 KB
- Stars: 0
- Watchers: 20
- Forks: 3
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Codefresh Consul backup to S3 bucket and restore
config.js define consul address and s3 bucket
### Backup
docker run example:
```bash
docker run --rm -v "/opt/codefresh/cf-backup-consul/aws-credentials:/root/.aws/credentials:ro" \
-v "/opt/codefresh/cf-backup-consul/config.js:/cf-backup-consul/config.js:ro" --net=host codefresh/cf-backup-consul:develop
```
### Restore
##### download consul-backup-*-zip from s3
```bash
aws s3 cp s3://cf-backup-consul/google_production/consul-backup-2016-07-19_9-57-02-cf-usc1b-consul-3.zip /tmp/
unzip consul-backup-2016-07-19_9-57-02-cf-usc1b-consul-3.zip
```
##### restore
set consul path in config.js
Usage: node restore.js nodes|kv backup_file.json filterPattern
Example:
```bash
# restore all nodes
./restore.js nodes /tmp/2016-07-25_9-57-02-nodes_services.json
# restore specific nodes by regexp
./restore.js nodes /tmp/2016-07-25_9-57-02-nodes_services.json 'docker-node-(0001|0005)'
# restore all kv
./restore.js kv ~/consul_restore/2016-07-25_9-57-02-kv.json
# restore specific kv by regexp
./restore.js kv ~/consul_restore/2016-07-25_9-57-02-kv.json 'services/docker-node/(node-ironsource-52-19-18-28|.*-0001)'
```