mrsk 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/lib/mrsk/cli/app.rb +3 -6
- data/lib/mrsk/commander.rb +9 -1
- data/lib/mrsk/commands/builder/native.rb +1 -1
- data/lib/mrsk/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 957bd15fa5ddbd2b63c0f264cb92ccb3288ba956d0ba371fcfa752bd75604e6c
|
4
|
+
data.tar.gz: 14826e53ee7534b3a25efe4671e7325486e377f4313cbe991348d119059070b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8020ed616daa525d17cec2d638abb7707a0daae8acf320f72a488609d8eaee64a65f708b17aa84f9d87e939f8e608298a31cbbe090f34000885d6a5702cf601a
|
7
|
+
data.tar.gz: 4e1a952fa22de6cba2c71983686d274b1d4fab3153b2db40859a4a3d03b49ac9676ee0d782892a812c55a39788d39c55b948456d59a43dea462c0106b777e6aa
|
data/README.md
CHANGED
@@ -43,12 +43,14 @@ This will:
|
|
43
43
|
|
44
44
|
Voila! All the servers are now serving the app on port 80. If you're just running a single server, you're ready to go. If you're running multiple servers, you need to put a load balancer in front of them.
|
45
45
|
|
46
|
-
## Why not just run Capistrano or
|
46
|
+
## Why not just run Capistrano, Kubernetes or Docker Swarm?
|
47
47
|
|
48
48
|
MRSK basically is Capistrano for Containers, which allow us to use vanilla servers as the hosts. No need to ensure that the servers have just the right version of Ruby or other dependencies you need. That all lives in the Docker image now. You can boot a brand new Ubuntu (or whatever) server, add it to the deploy servers of MRSK, and it'll be auto-provisioned with Docker, and run right away. Docker's layer caching also allows for quicker deployments with less mucking about on the server. And the images built for MRSK can be used for CI or later introspection.
|
49
49
|
|
50
50
|
Kubernetes is a beast. Running it yourself on your own hardware is not for the faint of heart. It's a fine option if you want to run on someone else's platform, like Render or Fly, but if you'd like the freedom to move between cloud and your own hardware, or even mix the two, MRSK is much simpler. You can see everything that's going on, it's just basic Docker commands being called.
|
51
51
|
|
52
|
+
Docker Swarm is much simpler than Kubernetes, but it's still built on the same declarative model that uses state reconciliation. MRSK is intentionally designed to around imperative commands, like Capistrano.
|
53
|
+
|
52
54
|
## Configuration
|
53
55
|
|
54
56
|
### Using .env file to load required environment variables
|
data/lib/mrsk/cli/app.rb
CHANGED
@@ -1,11 +1,6 @@
|
|
1
1
|
class Mrsk::Cli::App < Mrsk::Cli::Base
|
2
2
|
desc "boot", "Boot app on servers (or reboot app if already running)"
|
3
3
|
def boot
|
4
|
-
cli = self
|
5
|
-
|
6
|
-
say "Ensure no other version of the app is running...", :magenta
|
7
|
-
stop
|
8
|
-
|
9
4
|
say "Get most recent version available as an image...", :magenta unless options[:version]
|
10
5
|
using_version(options[:version] || most_recent_version_available) do |version|
|
11
6
|
say "Start container with version #{version} (or reboot if already running)...", :magenta
|
@@ -15,12 +10,14 @@ class Mrsk::Cli::App < Mrsk::Cli::Base
|
|
15
10
|
execute *MRSK.auditor.record("app boot version #{version}"), verbosity: :debug
|
16
11
|
|
17
12
|
begin
|
13
|
+
execute *MRSK.app.stop, raise_on_non_zero_exit: false
|
18
14
|
execute *MRSK.app.run(role: role.name)
|
19
15
|
rescue SSHKit::Command::Failed => e
|
20
16
|
if e.message =~ /already in use/
|
21
17
|
error "Rebooting container with same version already deployed on #{host}"
|
18
|
+
execute *MRSK.auditor.record("app rebooted with version #{version}"), verbosity: :debug
|
22
19
|
|
23
|
-
|
20
|
+
execute *MRSK.app.remove_container(version: version)
|
24
21
|
execute *MRSK.app.run(role: role.name)
|
25
22
|
else
|
26
23
|
raise
|
data/lib/mrsk/commander.rb
CHANGED
@@ -91,7 +91,15 @@ class Mrsk::Commander
|
|
91
91
|
|
92
92
|
private
|
93
93
|
def cascading_version
|
94
|
-
version.presence || ENV["VERSION"] ||
|
94
|
+
version.presence || ENV["VERSION"] || current_commit_hash
|
95
|
+
end
|
96
|
+
|
97
|
+
def current_commit_hash
|
98
|
+
if system("git rev-parse")
|
99
|
+
`git rev-parse HEAD`.strip
|
100
|
+
else
|
101
|
+
raise "Can't use commit hash as version, no git repository found in #{Dir.pwd}"
|
102
|
+
end
|
95
103
|
end
|
96
104
|
|
97
105
|
# Lazy setup of SSHKit
|
@@ -9,7 +9,7 @@ class Mrsk::Commands::Builder::Native < Mrsk::Commands::Builder::Base
|
|
9
9
|
|
10
10
|
def push
|
11
11
|
combine \
|
12
|
-
docker(:build, "-t", *build_args, *build_secrets,
|
12
|
+
docker(:build, "-t", config.absolute_image, *build_args, *build_secrets, "."),
|
13
13
|
docker(:push, config.absolute_image)
|
14
14
|
end
|
15
15
|
|
data/lib/mrsk/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mrsk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-02-
|
11
|
+
date: 2023-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -146,5 +146,5 @@ requirements: []
|
|
146
146
|
rubygems_version: 3.4.6
|
147
147
|
signing_key:
|
148
148
|
specification_version: 4
|
149
|
-
summary: Deploy
|
149
|
+
summary: Deploy web apps in containers to servers running Docker with zero downtime.
|
150
150
|
test_files: []
|