shippy 0.2.7 → 0.2.8
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 +4 -4
- data/README.md +18 -24
- data/lib/shippy/cli/app.rb +33 -1
- data/lib/shippy/cli/templates/apps/proxy/docker-compose.rb +2 -2
- data/lib/shippy/cli/templates/apps/proxy/traefik/config.yml.erb +0 -4
- data/lib/shippy/remote/app.rb +30 -0
- data/lib/shippy/secrets_manager.rb +5 -1
- data/lib/shippy/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1fe36006872a9b130eecbfa26b391a3a645dafaced62917c530ac9510944abd8
|
|
4
|
+
data.tar.gz: a8c0268d4cdb6c776600a21038eeb5de722c7601a770a8f33630bb8b414f0fc6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7b70994648b3f4c7c842460b335faf0f9a70ae62fff47a3236bcf145d052d45a189c05bddf72cbc1be14ce692f854366df846b925fa248a7ca841c65354a7340
|
|
7
|
+
data.tar.gz: abd35fa707247d73707c3c41ec15e5f65cb46d01a386aa48a7c003f92640b341ccb3cfd229224e03c759dcdf064cf2cfd960663bc0af79c085ea866897a51dd5
|
data/README.md
CHANGED
|
@@ -1,44 +1,33 @@
|
|
|
1
|
-
# Shippy
|
|
1
|
+
# 🚢 Shippy
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Shippy is a lightweight container orchestration tool designed specifically for homelabs. It combines the simplicity of Docker Compose with a powerful Ruby DSL, inspired by the deployment workflows of Capistrano and Kamal.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
7
|
- Ruby DSL to generate the docker-compose YAML files
|
|
8
8
|
- Centralized source to define secrets
|
|
9
9
|
- Uses Traefik as a reverse proxy with SSL wildcard support
|
|
10
|
+
- Manage the entire lab with a local `bin/shippy` command.
|
|
10
11
|
|
|
11
|
-
##
|
|
12
|
+
## 🚀 Getting Started
|
|
12
13
|
|
|
13
|
-
Install the gem
|
|
14
|
-
|
|
15
|
-
```shell
|
|
16
|
-
$ bundle add shippy
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
Or
|
|
14
|
+
Install the gem:
|
|
20
15
|
|
|
21
16
|
```shell
|
|
22
17
|
$ gem install shippy
|
|
23
18
|
```
|
|
24
19
|
|
|
25
|
-
## Usage
|
|
26
|
-
|
|
27
20
|
In you homelab directory execute:
|
|
28
21
|
|
|
29
22
|
```shell
|
|
30
|
-
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
Or
|
|
34
|
-
|
|
35
|
-
```shell
|
|
23
|
+
home$ mkdir homelab && cd homelab
|
|
36
24
|
homelab$ shippy init
|
|
37
25
|
```
|
|
38
26
|
|
|
39
|
-
This
|
|
40
|
-
|
|
41
|
-
|
|
27
|
+
This creates the core structure:
|
|
28
|
+
- `apps/`: Where your service definitions live.
|
|
29
|
+
- `config/`: Shippy configuration and secrets.
|
|
30
|
+
- `bin/shippy`: Your local entry point for all commands.
|
|
42
31
|
|
|
43
32
|
### Docker compose DSL:
|
|
44
33
|
|
|
@@ -55,7 +44,7 @@ Example:
|
|
|
55
44
|
```ruby
|
|
56
45
|
Shippy.define do
|
|
57
46
|
service :proxy do
|
|
58
|
-
image { "traefik:
|
|
47
|
+
image { "traefik:v3.6" }
|
|
59
48
|
command { "--configFile=/config/config.yml" }
|
|
60
49
|
|
|
61
50
|
environment do
|
|
@@ -71,17 +60,22 @@ Shippy.define do
|
|
|
71
60
|
|
|
72
61
|
volumes do
|
|
73
62
|
[
|
|
74
|
-
"/var/run/docker.sock:/var/run/docker.sock",
|
|
63
|
+
"/var/run/docker.sock:/var/run/docker.sock:ro",
|
|
75
64
|
"./traefik:/config",
|
|
76
65
|
"acme:/etc/traefik/acme"
|
|
77
66
|
]
|
|
78
67
|
end
|
|
79
68
|
|
|
80
|
-
use_default_options
|
|
69
|
+
use_default_options # Automatically handles networks, logging, and restart policies
|
|
81
70
|
end
|
|
82
71
|
end
|
|
72
|
+
|
|
83
73
|
```
|
|
84
74
|
|
|
75
|
+
By running `bin/shippy deploy proxy` the DSL gets converted to YAML and deployed on the server.
|
|
76
|
+
|
|
77
|
+
See the examples directory for more options.
|
|
78
|
+
|
|
85
79
|
## Development
|
|
86
80
|
|
|
87
81
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/lib/shippy/cli/app.rb
CHANGED
|
@@ -57,8 +57,40 @@ class Shippy::Cli::App < Shippy::Cli::Base
|
|
|
57
57
|
desc "compile", "Compile application"
|
|
58
58
|
def compile
|
|
59
59
|
say "Compiling #{app_name}...", :magenta
|
|
60
|
-
# Load app config and pass to builder
|
|
61
60
|
app_config = Shippy::Repo.load_app(app_name)
|
|
62
61
|
Shippy::Builder.new(app_config).compile
|
|
63
62
|
end
|
|
63
|
+
|
|
64
|
+
desc "rollback", "Rollback to a previous release"
|
|
65
|
+
method_option :step, aliases: "-n", type: :numeric, default: 1, desc: "Releases to go back"
|
|
66
|
+
def rollback
|
|
67
|
+
steps = options[:step]
|
|
68
|
+
|
|
69
|
+
backups = @remote_app.list_backups
|
|
70
|
+
if backups.empty?
|
|
71
|
+
error "No backups found."
|
|
72
|
+
exit(1)
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
target_index = steps - 1
|
|
76
|
+
if target_index < 0 || target_index >= backups.length
|
|
77
|
+
error "Cannot rollback #{steps} steps. Only #{backups.length} backups available."
|
|
78
|
+
exit(1)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
target_ts = backups[target_index]
|
|
82
|
+
say "Rolling back #{steps} step(s) to: #{target_ts}", :yellow
|
|
83
|
+
|
|
84
|
+
@docker.compose_down(@remote_app.current_path)
|
|
85
|
+
|
|
86
|
+
say "Restoring files...", :blue
|
|
87
|
+
@remote_app.restore_backup(target_ts)
|
|
88
|
+
|
|
89
|
+
say "Starting restored application...", :green
|
|
90
|
+
app_config = Shippy::Repo.load_app(app_name)
|
|
91
|
+
@docker.compose_up(@remote_app.current_path, flags: app_config&.deploy_flags)
|
|
92
|
+
rescue => e
|
|
93
|
+
error "Rollback failed: #{e.message}"
|
|
94
|
+
exit(1)
|
|
95
|
+
end
|
|
64
96
|
end
|
|
@@ -11,12 +11,12 @@ Shippy.define do
|
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
ports do
|
|
14
|
-
["80:80", "443:443"
|
|
14
|
+
["80:80", "443:443"]
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
volumes do
|
|
18
18
|
[
|
|
19
|
-
"/var/run/docker.sock:/var/run/docker.sock",
|
|
19
|
+
"/var/run/docker.sock:/var/run/docker.sock:ro",
|
|
20
20
|
"./traefik:/config",
|
|
21
21
|
"acme:/etc/traefik/acme"
|
|
22
22
|
]
|
data/lib/shippy/remote/app.rb
CHANGED
|
@@ -63,6 +63,36 @@ module Shippy
|
|
|
63
63
|
end
|
|
64
64
|
end
|
|
65
65
|
|
|
66
|
+
def list_backups
|
|
67
|
+
base = backups_path
|
|
68
|
+
data = []
|
|
69
|
+
|
|
70
|
+
on(@host) do
|
|
71
|
+
if test("[ -d #{base} ]")
|
|
72
|
+
data = capture(:ls, "-1r", base).split
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
data
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def restore_backup(target_ts)
|
|
80
|
+
backup_source = backups_path.join(target_ts, @app_name)
|
|
81
|
+
target = current_path
|
|
82
|
+
|
|
83
|
+
on(@host) do
|
|
84
|
+
unless test("[ -d #{backup_source} ]")
|
|
85
|
+
raise "Backup directory #{backup_source} does not exist"
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
backup_current_release
|
|
90
|
+
|
|
91
|
+
on(@host) do
|
|
92
|
+
execute :mv, backup_source, target
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
66
96
|
def current_path
|
|
67
97
|
SHIPPY.deploy_path.join("apps", @app_name)
|
|
68
98
|
end
|
|
@@ -33,7 +33,11 @@ module Shippy
|
|
|
33
33
|
@config.read
|
|
34
34
|
else
|
|
35
35
|
"# Add your secrets here. They will be encrypted on save.\n" \
|
|
36
|
-
"#
|
|
36
|
+
"# proxy:\n" \
|
|
37
|
+
"# cloudflare_token: value\n" \
|
|
38
|
+
"# cloudflare_email: name@example.com\n" \
|
|
39
|
+
"# other_service:\n" \
|
|
40
|
+
"# value: secret\n"
|
|
37
41
|
end
|
|
38
42
|
|
|
39
43
|
Tempfile.create(["secrets", ".yml"]) do |tmp_file|
|
data/lib/shippy/version.rb
CHANGED