mrsk 0.6.1 → 0.6.2

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: 957bd15fa5ddbd2b63c0f264cb92ccb3288ba956d0ba371fcfa752bd75604e6c
4
- data.tar.gz: 14826e53ee7534b3a25efe4671e7325486e377f4313cbe991348d119059070b3
3
+ metadata.gz: 0e810a4dc3e4a8e859440ab1902e51ada21f3267b5687efd3fb344d9d8d6af20
4
+ data.tar.gz: 1fbef83c2a77a821b011d43c22243e34bf8f0b631011441532b369b3a175e7da
5
5
  SHA512:
6
- metadata.gz: 8020ed616daa525d17cec2d638abb7707a0daae8acf320f72a488609d8eaee64a65f708b17aa84f9d87e939f8e608298a31cbbe090f34000885d6a5702cf601a
7
- data.tar.gz: 4e1a952fa22de6cba2c71983686d274b1d4fab3153b2db40859a4a3d03b49ac9676ee0d782892a812c55a39788d39c55b948456d59a43dea462c0106b777e6aa
6
+ metadata.gz: 18b1110d168d3cb05daece74232d31dbca6008d68f041aa4d90dd56b48422ded2df552d133dd3c0bf6e5a19de297e9f6e0eb1c84190fc42b700a81940b7bb406
7
+ data.tar.gz: 4c2f34570b9c3d193b874625afd8067aa271ee10556f0c756b8246d1cb93eec591b73ae7ae43eb3bc6713d24f14ee96e1b0e2c237ff0320ac75919e09132a792
data/README.md CHANGED
@@ -47,7 +47,7 @@ Voila! All the servers are now serving the app on port 80. If you're just runnin
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
- 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.
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, either transparently [like Render](https://thenewstack.io/render-cloud-deployment-with-less-engineering/) or explicitly on AWS/GCP, 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
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
53
 
@@ -249,14 +249,15 @@ builder:
249
249
 
250
250
  This build secret can then be referenced in the Dockerfile:
251
251
 
252
- ```
252
+ ```dockerfile
253
253
  # Copy Gemfiles
254
254
  COPY Gemfile Gemfile.lock ./
255
255
 
256
- # Install dependencies, including private repositories via access token
256
+ # Install dependencies, including private repositories via access token (then remove git configs with exposed GITHUB_TOKEN)
257
257
  RUN --mount=type=secret,id=GITHUB_TOKEN \
258
258
  BUNDLE_GITHUB__COM=x-access-token:$(cat /run/secrets/GITHUB_TOKEN) \
259
- bundle install
259
+ bundle install && \
260
+ find /usr/local/bundle/cache/bundler/git -name "config" -delete
260
261
  ```
261
262
 
262
263
  ### Using command arguments for Traefik
@@ -75,10 +75,14 @@ class Mrsk::Commander
75
75
 
76
76
 
77
77
  def with_verbosity(level)
78
- old_level = SSHKit.config.output_verbosity
78
+ old_level = self.verbosity
79
+
80
+ self.verbosity = level
79
81
  SSHKit.config.output_verbosity = level
82
+
80
83
  yield
81
84
  ensure
85
+ self.verbosity = old_level
82
86
  SSHKit.config.output_verbosity = old_level
83
87
  end
84
88
 
@@ -12,6 +12,7 @@ class Mrsk::Commands::Accessory < Mrsk::Commands::Base
12
12
  "--name", service_name,
13
13
  "-d",
14
14
  "--restart", "unless-stopped",
15
+ "--log-opt", "max-size=#{MAX_LOG_SIZE}",
15
16
  "-p", port,
16
17
  *env_args,
17
18
  *volume_args,
@@ -5,6 +5,7 @@ class Mrsk::Commands::App < Mrsk::Commands::Base
5
5
  docker :run,
6
6
  "-d",
7
7
  "--restart unless-stopped",
8
+ "--log-opt", "max-size=#{MAX_LOG_SIZE}",
8
9
  "--name", service_with_version,
9
10
  *role.env_args,
10
11
  *config.volume_args,
@@ -2,6 +2,8 @@ module Mrsk::Commands
2
2
  class Base
3
3
  delegate :redact, to: Mrsk::Utils
4
4
 
5
+ MAX_LOG_SIZE = "10m"
6
+
5
7
  attr_accessor :config
6
8
 
7
9
  def initialize(config)
@@ -13,6 +13,10 @@ class Mrsk::Commands::Builder::Base < Mrsk::Commands::Base
13
13
  argumentize "--secret", secrets.collect { |secret| [ "id", secret ] }
14
14
  end
15
15
 
16
+ def build_tags
17
+ [ "-t", config.absolute_image, "-t", config.latest_image ]
18
+ end
19
+
16
20
  private
17
21
  def args
18
22
  (config.builder && config.builder["args"]) || {}
@@ -12,7 +12,7 @@ class Mrsk::Commands::Builder::Multiarch < Mrsk::Commands::Builder::Base
12
12
  "--push",
13
13
  "--platform", "linux/amd64,linux/arm64",
14
14
  "--builder", builder_name,
15
- "-t", config.absolute_image,
15
+ *build_tags,
16
16
  *build_args,
17
17
  *build_secrets,
18
18
  "."
@@ -16,7 +16,7 @@ class Mrsk::Commands::Builder::Native::Remote < Mrsk::Commands::Builder::Native
16
16
  "--push",
17
17
  "--platform", platform,
18
18
  "--builder", builder_name,
19
- "-t", config.absolute_image,
19
+ *build_tags,
20
20
  *build_args,
21
21
  *build_secrets,
22
22
  "."
@@ -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", config.absolute_image, *build_args, *build_secrets, "."),
12
+ docker(:build, *build_tags, *build_args, *build_secrets, "."),
13
13
  docker(:push, config.absolute_image)
14
14
  end
15
15
 
@@ -2,8 +2,8 @@ require "active_support/duration"
2
2
  require "active_support/core_ext/numeric/time"
3
3
 
4
4
  class Mrsk::Commands::Prune < Mrsk::Commands::Base
5
- PRUNE_IMAGES_AFTER = 30.days.in_hours.to_i
6
- PRUNE_CONTAINERS_AFTER = 3.days.in_hours.to_i
5
+ PRUNE_IMAGES_AFTER = 7.days.in_hours.to_i
6
+ PRUNE_CONTAINERS_AFTER = 3.days.in_hours.to_i
7
7
 
8
8
  def images
9
9
  docker :image, :prune, "-f", "--filter", "until=#{PRUNE_IMAGES_AFTER}h"
@@ -2,7 +2,8 @@ class Mrsk::Commands::Traefik < Mrsk::Commands::Base
2
2
  def run
3
3
  docker :run, "--name traefik",
4
4
  "-d",
5
- "--restart unless-stopped",
5
+ "--restart", "unless-stopped",
6
+ "--log-opt", "max-size=#{MAX_LOG_SIZE}",
6
7
  "-p 80:80",
7
8
  "-v /var/run/docker.sock:/var/run/docker.sock",
8
9
  "traefik",
@@ -82,6 +82,10 @@ class Mrsk::Configuration
82
82
  "#{repository}:#{version}"
83
83
  end
84
84
 
85
+ def latest_image
86
+ "#{repository}:latest"
87
+ end
88
+
85
89
  def service_with_version
86
90
  "#{service}-#{version}"
87
91
  end
data/lib/mrsk/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mrsk
2
- VERSION = "0.6.1"
2
+ VERSION = "0.6.2"
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.1
4
+ version: 0.6.2
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-07 00:00:00.000000000 Z
11
+ date: 2023-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport