shippy 0.2.2 → 0.2.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d6b3f55a1265237768a447d1a0fc8004ce36d4251a29577c04ea4f612e39fc83
4
- data.tar.gz: 4687902298d33cd6ed0fc4eb14bb4925b3fda6652af086225ff6eb5114464a0e
3
+ metadata.gz: 5655cddec8ec27d9507202159d17e8501b7a8d4119857adf2b7b73d2e569fb3c
4
+ data.tar.gz: 6bba258479efe8243d089b28da0a4b775d1ecbacd6b733f60548f07c99644fa2
5
5
  SHA512:
6
- metadata.gz: 9252cf785d5e2ead3a4dfda960139b541b90b10f5aa3aa785ad53493c2e2b7964bf6bd59c4229975505c63e230098104ff260660fdb6010d54c698fb7150a591
7
- data.tar.gz: 5696767dae26cca80ef8203bb0e6395e9f2baa9618b33b49975318863dbd203277bd2e9591c9f9ee3855ca4facaa9d4359f87f7d53a5725113ac6f85cc29df17
6
+ metadata.gz: cf0825967db41d98a1ecff981892b39881434f21aa8cd0ed1e9f40d6ee4f056251ed960f53729f235d4794fd165d2df4835692a1159a8cd7fa0d48461187d0ff
7
+ data.tar.gz: d586a76ec8f0653dae0a95b5c054b6980388921a244d81f0c496eb8e5212a81d0097fcf391ca2bee50807ef4335b4c6434763063cdfc449712c0df03651aadaf
@@ -2,10 +2,17 @@ class Shippy::Cli::App < Shippy::Cli::Base
2
2
  argument :app_name, type: :string
3
3
 
4
4
  def initialize(...)
5
- super(...)
5
+ super
6
6
  load_app
7
7
  end
8
8
 
9
+ desc "compile", "compile application"
10
+ def compile
11
+ say "compiling #{app_name} on #{SHIPPY.host}...", :magenta
12
+
13
+ SHIPPY.compile
14
+ end
15
+
9
16
  desc "deploy", "Deploy application"
10
17
  def deploy
11
18
  say "Deploying #{app_name} on #{SHIPPY.host}...", :magenta
@@ -1,6 +1,6 @@
1
1
  Shippy.define do
2
2
  service :proxy do
3
- image { "traefik:v2.9" }
3
+ image { "traefik:v3.5" }
4
4
  command { "--configFile=/config/config.yml" }
5
5
 
6
6
  environment do
@@ -56,7 +56,7 @@ module Shippy
56
56
  def copy_template_files(file)
57
57
  new_path = build_dest(file.gsub(".erb", ""))
58
58
  mode = File.stat(file).mode
59
- template = ERB.new(File.read(file))
59
+ template = ERB.new(File.read(file), trim_mode: "-")
60
60
  result = template.result(app.get_binding)
61
61
  File.open(new_path, "wb", mode) { |f| f.write(result) }
62
62
  end
@@ -1,9 +1,9 @@
1
1
  module Shippy
2
2
  class Service
3
3
  ATTRIBUTES = %i[
4
- build command depends_on devices entrypoint environment hostname image
5
- labels logging networks user ports restart volumes volumes_from working_dir
6
- security_opt
4
+ build command depends_on devices entrypoint environment extra_hosts hostname
5
+ image labels logging networks user ports restart volumes volumes_from
6
+ working_dir security_opt
7
7
  ].freeze
8
8
 
9
9
  attr_reader :name, :app
@@ -56,21 +56,23 @@ module Shippy
56
56
  networks { ["lan_access"] }
57
57
  end
58
58
 
59
- def use_traefik(name:, alt: nil, port: nil, healthcheck: false)
59
+ def use_traefik(name:, alt: nil, port: nil, &block)
60
60
  labels do
61
61
  all_labels = ["traefik.enable=true"]
62
62
  all_labels += ["traefik.docker.network=lan_access"]
