gjallarhorn 0.1.0.alpha → 0.1.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 +4 -4
- data/.yardopts +12 -0
- data/README.md +116 -9
- data/examples/zero-downtime-deployment.rb +104 -0
- data/lib/gjallarhorn/adapter/aws.rb +652 -0
- data/lib/gjallarhorn/adapter/base.rb +125 -0
- data/lib/gjallarhorn/cli.rb +90 -4
- data/lib/gjallarhorn/configuration.rb +64 -8
- data/lib/gjallarhorn/deployer.rb +179 -9
- data/lib/gjallarhorn/deployment/basic.rb +171 -0
- data/lib/gjallarhorn/deployment/legacy.rb +40 -0
- data/lib/gjallarhorn/deployment/strategy.rb +189 -0
- data/lib/gjallarhorn/deployment/zero_downtime.rb +276 -0
- data/lib/gjallarhorn/history.rb +164 -0
- data/lib/gjallarhorn/proxy/kamal_proxy_manager.rb +36 -0
- data/lib/gjallarhorn/proxy/manager.rb +186 -0
- data/lib/gjallarhorn/proxy/nginx_manager.rb +362 -0
- data/lib/gjallarhorn/proxy/traefik_manager.rb +36 -0
- data/lib/gjallarhorn/version.rb +1 -1
- data/lib/gjallarhorn.rb +16 -0
- metadata +101 -6
- data/lib/gjallarhorn/adapters/aws.rb +0 -96
- data/lib/gjallarhorn/adapters/base.rb +0 -56
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "yaml"
|
|
4
|
-
require "logger"
|
|
5
|
-
|
|
6
|
-
# Base adapter interface
|
|
7
|
-
module Gjallarhorn
|
|
8
|
-
module Adapters
|
|
9
|
-
class Base
|
|
10
|
-
attr_reader :config, :logger
|
|
11
|
-
|
|
12
|
-
def initialize(config)
|
|
13
|
-
@config = config
|
|
14
|
-
@logger = Logger.new($stdout)
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
# Core deployment interface
|
|
18
|
-
def deploy(image:, environment:, services: [])
|
|
19
|
-
raise NotImplementedError, "Subclasses must implement deploy"
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def rollback(version:)
|
|
23
|
-
raise NotImplementedError, "Subclasses must implement rollback"
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def status
|
|
27
|
-
raise NotImplementedError, "Subclasses must implement status"
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def health_check(service:)
|
|
31
|
-
raise NotImplementedError, "Subclasses must implement health_check"
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def scale(service:, replicas:)
|
|
35
|
-
raise NotImplementedError, "Subclasses must implement scale"
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def logs(service:, lines: 100)
|
|
39
|
-
raise NotImplementedError, "Subclasses must implement logs"
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
protected
|
|
43
|
-
|
|
44
|
-
def wait_for_health(service, timeout = 300)
|
|
45
|
-
start_time = Time.now
|
|
46
|
-
loop do
|
|
47
|
-
return true if health_check(service: service)
|
|
48
|
-
|
|
49
|
-
raise "Health check timeout for #{service}" if Time.now - start_time > timeout
|
|
50
|
-
|
|
51
|
-
sleep 5
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
end
|