pvcglue 0.1.24 → 0.1.25

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 02bd7b82a867ccfbb8ae078a1bf1147a4c58126e
4
- data.tar.gz: d21de1f2a2ea747ed8d022d768e2d48d0483b03c
3
+ metadata.gz: 4d8e13eb849237295d92d5608720ebac8aa8d285
4
+ data.tar.gz: c33ef05585ffdda58c213a6bf38bea055804ca83
5
5
  SHA512:
6
- metadata.gz: 48781fc0a67f64fba00b21af49394d45843f824eac1901f809d0d401c7191332c94d9833e100d83ee3cf9c943859281f35d1eba6d278babcdbde876a0e740b5f
7
- data.tar.gz: dddbb020f052676f768d962dfcb9e0e346cf386176571a17d0478ea0955fb5ce586c165232fec797c4f99393683b3a44ef4842f459973a0dcfd253261572f1dc
6
+ metadata.gz: 94387410ece82c63f531436d92e7616a43403a1d33d8a5cb6e3842dd8d14160718321862f3ab378e6cc510b16fd2a78712f2cee3ba72efc534ae99f74f9add78
7
+ data.tar.gz: 6ccf6339855e66c432a13d09084d0f3abc934f0fc55b75141b40291878f33017d8232567febb939724bd38b7a716c869379c050fa9f3e2941c6a82829aa66248
data/README.md CHANGED
@@ -4,6 +4,8 @@ Pico Virtual Cloud Glue creates a tightly integrated (very small) virtual cloud
4
4
 
5
5
  An opinionated cloud application manager for Rails applications using your own servers.
6
6
 
7
+ ![pvcglue diagram](/../master/images/pvcglue.png?raw=true "PVC Glue Server Diagram")
8
+
7
9
  Currently supported stack:
8
10
 
9
11
  * Ubuntu 12.04 (with plans for supporting 14.04)
