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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8bb523ac89ed682e739e8312da6ee60bc45baace7f1d3b836d3fb62b9c75539f
4
- data.tar.gz: 5f3552e54648aa2f0c7c795b921c0523a3deca6aeb22d5bd2fa6901dec169e33
3
+ metadata.gz: 957bd15fa5ddbd2b63c0f264cb92ccb3288ba956d0ba371fcfa752bd75604e6c
4
+ data.tar.gz: 14826e53ee7534b3a25efe4671e7325486e377f4313cbe991348d119059070b3
5
5
  SHA512:
6
- metadata.gz: afd16123f8681337a1f30c0908221b96c8e9540485126f20a63741ed524bd9f282cc7bdaa1aad50f61f68887f7fe1176435f5dd2f58605780de2866ee141c40c
7
- data.tar.gz: e40f284df37ec58990c4a2e2ebd8765641eb797fb83abeed8d02aa857dd40a079793a62c5c98bfe3204c9bddeb8ebf1e2a33dde09cf337050cb4283eb05485df
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 Kubernetes?
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
- cli.remove_container version
20
+ execute *MRSK.app.remove_container(version: version)
24
21
  execute *MRSK.app.run(role: role.name)
25
22
  else
26
23
  raise
@@ -91,7 +91,15 @@ class Mrsk::Commander
91
91
 
92
92
  private
93
93
  def cascading_version
94
- version.presence || ENV["VERSION"] || `git rev-parse HEAD`.strip
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, config.absolute_image, "."),
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
@@ -1,3 +1,3 @@
1
1
  module Mrsk
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.1"
3
3
  end
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.0
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-05 00:00:00.000000000 Z
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 Rails apps in containers to servers running Docker with zero downtime.
149
+ summary: Deploy web apps in containers to servers running Docker with zero downtime.
150
150
  test_files: []