capistrano-uberspace 1.0.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 +7 -0
- data/.gitignore +17 -0
- data/Gemfile +3 -0
- data/LICENSE +22 -0
- data/README.md +98 -0
- data/Rakefile +2 -0
- data/capistrano-uberspace.gemspec +30 -0
- data/lib/capistrano-uberspace.rb +0 -0
- data/lib/capistrano/tasks/uberspace.rake +148 -0
- data/lib/capistrano/tasks/uberspace/mysql.rake +34 -0
- data/lib/capistrano/tasks/uberspace/postgresql.rake +59 -0
- data/lib/capistrano/tasks/uberspace/sqlite3.rake +21 -0
- data/lib/capistrano/uberspace.rb +10 -0
- data/lib/capistrano/uberspace/defaults.rb +45 -0
- data/lib/capistrano/uberspace/dsl.rb +1 -0
- data/lib/capistrano/uberspace/dsl/paths.rb +11 -0
- data/lib/capistrano/uberspace/mysql.rb +1 -0
- data/lib/capistrano/uberspace/postgresql.rb +1 -0
- data/lib/capistrano/uberspace/sqlite3.rb +1 -0
- data/lib/patches/sshkit/connection_pool.rb +18 -0
- metadata +162 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4c2d875c084e86b2d9db6d56bd941c06f0beda8e
|
4
|
+
data.tar.gz: 49ee6fc7b0a41590ebc6b8f67762a8eb2da791ba
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7a8c406bb5d312fdd51aaa6e131e4157ef9bf62cbbd0b3f9d023f9de665c923dc0355151292fb92d02fced31f68fc7f19b926fe24b95800a7447877e664e8fc9
|
7
|
+
data.tar.gz: 2ba85a422a1f039fd6644c3af6875c6888999d04a2f4bebb92ac992630ab3886f6d2bcd48c47885f614971cd7eaedc2dfc891430bbd9bf4eb539aff0b2125276
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Philipp Tessenow
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
# Capistrano::Uberspace
|
2
|
+
|
3
|
+
Deploy your Rails App to [uberspace](http://uberspace.de) with Capistrano 3.
|
4
|
+
|
5
|
+
Has support for MySQL, Potsgresql, and sqlite3 databases. Runs your app with any ruby version available at your uberpace.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'capistrano', '~> 3.4.0'
|
13
|
+
gem 'capistrano-uberspace', github: 'tessi/capistrano-uberspace'
|
14
|
+
```
|
15
|
+
|
16
|
+
And then execute:
|
17
|
+
|
18
|
+
$ bundle
|
19
|
+
|
20
|
+
In your `deploy.rb` file specify some app properties:
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
set :application, 'MyGreatApp'
|
24
|
+
set :repo_url, 'git@github.com:tessi.my_great_app.git'
|
25
|
+
```
|
26
|
+
|
27
|
+
Also specify how to reach the uberspace server in your stage definition (e.g. `production.rb`):
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
server 'your-host.uberspace.de',
|
31
|
+
user: 'uberspace-user',
|
32
|
+
roles: [:app, :web, :cron, :db],
|
33
|
+
primary: true,
|
34
|
+
ssh_options: {
|
35
|
+
keys: %w{~/.ssh/your_uberspace_private_key},
|
36
|
+
forward_agent: true,
|
37
|
+
auth_methods: %w(publickey)
|
38
|
+
}
|
39
|
+
|
40
|
+
set :user, 'uberspace-user'
|
41
|
+
set :branch, :production
|
42
|
+
set :domain, 'my-subdomain.example.tld'
|
43
|
+
```
|
44
|
+
|
45
|
+
Be sure to [setup the ssh-connection to your uberspace](https://wiki.uberspace.de/system:ssh#login_mit_ssh-schluessel1) and make sure that your uberspace is able to checkout your repository.
|
46
|
+
|
47
|
+
Require the following parts in your `Capfile`:
|
48
|
+
|
49
|
+
```ruby
|
50
|
+
require 'capistrano/bundler'
|
51
|
+
require 'capistrano/rails'
|
52
|
+
require 'capistrano/rails/assets'
|
53
|
+
require 'capistrano/rails/migrations'
|
54
|
+
require 'capistrano/uberspace'
|
55
|
+
# in the following line replace <database> with mysql, postgresql, or sqlite3
|
56
|
+
require 'capistrano/uberspace/<database>'
|
57
|
+
```
|
58
|
+
|
59
|
+
Please bundle the appropriate database-gem in your `Gemfile`.
|
60
|
+
|
61
|
+
|
62
|
+
## Usage
|
63
|
+
|
64
|
+
Execute `bundle exec cap deploy <stage>` to deploy to your uberspace.
|
65
|
+
|
66
|
+
Configurable options:
|
67
|
+
|
68
|
+
```ruby
|
69
|
+
set :ruby_version, '2.2' # default is '2.2', can be set to every ruby version supported by uberspace.
|
70
|
+
set :domain, nil # if you want to deploy your app as a subdomain, configure it here. Use the full URI. E.g. my-custom.example.tld
|
71
|
+
set :add_www_domain, true # default: true; set this to false if you do not want to also use your subdomain with prefixed www.
|
72
|
+
```
|
73
|
+
|
74
|
+
Useful tasks:
|
75
|
+
|
76
|
+
```ruby
|
77
|
+
deploy:start # starts the server
|
78
|
+
deploy:stop # stops the server
|
79
|
+
deploy:restart # restarts the server (automatically done after deploy)
|
80
|
+
deploy:status # shows the current status of the deamon which runs passenger
|
81
|
+
```
|
82
|
+
|
83
|
+
## Contributing
|
84
|
+
|
85
|
+
1. Fork it
|
86
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
87
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
88
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
89
|
+
5. Create new Pull Request
|
90
|
+
|
91
|
+
## Thanks
|
92
|
+
|
93
|
+
This gem was inspired by the awesome [uberspacify](https://github.com/yeah/uberspacify) gem, which lets you deploy your Rails app to uberspace with Capistrano 2.
|
94
|
+
|
95
|
+
## License
|
96
|
+
|
97
|
+
This project is licensed under the MIT License. See the `LICENSE` file for details.
|
98
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
Gem::Specification.new do |gem|
|
6
|
+
gem.name = 'capistrano-uberspace'
|
7
|
+
gem.version = '1.0.0'
|
8
|
+
gem.authors = ['Philipp Tessenow']
|
9
|
+
gem.email = ['philipp@tessenow.org']
|
10
|
+
gem.description = %q{uberspace support for your rails app for Capistrano 3.x}
|
11
|
+
gem.summary = %q{uberspace support for your rails app for Capistrano 3.x}
|
12
|
+
gem.homepage = 'https://github.com/tessi/capistrano-uberspace'
|
13
|
+
gem.license = 'MIT'
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ['lib']
|
19
|
+
|
20
|
+
gem.add_dependency 'capistrano', '~> 3.4.0'
|
21
|
+
gem.add_dependency 'capistrano-rails'
|
22
|
+
gem.add_dependency 'capistrano-bundler'
|
23
|
+
|
24
|
+
# dependencies for passenger on Uberspace
|
25
|
+
gem.add_dependency 'passenger', '~> 5.0'
|
26
|
+
gem.add_dependency 'rack', '~>1.4'
|
27
|
+
|
28
|
+
gem.add_development_dependency 'bundler', '>= 1.3'
|
29
|
+
gem.add_development_dependency 'rake'
|
30
|
+
end
|
File without changes
|
@@ -0,0 +1,148 @@
|
|
1
|
+
namespace :uberspace do
|
2
|
+
task :check do
|
3
|
+
end
|
4
|
+
before :'deploy:check:linked_files', :'uberspace:check'
|
5
|
+
|
6
|
+
task :setup_gemrc do
|
7
|
+
gemrc = <<-EOF
|
8
|
+
gem: --user-install --no-rdoc --no-ri
|
9
|
+
EOF
|
10
|
+
|
11
|
+
on roles fetch(:uberspace_roles) do
|
12
|
+
upload! StringIO.new(gemrc), "#{uberspace_home}/.gemrc"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
after :'uberspace:check', :'uberspace:setup_gemrc'
|
16
|
+
|
17
|
+
task :install_bundler do
|
18
|
+
on roles fetch(:uberspace_roles) do
|
19
|
+
with fetch(:uberspace_env_variables, {}) do
|
20
|
+
within(uberspace_home) do
|
21
|
+
execute :gem, 'install bundler'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
after :'uberspace:setup_gemrc', :'uberspace:install_bundler'
|
27
|
+
|
28
|
+
def passenger_port
|
29
|
+
@passenger_port ||= capture(:cat, "#{shared_path}/.passenger-port")
|
30
|
+
end
|
31
|
+
|
32
|
+
task :setup_passenger_port do
|
33
|
+
on roles fetch(:uberspace_roles) do
|
34
|
+
# find free and available port
|
35
|
+
unless test "[ -f #{shared_path}/.passenger-port ]"
|
36
|
+
port = capture('python -c \'import socket; s=socket.socket(); s.bind(("", 0)); print(s.getsockname()[1]); s.close()\'')
|
37
|
+
execute :mkdir, "-p #{shared_path}"
|
38
|
+
upload! StringIO.new(port), "#{shared_path}/.passenger-port"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
after :'uberspace:check', :'uberspace:setup_passenger_port'
|
43
|
+
|
44
|
+
task :setup_svscan do
|
45
|
+
on roles fetch(:uberspace_roles) do
|
46
|
+
execute 'test -d ~/service || uberspace-setup-svscan; echo 0'
|
47
|
+
end
|
48
|
+
end
|
49
|
+
after :'uberspace:check', :'uberspace:setup_svscan'
|
50
|
+
|
51
|
+
|
52
|
+
task :setup_secrets do
|
53
|
+
on roles fetch(:uberspace_roles) do
|
54
|
+
secrets = <<-EOF
|
55
|
+
#{fetch :passenger_environment}:
|
56
|
+
secret_key_base: #{SecureRandom.hex 40}
|
57
|
+
EOF
|
58
|
+
|
59
|
+
execute :mkdir, "-p #{shared_path}/config"
|
60
|
+
unless test "[ -f #{shared_path}/config/secrets.yml ]"
|
61
|
+
upload! StringIO.new(secrets), "#{shared_path}/config/secrets.yml"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
after :'uberspace:check', :'uberspace:setup_secrets'
|
66
|
+
|
67
|
+
task :setup_daemon do
|
68
|
+
on roles fetch(:uberspace_roles) do
|
69
|
+
daemon_script = <<-EOF
|
70
|
+
#!/bin/bash
|
71
|
+
export HOME=#{uberspace_home}
|
72
|
+
#{fetch(:uberspace_env_variables).map do |k,v|
|
73
|
+
"export #{k}=#{v}"
|
74
|
+
end.join("/n")}
|
75
|
+
cd #{fetch :deploy_to}/current
|
76
|
+
exec bundle exec passenger start -p #{passenger_port} -e #{fetch :passenger_environment} 2>&1
|
77
|
+
EOF
|
78
|
+
|
79
|
+
log_script = <<-EOF
|
80
|
+
#!/bin/sh
|
81
|
+
exec multilog t ./main
|
82
|
+
EOF
|
83
|
+
|
84
|
+
execute "mkdir -p #{uberspace_home}/etc/run-rails-#{fetch :application}"
|
85
|
+
execute "mkdir -p #{uberspace_home}/etc/run-rails-#{fetch :application}/log"
|
86
|
+
upload! StringIO.new(daemon_script), "#{uberspace_home}/etc/run-rails-#{fetch :application}/run"
|
87
|
+
upload! StringIO.new(log_script), "#{uberspace_home}/etc/run-rails-#{fetch :application}/log/run"
|
88
|
+
execute "chmod +x #{uberspace_home}/etc/run-rails-#{fetch :application}/run"
|
89
|
+
execute "chmod +x #{uberspace_home}/etc/run-rails-#{fetch :application}/log/run"
|
90
|
+
execute "ln -nfs #{uberspace_home}/etc/run-rails-#{fetch :application} #{uberspace_home}/service/rails-#{fetch :application}"
|
91
|
+
end
|
92
|
+
end
|
93
|
+
after :'deploy:updated', :'uberspace:setup_daemon'
|
94
|
+
|
95
|
+
task :setup_apache_reverse_proxy do
|
96
|
+
on roles fetch(:uberspace_roles) do
|
97
|
+
htaccess = <<-EOF
|
98
|
+
RewriteEngine On
|
99
|
+
RewriteBase /
|
100
|
+
RewriteRule ^(.*)$ http://localhost:#{passenger_port}/$1 [P]
|
101
|
+
EOF
|
102
|
+
|
103
|
+
path = fetch(:domain) ? "/var/www/virtual/#{fetch :user}/#{fetch :domain}" : "/var/www/virtual/#{fetch :user}/html"
|
104
|
+
execute "mkdir -p #{path}"
|
105
|
+
upload! StringIO.new(htaccess), "#{path}/.htaccess"
|
106
|
+
execute "chmod +r #{path}/.htaccess"
|
107
|
+
|
108
|
+
if fetch(:domain)
|
109
|
+
execute "uberspace-add-domain -qwd #{fetch :domain} ; true"
|
110
|
+
if fetch(:add_www_domain)
|
111
|
+
wwwpath = "/var/www/virtual/#{fetch :user}/www.#{fetch :domain}"
|
112
|
+
execute "ln -nfs #{path} #{wwwpath}"
|
113
|
+
execute "uberspace-add-domain -qwd www.#{fetch :domain} ; true"
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
after :'uberspace:check', :'uberspace:setup_apache_reverse_proxy'
|
119
|
+
|
120
|
+
end
|
121
|
+
|
122
|
+
namespace :deploy do
|
123
|
+
task :start do
|
124
|
+
on roles fetch(:uberspace_roles) do
|
125
|
+
execute "svc -u #{uberspace_home}/service/rails-#{fetch :application}"
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
task :stop do
|
130
|
+
on roles fetch(:uberspace_roles) do
|
131
|
+
execute "svc -d #{uberspace_home}/service/rails-#{fetch :application}"
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
task :restart do
|
136
|
+
on roles fetch(:uberspace_roles) do
|
137
|
+
execute "svc -du #{uberspace_home}/service/rails-#{fetch :application}"
|
138
|
+
end
|
139
|
+
end
|
140
|
+
after :publishing, :'deploy:restart'
|
141
|
+
|
142
|
+
desc "Displays status information of the application."
|
143
|
+
task :status do
|
144
|
+
on roles fetch(:uberspace_roles) do
|
145
|
+
execute "svstat #{uberspace_home}/service/rails-#{fetch :application}"
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
namespace :uberspace do
|
2
|
+
namespace :mysql do
|
3
|
+
task :setup_database_and_config do
|
4
|
+
on roles fetch(:uberspace_roles) do
|
5
|
+
my_cnf = capture('cat ~/.my.cnf')
|
6
|
+
config = {}
|
7
|
+
stages.each do |env|
|
8
|
+
config[env] = {
|
9
|
+
'adapter' => 'mysql2',
|
10
|
+
'encoding' => 'utf8',
|
11
|
+
'database' => "#{fetch :user}_rails_#{fetch :application}_#{env}",
|
12
|
+
'host' => 'localhost'
|
13
|
+
}
|
14
|
+
|
15
|
+
my_cnf.match(/^user=(\w+)/)
|
16
|
+
config[env]['username'] = $1
|
17
|
+
|
18
|
+
my_cnf.match(/^password=(\w+)/)
|
19
|
+
config[env]['password'] = $1
|
20
|
+
|
21
|
+
my_cnf.match(/^port=(\d+)/)
|
22
|
+
config[env]['port'] = $1.to_i
|
23
|
+
|
24
|
+
execute "mysql -e 'CREATE DATABASE IF NOT EXISTS #{config[env]['database']} CHARACTER SET utf8 COLLATE utf8_general_ci;'"
|
25
|
+
end
|
26
|
+
|
27
|
+
execute "mkdir -p #{shared_path}/config"
|
28
|
+
|
29
|
+
upload! StringIO.new(config.to_yaml), "#{shared_path}/config/database.yml"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
after :'uberspace:check', :'uberspace:mysql:setup_database_and_config'
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
namespace :uberspace do
|
2
|
+
namespace :postgresql do
|
3
|
+
task :setup_database_and_config do
|
4
|
+
on roles fetch(:uberspace_roles) do
|
5
|
+
unless test "[ -f #{uberspace_home}/.pgpass ]"
|
6
|
+
execute 'uberspace-setup-postgresql'
|
7
|
+
# we have to re-login to make psql work
|
8
|
+
self.class.pool.close_all_connections
|
9
|
+
# setup backups, see: https://wiki.uberspace.de/database:postgresql#backup
|
10
|
+
execute 'uberspace-setup-postgresql-backup'
|
11
|
+
end
|
12
|
+
|
13
|
+
# Config file comes in the following format:
|
14
|
+
# hostname:port:database:username:password
|
15
|
+
# /home/username/tmp:*:*:username:password
|
16
|
+
pg_config = capture('cat ~/.pgpass')
|
17
|
+
pg_config = pg_config.sub(/^.*\n/, '').split(':')
|
18
|
+
# pg_config = [
|
19
|
+
# [0] => hostname
|
20
|
+
# [1] => port
|
21
|
+
# [2] => database
|
22
|
+
# [3] => username
|
23
|
+
# [4] => password
|
24
|
+
# ]
|
25
|
+
config = {}
|
26
|
+
stages.each do |env|
|
27
|
+
config[env] = {
|
28
|
+
'adapter' => 'postgresql',
|
29
|
+
'encoding' => 'utf8',
|
30
|
+
'database' => "#{fetch :user}_rails_#{fetch :application}_#{env}",
|
31
|
+
'host' => "#{uberspace_home}/tmp"
|
32
|
+
}
|
33
|
+
config[env]['username'] = pg_config[3]
|
34
|
+
config[env]['password'] = pg_config[4]
|
35
|
+
|
36
|
+
unless test "psql -l | grep #{config[env]['database']}"
|
37
|
+
execute :createdb, config[env]['database']
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
execute "mkdir -p #{shared_path}/config"
|
42
|
+
|
43
|
+
upload! StringIO.new(config.to_yaml), "#{shared_path}/config/database.yml"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
after :'uberspace:check', :'uberspace:postgresql:setup_database_and_config'
|
47
|
+
|
48
|
+
task :setup_pg_gem do
|
49
|
+
on roles fetch(:uberspace_roles) do
|
50
|
+
with fetch(:uberspace_env_variables, {}) do
|
51
|
+
within(uberspace_home) do
|
52
|
+
execute :bundle, 'config build.pg --with-pg-config=/package/host/localhost/postgresql-${POSTGRESVERSION}/bin/pg_config '
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
before :'bundler:install', :'uberspace:postgresql:setup_pg_gem'
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
namespace :uberspace do
|
2
|
+
namespace :sqlite3 do
|
3
|
+
task :setup_database_and_config do
|
4
|
+
on roles fetch(:uberspace_roles) do
|
5
|
+
config = {}
|
6
|
+
stages.each do |env|
|
7
|
+
config[env] = {
|
8
|
+
'adapter' => 'sqlite3',
|
9
|
+
'pool' => 5,
|
10
|
+
'database' => "#{shared_path}/#{env}.sqlite3",
|
11
|
+
'timeout' => 5000
|
12
|
+
}
|
13
|
+
end
|
14
|
+
|
15
|
+
execute "mkdir -p #{shared_path}/config"
|
16
|
+
upload! StringIO.new(config.to_yaml), "#{shared_path}/config/database.yml"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
after :'uberspace:check', :'uberspace:sqlite3:setup_database_and_config'
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
set :ssh_options, { forward_agent: true }
|
2
|
+
set :pty, true
|
3
|
+
set :deploy_to, -> { "/var/www/virtual/#{fetch :user}/apps/#{fetch :application}" }
|
4
|
+
set :deploy_via, :remote_cache
|
5
|
+
set :use_sudo, false
|
6
|
+
|
7
|
+
# set :bundle_path, -> { '~/.gem' }
|
8
|
+
set :bundle_flags, '--deployment'
|
9
|
+
|
10
|
+
set :domain, nil
|
11
|
+
set :add_www_domain, -> { !!fetch(:domain) }
|
12
|
+
set :passenger_environment, -> { fetch(:rails_env) || fetch(:stage) }
|
13
|
+
|
14
|
+
set :uberspace_roles, :all
|
15
|
+
set :extra_env_variables, fetch(:extra_env_variables) || {}
|
16
|
+
|
17
|
+
set :ruby_version, fetch(:ruby_version, '2.2')
|
18
|
+
|
19
|
+
set :gem_path, (lambda do
|
20
|
+
begin
|
21
|
+
gempath = ''
|
22
|
+
on roles(:all) do
|
23
|
+
gempath = capture "PATH=#{fetch :ruby_path}:$PATH ruby -e 'require \"rubygems\"; print Gem.user_dir'"
|
24
|
+
end
|
25
|
+
@gempath = "#{gempath}/bin"
|
26
|
+
end unless @gempath
|
27
|
+
@gempath
|
28
|
+
end)
|
29
|
+
|
30
|
+
set :ruby_path, -> { "/package/host/localhost/ruby-#{fetch :ruby_version}/bin" }
|
31
|
+
|
32
|
+
set :uberspace_env_variables, lambda {
|
33
|
+
{
|
34
|
+
'PATH' => "#{fetch :ruby_path}:#{fetch :gem_path}:$PATH"
|
35
|
+
}.merge(fetch :extra_env_variables)
|
36
|
+
}
|
37
|
+
|
38
|
+
default_env = fetch(:default_env, {})
|
39
|
+
set :default_env, -> { default_env.merge(fetch(:uberspace_env_variables)) }
|
40
|
+
|
41
|
+
set :linked_dirs, fetch(:linked_dirs, []).push(*%w(log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system public/uploads))
|
42
|
+
set :linked_files, fetch(:linked_files, []).push('config/database.yml', 'config/secrets.yml')
|
43
|
+
|
44
|
+
# default is "set :bundle_bins, %w{gem rake rails}", but we want to 'gem install bundler' without bundle :)
|
45
|
+
set :bundle_bins, %w(rake rails)
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'capistrano/uberspace/dsl/paths'
|
@@ -0,0 +1 @@
|
|
1
|
+
load File.expand_path('../../tasks/uberspace/mysql.rake', __FILE__)
|
@@ -0,0 +1 @@
|
|
1
|
+
load File.expand_path('../../tasks/uberspace/postgresql.rake', __FILE__)
|
@@ -0,0 +1 @@
|
|
1
|
+
load File.expand_path('../../tasks/uberspace/sqlite3.rake', __FILE__)
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'sshkit/backends/connection_pool'
|
2
|
+
|
3
|
+
module SSHKit
|
4
|
+
module Backend
|
5
|
+
class ConnectionPool
|
6
|
+
def close_all_connections
|
7
|
+
@mutex.synchronize do
|
8
|
+
@pool.values.each do |entries|
|
9
|
+
entries.each do |entry|
|
10
|
+
entry.connection.close if entry.connection.respond_to?(:close) && !entry.closed?
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
flush_connections
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,162 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: capistrano-uberspace
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Philipp Tessenow
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-08-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: capistrano
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.4.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 3.4.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: capistrano-rails
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: capistrano-bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: passenger
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '5.0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '5.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rack
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.4'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.4'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: bundler
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.3'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.3'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rake
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: uberspace support for your rails app for Capistrano 3.x
|
112
|
+
email:
|
113
|
+
- philipp@tessenow.org
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- ".gitignore"
|
119
|
+
- Gemfile
|
120
|
+
- LICENSE
|
121
|
+
- README.md
|
122
|
+
- Rakefile
|
123
|
+
- capistrano-uberspace.gemspec
|
124
|
+
- lib/capistrano-uberspace.rb
|
125
|
+
- lib/capistrano/tasks/uberspace.rake
|
126
|
+
- lib/capistrano/tasks/uberspace/mysql.rake
|
127
|
+
- lib/capistrano/tasks/uberspace/postgresql.rake
|
128
|
+
- lib/capistrano/tasks/uberspace/sqlite3.rake
|
129
|
+
- lib/capistrano/uberspace.rb
|
130
|
+
- lib/capistrano/uberspace/defaults.rb
|
131
|
+
- lib/capistrano/uberspace/dsl.rb
|
132
|
+
- lib/capistrano/uberspace/dsl/paths.rb
|
133
|
+
- lib/capistrano/uberspace/mysql.rb
|
134
|
+
- lib/capistrano/uberspace/postgresql.rb
|
135
|
+
- lib/capistrano/uberspace/sqlite3.rb
|
136
|
+
- lib/patches/sshkit/connection_pool.rb
|
137
|
+
homepage: https://github.com/tessi/capistrano-uberspace
|
138
|
+
licenses:
|
139
|
+
- MIT
|
140
|
+
metadata: {}
|
141
|
+
post_install_message:
|
142
|
+
rdoc_options: []
|
143
|
+
require_paths:
|
144
|
+
- lib
|
145
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
146
|
+
requirements:
|
147
|
+
- - ">="
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '0'
|
150
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
151
|
+
requirements:
|
152
|
+
- - ">="
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: '0'
|
155
|
+
requirements: []
|
156
|
+
rubyforge_project:
|
157
|
+
rubygems_version: 2.2.2
|
158
|
+
signing_key:
|
159
|
+
specification_version: 4
|
160
|
+
summary: uberspace support for your rails app for Capistrano 3.x
|
161
|
+
test_files: []
|
162
|
+
has_rdoc:
|