capistrano-uberspace 1.0.2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +18 -3
- data/capistrano-uberspace.gemspec +1 -1
- data/lib/capistrano/tasks/uberspace.rake +38 -2
- data/lib/capistrano/uberspace/defaults.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: 782159336bca47dafaf38f1950a7910968388cbd
|
4
|
+
data.tar.gz: 888ea7900dfaa7568ec0cce8b8bf6bc61ee3325d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36f4875659761a55a46688e458a832abd205144ebf9d2be7206cac5e050451fac9163bb4c87ffc9d2fa27132e005adc3c7f9d2d1d6a411bf3c6d56ace3e68db6
|
7
|
+
data.tar.gz: 8a9b4e819c6936e634f7858a6859216fc8bed65a2f69fd44d4cd1270908914d37499abebbfa321b4a550ce7025c8e15698af47f7b006c41a12de8a6fc1581ab6
|
data/README.md
CHANGED
@@ -13,11 +13,17 @@ gem 'capistrano', '~> 3.4.0'
|
|
13
13
|
gem 'capistrano-uberspace', github: 'tessi/capistrano-uberspace'
|
14
14
|
```
|
15
15
|
|
16
|
+
If you do not install `capistrano-uberspace` in the `production`-group, then add `passenger` as a production dependency:
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
gem 'passenger', group: :production
|
20
|
+
```
|
21
|
+
|
16
22
|
And then execute:
|
17
23
|
|
18
|
-
$ bundle
|
24
|
+
$ bundle install
|
19
25
|
|
20
|
-
In your `deploy.rb` file specify some app properties:
|
26
|
+
In your `config/deploy.rb` file specify some app properties:
|
21
27
|
|
22
28
|
```ruby
|
23
29
|
set :application, 'MyGreatApp'
|
@@ -42,6 +48,15 @@ set :branch, :production
|
|
42
48
|
set :domain, 'my-subdomain.example.tld'
|
43
49
|
```
|
44
50
|
|
51
|
+
Optionally, you may specify HTTP BASIC AUTH authentication in your stage definition:
|
52
|
+
|
53
|
+
```
|
54
|
+
set :htaccess_username, "username"
|
55
|
+
set :htaccess_password, "password"
|
56
|
+
# instead of the :htaccess_password you may set the hashed password directly:
|
57
|
+
# set :htaccess_password_hashed, "bi2wsSekmG6Yw"
|
58
|
+
```
|
59
|
+
|
45
60
|
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
61
|
|
47
62
|
Require the following parts in your `Capfile`:
|
@@ -61,7 +76,7 @@ Please bundle the appropriate database-gem in your `Gemfile`.
|
|
61
76
|
|
62
77
|
## Usage
|
63
78
|
|
64
|
-
Execute `bundle exec cap
|
79
|
+
Execute `bundle exec cap <stage> deploy` to deploy to your uberspace.
|
65
80
|
|
66
81
|
Configurable options:
|
67
82
|
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |gem|
|
6
6
|
gem.name = 'capistrano-uberspace'
|
7
|
-
gem.version = '1.0
|
7
|
+
gem.version = '1.1.0'
|
8
8
|
gem.authors = ['Philipp Tessenow']
|
9
9
|
gem.email = ['philipp@tessenow.org']
|
10
10
|
gem.description = %q{uberspace support for your rails app for Capistrano 3.x}
|
@@ -14,6 +14,18 @@ gem: --user-install --no-rdoc --no-ri
|
|
14
14
|
end
|
15
15
|
after :'uberspace:check', :'uberspace:setup_gemrc'
|
16
16
|
|
17
|
+
task :setup_npmrc do
|
18
|
+
npmrc = <<-EOF
|
19
|
+
prefix = #{uberspace_home}
|
20
|
+
umask = 077
|
21
|
+
EOF
|
22
|
+
|
23
|
+
on roles fetch(:uberspace_roles) do
|
24
|
+
upload! StringIO.new(npmrc), "#{uberspace_home}/.npmrc"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
after :'uberspace:check', :'uberspace:setup_npmrc'
|
28
|
+
|
17
29
|
task :install_bundler do
|
18
30
|
on roles fetch(:uberspace_roles) do
|
19
31
|
with fetch(:uberspace_env_variables, {}) do
|
@@ -94,14 +106,38 @@ exec multilog t ./main
|
|
94
106
|
|
95
107
|
task :setup_apache_reverse_proxy do
|
96
108
|
on roles fetch(:uberspace_roles) do
|
109
|
+
path = fetch(:domain) ? "/var/www/virtual/#{fetch :user}/#{fetch :domain}" : "/var/www/virtual/#{fetch :user}/html"
|
110
|
+
execute "mkdir -p #{path}"
|
111
|
+
basic_auth = ''
|
112
|
+
|
113
|
+
if fetch(:htaccess_username, false)
|
114
|
+
unless fetch(:htaccess_password_hashed, false)
|
115
|
+
password = fetch(:htaccess_password, -> { abort 'ERROR: Define either :htaccess_password or :htaccess_password_hashed'})
|
116
|
+
salt = [*'0'..'9',*'A'..'Z',*'a'..'z'].sample(2).join
|
117
|
+
set :htaccess_password_hashed, "#{password}".crypt(salt)
|
118
|
+
end
|
119
|
+
|
120
|
+
htpasswd = <<-EOF
|
121
|
+
#{fetch :htaccess_username}:#{fetch :htaccess_password_hashed}
|
122
|
+
EOF
|
123
|
+
upload! StringIO.new(htpasswd), "#{path}/../.htpasswd"
|
124
|
+
|
125
|
+
basic_auth = <<-EOF
|
126
|
+
AuthType Basic
|
127
|
+
AuthName "Restricted"
|
128
|
+
AuthUserFile #{File.join(path, '../.htpasswd')}
|
129
|
+
Require valid-user
|
130
|
+
EOF
|
131
|
+
end
|
132
|
+
execute "chmod +r #{path}/../.htpasswd"
|
133
|
+
|
97
134
|
htaccess = <<-EOF
|
135
|
+
#{basic_auth}
|
98
136
|
RewriteEngine On
|
99
137
|
RewriteBase /
|
100
138
|
RewriteRule ^(.*)$ http://localhost:#{passenger_port}/$1 [P]
|
101
139
|
EOF
|
102
140
|
|
103
|
-
path = fetch(:domain) ? "/var/www/virtual/#{fetch :user}/#{fetch :domain}" : "/var/www/virtual/#{fetch :user}/html"
|
104
|
-
execute "mkdir -p #{path}"
|
105
141
|
upload! StringIO.new(htaccess), "#{path}/.htaccess"
|
106
142
|
execute "chmod +r #{path}/.htaccess"
|
107
143
|
|
@@ -31,7 +31,7 @@ set :ruby_path, -> { "/package/host/localhost/ruby-#{fetch :ruby_version}/bin" }
|
|
31
31
|
|
32
32
|
set :uberspace_env_variables, lambda {
|
33
33
|
{
|
34
|
-
'PATH' => "#{fetch :ruby_path}:#{fetch :gem_path}:$PATH"
|
34
|
+
'PATH' => "#{fetch :ruby_path}:#{fetch :gem_path}:/home/#{fetch :user}/bin:$PATH"
|
35
35
|
}.merge(fetch :extra_env_variables)
|
36
36
|
}
|
37
37
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-uberspace
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Philipp Tessenow
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|