Upgrade docker/down.sh to compose v2#2678
Conversation
✅ Deploy Preview for peppy-sprite-186812 canceled.
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2678 +/- ##
============================================
+ Coverage 80.63% 84.42% +3.79%
- Complexity 234 1416 +1182
============================================
Files 43 251 +208
Lines 976 6434 +5458
Branches 38 291 +253
============================================
+ Hits 787 5432 +4645
- Misses 160 850 +690
- Partials 29 152 +123 ☔ View full report in Codecov by Sentry. |
27dc322 to
d8ce15e
Compare
Signed-off-by: merobi-hub <merobi@gmail.com>
d8ce15e to
649e5d0
Compare
wslulciuc
left a comment
There was a problem hiding this comment.
Since docker/up.sh requires docker compose, I'm not sure we should have an exception for docker/down.sh. My suggestion would be that the we add a check in docker/up.sh ensuring that docker compose is installed, if not, log a warning that only the volumes will be deleted (flags --volumes, --help would no longer be needed).
Signed-off-by: merobi-hub <merobi@gmail.com>
|
@wslulciuc I did a little more experimenting and found that a differently formatted Compose command will work on Linux if you are using the Compose plugin, which is probably common as an alternative to Docker Desktop. So I removed the flag (but kept the help one because, why not? -- we have a usage string) and the command-removal condition. Instead of avoiding the command, this now checks for Linux and executes a differently formatted version of the command. It's been tested on Mint and works as long as the env vars in docker-compose.yml have been set. I would be happy to implement the change you suggested in docker/up and add a condition that checks for Compose and omits the command if not found. Please let me know WYT. |
| if [[ "$OSTYPE" == "linux-gnu" ]]; then | ||
| docker compose ${compose_files} down ${compose_args} | ||
| else | ||
| docker-compose $compose_files down $compose_args |
There was a problem hiding this comment.
We can fully migrate off docker compose v1 to v2. That is, we can replace docker-compose with docker compose as docker compose v1 is no longer receiving updates after July 2023 (of this year). This would also simplify the changes in the PR ;)
Signed-off-by: merobi-hub <merobi@gmail.com>
… into docker/linux-down
|
Tested again today and can confirm it works |
* Adds no-compose option and arg and help arg to docker/down. Signed-off-by: merobi-hub <merobi@gmail.com> * Adds os check and compose command for linux. Signed-off-by: merobi-hub <merobi@gmail.com> * Migrate down cmd to compose v2. Signed-off-by: merobi-hub <merobi@gmail.com> --------- Signed-off-by: merobi-hub <merobi@gmail.com> Co-authored-by: Willy Lulciuc <willy@datakin.com>
Problem
The down script in
dockerdoes not execute properly on at least one widely-used flavor of Linux. It turns out that the issue was actually being caused by the version of Docker Compose, not the OS.Solution
This migrates the script to Compose v2. This should be safe, as v1 has been deprecated for a while now.
One-line summary: migrates docker/down.sh to compose v2
Checklist
CHANGELOG.md(Depending on the change, this may not be necessary)..sqldatabase schema migration according to Flyway's naming convention (if relevant)