basecamp / kamal

Deploy web apps anywhere.
https://kamal-deploy.org
MIT License
9.38k stars 357 forks source link

Reuse same accessory across multiple kamal application deploy configs #829

Open chekkan opened 1 month ago

chekkan commented 1 month ago

Is there a way to reuse an accessory, such as mysql, or prometheus across multiple kamal application deployments?

So that I can share a mysql server, or a prometheus server across multiple applications?

At the moment, the docker container name for the accessory has the service's name as its prefix.

# app-a/config/deploy.yml
service: app-a
image: foo/app-a
accessories:
  db:
    image: mysql:5.7
    host: 1.1.1.3
    port: 3306

# app-b/config/deploy.yml
service: app-b
image: foo/app-b
accessories:
  db:
    image: mysql:5.7
    host: 1.1.1.3
    port: 3306

image

gerardnico commented 3 weeks ago

+1

djmb commented 3 weeks ago

You can set service on the accessories, does that work?

# app-a/config/deploy.yml
service: app-a
image: foo/app-a
accessories:
  db:
    service: shared-mysql
    image: mysql:5.7
    host: 1.1.1.3
    port: 3306

# app-b/config/deploy.yml
service: app-b
image: foo/app-b
accessories:
  db:
    service: shared-mysql
    image: mysql:5.7
    host: 1.1.1.3
    port: 3306