ferryboat 0.1.2 → 0.1.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: acf7c7b501facc790dcfc02da30974c7ca0e0bc6f756ff5ae0a8eedfdac4baca
4
- data.tar.gz: 3007ce3a3ceaeccb10dfc04b943b64e384f0da9e5ceebfac3107224ad673202f
3
+ metadata.gz: 6ee1558c548a0dd061b639e3b642e5e699fdeff279684476339819f97d0f19f4
4
+ data.tar.gz: a2bfb237a56febd5c8202971ddf02a0ac1938cecde997b61bd285b103fc38b7a
5
5
  SHA512:
6
- metadata.gz: f0ef8c0b48dfa47ed6e8974998787ccf2052ac5824dc5d86289617c52fee8e70bcf248e0c970b59dfff6668ac490311d91e409d4819fadb7f197609745db9eb9
7
- data.tar.gz: 874cd8a690a4fd14e58411f3528c5d1569f00c3f2d61465a12049092aaf8d10d1ede998f079afd1c42b39f7f9433c4e5d5c6709489117f43e8e65a9bba30337b
6
+ metadata.gz: 2fbac7ccf657537bc87c139c2ca3674771653c9046b103a09b02fa706bb57ab15ac1c645980d5fb33f3e2267f2037ac1b522ed6defb392e3fc74055e24b00b2d
7
+ data.tar.gz: d1f192edb63bd9d9ee765102e894cba22f11cbf86b685e5c26bb2d3cc6a85ef2533a132dd9984ba7a059bc428b00adfcaa21fa01248e827908a3c2054daf6be3
data/README.md CHANGED
@@ -12,7 +12,7 @@ It’s designed for marketing sites, micro-apps, and fast-moving projects that n
12
12
  - **Staging environments baked in**
13
13
  - **Lightweight backups** of container volumes
14
14
  - **GitHub integration** for pulling and building images
15
- - **Simple CLI** powered by Thor
15
+ - **Simple CLI**
16
16
  - **Config-driven** via `ferryboat.yml`
17
17
 
18
18
  ---
