shared-infrastructure 0.0.15 → 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/shared_infrastructure.rb +0 -1
- data/lib/shared_infrastructure/domain.rb +4 -0
- data/lib/shared_infrastructure/nginx/builder.rb +13 -0
- data/lib/shared_infrastructure/runner/base.rb +2 -1
- data/lib/shared_infrastructure/runner/rails.rb +1 -1
- data/lib/shared_infrastructure/runner/static_site.rb +1 -1
- data/lib/shared_infrastructure/systemd/rails.rb +1 -4
- metadata +2 -3
- data/lib/shared_infrastructure/runner/deploy.rb +0 -55
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d045d1733b5238d63ba991f82ee7a0aede2aa8c9
|
4
|
+
data.tar.gz: d8b39349b97ac3cdcf1042429ecd077e34899b72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 765448322ab39cbabb387e56bb6d112c6c017949a12d76be23204d40efd09787e176cf033726e702dcc594c7ac5a8abf825106aef60aa37e6384f203b81d6b75
|
7
|
+
data.tar.gz: e471cbb425cf5508aac4e1fcb0ba07b1f412197307982a265434d622cb66a75e42356f8ccd314ee641dc468ed950947db7cc95de0248042d79c777349a6c7e7d
|
@@ -15,6 +15,5 @@ require "shared_infrastructure/runner/base.rb"
|
|
15
15
|
require "shared_infrastructure/runner/reverse_proxy.rb"
|
16
16
|
require "shared_infrastructure/runner/static_site.rb"
|
17
17
|
require "shared_infrastructure/runner/rails.rb"
|
18
|
-
require "shared_infrastructure/runner/deploy.rb"
|
19
18
|
require "shared_infrastructure/systemd/systemd.rb"
|
20
19
|
require "shared_infrastructure/systemd/rails.rb"
|
@@ -170,6 +170,19 @@ Finally, re-run this script to configure nginx for TLS.
|
|
170
170
|
ENV[var]
|
171
171
|
end
|
172
172
|
end
|
173
|
+
SharedInfrastructure::Output.open(File.join("/etc/logrotate.d", "#{domain.domain_name}.conf"), "w") do |io|
|
174
|
+
io << <<~LOGROTATE
|
175
|
+
compress
|
176
|
+
|
177
|
+
#{domain.production_log} {
|
178
|
+
size 1M
|
179
|
+
rotate 4
|
180
|
+
copytruncate
|
181
|
+
missingok
|
182
|
+
notifempty
|
183
|
+
}
|
184
|
+
LOGROTATE
|
185
|
+
end &&
|
173
186
|
File.open(SharedInfrastructure::Output.file_name(File.join(domain.site_root, "secrets")), "w", 0o600) do |io|
|
174
187
|
io << env.map { |pair| "#{pair[0]}=#{pair[1]}\n" }.join
|
175
188
|
end &&
|
@@ -73,11 +73,12 @@ module Runner
|
|
73
73
|
"--root DIRECTORY",
|
74
74
|
"DIRECTORY. Set a root for files. This options is for debugging.") do |directory|
|
75
75
|
Nginx.chroot(directory)
|
76
|
+
SharedInfrastructure::Output.fake_root(directory)
|
76
77
|
end
|
77
78
|
|
78
79
|
opts.on("-u USER",
|
79
80
|
"--user USER",
|
80
|
-
"User to be the owner of certain files. Default:
|
81
|
+
"User to be the owner of certain files. Default: the current user.") do |user|
|
81
82
|
options[:user] = user
|
82
83
|
end
|
83
84
|
|
@@ -22,7 +22,7 @@ module Runner
|
|
22
22
|
# There's almost certainly a refactoring that would make this less
|
23
23
|
# convoluted.
|
24
24
|
domain_name = options.delete(:domain_name)
|
25
|
-
user = options.delete(:user)
|
25
|
+
user = options.delete(:user)
|
26
26
|
certificate_domain = options.delete(:certificate_domain)
|
27
27
|
accel_location = options.delete(:accel_location)
|
28
28
|
domain = SharedInfrastructure::Domain.new(domain_name)
|
@@ -12,7 +12,7 @@ module Runner
|
|
12
12
|
)
|
13
13
|
|
14
14
|
domain_name = options.delete(:domain_name)
|
15
|
-
user = options.delete(:user)
|
15
|
+
user = options.delete(:user)
|
16
16
|
certificate_domain = options.delete(:certificate_domain)
|
17
17
|
domain = SharedInfrastructure::Domain.new(domain_name)
|
18
18
|
protocol_class.new(user, certificate_domain, domain: domain)
|
@@ -44,11 +44,8 @@ module Systemd
|
|
44
44
|
# Environment=PUMA_DEBUG=1
|
45
45
|
Environment=RACK_ENV=production
|
46
46
|
Environment=RAILS_ENV=production
|
47
|
+
# FIXME: The following is the wrong place
|
47
48
|
EnvironmentFile=#{domain.secrets}
|
48
|
-
Environment=SECRET_KEY_BASE=#{ENV['SECRET_KEY_BASE']}
|
49
|
-
Environment=DATABASE_USERNAME=#{ENV['DATABASE_USERNAME']}
|
50
|
-
Environment=DATABASE_PASSWORD=#{ENV['DATABASE_PASSWORD']}
|
51
|
-
Environment=EMAIL_PASSWORD=#{ENV['EMAIL_PASSWORD']}
|
52
49
|
Environment=REDIS_URL=unix:///tmp/#{redis_location(domain_name)}.sock
|
53
50
|
|
54
51
|
# The command to start Puma
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shared-infrastructure
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Larry Reid
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: 'For static sites, Rails apps, and reverse proxies.
|
14
14
|
|
@@ -37,7 +37,6 @@ files:
|
|
37
37
|
- lib/shared_infrastructure/nginx/upstream.rb
|
38
38
|
- lib/shared_infrastructure/output.rb
|
39
39
|
- lib/shared_infrastructure/runner/base.rb
|
40
|
-
- lib/shared_infrastructure/runner/deploy.rb
|
41
40
|
- lib/shared_infrastructure/runner/rails.rb
|
42
41
|
- lib/shared_infrastructure/runner/reverse_proxy.rb
|
43
42
|
- lib/shared_infrastructure/runner/static_site.rb
|
@@ -1,55 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "optparse"
|
4
|
-
require "production"
|
5
|
-
|
6
|
-
module Runner
|
7
|
-
class << self
|
8
|
-
attr_accessor :debug
|
9
|
-
end
|
10
|
-
self.debug = false
|
11
|
-
|
12
|
-
##
|
13
|
-
# Runner for deployment
|
14
|
-
class Deploy
|
15
|
-
def main
|
16
|
-
process_options
|
17
|
-
raise MissingArgument, "repository required" unless ARGV.size == 1
|
18
|
-
Production.repository = ARGV[0]
|
19
|
-
end
|
20
|
-
|
21
|
-
def process_options
|
22
|
-
options = OptionParser.new do |opts|
|
23
|
-
opts.banner = "Usage: [options] REPOSITORY"
|
24
|
-
|
25
|
-
opts.on("-b BRANCH", "--branch BRANCH", "Branch in repository to deploy.") do |branch|
|
26
|
-
Production.branch = branch
|
27
|
-
end
|
28
|
-
|
29
|
-
opts.on("-d", "--debug", "Print debugging information.") do
|
30
|
-
Runner.debug = true
|
31
|
-
end
|
32
|
-
|
33
|
-
opts.on("-r DIRECTORY",
|
34
|
-
"--root DIRECTORY",
|
35
|
-
"DIRECTORY. Set a root for files. This options is for debugging.") do |directory|
|
36
|
-
Output.fake_root(directory)
|
37
|
-
end
|
38
|
-
|
39
|
-
opts.on("-u REPOSITORY_USER",
|
40
|
-
"--user REPOSITORY_USER",
|
41
|
-
"REPOSITORY_USER. User name for the respository.") do |user|
|
42
|
-
Production.user = user
|
43
|
-
end
|
44
|
-
end
|
45
|
-
options.parse!
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
class MissingArgument < RuntimeError
|
50
|
-
def initialize(msg)
|
51
|
-
super msg
|
52
|
-
end
|
53
|
-
attr_reader :msg
|
54
|
-
end
|
55
|
-
end
|