capistrano-twingly 2.4.1 → 4.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +26 -0
- data/CHANGELOG.md +80 -2
- data/README.md +6 -29
- data/capistrano-twingly.gemspec +3 -4
- data/lib/capistrano/twingly.rb +4 -1
- data/lib/capistrano/twingly/service.rb +1 -0
- data/lib/capistrano/twingly/tasks/nginx.rake +1 -2
- data/lib/capistrano/twingly/tasks/servers_from_srv_record.rake +0 -1
- data/lib/capistrano/twingly/tasks/service.rake +128 -0
- metadata +15 -30
- data/.travis.yml +0 -28
- data/lib/capistrano/twingly/tasks/upstart.rake +0 -58
- data/lib/capistrano/twingly/upstart.rb +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5eca6ea50991714c2600ca2f700235fb3a5284320f70cde25534de3606e3a30
|
4
|
+
data.tar.gz: 0757c016c4a0dca706fef45c342a95425c11b5d15647501b07a960cdbe1391b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86c947ed2c3a163875739769ffd4c1410d055f5c4ec976629b55ba44d6d1180f14a83a4bcbb11e7a06682c569fc7da714193d1af4b74d4f82dc72f23e82d8bc2
|
7
|
+
data.tar.gz: ea462c70951642dcf469e4e8fe23c987d602274cc9b00c0f3b5039b4532332d5f78194cf8740c75732d63aebb843a36eb8711fd9a98643cbd1617c78e6f4dd9f
|
@@ -0,0 +1,26 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
pull_request:
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
build:
|
9
|
+
runs-on: ubuntu-18.04
|
10
|
+
|
11
|
+
strategy:
|
12
|
+
matrix:
|
13
|
+
ruby: [2.7.1, head]
|
14
|
+
|
15
|
+
steps:
|
16
|
+
- name: Checkout Code
|
17
|
+
uses: actions/checkout@v2
|
18
|
+
|
19
|
+
- name: Setup Ruby ${{ matrix.ruby }}
|
20
|
+
uses: ruby/setup-ruby@v1
|
21
|
+
with:
|
22
|
+
ruby-version: ${{ matrix.ruby }}
|
23
|
+
bundler-cache: true
|
24
|
+
|
25
|
+
- name: Run
|
26
|
+
run: bundle exec rake
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,58 @@
|
|
1
|
-
#
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## [v4.0.2](https://github.com/twingly/capistrano-twingly/tree/v4.0.2) (2020-11-24)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/twingly/capistrano-twingly/compare/v4.0.1...v4.0.2)
|
6
|
+
|
7
|
+
**Fixed bugs:**
|
8
|
+
|
9
|
+
- Cannot published gem using "rake release" [\#48](https://github.com/twingly/capistrano-twingly/issues/48)
|
10
|
+
|
11
|
+
**Merged pull requests:**
|
12
|
+
|
13
|
+
- Move to GitHub actions [\#58](https://github.com/twingly/capistrano-twingly/pull/58) ([Chrizpy](https://github.com/Chrizpy))
|
14
|
+
- Update Capistrano [\#57](https://github.com/twingly/capistrano-twingly/pull/57) ([Pontus4](https://github.com/Pontus4))
|
15
|
+
- Ruby 2.7 support [\#56](https://github.com/twingly/capistrano-twingly/pull/56) ([walro](https://github.com/walro))
|
16
|
+
- Newer Ruby on Travis [\#54](https://github.com/twingly/capistrano-twingly/pull/54) ([roback](https://github.com/roback))
|
17
|
+
|
18
|
+
## [v4.0.1](https://github.com/twingly/capistrano-twingly/tree/v4.0.1) (2019-05-02)
|
19
|
+
|
20
|
+
[Full Changelog](https://github.com/twingly/capistrano-twingly/compare/v4.0.0...v4.0.1)
|
21
|
+
|
22
|
+
**Fixed bugs:**
|
23
|
+
|
24
|
+
- Initial deploy for systemd fails since \#47 [\#49](https://github.com/twingly/capistrano-twingly/issues/49)
|
25
|
+
|
26
|
+
**Merged pull requests:**
|
27
|
+
|
28
|
+
- Make sure systemd target is loaded before trying to stop it [\#50](https://github.com/twingly/capistrano-twingly/pull/50) ([roback](https://github.com/roback))
|
29
|
+
|
30
|
+
## [v4.0.0](https://github.com/twingly/capistrano-twingly/tree/v4.0.0) (2019-04-29)
|
31
|
+
|
32
|
+
[Full Changelog](https://github.com/twingly/capistrano-twingly/compare/v3.0.0...v4.0.0)
|
33
|
+
|
34
|
+
**Closed issues:**
|
35
|
+
|
36
|
+
- Add systemd support [\#45](https://github.com/twingly/capistrano-twingly/issues/45)
|
37
|
+
|
38
|
+
**Merged pull requests:**
|
39
|
+
|
40
|
+
- Generate systemd config in addition to upstart [\#47](https://github.com/twingly/capistrano-twingly/pull/47) ([roback](https://github.com/roback))
|
41
|
+
|
42
|
+
## [v3.0.0](https://github.com/twingly/capistrano-twingly/tree/v3.0.0) (2018-11-08)
|
43
|
+
|
44
|
+
[Full Changelog](https://github.com/twingly/capistrano-twingly/compare/v2.4.1...v3.0.0)
|
45
|
+
|
46
|
+
**Merged pull requests:**
|
47
|
+
|
48
|
+
- Remove LKP traces [\#44](https://github.com/twingly/capistrano-twingly/pull/44) ([walro](https://github.com/walro))
|
49
|
+
|
50
|
+
## [v2.4.1](https://github.com/twingly/capistrano-twingly/tree/v2.4.1) (2018-10-05)
|
51
|
+
|
52
|
+
[Full Changelog](https://github.com/twingly/capistrano-twingly/compare/v2.4.0...v2.4.1)
|
2
53
|
|
3
54
|
## [v2.4.0](https://github.com/twingly/capistrano-twingly/tree/v2.4.0) (2018-10-04)
|
55
|
+
|
4
56
|
[Full Changelog](https://github.com/twingly/capistrano-twingly/compare/v2.3.0...v2.4.0)
|
5
57
|
|
6
58
|
**Merged pull requests:**
|
@@ -8,6 +60,7 @@
|
|
8
60
|
- Each server can have different Procfiles [\#43](https://github.com/twingly/capistrano-twingly/pull/43) ([roback](https://github.com/roback))
|
9
61
|
|
10
62
|
## [v2.3.0](https://github.com/twingly/capistrano-twingly/tree/v2.3.0) (2018-10-04)
|
63
|
+
|
11
64
|
[Full Changelog](https://github.com/twingly/capistrano-twingly/compare/v2.2.0...v2.3.0)
|
12
65
|
|
13
66
|
**Merged pull requests:**
|
@@ -15,6 +68,7 @@
|
|
15
68
|
- Lookup app servers using multiple SRV records [\#42](https://github.com/twingly/capistrano-twingly/pull/42) ([roback](https://github.com/roback))
|
16
69
|
|
17
70
|
## [v2.2.0](https://github.com/twingly/capistrano-twingly/tree/v2.2.0) (2017-12-18)
|
71
|
+
|
18
72
|
[Full Changelog](https://github.com/twingly/capistrano-twingly/compare/v2.1.0...v2.2.0)
|
19
73
|
|
20
74
|
**Implemented enhancements:**
|
@@ -27,6 +81,7 @@
|
|
27
81
|
- Be able to use the gem with ssh-ed25519 keys [\#39](https://github.com/twingly/capistrano-twingly/pull/39) ([dentarg](https://github.com/dentarg))
|
28
82
|
|
29
83
|
## [v2.1.0](https://github.com/twingly/capistrano-twingly/tree/v2.1.0) (2016-09-22)
|
84
|
+
|
30
85
|
[Full Changelog](https://github.com/twingly/capistrano-twingly/compare/v2.0.1...v2.1.0)
|
31
86
|
|
32
87
|
**Fixed bugs:**
|
@@ -39,9 +94,11 @@
|
|
39
94
|
- Add foreman as a dependency [\#30](https://github.com/twingly/capistrano-twingly/pull/30) ([jage](https://github.com/jage))
|
40
95
|
|
41
96
|
## [v2.0.1](https://github.com/twingly/capistrano-twingly/tree/v2.0.1) (2016-09-06)
|
97
|
+
|
42
98
|
[Full Changelog](https://github.com/twingly/capistrano-twingly/compare/v2.0.0...v2.0.1)
|
43
99
|
|
44
100
|
## [v2.0.0](https://github.com/twingly/capistrano-twingly/tree/v2.0.0) (2016-06-13)
|
101
|
+
|
45
102
|
[Full Changelog](https://github.com/twingly/capistrano-twingly/compare/v1.8.0...v2.0.0)
|
46
103
|
|
47
104
|
**Implemented enhancements:**
|
@@ -53,6 +110,7 @@
|
|
53
110
|
- Use generic socket name [\#27](https://github.com/twingly/capistrano-twingly/pull/27) ([jage](https://github.com/jage))
|
54
111
|
|
55
112
|
## [v1.8.0](https://github.com/twingly/capistrano-twingly/tree/v1.8.0) (2016-05-03)
|
113
|
+
|
56
114
|
[Full Changelog](https://github.com/twingly/capistrano-twingly/compare/v1.7.1...v1.8.0)
|
57
115
|
|
58
116
|
**Merged pull requests:**
|
@@ -60,9 +118,11 @@
|
|
60
118
|
- Send process output to syslog [\#26](https://github.com/twingly/capistrano-twingly/pull/26) ([roback](https://github.com/roback))
|
61
119
|
|
62
120
|
## [v1.7.1](https://github.com/twingly/capistrano-twingly/tree/v1.7.1) (2015-02-16)
|
121
|
+
|
63
122
|
[Full Changelog](https://github.com/twingly/capistrano-twingly/compare/v1.7.0...v1.7.1)
|
64
123
|
|
65
124
|
## [v1.7.0](https://github.com/twingly/capistrano-twingly/tree/v1.7.0) (2014-12-09)
|
125
|
+
|
66
126
|
[Full Changelog](https://github.com/twingly/capistrano-twingly/compare/v1.6.2...v1.7.0)
|
67
127
|
|
68
128
|
**Fixed bugs:**
|
@@ -78,9 +138,11 @@
|
|
78
138
|
- Fail if no servers \(SRV-records\) are found [\#22](https://github.com/twingly/capistrano-twingly/pull/22) ([jage](https://github.com/jage))
|
79
139
|
|
80
140
|
## [v1.6.2](https://github.com/twingly/capistrano-twingly/tree/v1.6.2) (2014-09-19)
|
141
|
+
|
81
142
|
[Full Changelog](https://github.com/twingly/capistrano-twingly/compare/v1.6.1...v1.6.2)
|
82
143
|
|
83
144
|
## [v1.6.1](https://github.com/twingly/capistrano-twingly/tree/v1.6.1) (2014-07-28)
|
145
|
+
|
84
146
|
[Full Changelog](https://github.com/twingly/capistrano-twingly/compare/v1.6.0...v1.6.1)
|
85
147
|
|
86
148
|
**Implemented enhancements:**
|
@@ -92,9 +154,11 @@
|
|
92
154
|
- Add ability to control autostart in upstart [\#21](https://github.com/twingly/capistrano-twingly/pull/21) ([jage](https://github.com/jage))
|
93
155
|
|
94
156
|
## [v1.6.0](https://github.com/twingly/capistrano-twingly/tree/v1.6.0) (2014-07-28)
|
157
|
+
|
95
158
|
[Full Changelog](https://github.com/twingly/capistrano-twingly/compare/v1.5.1...v1.6.0)
|
96
159
|
|
97
160
|
## [v1.5.1](https://github.com/twingly/capistrano-twingly/tree/v1.5.1) (2014-05-12)
|
161
|
+
|
98
162
|
[Full Changelog](https://github.com/twingly/capistrano-twingly/compare/v1.5.0...v1.5.1)
|
99
163
|
|
100
164
|
**Implemented enhancements:**
|
@@ -102,9 +166,11 @@
|
|
102
166
|
- Create temporary files in tmp/ [\#9](https://github.com/twingly/capistrano-twingly/issues/9)
|
103
167
|
|
104
168
|
## [v1.5.0](https://github.com/twingly/capistrano-twingly/tree/v1.5.0) (2014-05-12)
|
169
|
+
|
105
170
|
[Full Changelog](https://github.com/twingly/capistrano-twingly/compare/v1.4.0...v1.5.0)
|
106
171
|
|
107
172
|
## [v1.4.0](https://github.com/twingly/capistrano-twingly/tree/v1.4.0) (2014-03-31)
|
173
|
+
|
108
174
|
[Full Changelog](https://github.com/twingly/capistrano-twingly/compare/v1.3.0...v1.4.0)
|
109
175
|
|
110
176
|
**Merged pull requests:**
|
@@ -113,6 +179,7 @@
|
|
113
179
|
- If system/maintenance.html exist, show it [\#12](https://github.com/twingly/capistrano-twingly/pull/12) ([jage](https://github.com/jage))
|
114
180
|
|
115
181
|
## [v1.3.0](https://github.com/twingly/capistrano-twingly/tree/v1.3.0) (2014-03-26)
|
182
|
+
|
116
183
|
[Full Changelog](https://github.com/twingly/capistrano-twingly/compare/v1.2.1...v1.3.0)
|
117
184
|
|
118
185
|
**Merged pull requests:**
|
@@ -120,6 +187,7 @@
|
|
120
187
|
- Fix deploy namespace for Nginx tasks in README. [\#11](https://github.com/twingly/capistrano-twingly/pull/11) ([benmanns](https://github.com/benmanns))
|
121
188
|
|
122
189
|
## [v1.2.1](https://github.com/twingly/capistrano-twingly/tree/v1.2.1) (2014-02-14)
|
190
|
+
|
123
191
|
[Full Changelog](https://github.com/twingly/capistrano-twingly/compare/v1.1.1...v1.2.1)
|
124
192
|
|
125
193
|
**Closed issues:**
|
@@ -127,9 +195,11 @@
|
|
127
195
|
- Add stage name to git deploy tag [\#8](https://github.com/twingly/capistrano-twingly/issues/8)
|
128
196
|
|
129
197
|
## [v1.1.1](https://github.com/twingly/capistrano-twingly/tree/v1.1.1) (2014-02-11)
|
198
|
+
|
130
199
|
[Full Changelog](https://github.com/twingly/capistrano-twingly/compare/v1.0.1...v1.1.1)
|
131
200
|
|
132
201
|
## [v1.0.1](https://github.com/twingly/capistrano-twingly/tree/v1.0.1) (2014-02-11)
|
202
|
+
|
133
203
|
[Full Changelog](https://github.com/twingly/capistrano-twingly/compare/v1.0.0...v1.0.1)
|
134
204
|
|
135
205
|
**Closed issues:**
|
@@ -137,9 +207,11 @@
|
|
137
207
|
- Bug in nginx.rake [\#6](https://github.com/twingly/capistrano-twingly/issues/6)
|
138
208
|
|
139
209
|
## [v1.0.0](https://github.com/twingly/capistrano-twingly/tree/v1.0.0) (2014-02-11)
|
210
|
+
|
140
211
|
[Full Changelog](https://github.com/twingly/capistrano-twingly/compare/v0.1.4...v1.0.0)
|
141
212
|
|
142
213
|
## [v0.1.4](https://github.com/twingly/capistrano-twingly/tree/v0.1.4) (2014-02-10)
|
214
|
+
|
143
215
|
[Full Changelog](https://github.com/twingly/capistrano-twingly/compare/v0.1.3...v0.1.4)
|
144
216
|
|
145
217
|
**Implemented enhancements:**
|
@@ -147,6 +219,7 @@
|
|
147
219
|
- nginx task requires constants [\#3](https://github.com/twingly/capistrano-twingly/issues/3)
|
148
220
|
|
149
221
|
## [v0.1.3](https://github.com/twingly/capistrano-twingly/tree/v0.1.3) (2014-02-04)
|
222
|
+
|
150
223
|
[Full Changelog](https://github.com/twingly/capistrano-twingly/compare/v0.1.2...v0.1.3)
|
151
224
|
|
152
225
|
**Fixed bugs:**
|
@@ -154,9 +227,11 @@
|
|
154
227
|
- HTTPS support missing [\#4](https://github.com/twingly/capistrano-twingly/issues/4)
|
155
228
|
|
156
229
|
## [v0.1.2](https://github.com/twingly/capistrano-twingly/tree/v0.1.2) (2014-01-31)
|
230
|
+
|
157
231
|
[Full Changelog](https://github.com/twingly/capistrano-twingly/compare/v0.1.1...v0.1.2)
|
158
232
|
|
159
233
|
## [v0.1.1](https://github.com/twingly/capistrano-twingly/tree/v0.1.1) (2014-01-15)
|
234
|
+
|
160
235
|
[Full Changelog](https://github.com/twingly/capistrano-twingly/compare/v0.1.0...v0.1.1)
|
161
236
|
|
162
237
|
**Implemented enhancements:**
|
@@ -165,5 +240,8 @@
|
|
165
240
|
|
166
241
|
## [v0.1.0](https://github.com/twingly/capistrano-twingly/tree/v0.1.0) (2014-01-14)
|
167
242
|
|
243
|
+
[Full Changelog](https://github.com/twingly/capistrano-twingly/compare/0c5897c038d57e7acf3551a0c0b778571c9f293f...v0.1.0)
|
244
|
+
|
245
|
+
|
168
246
|
|
169
|
-
\* *This
|
247
|
+
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
data/README.md
CHANGED
@@ -45,7 +45,7 @@ require 'capistrano/twingly/nginx'
|
|
45
45
|
|
46
46
|
# config/deploy.rb
|
47
47
|
set :app_name, 'contest-bamba'
|
48
|
-
set :server_names, %w(bamba.bloggportalen.se)
|
48
|
+
set :server_names, %w(bamba.bloggportalen.se)
|
49
49
|
set :use_https, true # Optional
|
50
50
|
|
51
51
|
namespace :deploy do
|
@@ -56,11 +56,11 @@ namespace :deploy do
|
|
56
56
|
end
|
57
57
|
```
|
58
58
|
|
59
|
-
### Upstart
|
59
|
+
### Upstart/Systemd
|
60
60
|
|
61
61
|
```Ruby
|
62
62
|
# Capfile
|
63
|
-
require 'capistrano/twingly/
|
63
|
+
require 'capistrano/twingly/service'
|
64
64
|
|
65
65
|
# config/deploy.rb
|
66
66
|
set :procfile_contents, -> {
|
@@ -74,29 +74,6 @@ set :procfile_contents, -> {
|
|
74
74
|
}
|
75
75
|
|
76
76
|
namespace :deploy do
|
77
|
-
desc 'Start application'
|
78
|
-
task :start do
|
79
|
-
invoke 'deploy:export_upstart'
|
80
|
-
on roles(:app) do
|
81
|
-
sudo :start, fetch(:application)
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
desc 'Restart application'
|
86
|
-
task :restart do
|
87
|
-
invoke 'deploy:export_upstart'
|
88
|
-
on roles(:app) do
|
89
|
-
execute "sudo restart #{fetch(:application)} || sudo start #{fetch(:application)}"
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
desc 'Stop application'
|
94
|
-
task :stop do
|
95
|
-
on roles(:app) do
|
96
|
-
sudo :stop, fetch(:application)
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
77
|
after :stop, 'deploy:disable_autostart'
|
101
78
|
after :start, 'deploy:enable_autostart'
|
102
79
|
after :restart, 'deploy:enable_autostart'
|
@@ -148,13 +125,13 @@ end
|
|
148
125
|
|
149
126
|
* Bump the version in `capistrano-twingly.gemspec` in a commit, no need to push (the release task does that).
|
150
127
|
|
128
|
+
* Ensure you are signed in to RubyGems.org as [twingly][twingly-rubygems] with `gem signin`.
|
129
|
+
|
151
130
|
* Build and [publish](http://guides.rubygems.org/publishing/) the gem. This will create the proper tag in git, push the commit and tag and upload to RubyGems.
|
152
131
|
|
153
132
|
bundle exec rake release
|
154
133
|
|
155
|
-
|
156
|
-
|
157
|
-
* Update the changelog with [GitHub Changelog Generator](https://github.com/skywinder/github-changelog-generator/) (`gem install github_changelog_generator` if you don't have it, set `CHANGELOG_GITHUB_TOKEN` to a personal access token to avoid rate limiting by GitHub). This command will update `CHANGELOG.md`, commit and push manually.
|
134
|
+
* Update the changelog with [GitHub Changelog Generator](https://github.com/skywinder/github-changelog-generator/) (`gem install github_changelog_generator` if you don't have it, set `CHANGELOG_GITHUB_TOKEN` to a personal access token to avoid rate limiting by GitHub). This command will update `CHANGELOG.md`. You need to commit and push manually.
|
158
135
|
|
159
136
|
github_changelog_generator
|
160
137
|
|
data/capistrano-twingly.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "capistrano-twingly"
|
7
|
-
spec.version = '
|
7
|
+
spec.version = '4.0.3'
|
8
8
|
spec.authors = ["Twingly AB"]
|
9
9
|
spec.email = ["support@twingly.com"]
|
10
10
|
spec.summary = %q{Capistrano 3 tasks used for Twingly's Ruby deployment}
|
@@ -17,15 +17,14 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
|
20
|
-
spec.add_dependency "capistrano", "~> 3.
|
21
|
-
spec.add_dependency "capistrano-bundler", "
|
20
|
+
spec.add_dependency "capistrano", "~> 3.14"
|
21
|
+
spec.add_dependency "capistrano-bundler", "~> 2.0"
|
22
22
|
spec.add_dependency "capistrano-chruby", "0.1.2"
|
23
23
|
spec.add_dependency "foreman", "~> 0.82"
|
24
24
|
spec.add_dependency "net-ssh", "~> 5.0"
|
25
25
|
spec.add_dependency "ed25519", ">= 1.2", "< 1.3"
|
26
26
|
spec.add_dependency "bcrypt_pbkdf", ">= 1.0", "< 2.0"
|
27
27
|
|
28
|
-
spec.add_development_dependency "bundler", "~> 1.5"
|
29
28
|
spec.add_development_dependency "rspec", "~> 3"
|
30
29
|
spec.add_development_dependency "rake"
|
31
30
|
end
|
data/lib/capistrano/twingly.rb
CHANGED
@@ -4,6 +4,9 @@ require "capistrano/setup"
|
|
4
4
|
# Include default deployment tasks
|
5
5
|
require "capistrano/deploy"
|
6
6
|
|
7
|
+
require "capistrano/scm/git"
|
8
|
+
install_plugin Capistrano::SCM::Git
|
9
|
+
|
7
10
|
# Console to the servers
|
8
11
|
require "capistrano/console"
|
9
12
|
|
@@ -13,7 +16,7 @@ require "capistrano/bundler"
|
|
13
16
|
|
14
17
|
# Twingly tasks
|
15
18
|
require "capistrano/twingly/nginx"
|
16
|
-
require "capistrano/twingly/
|
19
|
+
require "capistrano/twingly/service"
|
17
20
|
require "capistrano/twingly/tag_deploy_in_git"
|
18
21
|
require "capistrano/twingly/current_git_branch"
|
19
22
|
require "capistrano/twingly/servers_from_srv_record"
|
@@ -0,0 +1 @@
|
|
1
|
+
load File.expand_path("../tasks/service.rake", __FILE__)
|
@@ -6,8 +6,7 @@ namespace :deploy do
|
|
6
6
|
|
7
7
|
app_dir = fetch(:deploy_to)
|
8
8
|
app_name = fetch(:app_name)
|
9
|
-
server_names =
|
10
|
-
server_names << "#{app_name}.live.lkp.primelabs.se"
|
9
|
+
server_names = fetch(:server_names)
|
11
10
|
|
12
11
|
https_port = ":443" if fetch(:use_https)
|
13
12
|
|
@@ -0,0 +1,128 @@
|
|
1
|
+
namespace :deploy do
|
2
|
+
desc 'Lookup which service manager is used on each server'
|
3
|
+
task :lookup_server_service_manager do
|
4
|
+
init_system_pid = 1
|
5
|
+
|
6
|
+
on roles(:app) do |host|
|
7
|
+
service_manager_name =
|
8
|
+
capture "ps -p#{init_system_pid} co command | grep systemd || echo upstart"
|
9
|
+
|
10
|
+
server(host).add_role(service_manager_name.to_sym)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
desc 'Export service script'
|
15
|
+
task export_service: %w[lookup_server_service_manager foreman:upload_procfile] do
|
16
|
+
set :bundle_binstubs, -> { shared_path.join('bin') }
|
17
|
+
|
18
|
+
on roles(:upstart) do
|
19
|
+
within current_path do
|
20
|
+
sudo fetch(:chruby_exec), "#{fetch(:chruby_ruby)} -- #{fetch(:bundle_binstubs)}/foreman export upstart /etc/init -a #{fetch(:application)} -u \`whoami\` -l #{shared_path}/log"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
on roles(:systemd) do
|
25
|
+
load_state =
|
26
|
+
capture "systemctl show #{fetch(:application)}.target -p LoadState --value"
|
27
|
+
|
28
|
+
if load_state == "loaded"
|
29
|
+
sudo :systemctl, "stop #{fetch(:application)}.target"
|
30
|
+
end
|
31
|
+
|
32
|
+
within current_path do
|
33
|
+
sudo fetch(:chruby_exec), "#{fetch(:chruby_ruby)} -- #{fetch(:bundle_binstubs)}/foreman export systemd /etc/systemd/system -a #{fetch(:application)} -u \`whoami\` -l #{shared_path}/log"
|
34
|
+
end
|
35
|
+
|
36
|
+
sudo :systemctl, "daemon-reload"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
desc "Start application"
|
41
|
+
task start: :lookup_server_service_manager do
|
42
|
+
invoke "deploy:export_service"
|
43
|
+
|
44
|
+
on roles(:upstart) do
|
45
|
+
sudo :start, fetch(:application)
|
46
|
+
end
|
47
|
+
|
48
|
+
on roles(:systemd) do
|
49
|
+
sudo :systemctl, "start #{fetch(:application)}.target"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
desc "Restart application"
|
54
|
+
task restart: :lookup_server_service_manager do
|
55
|
+
invoke "deploy:export_service"
|
56
|
+
|
57
|
+
on roles(:upstart) do
|
58
|
+
execute "sudo restart #{fetch(:application)} || sudo start #{fetch(:application)}"
|
59
|
+
end
|
60
|
+
|
61
|
+
on roles(:systemd) do
|
62
|
+
application = fetch(:application)
|
63
|
+
execute "sudo systemctl restart #{application}.target || sudo systemctl start #{application}.target"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
desc "Stop application"
|
68
|
+
task stop: :lookup_server_service_manager do
|
69
|
+
on roles(:upstart) do
|
70
|
+
sudo :stop, fetch(:application)
|
71
|
+
end
|
72
|
+
|
73
|
+
on roles(:systemd) do
|
74
|
+
sudo :systemctl, "stop #{fetch(:application)}.target"
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
task disable_autostart: :lookup_server_service_manager do
|
79
|
+
on roles(:upstart) do
|
80
|
+
execute "/bin/echo manual | sudo /usr/bin/tee /etc/init/#{fetch(:application)}.override"
|
81
|
+
end
|
82
|
+
|
83
|
+
on roles(:systemd) do
|
84
|
+
sudo :systemctl, "disable #{fetch(:application)}.target"
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
task enable_autostart: :lookup_server_service_manager do
|
89
|
+
on roles(:upstart) do
|
90
|
+
execute "/bin/echo | sudo /usr/bin/tee /etc/init/#{fetch(:application)}.override"
|
91
|
+
end
|
92
|
+
|
93
|
+
on roles(:systemd) do
|
94
|
+
sudo :systemctl, "enable #{fetch(:application)}.target"
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
namespace :foreman do
|
99
|
+
desc 'Upload Procfile to server'
|
100
|
+
task upload_procfile: :generate_procfile do
|
101
|
+
on roles(:app) do |host|
|
102
|
+
upload! "tmp/Procfile_#{host.hostname}", "#{fetch(:deploy_to)}/current/Procfile"
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
desc 'Generate Procfile'
|
107
|
+
task :generate_procfile do
|
108
|
+
Dir.mkdir('tmp') unless Dir.exist?('tmp')
|
109
|
+
|
110
|
+
procfile_contents = fetch(:procfile_contents)
|
111
|
+
|
112
|
+
on roles(:app) do |host|
|
113
|
+
procfile_contents_string =
|
114
|
+
if procfile_contents.is_a?(Hash)
|
115
|
+
procfile_contents.fetch(host.hostname)
|
116
|
+
else
|
117
|
+
procfile_contents
|
118
|
+
end
|
119
|
+
|
120
|
+
File.open("tmp/Procfile_#{host.hostname}", 'w') do |conf|
|
121
|
+
procfile_contents_string.each_line do |line|
|
122
|
+
conf.puts "#{line.chomp} 2>&1 | logger -t #{fetch(:app_name)}"
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-twingly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Twingly AB
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 3.
|
19
|
+
version: '3.14'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 3.
|
26
|
+
version: '3.14'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: capistrano-bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: '2.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: '2.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: capistrano-chruby
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -120,20 +120,6 @@ dependencies:
|
|
120
120
|
- - "<"
|
121
121
|
- !ruby/object:Gem::Version
|
122
122
|
version: '2.0'
|
123
|
-
- !ruby/object:Gem::Dependency
|
124
|
-
name: bundler
|
125
|
-
requirement: !ruby/object:Gem::Requirement
|
126
|
-
requirements:
|
127
|
-
- - "~>"
|
128
|
-
- !ruby/object:Gem::Version
|
129
|
-
version: '1.5'
|
130
|
-
type: :development
|
131
|
-
prerelease: false
|
132
|
-
version_requirements: !ruby/object:Gem::Requirement
|
133
|
-
requirements:
|
134
|
-
- - "~>"
|
135
|
-
- !ruby/object:Gem::Version
|
136
|
-
version: '1.5'
|
137
123
|
- !ruby/object:Gem::Dependency
|
138
124
|
name: rspec
|
139
125
|
requirement: !ruby/object:Gem::Requirement
|
@@ -169,9 +155,9 @@ executables: []
|
|
169
155
|
extensions: []
|
170
156
|
extra_rdoc_files: []
|
171
157
|
files:
|
158
|
+
- ".github/workflows/ci.yml"
|
172
159
|
- ".gitignore"
|
173
160
|
- ".rspec"
|
174
|
-
- ".travis.yml"
|
175
161
|
- CHANGELOG.md
|
176
162
|
- Gemfile
|
177
163
|
- LICENSE.txt
|
@@ -182,19 +168,19 @@ files:
|
|
182
168
|
- lib/capistrano/twingly/current_git_branch.rb
|
183
169
|
- lib/capistrano/twingly/nginx.rb
|
184
170
|
- lib/capistrano/twingly/servers_from_srv_record.rb
|
171
|
+
- lib/capistrano/twingly/service.rb
|
185
172
|
- lib/capistrano/twingly/tag_deploy_in_git.rb
|
186
173
|
- lib/capistrano/twingly/tasks/current_git_branch.rake
|
187
174
|
- lib/capistrano/twingly/tasks/nginx.rake
|
188
175
|
- lib/capistrano/twingly/tasks/servers_from_srv_record.rake
|
176
|
+
- lib/capistrano/twingly/tasks/service.rake
|
189
177
|
- lib/capistrano/twingly/tasks/tag_deploy_in_git.rake
|
190
|
-
- lib/capistrano/twingly/tasks/upstart.rake
|
191
|
-
- lib/capistrano/twingly/upstart.rb
|
192
178
|
- spec/integration/net_ssh_spec.rb
|
193
179
|
homepage: https://github.com/twingly/capistrano-twingly
|
194
180
|
licenses:
|
195
181
|
- MIT
|
196
182
|
metadata: {}
|
197
|
-
post_install_message:
|
183
|
+
post_install_message:
|
198
184
|
rdoc_options: []
|
199
185
|
require_paths:
|
200
186
|
- lib
|
@@ -209,9 +195,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
209
195
|
- !ruby/object:Gem::Version
|
210
196
|
version: '0'
|
211
197
|
requirements: []
|
212
|
-
|
213
|
-
|
214
|
-
signing_key:
|
198
|
+
rubygems_version: 3.1.2
|
199
|
+
signing_key:
|
215
200
|
specification_version: 4
|
216
201
|
summary: Capistrano 3 tasks used for Twingly's Ruby deployment
|
217
202
|
test_files:
|
data/.travis.yml
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
sudo: false
|
3
|
-
|
4
|
-
rvm:
|
5
|
-
- 2.4.2
|
6
|
-
- ruby-head
|
7
|
-
|
8
|
-
matrix:
|
9
|
-
allow_failures:
|
10
|
-
- rvm: ruby-head
|
11
|
-
fast_finish: true
|
12
|
-
|
13
|
-
before_install:
|
14
|
-
- gem install bundler
|
15
|
-
|
16
|
-
cache: bundler
|
17
|
-
|
18
|
-
notifications:
|
19
|
-
email: false
|
20
|
-
hipchat:
|
21
|
-
rooms:
|
22
|
-
secure: "ILGWgc1QgHVRhwxWgYo+DxLySgOPdwahOV8py1dlRhi4juRUvMcMJSFYvTS47T1Mm8JSJXGaJtEcz24YgWF4XQsL2OawntdxJDNuzmFhF0fC+syN3qHXVzaRIplfcbGOj5rW4Uga8HumvvrQl/g5fscgsGM02BAOKgJhRPM7YLY="
|
23
|
-
on_success: never
|
24
|
-
on_failure: change
|
25
|
-
template:
|
26
|
-
- '%{repository}#%{build_number} (%{branch} - %{commit} : %{author}): %{message}
|
27
|
-
(<a href="%{build_url}">Details</a>/<a href="%{compare_url}">Change view</a>)'
|
28
|
-
format: html
|
@@ -1,58 +0,0 @@
|
|
1
|
-
namespace :deploy do
|
2
|
-
set :bundle_binstubs, -> { shared_path.join('bin') }
|
3
|
-
|
4
|
-
desc 'Export upstart script'
|
5
|
-
task :export_upstart do
|
6
|
-
on roles(:app) do
|
7
|
-
within current_path do
|
8
|
-
sudo fetch(:chruby_exec), "#{fetch(:chruby_ruby)} -- #{fetch(:bundle_binstubs)}/foreman export upstart /etc/init -a #{fetch(:application)} -u \`whoami\` -l #{shared_path}/log"
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
task :disable_autostart do
|
14
|
-
on roles(:app) do
|
15
|
-
execute "/bin/echo manual | sudo /usr/bin/tee /etc/init/#{fetch(:application)}.override"
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
task :enable_autostart do
|
20
|
-
on roles(:app) do
|
21
|
-
execute "/bin/echo | sudo /usr/bin/tee /etc/init/#{fetch(:application)}.override"
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
namespace :foreman do
|
26
|
-
desc 'Upload Procfile to server'
|
27
|
-
task :upload_procfile do
|
28
|
-
on roles(:app) do |host|
|
29
|
-
upload! "tmp/Procfile_#{host.hostname}", "#{fetch(:deploy_to)}/current/Procfile"
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
desc 'Generate Procfile'
|
34
|
-
task :generate_procfile do
|
35
|
-
Dir.mkdir('tmp') unless Dir.exist?('tmp')
|
36
|
-
|
37
|
-
procfile_contents = fetch(:procfile_contents)
|
38
|
-
|
39
|
-
on roles(:app) do |host|
|
40
|
-
procfile_contents_string =
|
41
|
-
if procfile_contents.is_a?(Hash)
|
42
|
-
procfile_contents.fetch(host.hostname)
|
43
|
-
else
|
44
|
-
procfile_contents
|
45
|
-
end
|
46
|
-
|
47
|
-
File.open("tmp/Procfile_#{host.hostname}", 'w') do |conf|
|
48
|
-
procfile_contents_string.each_line do |line|
|
49
|
-
conf.puts "#{line.chomp} 2>&1 | logger -t #{fetch(:app_name)}"
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
before 'deploy:export_upstart', 'deploy:foreman:upload_procfile'
|
57
|
-
before 'deploy:foreman:upload_procfile', 'deploy:foreman:generate_procfile'
|
58
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
load File.expand_path("../tasks/upstart.rake", __FILE__)
|