palisade 0.0.2 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +23 -10
- data/lib/palisade/backup.rb +19 -16
- data/lib/palisade/version.rb +1 -1
- data/lib/templates/config.yml +42 -13
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a529d4ac1d98c172b9e26bb10fa44604053d719e
|
4
|
+
data.tar.gz: 3f2529c58389b2d82025ecbe9a04c412cdbe9f9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c72e5aa330f67aad252a439130103c6d2836c16a78774301b336c85b596b42f6c61e1e45d1b874d61b152fb2e275fcb1adad4b911bf151d21ae3e0c3b5adaee
|
7
|
+
data.tar.gz: 8c1e3a97f2115f90615610836afb1745434a9ce3d5029c21a5632aea7c209c8727770631a7b56064e22e4f3040bccac80a6c8b6ead5c1a1017a7c148c295d2fb
|
data/README.md
CHANGED
@@ -1,26 +1,39 @@
|
|
1
1
|
# Palisade
|
2
2
|
|
3
|
-
|
3
|
+
**WARNING! Palisade is still under v1.0 development. However, pieces of what
|
4
|
+
I'd like to be v1.0 are working. This document reflects its current state. Feel
|
5
|
+
free to use, but use at your own risk.**
|
4
6
|
|
5
|
-
## Installation
|
7
|
+
## Installation & Configuration
|
6
8
|
|
7
|
-
|
9
|
+
Palisade is a system gem. Install it globally to your system:
|
8
10
|
|
9
|
-
```
|
10
|
-
gem
|
11
|
+
```text
|
12
|
+
$ gem install palisade
|
11
13
|
```
|
12
14
|
|
13
|
-
|
15
|
+
If you're using `rbenv` or `rvm`, you may need to refresh your `$PATH`. Run
|
16
|
+
that command, or simply open a new command line session.
|
14
17
|
|
15
|
-
|
18
|
+
We then need to generate a config file:
|
16
19
|
|
17
|
-
|
20
|
+
```text
|
21
|
+
$ palisade install
|
22
|
+
```
|
18
23
|
|
19
|
-
|
24
|
+
This will generate a hidden directory -- `.palisade` -- inside your home
|
25
|
+
directory. The Palisade directory has only one file -- `config.yml`. This is
|
26
|
+
where you place your backup configuration.
|
20
27
|
|
21
28
|
## Usage
|
22
29
|
|
23
|
-
|
30
|
+
Once you are configured, you can run backups from the command line.
|
31
|
+
|
32
|
+
```text
|
33
|
+
$ palisade backup
|
34
|
+
```
|
35
|
+
|
36
|
+
More automated options coming soon.
|
24
37
|
|
25
38
|
## Contributing
|
26
39
|
|
data/lib/palisade/backup.rb
CHANGED
@@ -24,17 +24,15 @@ module Palisade
|
|
24
24
|
verify_db_dir(name)
|
25
25
|
rsync(config['db'], db_dir(name))
|
26
26
|
end
|
27
|
-
|
28
|
-
method =
|
27
|
+
config['assets'].each do |asset_name, data|
|
28
|
+
method = data['method']
|
29
29
|
method = 'rsync' if method.nil? || method == ''
|
30
30
|
case method
|
31
31
|
when 'rsync'
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
end
|
37
|
-
end
|
32
|
+
rsync(data['route'], project_dir(name))
|
33
|
+
when 's3cmd'
|
34
|
+
verify_s3_dir(name, asset_name)
|
35
|
+
s3cmd(data['route'], s3_dir(name, asset_name), data['config'])
|
38
36
|
end
|
39
37
|
end
|
40
38
|
end
|
@@ -44,6 +42,11 @@ module Palisade
|
|
44
42
|
system("rsync #{rsync_options} #{src} #{dest}")
|
45
43
|
end
|
46
44
|
|
45
|
+
def s3cmd(src, dest, config = nil)
|
46
|
+
config = "-c #{config}" unless config.nil?
|
47
|
+
system("s3cmd get -vr --skip-existing #{config} s3://#{src}/ #{dest}")
|
48
|
+
end
|
49
|
+
|
47
50
|
# ------------------------------------------ Directory Management
|
48
51
|
|
49
52
|
def project_dir(name)
|
@@ -54,9 +57,9 @@ module Palisade
|
|
54
57
|
"#{project_dir(name)}/db"
|
55
58
|
end
|
56
59
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
+
def s3_dir(name, asset_name)
|
61
|
+
"#{project_dir(name)}/#{asset_name}"
|
62
|
+
end
|
60
63
|
|
61
64
|
def verify_project_dir(name)
|
62
65
|
unless Dir.exists?(project_dir(name))
|
@@ -70,11 +73,11 @@ module Palisade
|
|
70
73
|
end
|
71
74
|
end
|
72
75
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
76
|
+
def verify_s3_dir(name, asset_name)
|
77
|
+
unless Dir.exists?(s3_dir(name, asset_name))
|
78
|
+
FileUtils.mkdir_p(s3_dir(name, asset_name))
|
79
|
+
end
|
80
|
+
end
|
78
81
|
|
79
82
|
# ------------------------------------------ Configuration / Options
|
80
83
|
|
data/lib/palisade/version.rb
CHANGED
data/lib/templates/config.yml
CHANGED
@@ -36,19 +36,48 @@ projects:
|
|
36
36
|
# `assets` should stay as it is and have NO VALUE
|
37
37
|
# -------------------
|
38
38
|
assets:
|
39
|
-
# -------------------
|
40
|
-
# `method` is the method by which we're going to back
|
41
|
-
# up the assets.
|
42
|
-
#
|
43
|
-
# Options: rsync, s3cmd
|
44
|
-
#
|
45
|
-
# You should make sure the method you're using is
|
46
|
-
# installed on your machine.
|
47
|
-
# -------------------
|
48
|
-
method: rsync
|
49
39
|
# -------------------
|
50
40
|
# From here, you can add as many keys as you want, and
|
51
|
-
# each can have their own remote ssh url.
|
41
|
+
# each can have their own remote ssh url. Each key
|
42
|
+
# creates a segmented backup within this project.
|
43
|
+
#
|
44
|
+
# Note: There should be no value for this key
|
52
45
|
# -------------------
|
53
|
-
files:
|
54
|
-
|
46
|
+
files:
|
47
|
+
# -------------------
|
48
|
+
# `method` is the method by which we're going to
|
49
|
+
# back up the assets.
|
50
|
+
#
|
51
|
+
# Options: rsync, s3cmd
|
52
|
+
#
|
53
|
+
# You should make sure the method you're using is
|
54
|
+
# installed on your machine.
|
55
|
+
# -------------------
|
56
|
+
method: rsync
|
57
|
+
# -------------------
|
58
|
+
# The route is the full path to the directory to
|
59
|
+
# backup. For rsync, you can use shorthand methods.
|
60
|
+
# -------------------
|
61
|
+
route: deploy@192.168.1.1:~/apps/my_app/shared/files
|
62
|
+
uploads:
|
63
|
+
# -------------------
|
64
|
+
# This is an example that uses s3cmd to backup an
|
65
|
+
# Amazon S3 bucket.
|
66
|
+
# -------------------
|
67
|
+
method: s3cmd
|
68
|
+
# -------------------
|
69
|
+
# When you use s3cmd, you can point to a custom
|
70
|
+
# configuration file. If you leave this key blank
|
71
|
+
# (or if it's missing), we assume the default
|
72
|
+
# location.
|
73
|
+
# -------------------
|
74
|
+
config: ~/.mys3cfg
|
75
|
+
# -------------------
|
76
|
+
# Although s3cmd routes look this this:
|
77
|
+
#
|
78
|
+
# s3://mybucket/path/to/my/files/
|
79
|
+
#
|
80
|
+
# You should omit the protocol, as we add that
|
81
|
+
# automatically.
|
82
|
+
# -------------------
|
83
|
+
route: mybucket/
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: palisade
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean C Davis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|