-
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
Use service profiles to specify drunc-lite use case #147
Conversation
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.
Looks promising but its based on a fairly old version of main at this point and a couple of other services have been added to docker-compose.yml. Could you update?
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.
LGTM except for the pre-commit
thing!
I'm guessing the lite image is exactly the same as we had before...?
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.
Looks good, besides the sh -> bash thing. 👍 One question.
profiles: | ||
- drunc-lite |
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.
Does this mean that --profile
is now required, or does it somehow default to one or the other?
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.
The former. It's necessary for both drunc
and drunc-lite
services. I couldn't find an elegant way to default to one or the other in the absence of --profile
.
Some thoughts on continuing the work in this PR... After bringing this branch up to date with Line 16 in d09c189
I was considering handling this with a bash script, where the user can pass by argument which drunc service to run and, at the same time, set the #scripts/run_docker_compose.sh
#!/bin/bash
PROFILE=$1
# Set environment variable based on the profile
if [ "$PROFILE" == "drunc-lite" ]; then
export DRUNC_SERVICE=drunc-lite
else
export DRUNC_SERVICE=drunc
fi
# Run Docker Compose with the specified profile
docker compose --profile $PROFILE up Then, in services:
app:
build: .
command:
- bash
- -c
- |
python manage.py migrate
python manage.py runserver 0:8000
ports:
- 127.0.0.1:8000:8000
volumes:
- .:/usr/src/app
- db:/usr/src/app/db
environment:
- PROCESS_MANAGER_URL=${DRUNC_SERVICE}:10054
depends_on:
- ${DRUNC_SERVICE}
# ... (rest of docker-compose.yml) It feels a bit hacky, but from the user's perspective it's still just running one line, e.g. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## full-drunc-image #147 +/- ##
=================================================
Coverage 80.55% 80.55%
=================================================
Files 26 26
Lines 324 324
=================================================
Hits 261 261
Misses 63 63 ☔ View full report in Codecov by Sentry. |
Description
Uses profiles in Compose to allow the user to selectively activate either the full
drunc
service, or thedunc-lite
service.To test run either;
or
for the full or lite services, respectively.
Fixes #115
Type of change
Key checklist
python -m pytest
)python -m sphinx -b html docs docs/build
)pre-commit run --all-files
)Further checks