shippy 0.1.4 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +42 -0
- data/lib/shippy/service.rb +13 -10
- data/lib/shippy/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6045bbdd9f3d3ec7b83b88dc28809c7d3f5391c421b1d8972793e468eb23486
|
4
|
+
data.tar.gz: 63a4e730a4a4637b5d8f4eb13be9330ec6058f622ea17d4bc4cea6e98be26355
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fbee88e84f54ad80aa02e4337586a0f5cba380ec20185e8b3fa45bbcb8ad927accef5e03fdda69b2d61a096d62d544100a51faef78e42ac991e81de217efba8
|
7
|
+
data.tar.gz: bef7b11ba7a7219c229f5da67d3caad8a66405514ed62d5c453051740aa9defe4875597866288b4ab7b7cc6bbd4829bc548b8518d53df863acc16ace04b8649d
|
data/README.md
CHANGED
@@ -40,6 +40,48 @@ This will generate the config files and the `apps` directory with Traefik in the
|
|
40
40
|
|
41
41
|
Now `shippy` can be called using `bin/shippy` binstub and the other commands can be listed using `bin/shippy -h`.
|
42
42
|
|
43
|
+
### Docker compose DSL:
|
44
|
+
|
45
|
+
Conventions:
|
46
|
+
|
47
|
+
- the file needs to be located at `apps/app_name/docker-compose.rb`
|
48
|
+
- the `Shippy.define {}` block describes multiple services for the same compose file
|
49
|
+
- `service :name` describes a docker service
|
50
|
+
- most of the docker-compose keywords are implemented as [methods](./lib/shippy/service.rb) that accept a block.
|
51
|
+
- `volumes` and `networks` are automatically defined
|
52
|
+
|
53
|
+
Example:
|
54
|
+
|
55
|
+
```ruby
|
56
|
+
Shippy.define do
|
57
|
+
service :proxy do
|
58
|
+
image { "traefik:v2.9" }
|
59
|
+
command { "--configFile=/config/config.yml" }
|
60
|
+
|
61
|
+
environment do
|
62
|
+
{
|
63
|
+
CF_API_EMAIL: secrets(:cloudflare_email),
|
64
|
+
CF_DNS_API_TOKEN: secrets(:cloudflare_token)
|
65
|
+
}
|
66
|
+
end
|
67
|
+
|
68
|
+
ports do
|
69
|
+
["80:80", "443:443", "8080:8080"]
|
70
|
+
end
|
71
|
+
|
72
|
+
volumes do
|
73
|
+
[
|
74
|
+
"/var/run/docker.sock:/var/run/docker.sock",
|
75
|
+
"./traefik:/config",
|
76
|
+
"acme:/etc/traefik/acme"
|
77
|
+
]
|
78
|
+
end
|
79
|
+
|
80
|
+
use_default_options
|
81
|
+
end
|
82
|
+
end
|
83
|
+
```
|
84
|
+
|
43
85
|
## Development
|
44
86
|
|
45
87
|
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/service.rb
CHANGED
@@ -2,7 +2,7 @@ module Shippy
|
|
2
2
|
class Service
|
3
3
|
ATTRIBUTES = %i[
|
4
4
|
build command depends_on devices entrypoint environment hostname image
|
5
|
-
labels logging networks ports restart volumes volumes_from working_dir
|
5
|
+
labels logging networks user ports restart volumes volumes_from working_dir
|
6
6
|
security_opt
|
7
7
|
].freeze
|
8
8
|
|
@@ -56,17 +56,18 @@ module Shippy
|
|
56
56
|
networks { ["lan_access"] }
|
57
57
|
end
|
58
58
|
|
59
|
-
def use_traefik(name:, alt: nil, port: nil, healthcheck:
|
59
|
+
def use_traefik(name:, alt: nil, port: nil, healthcheck: false)
|
60
60
|
labels do
|
61
61
|
all_labels = ["traefik.enable=true"]
|
62
|
-
all_labels += build_traefik_labels(name: name, port: port
|
63
|
-
all_labels += build_traefik_labels(name: alt, port: port
|
62
|
+
all_labels += build_traefik_labels(name: name, port: port)
|
63
|
+
all_labels += build_traefik_labels(name: alt, port: port) if alt
|
64
|
+
all_labels += build_ihxator_labels(service: "https://#{name}.#{wildcard_domain}") if healthcheck
|
64
65
|
|
65
66
|
all_labels
|
66
67
|
end
|
67
68
|
end
|
68
69
|
|
69
|
-
def build_traefik_labels(name:, port: nil
|
70
|
+
def build_traefik_labels(name:, port: nil)
|
70
71
|
[
|
71
72
|
"traefik.http.routers.websecure-#{name}.rule=Host(`#{name}.#{wildcard_domain}`)",
|
72
73
|
"traefik.http.routers.websecure-#{name}.entrypoints=websecure",
|
@@ -92,14 +93,16 @@ module Shippy
|
|
92
93
|
labels << "traefik.http.routers.web-#{name}.service=#{name}"
|
93
94
|
labels << "traefik.http.routers.#{name}-local.service=#{name}"
|
94
95
|
end
|
95
|
-
|
96
|
-
if healthcheck
|
97
|
-
labels << "traefik.http.services.#{name}.loadbalancer.healthcheck.path=#{healthcheck}"
|
98
|
-
labels << "traefik.http.services.#{name}.loadbalancer.healthcheck.interval=5s"
|
99
|
-
end
|
100
96
|
end
|
101
97
|
end
|
102
98
|
|
99
|
+
def build_ihxator_labels(service:)
|
100
|
+
[
|
101
|
+
"ihxator.enable=true",
|
102
|
+
"ihxator.service=#{service}"
|
103
|
+
]
|
104
|
+
end
|
105
|
+
|
103
106
|
def secrets(name)
|
104
107
|
@app.secrets(name)
|
105
108
|
end
|
data/lib/shippy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shippy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marius Bobin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-04-
|
11
|
+
date: 2023-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|