data/bin/console ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "ferryboat"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ require "irb"
11
+ IRB.start(__FILE__)
data/bin/ferryboat ADDED
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ $stdout.sync = true
5
+
6
+ # Quiet thread exceptions
7
+ Thread.report_on_exception = false
8
+
9
+ # Be nice on Ctrl-C and TERM
10
+ Signal.trap("INT") { exit 0 }
11
+ Signal.trap("TERM") { exit 0 }
12
+ Signal.trap("PIPE") { exit 0 } rescue nil
13
+
14
+ begin
15
+ require "ferryboat"
16
+ require "ferryboat/cli" # explicit for reliability
17
+ rescue LoadError => e
18
+ warn "ferryboat: failed to load library: #{e.message}"
19
+ warn e.backtrace.join("\n") if ENV["FERRY_DEBUG"] == "1"
20
+ exit 1
21
+ end
22
+
23
+ begin
24
+ Ferryboat::Cli.start(ARGV)
25
+ rescue SystemExit => e
26
+ # Respect Thor's exit codes
27
+ exit e.status
28
+ rescue => e
29
+ warn "ferryboat: #{e.message}"
30
+ warn e.backtrace.join("\n") if ENV["FERRY_DEBUG"] == "1"
31
+ exit 1
32
+ end
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,88 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "yaml"
4
+
5
+ module Ferryboat
6
+ class Config
7
+ attr_reader :env, :service, :image_repo, :domain, :host,
8
+ :provider, :git_url, :git_branch,
9
+ :health_path, :health_timeout, :detect_timeout,
10
+ :auto_backup
11
+
12
+ REQUIRED_KEYS = %i[service image_repo domain].freeze
13
+
14
+ def self.from_env(env: ENV.fetch("FERRY_ENV", "production"))
15
+ new(
16
+ env: env,
17
+ service: ENV.fetch("FERRY_SERVICE", nil),
18
+ image_repo: ENV.fetch("FERRY_IMAGE", nil),
19
+ domain: ENV.fetch("FERRY_DOMAIN", nil),
20
+ host: ENV.fetch("FERRY_HOST", "localhost"),
21
+ provider: ENV.fetch("FERRY_PROVIDER", "docker"), # docker|kamal
22
+ git_url: ENV["GIT_URL"],
23
+ git_branch: ENV.fetch("GIT_BRANCH", "main"),
24
+ health_path: ENV.fetch("FERRY_HEALTH_PATH", "/up"),
25
+ health_timeout: Integer(ENV.fetch("FERRY_HEALTH_TIMEOUT", "120")),
26
+ detect_timeout: Integer(ENV.fetch("FERRY_TRAEFIK_DETECT_TIMEOUT", "60")),
27
+ auto_backup: ENV["FERRY_AUTO_BACKUP"] == "true"
28
+ )
29
+ end
30
+
31
+ # Optional YAML loader (keeps env override semantics)
32
+ def self.from_file(path, env: "production")
33
+ data = YAML.load_file(path)
34
+ cfg = (data[env] || {})
35
+ new(
36
+ env: env,
37
+ service: ENV["FERRY_SERVICE"] || cfg["service"],
38
+ image_repo: ENV["FERRY_IMAGE"] || cfg["image_repo"] || cfg["docker_registry"],
39
+ domain: ENV["FERRY_DOMAIN"] || cfg["domain"],
40
+ host: ENV["FERRY_HOST"] || cfg["host"] || "localhost",
41
+ provider: ENV["FERRY_PROVIDER"] || cfg["provider"] || "docker",
42
+ git_url: ENV["GIT_URL"] || cfg["git_url"],
43
+ git_branch: ENV["GIT_BRANCH"] || cfg["git_branch"] || "main",
44
+ health_path: ENV["FERRY_HEALTH_PATH"] || cfg["health_path"] || "/up",
45
+ health_timeout: Integer(ENV["FERRY_HEALTH_TIMEOUT"] || cfg["health_timeout"] || 120),
46
+ detect_timeout: Integer(ENV["FERRY_TRAEFIK_DETECT_TIMEOUT"] || cfg["detect_timeout"] || 60),
47
+ auto_backup: (ENV["FERRY_AUTO_BACKUP"] || cfg["auto_backup"]).to_s == "true"
48
+ )
49
+ end
50
+
51
+ def initialize(env:, service:, image_repo:, domain:, host:, provider:, git_url:, git_branch:, health_path:, health_timeout:, detect_timeout:, auto_backup:)
52
+ @env, @service, @image_repo, @domain = env, service, image_repo, domain
53
+ @host, @provider = host, provider
54
+ @git_url, @git_branch = git_url, git_branch
55
+ @health_path, @health_timeout, @detect_timeout = health_path, health_timeout, detect_timeout
56
+ @auto_backup = auto_backup
57
+ validate!
58
+ end
59
+
60
+ def validate!
61
+ missing = []
62
+ missing << :service if blank?(service)
63
+ missing << :image_repo if blank?(image_repo)
64
+ missing << :domain if blank?(domain)
65
+ return true if missing.empty?
66
+ raise ArgumentError, "Missing required config: #{missing.join(', ')}"
67
+ end
68
+
69
+ def provider_runner
70
+ case provider
71
+ when "kamal" then Ferryboat::Deployer::KamalRunner.new
72
+ when "docker" then Ferryboat::Deployer::DockerRunner.new
73
+ else raise ArgumentError, "Unknown provider: #{provider.inspect}"
74
+ end
75
+ end
76
+
77
+ def to_h
78
+ {
79
+ env: env, service: service, image_repo: image_repo, domain: domain,
80
+ host: host, provider: provider, git_url: git_url, git_branch: git_branch,
81
+ health_path: health_path, health_timeout: health_timeout,
82
+ detect_timeout: detect_timeout, auto_backup: auto_backup
83
+ }
84
+ end
85
+
86
+ private
87
+ end
88
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Ferryboat
4
+ # Wraps Kamal CLI commands for remote execution
5
+ class Kamal
6
+ def initialize(app: nil, reuse: true)
7
+ @app = app || ENV.fetch("FERRY_SERVICE")
8
+ @reuse = reuse
9
+ end
10
+
11
+ # run a raw kamal command
12
+ def run(*args)
13
+ cmd = ["kamal"]
14
+ cmd << "app" << "exec"
15
+ cmd << "--reuse" if @reuse
16
+ cmd << "--app" << @app if @app
17
+ cmd << "--" << "/bin/sh" << "-lc" << %("#{args.join(' ')}")
18
+ sh cmd.join(" ")
19
+ end
20
+
21
+ # convenience: docker subcommand
22
+ def docker(*args)
23
+ run("docker", *args)
24
+ end
25
+
26
+ private
27
+
28
+ def sh(cmd)
29
+ puts "→ #{cmd}"
30
+ system(cmd)
31
+ end
32
+ end
33
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ferryboat
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.4"
5
5
  end
data/lib/ferryboat.rb CHANGED
@@ -3,6 +3,4 @@
3
3
  require_relative "ferryboat/version"
4
4
 
5
5
  module Ferryboat
6
- class Error < StandardError; end
7
- # Your code goes here...
8
6
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ferryboat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - 21tycoons
8
- bindir: exe
8
+ bindir: bin
9
9
  cert_chain: []
10
- date: 2025-08-17 00:00:00.000000000 Z
10
+ date: 2025-08-20 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: thor
@@ -44,14 +44,20 @@ description: |
44
44
  safely to production without unnecessary complexity.
45
45
  email:
46
46
  - liroy@tycooncrm.com
47
- executables: []
47
+ executables:
48
+ - ferryboat
48
49
  extensions: []
49
50
  extra_rdoc_files: []
50
51
  files:
51
52
  - README.md
53
+ - bin/console
54
+ - bin/ferryboat
55
+ - bin/setup
52
56
  - lib/ferryboat.rb
53
57
  - lib/ferryboat/cli.rb
58
+ - lib/ferryboat/config.rb
54
59
  - lib/ferryboat/deployer.rb
60
+ - lib/ferryboat/kamal.rb
55
61
  - lib/ferryboat/version.rb
56
62
  homepage: https://github.com/21tycoons/ferryboat
57
63
  licenses: