shippy 0.1.3 → 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 +4 -4
- data/README.md +30 -10
- data/lib/shippy/cli/init.rb +50 -0
- data/lib/shippy/cli/main.rb +2 -31
- data/lib/shippy/cli/templates/apps/proxy/docker-compose.rb +27 -0
- data/lib/shippy/cli/templates/apps/proxy/traefik/config.yml.erb +27 -0
- data/lib/shippy/cli/templates/apps/proxy/traefik/dynamic_config.yml +7 -0
- data/lib/shippy/cli/templates/config/secrets.yml +3 -0
- data/lib/shippy/cli/templates/{shippy.yml → config/shippy.yml} +2 -3
- data/lib/shippy/cli.rb +1 -0
- data/lib/shippy/config.rb +5 -7
- data/lib/shippy/secrets.rb +15 -0
- data/lib/shippy/version.rb +1 -1
- data/lib/shippy.rb +1 -0
- metadata +9 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88e53546e6bcac389ac600b0432bed0809b162857622e3bc560dbc98ea87da94
|
4
|
+
data.tar.gz: bc1e127d902f21cf04d3282d3f04c10db1aff3ea6113df213e2af0ceea8e69f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 430ed1debda3020d516dd4d5902b6b176a747cb53d9775eed6e49ecf070fe5cd028b3ed343641d60c3e38959e918d9d8730d3bb9a6aba43a7650393aa24b55b1
|
7
|
+
data.tar.gz: 2596088fa15a92310a8fd4e5db8909267892b1c04b4cbaacbeffe37fceaf8ba1905c57580ac9d8cf277e94b64629cb88e97620aef6f7db9de6c81db4e5d3cbb4
|
data/README.md
CHANGED
@@ -1,24 +1,44 @@
|
|
1
1
|
# Shippy
|
2
2
|
|
3
|
-
|
3
|
+
Container orchestration solution for homelabs inspired by [Capistrano](https://capistranorb.com/) and [mrsk](https://github.com/mrsked/mrsk) and built on top of [docker-compose](https://docs.docker.com/compose/).
|
4
4
|
|
5
|
-
|
5
|
+
## Features
|
6
6
|
|
7
|
-
|
7
|
+
- Ruby DSL to generate the docker-compose YAML files
|
8
|
+
- Centralized source to define secrets
|
9
|
+
- Uses Traefik as a reverse proxy with SSL wildcard support
|
8
10
|
|
9
|
-
|
11
|
+
## Installation
|
10
12
|
|
11
13
|
Install the gem and add to the application's Gemfile by executing:
|
12
14
|
|
13
|
-
|
15
|
+
```shell
|
16
|
+
$ bundle add shippy
|
17
|
+
```
|
14
18
|
|
15
|
-
|
19
|
+
Or
|
16
20
|
|
17
|
-
|
21
|
+
```shell
|
22
|
+
$ gem install shippy
|
23
|
+
```
|
18
24
|
|
19
25
|
## Usage
|
20
26
|
|
21
|
-
|
27
|
+
In you homelab directory execute:
|
28
|
+
|
29
|
+
```shell
|
30
|
+
homelab$ bundle exec shippy init
|
31
|
+
```
|
32
|
+
|
33
|
+
Or
|
34
|
+
|
35
|
+
```shell
|
36
|
+
homelab$ shippy init
|
37
|
+
```
|
38
|
+
|
39
|
+
This will generate the config files and the `apps` directory with Traefik in the `proxy` app. This can be used as a guide for other apps.
|
40
|
+
|
41
|
+
Now `shippy` can be called using `bin/shippy` binstub and the other commands can be listed using `bin/shippy -h`.
|
22
42
|
|
23
43
|
## Development
|
24
44
|
|
@@ -28,7 +48,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
28
48
|
|
29
49
|
## Contributing
|
30
50
|
|
31
|
-
Bug reports and
|
51
|
+
Bug reports and merge requests are welcome on GitLab at https://gitlab.com/mrbobin/shippy. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](./CODE_OF_CONDUCT.md).
|
32
52
|
|
33
53
|
## License
|
34
54
|
|
@@ -36,4 +56,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
36
56
|
|
37
57
|
## Code of Conduct
|
38
58
|
|
39
|
-
Everyone interacting in the Shippy project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](
|
59
|
+
Everyone interacting in the Shippy project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](./CODE_OF_CONDUCT.md).
|
@@ -0,0 +1,50 @@
|
|
1
|
+
class Shippy::Cli::Init < Thor::Group
|
2
|
+
include Thor::Actions
|
3
|
+
|
4
|
+
def self.exit_on_failure?
|
5
|
+
true
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.source_root
|
9
|
+
File.dirname(__FILE__)
|
10
|
+
end
|
11
|
+
|
12
|
+
def create_config_file
|
13
|
+
copy_file "templates/config/shippy.yml", "config/shippy.yml"
|
14
|
+
end
|
15
|
+
|
16
|
+
def create_secrets_file
|
17
|
+
copy_file "templates/config/secrets.yml", "config/secrets.yml"
|
18
|
+
end
|
19
|
+
|
20
|
+
def init_gemfile
|
21
|
+
return if ::File.exist?("Gemfile")
|
22
|
+
|
23
|
+
run "bundle init", abort_on_failure: false
|
24
|
+
end
|
25
|
+
|
26
|
+
def add_shippy_to_gemfile
|
27
|
+
insert_into_file "Gemfile", "gem 'shippy', '~> #{Shippy::VERSION}'"
|
28
|
+
|
29
|
+
run "bundle install", abort_on_failure: false
|
30
|
+
end
|
31
|
+
|
32
|
+
def generate_binstubs
|
33
|
+
run "bundle binstubs shippy"
|
34
|
+
end
|
35
|
+
|
36
|
+
def create_default_apps
|
37
|
+
directory "templates/apps", "apps"
|
38
|
+
end
|
39
|
+
|
40
|
+
def init_git
|
41
|
+
run "git init"
|
42
|
+
end
|
43
|
+
|
44
|
+
def genegate_gitignore
|
45
|
+
create_file ".gitignore"
|
46
|
+
insert_into_file ".gitignore", "/.bundle/\n"
|
47
|
+
insert_into_file ".gitignore", "/builds/\n"
|
48
|
+
insert_into_file ".gitignore", "/config/secrets.yml\n"
|
49
|
+
end
|
50
|
+
end
|
data/lib/shippy/cli/main.rb
CHANGED
@@ -1,38 +1,9 @@
|
|
1
1
|
require "thor"
|
2
2
|
|
3
3
|
class Shippy::Cli::Main < Shippy::Cli::Base
|
4
|
-
desc "init", "Create config
|
5
|
-
option :bundle, type: :boolean, default: false, desc: "Add SHIPPY to the Gemfile and create a bin/shippy binstub"
|
4
|
+
desc "init", "Create config files and app setup"
|
6
5
|
def init
|
7
|
-
|
8
|
-
|
9
|
-
if (config_file = Pathname.new(File.expand_path("config/shippy.yml"))).exist?
|
10
|
-
puts "Config file already exists in config/shippy.yml (remove first to create a new one)"
|
11
|
-
else
|
12
|
-
FileUtils.mkdir_p config_file.dirname
|
13
|
-
FileUtils.cp_r Pathname.new(File.expand_path("templates/shippy.yml", __dir__)), config_file
|
14
|
-
puts "Created configuration file in config/shippy.yml"
|
15
|
-
end
|
16
|
-
|
17
|
-
if Pathname.new(File.expand_path("apps")).exist?
|
18
|
-
puts "Apps directory already exists in ./apps (remove first to create a new one)"
|
19
|
-
else
|
20
|
-
FileUtils.mkdir_p "apps"
|
21
|
-
puts "Created apps directory in ./apps"
|
22
|
-
end
|
23
|
-
|
24
|
-
if options[:bundle]
|
25
|
-
if Pathname.new(File.expand_path("bin/shippy")).exist?
|
26
|
-
puts "Binstub already exists in bin/shippy (remove first to create a new one)"
|
27
|
-
else
|
28
|
-
puts "Adding SHIPPY to Gemfile and bundle..."
|
29
|
-
run_locally do
|
30
|
-
execute :bundle, :add, :shippy
|
31
|
-
execute :bundle, :binstubs, :shippy
|
32
|
-
end
|
33
|
-
puts "Created binstub file in bin/shippy"
|
34
|
-
end
|
35
|
-
end
|
6
|
+
Shippy::Cli::Init.new.invoke_all
|
36
7
|
end
|
37
8
|
|
38
9
|
desc "version", "Show SHIPPY version"
|
@@ -0,0 +1,27 @@
|
|
1
|
+
Shippy.define do
|
2
|
+
service :proxy do
|
3
|
+
image { "traefik:v2.9" }
|
4
|
+
command { "--configFile=/config/config.yml" }
|
5
|
+
|
6
|
+
environment do
|
7
|
+
{
|
8
|
+
CF_API_EMAIL: secrets(:cloudflare_email),
|
9
|
+
CF_DNS_API_TOKEN: secrets(:cloudflare_token)
|
10
|
+
}
|
11
|
+
end
|
12
|
+
|
13
|
+
ports do
|
14
|
+
["80:80", "443:443", "8080:8080"]
|
15
|
+
end
|
16
|
+
|
17
|
+
volumes do
|
18
|
+
[
|
19
|
+
"/var/run/docker.sock:/var/run/docker.sock",
|
20
|
+
"./traefik:/config",
|
21
|
+
"acme:/etc/traefik/acme"
|
22
|
+
]
|
23
|
+
end
|
24
|
+
|
25
|
+
use_default_options
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
providers:
|
2
|
+
docker:
|
3
|
+
exposedByDefault: false
|
4
|
+
file:
|
5
|
+
filename: "/config/dynamic_config.yml"
|
6
|
+
|
7
|
+
api:
|
8
|
+
insecure: true
|
9
|
+
dashboard: true
|
10
|
+
|
11
|
+
entryPoints:
|
12
|
+
web:
|
13
|
+
address: ":80"
|
14
|
+
websecure:
|
15
|
+
address: ":443"
|
16
|
+
|
17
|
+
log:
|
18
|
+
level: TRACE
|
19
|
+
accessLog: {}
|
20
|
+
|
21
|
+
certificatesResolvers:
|
22
|
+
ssl-resolver:
|
23
|
+
acme:
|
24
|
+
email: <%= secrets(:cloudflare_email) %>
|
25
|
+
storage: /etc/traefik/acme/acme.json
|
26
|
+
dnsChallenge:
|
27
|
+
provider: cloudflare
|
data/lib/shippy/cli.rb
CHANGED
data/lib/shippy/config.rb
CHANGED
@@ -4,13 +4,11 @@ module Shippy
|
|
4
4
|
|
5
5
|
def initialize(file)
|
6
6
|
@data = YAML.load_file(file).deep_symbolize_keys
|
7
|
+
@secrets = Secrets.new(@data.fetch(:secrets_file))
|
7
8
|
end
|
8
9
|
|
9
10
|
def secrets(app, name)
|
10
|
-
@
|
11
|
-
.fetch(:secrets)
|
12
|
-
.fetch(app.to_sym)
|
13
|
-
.fetch(name.to_sym)
|
11
|
+
@secrets.fetch(app, name)
|
14
12
|
end
|
15
13
|
|
16
14
|
def ssh_options
|
@@ -30,15 +28,15 @@ module Shippy
|
|
30
28
|
end
|
31
29
|
|
32
30
|
def method_missing(name, *args)
|
33
|
-
if
|
34
|
-
|
31
|
+
if data.key?(name)
|
32
|
+
data.fetch(name)
|
35
33
|
else
|
36
34
|
super
|
37
35
|
end
|
38
36
|
end
|
39
37
|
|
40
38
|
def respond_to_missing?(name, include_private = false)
|
41
|
-
|
39
|
+
data.key?(name) || super
|
42
40
|
end
|
43
41
|
end
|
44
42
|
end
|
data/lib/shippy/version.rb
CHANGED
data/lib/shippy.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.4
|
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-
|
11
|
+
date: 2023-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -163,15 +163,21 @@ files:
|
|
163
163
|
- lib/shippy/cli.rb
|
164
164
|
- lib/shippy/cli/app.rb
|
165
165
|
- lib/shippy/cli/base.rb
|
166
|
+
- lib/shippy/cli/init.rb
|
166
167
|
- lib/shippy/cli/main.rb
|
167
168
|
- lib/shippy/cli/prune.rb
|
168
169
|
- lib/shippy/cli/server.rb
|
169
|
-
- lib/shippy/cli/templates/
|
170
|
+
- lib/shippy/cli/templates/apps/proxy/docker-compose.rb
|
171
|
+
- lib/shippy/cli/templates/apps/proxy/traefik/config.yml.erb
|
172
|
+
- lib/shippy/cli/templates/apps/proxy/traefik/dynamic_config.yml
|
173
|
+
- lib/shippy/cli/templates/config/secrets.yml
|
174
|
+
- lib/shippy/cli/templates/config/shippy.yml
|
170
175
|
- lib/shippy/commander.rb
|
171
176
|
- lib/shippy/compiler.rb
|
172
177
|
- lib/shippy/compose.rb
|
173
178
|
- lib/shippy/config.rb
|
174
179
|
- lib/shippy/repo.rb
|
180
|
+
- lib/shippy/secrets.rb
|
175
181
|
- lib/shippy/service.rb
|
176
182
|
- lib/shippy/version.rb
|
177
183
|
homepage: https://mbobin.me/shippy
|