FryingDutch / DoubleDutch

DoubleDutch: a distributed advisory lock
0 stars 1 forks source link

[Warning!] Changed folder structure when going from 0.1.0 to 0.2.0 #10

Closed jessehl closed 3 years ago

jessehl commented 3 years ago

I justed bumped DD from 0.1.0 to 0.2.0 in my project. Loving the small image size πŸ‘ : image

When trying to deploy to the Swarm, I encountered some issues. DoubleDutch failed to start for some reason. After some digging, I found out what happened.

In my compose-file, I declare where I want to put my secrets:

secrets:
    - source: double_dutch_api_key 
      target: /config.txt
    - source: ssl_private_key
      target: /SSL/privateKey.key 
    - source: ssl_certificate 
      target: /SSL/certificate.crt 

This worked fine with version 0.1.0. This did not work with version 0.2.0, however, because the location of the folders (inside the Docker image) changed:

secrets:
    - source: double_dutch_api_key 
      target: /DoubleDutch/config.txt
    - source: ssl_private_key
      target: /DoubleDutch/SSL/privateKey.key 
    - source: ssl_certificate 
      target: /DoubleDutch/SSL/certificate.crt 

Your documentation is actually valid, since the location for the api key and the SSL files are mentioned from the viewpoint of placing those files there, and then building the image.

As a suggestion (for v0.3.0 or even v1.0.0 πŸ˜ƒ) I think a better strategy is to omit those files from your build altogether - including secrets and configuration is an anti-pattern to begin with, see number 5). My suggestions: just document where your container expects to find the files, and then let the user decide how he/she gets the files inside of the container!

Note: this is more like a FYI/nice-to-have. 0.2.0 is running smoothly now! πŸš€ πŸš€ πŸš€ πŸš€ πŸš€ πŸš€