63
- all_labels += build_traefik_labels(name: name, port: port)
64
- all_labels += build_traefik_labels(name: alt, port: port) if alt
65
- all_labels += build_ihxator_labels(service: "https://#{name}.#{wildcard_domain}") if healthcheck
63
+ all_labels += build_traefik_labels(name: name, port: port, &block)
64
+ all_labels += build_traefik_labels(name: alt, port: port, &block) if alt
66
65
 
67
66
  all_labels
68
67
  end
69
68
  end
70
69
 
71
70
  def build_traefik_labels(name:, port: nil)
71
+ rule = "Host(`#{name}.#{wildcard_domain}`)"
72
+ rule = yield(rule) if block_given?
73
+
72
74
  [
73
- "traefik.http.routers.websecure-#{name}.rule=Host(`#{name}.#{wildcard_domain}`)",
75
+ "traefik.http.routers.websecure-#{name}.rule=#{rule}",
74
76
  "traefik.http.routers.websecure-#{name}.entrypoints=websecure",
75
77
  "traefik.http.routers.websecure-#{name}.tls=true",
76
78
  "traefik.http.routers.websecure-#{name}.tls.certresolver=ssl-resolver",
@@ -79,31 +81,16 @@ module Shippy
79
81
 
80
82
  "traefik.http.routers.web-#{name}.rule=Host(`#{name}.#{wildcard_domain}`)",
81
83
  "traefik.http.routers.web-#{name}.entrypoints=web",
82
- "traefik.http.routers.web-#{name}.middlewares=secure-redirect-scheme@file",
83
-
84
- "traefik.http.routers.#{name}-local.rule=Host(`#{name}.#{local_domain}`)",
85
- "traefik.http.routers.#{name}-local.entrypoints=web",
86
- "traefik.http.middlewares.#{name}-local.redirectregex.regex=^http://#{name}.#{local_domain}",
87
- "traefik.http.middlewares.#{name}-local.redirectregex.replacement=https://#{name}.#{wildcard_domain}",
88
- "traefik.http.middlewares.#{name}-local.redirectregex.permanent=true",
89
- "traefik.http.routers.#{name}-local.middlewares=#{name}-local@docker"
84
+ "traefik.http.routers.web-#{name}.middlewares=secure-redirect-scheme@file"
90
85
  ].tap do |labels|
91
86
  if port
92
87
  labels << "traefik.http.services.#{name}.loadbalancer.server.port=#{port}"
93
88
  labels << "traefik.http.routers.websecure-#{name}.service=#{name}"
94
89
  labels << "traefik.http.routers.web-#{name}.service=#{name}"
95
- labels << "traefik.http.routers.#{name}-local.service=#{name}"
96
90
  end
97
91
  end
98
92
  end
99
93
 
100
- def build_ihxator_labels(service:)
101
- [
102
- "ihxator.enable=true",
103
- "ihxator.service=#{service}"
104
- ]
105
- end
106
-
107
94
  def secrets(name)
108
95
  @app.secrets(name)
109
96
  end
@@ -1,3 +1,3 @@
1
1
  module Shippy
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shippy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marius Bobin
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-01-25 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: activesupport
@@ -148,7 +147,6 @@ dependencies:
148
147
  - - "~>"
149
148
  - !ruby/object:Gem::Version
150
149
  version: '1.3'
151
- description:
152
150
  email:
153
151
  - marius@mbobin.me
154
152
  executables:
@@ -187,7 +185,6 @@ metadata:
187
185
  allowed_push_host: https://rubygems.org
188
186
  homepage_uri: https://mbobin.me/shippy
189
187
  source_code_uri: https://mbobin.me/shippy
190
- post_install_message:
191
188
  rdoc_options: []
192
189
  require_paths:
193
190
  - lib
@@ -202,8 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
202
199
  - !ruby/object:Gem::Version
203
200
  version: '0'
204
201
  requirements: []
205
- rubygems_version: 3.5.21
206
- signing_key:
202
+ rubygems_version: 4.0.3
207
203
  specification_version: 4
208
204
  summary: Deployment wrapper around docker-compose and SSH Kit
209
205
  test_files: []