CirclesUBI / land-local

A completely local environment for the circles.land wallet
2 stars 1 forks source link

Use Compose V2 `compose.yaml` and DRY it out #5

Open almereyda opened 1 year ago

almereyda commented 1 year ago

Is your feature request related to a problem? Please describe.

Currently the docker-compose.yml manifests, which do not carry a version: tag and are as such Compose v2 manifests, can also be interpreted by deprecated docker-compose clients.

This in return can lead to subtle errors in the interpretation of the provided keys and values, where implementation details have changed between docker-compose/Compose v1 and docker compose/Compose v2.

Describe the solution you'd like

mv docker-compose.yaml compose.yaml

Describe alternatives you've considered

We remain backwards compatible and support multiple runtime engines at the same time.

Additional context

Actually we want to run the stack locally in Kubernetes, but we are just not there yet.

almereyda commented 1 year ago

If we agree on compose.yaml to reduce ambiguity and break interoperability with previous docker-compose versions, we can also use service profiles to identify components in the stack that belong together.

Their example is quite telling about which use case is targeted with this feature:

docker compose run db-migrations

Which directly relates this conversation to #2

almereyda commented 1 year ago

Some nice patterns to use Docker Compose to its full extent can be found in:

These features could also help to structure the template better:

We can also use some YAML syntax rules to deduplicate code, namely anchors and alias nodes

as exemplified in i.e.

This is also where I learned about service_completed_successfully

Similar to them, we could also agree on better task execution runner than bash, and specify more jobs in a package.json instead.

Later we could consider more sophisticated task runners, like just et al.

In the new Compose, we can also use Docker Stack's deploy for specifying resources, if applicable (eventually good to identify memory leaks locally):

almereyda commented 1 year ago

is a nice example about how a x-common: block and configurations therein are being reused in services et al. It also shows how a single value can be reused.

almereyda commented 1 year ago

In addition to the previous YAML examples, here's a writeup (found via the veggiemonk/awesome-docker list of Docker resources and projects: