conjure 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.md +6 -0
- data/lib/conjure/firewall.rb +32 -0
- data/lib/conjure/instance.rb +2 -0
- data/lib/conjure/log_rotate.rb +28 -0
- data/lib/conjure/rails_application.rb +5 -1
- data/lib/conjure/version.rb +1 -1
- metadata +4 -2
data/History.md
CHANGED
@@ -0,0 +1,32 @@
|
|
1
|
+
module Conjure
|
2
|
+
class Firewall
|
3
|
+
def initialize(server)
|
4
|
+
@server = server
|
5
|
+
end
|
6
|
+
|
7
|
+
def install
|
8
|
+
if exists?
|
9
|
+
puts "Firewall detected."
|
10
|
+
else
|
11
|
+
puts "Firewall not detected, installing..."
|
12
|
+
open_ports.each { |port| @server.run "ufw allow #{port}/tcp" }
|
13
|
+
@server.run "ufw --force enable"
|
14
|
+
puts "Firewall installed."
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def pending_files
|
19
|
+
[]
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def open_ports
|
25
|
+
[22, 80, 443, 2222]
|
26
|
+
end
|
27
|
+
|
28
|
+
def exists?
|
29
|
+
@server.run("ufw status").include? "Status: active"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/conjure/instance.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "conjure/docker/host"
|
2
|
+
require "conjure/firewall"
|
2
3
|
require "conjure/rails_application"
|
3
4
|
require "conjure/server"
|
4
5
|
require "conjure/swap"
|
@@ -49,6 +50,7 @@ module Conjure
|
|
49
50
|
|
50
51
|
def components
|
51
52
|
@components ||= [
|
53
|
+
Firewall.new(@server),
|
52
54
|
Swap.new(@server),
|
53
55
|
RailsApplication.new(Docker::Host.new(@server), @options),
|
54
56
|
]
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Conjure
|
2
|
+
class LogRotate
|
3
|
+
def initialize(options)
|
4
|
+
@rails_env = options[:rails_env]
|
5
|
+
end
|
6
|
+
|
7
|
+
def apply(template)
|
8
|
+
template.add_file_data config_file, "/etc/logrotate.d/application"
|
9
|
+
end
|
10
|
+
|
11
|
+
def system_packages
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def config_file
|
17
|
+
'/home/app/application/shared/log/*.log {
|
18
|
+
daily
|
19
|
+
rotate 14
|
20
|
+
missingok
|
21
|
+
compress
|
22
|
+
delaycompress
|
23
|
+
copytruncate
|
24
|
+
}
|
25
|
+
'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require "conjure/delayed_job"
|
2
|
+
require "conjure/log_rotate"
|
2
3
|
require "conjure/postgres"
|
3
4
|
require "conjure/passenger"
|
4
5
|
|
@@ -24,7 +25,10 @@ module Conjure
|
|
24
25
|
database = Postgres.new(@container_host),
|
25
26
|
Passenger.new(@container_host, @options.merge(
|
26
27
|
database: database,
|
27
|
-
services: [
|
28
|
+
services: [
|
29
|
+
DelayedJob.new(@options),
|
30
|
+
LogRotate.new(@options),
|
31
|
+
],
|
28
32
|
)),
|
29
33
|
]
|
30
34
|
end
|
data/lib/conjure/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: conjure
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-01-
|
12
|
+
date: 2016-01-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: net-scp
|
@@ -170,8 +170,10 @@ files:
|
|
170
170
|
- lib/conjure/digital_ocean/key_set.rb
|
171
171
|
- lib/conjure/docker/host.rb
|
172
172
|
- lib/conjure/docker/template.rb
|
173
|
+
- lib/conjure/firewall.rb
|
173
174
|
- lib/conjure/http_request.rb
|
174
175
|
- lib/conjure/instance.rb
|
176
|
+
- lib/conjure/log_rotate.rb
|
175
177
|
- lib/conjure/passenger.rb
|
176
178
|
- lib/conjure/postgres.rb
|
177
179
|
- lib/conjure/rails_application.rb
|