pvcglue 0.9.1 → 0.9.2
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 +26 -19
- data/bin/pvc +31 -7
- data/lib/pvcglue.rb +43 -5
- data/lib/pvcglue/cloud.rb +8 -0
- data/lib/pvcglue/configuration.rb +5 -0
- data/lib/pvcglue/templates/capfile.erb +2 -1
- data/lib/pvcglue/templates/deploy.rb.erb +0 -1
- data/lib/pvcglue/templates/stage-deploy.rb.erb +1 -0
- data/lib/pvcglue/version.rb +1 -1
- 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: bdc792eaea2d67f856dd33bf0823c6b46b984c0e
|
4
|
+
data.tar.gz: db46f4572b3151204063f5d9d7f30577c8cc7ed8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 280cb61ab704549c9d4b981836046afa591ce7edcbd4ba9c40a4ee0fa7c57f999dd2b60b4a4032fed59d37d1d8a5d94ed0919ea7602a958fa82ba750b2214683
|
7
|
+
data.tar.gz: dc5f5edf764add9e331fd25aa4bf696c0d03d417062645e79fb887abe1bc7423c9159d4926ebee784d4ed479689d813d5168ed998e8ff07e15497b0650f879bf
|
data/README.md
CHANGED
@@ -1,14 +1,10 @@
|
|
1
|
-
###
|
2
|
-
There is an issue with gem 'tilt', '>=2.0.0', use
|
3
|
-
|
4
|
-
gem 'tilt', '<2.0.0'
|
5
|
-
|
6
|
-
in your project's Gemfile, as a temporary workaournd.
|
7
1
|
# PVC Glue
|
2
|
+
###Pico Virtual Cloud
|
3
|
+
The "glue" that creates a tightly integrated (and very small) virtual cloud for your Rails applications.
|
8
4
|
|
9
|
-
|
5
|
+
PVC Glue is an cloud application manager for Rails applications using your own (virtual) servers.
|
10
6
|
|
11
|
-
|
7
|
+
PVC Glue was developed as a professional grade replacement for Heroku (and others).
|
12
8
|
|
13
9
|

