-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cache Beebop databases in CI #86
Merged
Merged
Changes from 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
7f7abe1
feat: jest try cache
absternator 6ff317d
{commit_message}
absternator 5163a70
{commit_message}
absternator 877cc0e
feat: enhance Jest CI workflow and add database download script
absternator 547a959
{commit_message}
absternator 1d30162
feat: update database download script and improve volume handling
absternator cc6778b
{commit_message}
absternator 0473946
feat: enhance CI workflows with storage path configuration and cachin…
absternator f5fdea6
{commit_message}
absternator 222a2e5
Merge branch 'main' of https://github.com/bacpop/beebop into cache-pi…
absternator 52bede2
feat: extract parse mount arg
absternator File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
#!/usr/bin/env bash | ||
export API_IMAGE="main" | ||
|
||
NETWORK=beebop_nw | ||
VOLUME=beebop-storage | ||
NAME_REDIS=beebop-redis | ||
NAME_API=beebop-py-api | ||
NAME_WORKER=beebop-py-worker | ||
PORT=5000 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,32 +4,43 @@ set -ex | |
HERE=$(realpath "$(dirname $0)") | ||
. $HERE/common | ||
|
||
NETWORK=beebop_nw | ||
VOLUME=beebop-storage | ||
NAME_REDIS=beebop-redis | ||
NAME_API=beebop-py-api | ||
NAME_WORKER=beebop-py-worker | ||
PORT=5000 | ||
|
||
docker volume create $VOLUME | ||
docker run --rm -v $VOLUME:/beebop/storage \ | ||
while [ $# -gt 0 ]; do | ||
case "$1" in | ||
-mount) | ||
MOUNT="$2" | ||
shift 2 | ||
;; | ||
*) | ||
shift | ||
;; | ||
esac | ||
done | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is shared logic with run _test to find the mount arg - could pull this out into a shared script - or just use a positional arg if it's easier! But it's quite nice and clear to have a named arg. |
||
if [ -z "$MOUNT" ]; then | ||
echo "No mount path provided, using default: $VOLUME" | ||
MOUNT=$VOLUME | ||
docker volume create $VOLUME | ||
fi | ||
|
||
docker network create $NETWORK > /dev/null || /bin/true | ||
|
||
docker run --rm -v $MOUNT:/beebop/storage \ | ||
--pull always \ | ||
ghcr.io/bacpop/beebop-py:$API_IMAGE \ | ||
./scripts/download_databases --refs # remove --refs to download all databases | ||
docker network create $NETWORK > /dev/null || /bin/true | ||
|
||
docker run -d --rm --name $NAME_REDIS --network=$NETWORK -p 6379:6379 redis:5.0 | ||
docker run -d --rm --name $NAME_WORKER --network=$NETWORK \ | ||
--pull always \ | ||
--env=REDIS_HOST="$NAME_REDIS" \ | ||
-v $VOLUME:/beebop/storage \ | ||
-v $MOUNT:/beebop/storage \ | ||
ghcr.io/bacpop/beebop-py:$API_IMAGE rqworker | ||
|
||
docker run -d --rm --name $NAME_API --network=$NETWORK \ | ||
--pull always \ | ||
--env=REDIS_HOST="$NAME_REDIS" \ | ||
--env=STORAGE_LOCATION="./storage" \ | ||
--env=DBS_LOCATION="./storage/dbs" \ | ||
-v $VOLUME:/beebop/storage \ | ||
-v $MOUNT:/beebop/storage \ | ||
-p $PORT:5000 \ | ||
ghcr.io/bacpop/beebop-py:$API_IMAGE |
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.