I have a couple of doubts regarding the rancher-compose file, and its requirements etc… I have noticed that when I create a stack from the rancher UI, I get a pretty simple docker-compose and rancher-compose file, with basically just the name, image, etc… However, when I use rancher-compose CLI to add a stack from a docker-compose file (without a rancher-compose file present), I am getting some other stuff added to both rancher-compose.yml and docker-compose.yml (when I click on View Config from the UI)…
I’d like to understand what they do, and whether I should keep some things when doing my own rancher-compose file…
the service hash and the metadata is what my question revolves mostly around…
rancher compose exerpt:
app: scale: 1 metadata: &id001 io.rancher.service.hash: 75eb960afaec0b728ce4dafa79170a41b5252dc3 datacontainer: scale: 1 metadata: *id001
app: ports: - 64174:80/tcp labels: io.rancher.sidekicks: datacontainer io.rancher.container.pull_image: always io.rancher.service.hash: e26441407c7c20211362fae3fede5d54b4061699 image: app-a9c64d471210 links: - php5:php5 volumes_from: - datacontainer datacontainer: labels: io.rancher.container.pull_image: always io.rancher.service.hash: 82c1360a7a9aea7481ff03761c79567cf1c8ad52 command: - cat tty: true image: datacontainer-f90929ca57c4 links: - php5:php5 volumes: - /var/www stdin_open: true
In this example, the two containers are linked, actually datacontainer is a sidekick to app… Is this what the metadata &idxx and *idxx mean?
I also noticed that I dont have links in my datacontainer section of my original docker-compose file, but a link to another container which doesnt even use datacointainer was added when I submitted with rancher-compose…why? is it necessary/correct? (the datacontainer appears to “inherit” the links from the container it is a sidekick to)
Also, I notice that each container has a hash in docker-compose, but they dont correspond to the hash in the rancher-compose file… is this correct? Why are the hashes added/are they required?
Also, a bit unrelated, but is there a plan to allow editing of more options from a service? Or must we always clone the service in order to change things on the UI? (healthchecks, ports, advanced settings, scheduling options, etc)… is there a reason for this to be available at creation only?
I have also noted another issue… I’m trying to scale up a service that has a datacontainer and is linked from another service (basically its a php container, and its linked to the webserver container. I’m trying to scale up the php to 2 containers for 1 webserver…) When I try to scale up it creates an additional data-container, but doesnt create the php container itself and then move the datacontainer to sidekick… Is anyone else having this issue? Also, in my setup im currently testing with only 1 host, so in this case wouldnt it be better/possible to re-use the datacontainer?
EDIT: When obsrving the service try to scale up here is what is going on… it tries to start the container, but just gos to removed right away… I’m unable to pull logs for it…
For this sort of setup, is there any suggestion to how to place the containers/services? Ideally I want to use the containers from the same host, is there any way to accomplish this? I can put affinity rules to place containers on the same host (ex: php containers should co-exist with webserver containers), but how do I ensure that the routing is going to the local containers?
My idea is that I will have X webservers containers and Z php containers… I should be able to scale them independently from each other, and ideally should be able to use the closest possible php containers (i.e. from the same host if possible)… Is anything like this currently supported or planned? I think it would be a powerful usecase… I’d also in theory maybe want to prevent the linking from going to certain other hosts? (i.e. prefer local host, otherwise use another host in xxx datacenter, but dont use another datacenter as that would be too laggy - just an example…) Like I said I’m still having trouble scaling up the containers, but this will be my next question so I thought i’d already add it here…