chore: replace docker shell script with js CLI commands and use for dev and test environments#2130
Open
yusefnapora wants to merge 3 commits intomainfrom
Open
chore: replace docker shell script with js CLI commands and use for dev and test environments#2130yusefnapora wants to merge 3 commits intomainfrom
yusefnapora wants to merge 3 commits intomainfrom
Conversation
Deploying with
|
| Latest commit: |
df7a91e
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://2c004b07.nft-storage-1at.pages.dev |
| Branch Preview URL: | https://chore-refactor-docker-test-s.nft-storage-1at.pages.dev |
Contributor
Author
|
cc @funkytek - would be great if you guys could play with this branch a bit and see if there are any rough spots I missed :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This closes #2121 by replacing the
run-with-dependencies.shscript I added with arunWithServicesfunction inscripts/cmds/services.js.This does essentially the same thing as the shell script, which is to run
docker compose upto bring up the services, get the local ports for the running services and override some config variables, then run the action you give it. It also registers a cleanup hook to rundocker compose downwhenever the process exits (including abnormal exit, Ctrl+C, etc).I replaced the existing
services startandservices stopcommands withservices exec, which does therunWithServicesthing to an arbitrary shell command you give it. The motivation here is to allow using a unique docker compose project name for each run (except in persistent mode, where the project name is alwaysnft-storage-dev-persistent). With separatestartandstopcommands, you would need to write the project name to a file or something to keep track of it between invocations, but with the start and cleanup commands in the same process you can just keep the project name in memory. If you want something like the old behavior (because you want to manually poke at the db, say), you can runcli.js services exec bashto run a shell, and then run whatever you want inside the shell.I also wired this up to
yarn devand added a newyarn dev:persistcommand, which I believe meets the requirements we were trying to hit in #1888, but with less boilerplate and without putting miniflare or the test runner into a container.The persistent mode works by creating named docker volumes on the host, and using the
docker-compose-volumes.ymlfile to point the services at those long-lived volumes instead of the ephemeral volumes specified in the maindocker-compose.yml.