data/bin/pvc CHANGED
@@ -9,6 +9,5 @@ if ARGV.count >= 2 && %w[local test alpha beta gamma delta preview production st
9
9
  end
10
10
 
11
11
  # puts ARGV.inspect
12
-
13
12
  Pvcglue::CLI.start
14
13
  puts "----- Done -----"
@@ -0,0 +1 @@
1
+ {"contentType":"application/gliffy+json","version":"1.1","metadata":{"title":"untitled","revision":0,"exportBorder":false},"embeddedResources":{"index":0,"resources":[]},"stage":{"objects":[{"x":160,"y":112.5,"rotation":0,"id":28,"uid":"com.gliffy.shape.basic.basic_v1.default.text","width":540,"height":27,"lockAspectRatio":false,"lockShape":false,"order":28,"graphic":{"type":"Text","Text":{"tid":null,"valign":"middle","overflow":"none","vposition":"none","hposition":"none","html":"<p style=\"text-align:center;\"><span style=\"font-size: 24px; font-family: Arial; white-space: pre-wrap; text-decoration: none; line-height: 27px; color: rgb(0, 0, 0);\">Cluster</span></p>","paddingLeft":2,"paddingRight":2,"paddingBottom":2,"paddingTop":2}},"children":null,"linkMap":[]},{"x":20,"y":232.5,"rotation":0,"id":15,"uid":"com.gliffy.shape.basic.basic_v2.default.round_rectangle","width":100,"height":75,"lockAspectRatio":true,"lockShape":false,"order":11,"graphic":{"type":"Shape","Shape":{"tid":"com.gliffy.stencil.rectangle.basic_v2","strokeWidth":2,"strokeColor":"#3399FF","fillColor":"#FFFFFF","gradient":true,"dropShadow":false,"state":0,"shadowX":0,"shadowY":0,"opacity":1}},"children":[{"x":2,"y":0,"rotation":0,"id":17,"uid":null,"width":96,"height":28,"lockAspectRatio":false,"lockShape":false,"order":"auto","graphic":{"type":"Text","Text":{"tid":null,"valign":"middle","overflow":"none","vposition":"none","hposition":"none","html":"<p style=\"text-align:center;\"><span style=\"font-size: 12px; font-family: Arial; white-space: pre-wrap; text-decoration: none; line-height: 14px; color: rgb(0, 0, 0);\">Manager\n</span></p><p style=\"text-align:center;\"><span style=\"font-size: 12px; font-family: Arial; white-space: pre-wrap; text-decoration: none; line-height: 14px; color: rgb(0, 0, 0);\">(manager)</span></p>","paddingLeft":2,"paddingRight":2,"paddingBottom":2,"paddingTop":2}},"children":null}],"linkMap":[]},{"x":457,"y":270.5,"rotation":0,"id":21,"uid":"com.gliffy.shape.basic.basic_v1.default.line","width":100,"height":100,"lockAspectRatio":false,"lockShape":false,"order":16,"graphic":{"type":"Line","Line":{"strokeWidth":2,"strokeColor":"#000000","fillColor":"none","dashStyle":null,"startArrow":0,"endArrow":0,"startArrowRotation":"auto","endArrowRotation":"auto","ortho":true,"interpolationType":"linear","cornerRadius":10,"controlPath":[[25.200274348422454,-0.5],[52.10013717421123,-0.5],[52.10013717421123,119.5],[79,119.5]],"lockSegments":{}}},"children":null,"constraints":{"constraints":[],"startConstraint":{"type":"StartPositionConstraint","StartPositionConstraint":{"nodeId":3,"px":1,"py":0.5}},"endConstraint":{"type":"EndPositionConstraint","EndPositionConstraint":{"nodeId":11,"px":0,"py":0.5}}},"linkMap":[]},{"x":453,"y":267.5,"rotation":0,"id":20,"uid":"com.gliffy.shape.basic.basic_v1.default.line","width":100,"height":100,"lockAspectRatio":false,"lockShape":false,"order":15,"graphic":{"type":"Line","Line":{"strokeWidth":2,"strokeColor":"#000000","fillColor":"none","dashStyle":null,"startArrow":0,"endArrow":0,"startArrowRotation":"auto","endArrowRotation":"auto","ortho":true,"interpolationType":"linear","cornerRadius":10,"controlPath":[[29.200274348422454,2.5],[56.10013717421123,2.5],[56.10013717421123,-117.5],[83,-117.5]],"lockSegments":{}}},"children":null,"constraints":{"constraints":[],"startConstraint":{"type":"StartPositionConstraint","StartPositionConstraint":{"nodeId":3,"px":1,"py":0.5}},"endConstraint":{"type":"EndPositionConstraint","EndPositionConstraint":{"nodeId":9,"px":0,"py":0.5}}},"linkMap":[]},{"x":458,"y":270.5,"rotation":0,"id":19,"uid":"com.gliffy.shape.basic.basic_v1.default.line","width":100,"height":100,"lockAspectRatio":false,"lockShape":false,"order":14,"graphic":{"type":"Line","Line":{"strokeWidth":2,"strokeColor":"#000000","fillColor":"none","dashStyle":null,"startArrow":0,"endArrow":0,"startArrowRotation":"auto","endArrowRotation":"auto","ortho":true,"interpolationType":"linear","cornerRadius":10,"controlPath":[[24.200274348422454,-0.5],[42.133516232281636,-0.5],[60.06675811614082,-0.5],[78,-0.5]],"lockSegments":{}}},"children":null,"constraints":{"constraints":[],"startConstraint":{"type":"StartPositionConstraint","StartPositionConstraint":{"nodeId":3,"px":1,"py":0.5}},"endConstraint":{"type":"EndPositionConstraint","EndPositionConstraint":{"nodeId":6,"px":0,"py":0.5}}},"linkMap":[]},{"x":279,"y":266.5,"rotation":0,"id":18,"uid":"com.gliffy.shape.basic.basic_v1.default.line","width":100,"height":100,"lockAspectRatio":false,"lockShape":false,"order":13,"graphic":{"type":"Line","Line":{"strokeWidth":2,"strokeColor":"#000000","fillColor":"none","dashStyle":null,"startArrow":0,"endArrow":0,"startArrowRotation":"auto","endArrowRotation":"auto","ortho":true,"interpolationType":"linear","cornerRadius":10,"controlPath":[[-3,3.5],[23.666666666666686,3.5],[50.333333333333314,3.5],[77,3.5]],"lockSegments":{}}},"children":null,"constraints":{"constraints":[],"startConstraint":{"type":"StartPositionConstraint","StartPositionConstraint":{"nodeId":0,"px":1,"py":0.5}},"endConstraint":{"type":"EndPositionConstraint","EndPositionConstraint":{"nodeId":3,"px":0,"py":0.5}}},"linkMap":[]},{"x":536,"y":352.5,"rotation":0,"id":11,"uid":"com.gliffy.shape.basic.basic_v2.default.round_rectangle","width":126.20027434842248,"height":75,"lockAspectRatio":true,"lockShape":false,"order":9,"graphic":{"type":"Shape","Shape":{"tid":"com.gliffy.stencil.rectangle.basic_v2","strokeWidth":2,"strokeColor":"#3399FF","fillColor":"#FFFFFF","gradient":true,"dropShadow":false,"state":0,"shadowX":0,"shadowY":0,"opacity":1}},"children":[{"x":2.52400548696845,"y":0,"rotation":0,"id":14,"uid":null,"width":121.15226337448557,"height":28,"lockAspectRatio":false,"lockShape":false,"order":"auto","graphic":{"type":"Text","Text":{"tid":null,"valign":"middle","overflow":"none","vposition":"none","hposition":"none","html":"<p style=\"text-align:center;\"><span style=\"font-size: 12px; font-family: Arial; white-space: pre-wrap; text-decoration: none; line-height: 14px; color: rgb(0, 0, 0);\">Redis [alpha]\n</span></p><p style=\"text-align:center;\"><span style=\"font-size: 12px; font-family: Arial; white-space: pre-wrap; text-decoration: none; line-height: 14px; color: rgb(0, 0, 0);\">(redis)</span></p>","paddingLeft":2,"paddingRight":2,"paddingBottom":2,"paddingTop":2}},"children":null}],"linkMap":[]},{"x":536,"y":112.5,"rotation":0,"id":9,"uid":"com.gliffy.shape.basic.basic_v2.default.rectangle","width":126.20027434842248,"height":75,"lockAspectRatio":true,"lockShape":false,"order":7,"graphic":{"type":"Shape","Shape":{"tid":"com.gliffy.stencil.rectangle.basic_v2","strokeWidth":2,"strokeColor":"#3399FF","fillColor":"#FFFFFF","gradient":true,"dropShadow":false,"state":0,"shadowX":0,"shadowY":0,"opacity":1}},"children":[{"x":2.52400548696845,"y":0,"rotation":0,"id":13,"uid":null,"width":121.15226337448557,"height":28,"lockAspectRatio":false,"lockShape":false,"order":"auto","graphic":{"type":"Text","Text":{"tid":null,"valign":"middle","overflow":"none","vposition":"none","hposition":"none","html":"<p style=\"text-align:center;\"><span style=\"font-size: 12px; font-family: Arial; white-space: pre-wrap; text-decoration: none; line-height: 14px; color: rgb(0, 0, 0);\">Memcache\n</span></p><p style=\"text-align:center;\"><span style=\"font-size: 12px; font-family: Arial; white-space: pre-wrap; text-decoration: none; line-height: 14px; color: rgb(0, 0, 0);\">(memcached)</span></p>","paddingLeft":2,"paddingRight":2,"paddingBottom":2,"paddingTop":2}},"children":null}],"linkMap":[]},{"x":536,"y":232.5,"rotation":0,"id":6,"uid":"com.gliffy.shape.basic.basic_v2.default.round_rectangle","width":126.20027434842248,"height":75,"lockAspectRatio":true,"lockShape":false,"order":5,"graphic":{"type":"Shape","Shape":{"tid":"com.gliffy.stencil.rectangle.basic_v2","strokeWidth":2,"strokeColor":"#3399FF","fillColor":"#FFFFFF","gradient":true,"dropShadow":false,"state":0,"shadowX":0,"shadowY":0,"opacity":1}},"children":[{"x":2.52400548696845,"y":0,"rotation":0,"id":8,"uid":null,"width":121.15226337448557,"height":28,"lockAspectRatio":false,"lockShape":false,"order":"auto","graphic":{"type":"Text","Text":{"tid":null,"valign":"middle","overflow":"none","vposition":"none","hposition":"none","html":"<p style=\"text-align:center;\"><span style=\"font-size: 12px; font-family: Arial; white-space: pre-wrap; text-decoration: none; line-height: 14px; color: rgb(0, 0, 0);\">PostgreSQL\n</span></p><p style=\"text-align:center;\"><span style=\"font-size: 12px; font-family: Arial; white-space: pre-wrap; text-decoration: none; line-height: 14px; color: rgb(0, 0, 0);\">(db)</span></p>","paddingLeft":2,"paddingRight":2,"paddingBottom":2,"paddingTop":2}},"children":null}],"linkMap":[]},{"x":356,"y":232.5,"rotation":0,"id":3,"uid":"com.gliffy.shape.basic.basic_v2.default.round_rectangle","width":126.20027434842248,"height":75,"lockAspectRatio":true,"lockShape":false,"order":3,"graphic":{"type":"Shape","Shape":{"tid":"com.gliffy.stencil.rectangle.basic_v2","strokeWidth":2,"strokeColor":"#3399FF","fillColor":"#FFFFFF","gradient":true,"dropShadow":false,"state":0,"shadowX":0,"shadowY":0,"opacity":1}},"children":[{"x":2.52400548696845,"y":0,"rotation":0,"id":5,"uid":null,"width":121.15226337448557,"height":28,"lockAspectRatio":false,"lockShape":false,"order":"auto","graphic":{"type":"Text","Text":{"tid":null,"valign":"middle","overflow":"none","vposition":"none","hposition":"none","html":"<p style=\"text-align:center;\"><span style=\"font-size: 12px; font-family: Arial; white-space: pre-wrap; text-decoration: none; line-height: 14px; color: rgb(0, 0, 0);\">Web Server(s)\n</span></p><p style=\"text-align:center;\"><span style=\"font-size: 12px; font-family: Arial; white-space: pre-wrap; text-decoration: none; line-height: 14px; color: rgb(0, 0, 0);\">(web_1)</span></p>","paddingLeft":2,"paddingRight":2,"paddingBottom":2,"paddingTop":2}},"children":null}],"linkMap":[]},{"x":176,"y":232.5,"rotation":0,"id":0,"uid":"com.gliffy.shape.basic.basic_v2.default.round_rectangle","width":100,"height":75,"lockAspectRatio":true,"lockShape":false,"order":1,"graphic":{"type":"Shape","Shape":{"tid":"com.gliffy.stencil.rectangle.basic_v2","strokeWidth":2,"strokeColor":"#3399FF","fillColor":"#FFFFFF","gradient":true,"dropShadow":false,"state":0,"shadowX":0,"shadowY":0,"opacity":1}},"children":[{"x":2,"y":0,"rotation":0,"id":2,"uid":null,"width":96,"height":28,"lockAspectRatio":false,"lockShape":false,"order":"auto","graphic":{"type":"Text","Text":{"tid":null,"valign":"middle","overflow":"none","vposition":"none","hposition":"none","html":"<p style=\"text-align:center;\"><span style=\"font-size: 12px; font-family: Arial; white-space: pre-wrap; text-decoration: none; line-height: 14px; color: rgb(0, 0, 0);\">Load Balancer\n</span></p><p style=\"text-align:center;\"><span style=\"font-size: 12px; font-family: Arial; white-space: pre-wrap; text-decoration: none; line-height: 14px; color: rgb(0, 0, 0);\">(lb)</span></p>","paddingLeft":2,"paddingRight":2,"paddingBottom":2,"paddingTop":2}},"children":null}],"linkMap":[]},{"x":160,"y":90,"rotation":0,"id":26,"uid":"com.gliffy.shape.basic.basic_v1.default.rectangle","width":520,"height":360,"lockAspectRatio":false,"lockShape":false,"order":0,"graphic":{"type":"Shape","Shape":{"tid":"com.gliffy.stencil.rectangle.basic_v1","strokeWidth":2,"strokeColor":"#333333","fillColor":"#FFFFFF","gradient":false,"dropShadow":false,"state":0,"shadowX":0,"shadowY":0,"opacity":1}},"children":[],"linkMap":[]}],"background":"#FFFFFF","width":700,"height":450,"maxWidth":5000,"maxHeight":5000,"nodeIndex":32,"autoFit":true,"exportBorder":false,"gridOn":true,"snapToGrid":true,"drawingGuidesOn":true,"pageBreaksOn":false,"printGridOn":false,"printPaper":"LETTER","printShrinkToFit":false,"printPortrait":true,"shapeStyles":{"com.gliffy.shape.basic.basic_v2.default":{"fill":"#FFFFFF","stroke":"#3399FF","gradient":true},"com.gliffy.shape.basic.basic_v1.default":{"fill":"#FFFFFF","stroke":"#333333","strokeWidth":2}},"lineStyles":{"global":{}},"textStyles":{},"themeData":null}}
Binary file
@@ -8,15 +8,16 @@ module Pvcglue
8
8
  Pvcglue::Db.configure_database_yml
9
9
  end
10
10
 
11
+ method_option :fast, :type => :boolean, :aliases => "-f"
12
+
11
13
  desc "push", "push"
12
14
 
13
15
  def push(file_name = nil)
14
16
  raise(Thor::Error, "Stage required.") if Pvcglue.cloud.stage_name.nil?
15
- pg_restore(self.class.remote, file_name)
17
+ pg_restore(self.class.remote, file_name, options[:fast])
16
18
  end
17
19
 
18
20
  desc "pull", "Pull copy of database from remote stage. Pass -f to exclude tables defined in the configuration file. If no tables are specified in the `excluded_db_tables` option, 'versions' will be used by default."
19
- method_option :fast, :type => :boolean, :aliases => "-f"
20
21
 
21
22
  def pull(file_name = nil)
22
23
  raise(Thor::Error, "Stage required.") if Pvcglue.cloud.stage_name.nil?
@@ -171,7 +172,7 @@ module Pvcglue
171
172
  end
172
173
  end
173
174
 
174
- def pg_restore(db, file_name)
175
+ def pg_restore(db, file_name, fast = false)
175
176
  Pvcglue.cloud.stage_name == 'production' && destroy_prod?
176
177
  file_name = self.class.file_helper(file_name)
177
178
 
@@ -180,10 +181,17 @@ module Pvcglue
180
181
  port = Pvcglue.cloud.port_in_context(:shell)
181
182
  user = 'deploy'
182
183
 
183
- cmd = %{scp -P #{port} #{file_name} #{user}@#{host}:#{file_name}}
184
+ # cmd = %{scp -P #{port} #{file_name} #{user}@#{host}:#{file_name}}
185
+ cmd = %{rsync -avhPe "ssh -p #{port}" --progress #{file_name} #{user}@#{host}:#{file_name}}
184
186
  unless system cmd
185
187
  raise(Thor::Error, "Error: #{$?}")
186
188
  end
189
+
190
+ unless fast
191
+ # Drop and recreate DB
192
+ Pvcglue::Packages.apply('postgresql-app-stage-db-drop'.to_sym, :build, Pvcglue.cloud.nodes_in_stage('db'))
193
+ Pvcglue::Packages.apply('postgresql-app-stage-conf'.to_sym, :build, Pvcglue.cloud.nodes_in_stage('db'))
194
+ end
187
195
  end
188
196
 
189
197
  cmd = "pg_restore --verbose --clean --no-acl --no-owner -h #{db.host} -p #{db.port}"
@@ -38,6 +38,45 @@ package 'postgresql-app-stage-conf' do
38
38
  end
39
39
  end
40
40
 
41
+ package 'postgresql-app-stage-db-drop' do
42
+ apply do
43
+ username = Pvcglue.cloud.stage_env['DB_USER_POSTGRES_USERNAME']
44
+ db_name = username # just for clarity in later statements. This also must match database.yml.
45
+
46
+ sql = <<-SQL
47
+ UPDATE pg_catalog.pg_database
48
+ SET datallowconn=false WHERE datname='#{db_name}'
49
+ SQL
50
+ run(%Q[sudo -u postgres psql -c "#{sql}"])
51
+
52
+ # To simplify logic, try it with both versions.
53
+ # version >= 9.2
54
+ sql = <<-SQL
55
+ SELECT pg_terminate_backend(pg_stat_activity.pid)
56
+ FROM pg_stat_activity
57
+ WHERE pg_stat_activity.datname = '#{db_name}';
58
+ SQL
59
+ run(%Q[sudo -u postgres psql -c "#{sql}"])
60
+
61
+ # #puts "version < 9.2"
62
+ sql = <<-SQL
63
+ SELECT pg_terminate_backend(pg_stat_activity.procpid)
64
+ FROM pg_stat_activity
65
+ WHERE pg_stat_activity.datname = '#{db_name}';
66
+ SQL
67
+ run(%Q[sudo -u postgres psql -c "#{sql}"])
68
+
69
+ run(%Q[sudo -u postgres psql -c "DROP DATABASE #{db_name}"])
70
+
71
+ sql = <<-SQL
72
+ UPDATE pg_catalog.pg_database
73
+ SET datallowconn=true WHERE datname='#{db_name}'
74
+ SQL
75
+ run(%Q[sudo -u postgres psql -c "#{sql}"])
76
+
77
+ end
78
+ end
79
+
41
80
  package 'postgresql-root-password' do
42
81
  apply do
43
82
  # TODO: Use this to implement setting of the root password
@@ -1,3 +1,3 @@
1
1
  module Pvcglue
2
- VERSION = "0.1.24"
2
+ VERSION = "0.1.25"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pvcglue
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.24
4
+ version: 0.1.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Lyric
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-03 00:00:00.000000000 Z
11
+ date: 2015-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -218,6 +218,8 @@ files:
218
218
  - README.md
219
219
  - Rakefile
220
220
  - bin/pvc
221
+ - images/pvcglue.gliffy
222
+ - images/pvcglue.png
221
223
  - lib/pvcglue.rb
222
224
  - lib/pvcglue/all_the_things.rb
223
225
  - lib/pvcglue/bootstrap.rb
@@ -298,7 +300,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
298
300
  version: '0'
299
301
  requirements: []
300
302
  rubyforge_project:
301
- rubygems_version: 2.4.3
303
+ rubygems_version: 2.4.6
302
304
  signing_key:
303
305
  specification_version: 4
304
306
  summary: PVC_Glue summary