|
14
10
|
|
@@ -16,25 +12,36 @@ Currently supported stack:
|
|
16
12
|
|
17
13
|
* SSL support: none, manual and automatic with Let's Encrypt
|
18
14
|
* Ubuntu 16.04 LTS
|
19
|
-
* Provision servers automatically on Digital Ocean (and Linode)
|
15
|
+
* Provision servers automatically on Digital Ocean (and Linode*)
|
20
16
|
* No need to install anything on servers first (you just need SSH access)
|
21
|
-
* Ruby >= 1.9 (multiple versions supported on same server)
|
17
|
+
* Ruby >= 1.9 (multiple versions supported on same server!)
|
22
18
|
* Rails >= 3.2
|
23
19
|
* RVM
|
24
20
|
* Postgresql 9.6
|
25
21
|
* Nginx
|
26
|
-
* Passenger
|
27
|
-
* Memcached
|
28
|
-
* Redis
|
22
|
+
* Phusion Passenger (>= 5.x)
|
23
|
+
* Memcached*
|
24
|
+
* Redis*
|
25
|
+
* Designed to easily support multiple staging environments
|
29
26
|
|
30
27
|
Workers:
|
31
28
|
|
32
|
-
* Delayed Job
|
33
|
-
* Rescue
|
29
|
+
* Delayed Job*
|
30
|
+
* Rescue*
|
31
|
+
|
32
|
+
(* Coming soon)
|
33
|
+
|
34
|
+
# Quick Start
|
35
|
+
|
36
|
+
##New developer starting to working a application with PVC Glue already set up
|
37
|
+
|
38
|
+
For each development machine used, the "manager" must be configured once.
|
39
|
+
|
40
|
+
pvc manager configure
|
34
41
|
|
35
42
|
# This is a work in progress
|
36
43
|
|
37
|
-
Although this project is being used on productions sites, this should be considered "
|
44
|
+
Although this project is being used on productions sites, this should be considered "Beta" code, as things my change without notice until version 1.0. :)
|
38
45
|
|
39
46
|
# First Time Set Up for Existing Project
|
40
47
|
|
@@ -170,12 +177,12 @@ https://github.com/radar/guides/blob/master/gem-development.md#releasing-the-gem
|
|
170
177
|
Add these lines to your application's Gemfile. `dotenv-rails` must be listed first!
|
171
178
|
|
172
179
|
################# Must be the first Gem ###################
|
173
|
-
gem 'dotenv-rails'
|
180
|
+
gem 'dotenv-rails'
|
174
181
|
################# Must be the first Gem ###################
|
175
182
|
|
176
|
-
Then add these lines to your application's Gemfile,
|
183
|
+
Then add these lines to your application's Gemfile, wherever you like (usually at the end):
|
177
184
|
|
178
|
-
gem 'pvcglue', "~> 0.
|
185
|
+
gem 'pvcglue', "~> 0.9.2", :group => :development
|
179
186
|
gem 'pvcglue_dbutils', "~> 0.5.3"
|
180
187
|
|
181
188
|
And then execute:
|
data/bin/pvc
CHANGED
@@ -5,12 +5,36 @@ require 'benchmark'
|
|
5
5
|
# Allow use of Capistrano style environment syntax and convert to 'standard' syntax
|
6
6
|
# Example: `pvc production bootstrap` ==> `pvc bootstrap --stage=production`
|
7
7
|
# TODO: refactor to use a list of user specified environments
|
8
|
-
if ARGV.count >= 2 && %w[local vmtest test alpha beta gamma delta preview production staging all].include?(ARGV[0])
|
9
|
-
ARGV[0], ARGV[1] = ARGV[1], "--stage=#{ARGV[0]}"
|
10
|
-
end
|
11
8
|
|
12
9
|
Pvcglue.logger.info('Starting up...')
|
13
|
-
Pvcglue.logger.
|
14
|
-
#
|
15
|
-
|
16
|
-
Pvcglue.logger.
|
10
|
+
# Pvcglue.logger.info("----- Done #{Benchmark.measure { Pvcglue::CLI.start }}")
|
11
|
+
# ap Pvcglue.instance_variables
|
12
|
+
def capistrano_style_environment
|
13
|
+
Pvcglue.logger.debug { ARGV.inspect }
|
14
|
+
if ARGV.count >= 2
|
15
|
+
if %w[local vmtest test alpha beta gamma delta preview production staging].include?(ARGV[0])
|
16
|
+
ARGV[0], ARGV[1] = ARGV[1], "--stage=#{ARGV[0]}"
|
17
|
+
Pvcglue.logger.debug { ARGV.inspect }
|
18
|
+
Pvcglue::CLI.start
|
19
|
+
elsif ARGV[0] == 'all'
|
20
|
+
Pvcglue.logger.error('Not supported, yet. :(')
|
21
|
+
elsif ARGV[0].include?(',')
|
22
|
+
stages = ARGV[0].split(',')
|
23
|
+
original_argv_1 = ARGV[1]
|
24
|
+
stages.each do |stage|
|
25
|
+
# puts "********** Stage: #{stage} **********"
|
26
|
+
ARGV[0] = stage
|
27
|
+
Pvcglue.logger.debug { ARGV.inspect }
|
28
|
+
# Pvcglue.reset!
|
29
|
+
puts `pvc #{ARGV.join(' ')}`
|
30
|
+
# Pvcglue::CLI.start
|
31
|
+
end
|
32
|
+
else
|
33
|
+
Pvcglue::CLI.start
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
Pvcglue.logger.info("----- Done #{Benchmark.measure { capistrano_style_environment }}")
|
39
|
+
|
40
|
+
|
data/lib/pvcglue.rb
CHANGED
@@ -33,6 +33,44 @@ require 'pry'
|
|
33
33
|
# pvc manager bootstrap --cloud_manager_override=local_cloud.pvcglue.toml --save_before_upload=save --verbose
|
34
34
|
|
35
35
|
module Pvcglue
|
36
|
+
# def self.reset!
|
37
|
+
# ap Pvcglue.instance_variables
|
38
|
+
# ap Pvcglue.class_variables
|
39
|
+
#
|
40
|
+
# raise("Now working!")
|
41
|
+
# Pvcglue.constants.select { |c| Pvcglue.const_get(c).is_a? Class }.each do |pvc_class|
|
42
|
+
# pvc_class.instance_variables.each do |var|
|
43
|
+
# pvc_class.remove_instance_variable(var)
|
44
|
+
# end
|
45
|
+
#
|
46
|
+
# if pvc_class.respond_to?(:class_variables)
|
47
|
+
# pvc_class.class_variables.each do |var|
|
48
|
+
# pvc_class.remove_class_variable(var)
|
49
|
+
# end
|
50
|
+
# end
|
51
|
+
# end
|
52
|
+
#
|
53
|
+
# Pvcglue::Packages.constants.select { |c| Pvcglue::Packages.const_get(c).is_a? Class }.each do |pvc_class|
|
54
|
+
# pvc_class.instance_variables.each do |var|
|
55
|
+
# pvc_class.remove_instance_variable(var)
|
56
|
+
# end
|
57
|
+
# if pvc_class.respond_to?(:class_variables)
|
58
|
+
# pvc_class.class_variables.each do |var|
|
59
|
+
# pvc_class.remove_class_variable(var)
|
60
|
+
# end
|
61
|
+
# end
|
62
|
+
# end
|
63
|
+
#
|
64
|
+
# self.instance_variables.each do |var|
|
65
|
+
# # ap var.inspect
|
66
|
+
# # ap self.instance_variable_get(var)
|
67
|
+
# # self.instance_variable_set var, nil
|
68
|
+
# self.remove_instance_variable(var)
|
69
|
+
# # ap self.instance_variable_get(var)
|
70
|
+
#
|
71
|
+
# end
|
72
|
+
# end
|
73
|
+
|
36
74
|
mattr_accessor :command_line_options do
|
37
75
|
{}
|
38
76
|
end
|
@@ -41,14 +79,14 @@ module Pvcglue
|
|
41
79
|
|
42
80
|
logger = Logger.new(STDOUT)
|
43
81
|
# DEBUG < INFO < WARN < ERROR < FATAL < UNKNOWN
|
44
|
-
if ARGV.detect {|arg| arg.downcase == '--debug' || arg.downcase == '--verbose'}
|
45
|
-
logger.level = Logger::DEBUG
|
82
|
+
if ARGV.detect { |arg| arg.downcase == '--debug' || arg.downcase == '--verbose' }
|
83
|
+
logger.level = Logger::DEBUG
|
46
84
|
elsif ARGV.detect { |arg| arg.downcase == '--quiet' }
|
47
|
-
logger.level = Logger::WARN
|
85
|
+
logger.level = Logger::WARN
|
48
86
|
elsif ARGV.detect { |arg| arg.downcase == '--info' }
|
49
|
-
logger.level = Logger::INFO
|
87
|
+
logger.level = Logger::INFO
|
50
88
|
else
|
51
|
-
logger.level = Logger::INFO
|
89
|
+
logger.level = Logger::INFO
|
52
90
|
end
|
53
91
|
|
54
92
|
logger.formatter = proc do |severity, datetime, progname, msg|
|
data/lib/pvcglue/cloud.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# TODO: Remove these requirements, is possible.
|
1
2
|
require "active_support"
|
2
3
|
require "active_support/core_ext" # for `with_indifferent_access`
|
3
4
|
|
@@ -13,6 +14,8 @@ module Pvcglue
|
|
13
14
|
attr_accessor :port_in_node_context
|
14
15
|
# attr_accessor :stage_secrets
|
15
16
|
|
17
|
+
|
18
|
+
|
16
19
|
def data
|
17
20
|
::Pvcglue::Manager.initialize_cloud_data unless @data
|
18
21
|
@data
|
@@ -332,6 +335,11 @@ module Pvcglue
|
|
332
335
|
project[:gems] || {}
|
333
336
|
end
|
334
337
|
|
338
|
+
def whenever_gem_installed?
|
339
|
+
data = File.read(Pvcglue.configuration.gemfile_file_name)
|
340
|
+
data =~ /^\s*gem\s+['"]whenever['"]/
|
341
|
+
end
|
342
|
+
|
335
343
|
def db_rebuild
|
336
344
|
!!stage[:db_rebuild]
|
337
345
|
end
|
@@ -122,6 +122,7 @@ module Pvcglue
|
|
122
122
|
end
|
123
123
|
|
124
124
|
def find_app_name
|
125
|
+
# TODO: Just use something like `rails runner 'Rails.application.class.parent'` and then cache it to a temporary file
|
125
126
|
# try known files...anyone know a better way, without loading Rails?
|
126
127
|
rack_up = File.join(application_dir, 'config.ru')
|
127
128
|
app_name = underscore($1) if File.exists?(rack_up) && File.read(rack_up) =~ /^run (.*)::/
|
@@ -168,6 +169,10 @@ module Pvcglue
|
|
168
169
|
File.join(application_dir, '.ruby-version')
|
169
170
|
end
|
170
171
|
|
172
|
+
def gemfile_file_name
|
173
|
+
File.join(application_dir, 'Gemfile')
|
174
|
+
end
|
175
|
+
|
171
176
|
def ruby_version
|
172
177
|
File.read(ruby_version_file_name).strip
|
173
178
|
end
|
@@ -16,7 +16,8 @@ require 'capistrano/rails/assets'
|
|
16
16
|
<% end %>
|
17
17
|
|
18
18
|
require 'capistrano/rails/migrations'
|
19
|
-
|
19
|
+
|
20
|
+
<% if Pvcglue.cloud.whenever_gem_installed? %>
|
20
21
|
set :whenever_identifier, ->{ "#{fetch(:application)}_#{fetch(:stage)}" }
|
21
22
|
require 'whenever/capistrano'
|
22
23
|
<% end %>
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# This is a generated file. Do not modify...or else! :)
|
2
2
|
|
3
|
+
set :tmp_dir, '/tmp/ <%= Pvcglue.cloud.app_and_stage_name %> '
|
3
4
|
set :stage, :<%= Pvcglue.cloud.stage_name %>
|
4
5
|
set :rails_env, :<%= Pvcglue.cloud.stage_name %> # workaround for RAILS_ENV= being blank in delayed job tasks
|
5
6
|
set :deploy_to, '<%= Pvcglue.cloud.deploy_to_app_dir %>'
|
data/lib/pvcglue/version.rb
CHANGED
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.9.
|
4
|
+
version: 0.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- T. Andrew Lyric
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|