Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
artyomb committed Sep 5, 2024
1 parent e9d93d7 commit 8c9e3d6
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
dry-stack (0.1.13)
dry-stack (0.1.14)

GEM
remote: https://rubygems.org/
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This gem allows ...
cat simple_stack.drs | dry-stack -e to_compose | docker stack deploy -c - simple_stack
$ dry-stack
Version: 0.1.13
Version: 0.1.14
Usage:
dry-stack -s stackfile [options] COMMAND
cat stackfile | dry-stack COMMAND
Expand Down
8 changes: 4 additions & 4 deletions lib/dry-stack/stack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,16 +147,16 @@ def to_compose(opts = @options)
configs: YAML.load(@configs.to_yaml, aliases: true)
}

if @ingress.any?
compose[:networks].merge! ingress_routing: {external: true, name: 'ingress-routing'}
end

compose[:services].each do |name, service|

service[:image].gsub!(/:latest$/, '') if service[:image] # let docker swarm to create tag: :latest@sha265:0000...

ingress = [@ingress[name], service[:ingress] || [] ].flatten.compact

if ingress.any?
compose[:networks].merge! ingress_routing: {external: true, name: 'ingress-routing'}
end

service[:deploy] ||= {}
service[:deploy][:labels] ||= []
service[:deploy][:labels] += @labels.map { "#{_1}=#{_2}" }
Expand Down
2 changes: 1 addition & 1 deletion lib/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Dry
class Stack
VERSION = '0.1.13'
VERSION = '0.1.14'
end
end
21 changes: 21 additions & 0 deletions spec/data/stack17-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
version: '3.8'
services:
admin:
environment:
STACK_NAME: stack_name
STACK_SERVICE_NAME: admin
deploy:
labels:
- traefik.enable=true
- traefik.http.routers.stack_name_admin-0.service=stack_name_admin-0
- traefik.http.services.stack_name_admin-0.loadbalancer.server.port=5000
- traefik.http.routers.stack_name_admin-0.rule=PathPrefix(`frontend\..*`)
networks:
default:
ingress_routing:
image: admin
networks:
ingress_routing:
external: true
name: ingress-routing
5 changes: 5 additions & 0 deletions spec/data/stack17.drs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Options name: 'stack_name'

Service :admin, image: 'admin:latest', ports: 5000,
ingress: { path: 'frontend.*' }

0 comments on commit 8c9e3d6

Please sign in to comment.