-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify backend generation to avoid port publishing #204
base: swarm-services
Are you sure you want to change the base?
Simplify backend generation to avoid port publishing #204
Conversation
How do we handle backward compatibility and non-Swarm mode here? |
As far as I understood, I didn't touch the pure container part, hence the backward compatibility should not be impacted. But maybe you have a use case in mind where it does not work? |
Ah! One more thing, I only treated the swarm services case, for container, I haven't looked at a solution to avoid publishing port. |
So I'm testing this PR out with a compose stack deployment ( "Ports": {
"3000/tcp": null
} I'm deploying with interlock in a compose file with: interlock:
image: sedouard/interlock:swarm-mode # <- just a build of this pull-request source branch
command: -D run -c /etc/interlock/config.toml
tty: true
deploy:
mode: replicated
replicas: 2
placement:
constraints:
- node.labels.type == web-server
volumes:
- /var/run/docker.sock:/var/run/docker.sock:rw
networks:
- redis-network
depends_on:
- nginx
ports:
- 8080:8080
environment:
INTERLOCK_CONFIG: |
ListenAddr = ":8080"
DockerURL = "unix:///var/run/docker.sock"
PollInterval = "2s"
[[Extensions]]
Name = "nginx"
ConfigPath = "/etc/nginx/nginx.conf"
PidPath = "/var/run/nginx.pid"
TemplatePath = ""
MaxConn = 1024
Port = 80
nginx:
image: nginx:1.11
entrypoint: nginx
command: -g "daemon off;" -c /etc/nginx/nginx.conf
ports:
- 80:80
labels:
- "interlock.ext.name=nginx"
deploy:
mode: global
placement:
constraints:
- node.labels.type == web-server
networks:
- redis-network
api:
image: sedouard/api:latest
ports:
- 3000
networks:
- redis-network
deploy:
mode: global
placement:
constraints:
- node.labels.type == web-server The line of code is: where it seems to just be looking to see if there are >0 ports in the |
Silly me -- my labels weren't under the |
cool :). I'm not sure we can merge this until the non swarm mode issue is addressed. |
What's the problem with non swarm mode case? |
Sorry I haven't looked here for a while since I used another solution for my use case. But if you need me to finish this PR, just tell me what you think is missing |
In order to avoid port publishing when using Swarm services, the backend generation is based upon service name and service port (given by the interlock.port label on service).
The example has been updated accordingly.