-
Notifications
You must be signed in to change notification settings - Fork 155
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
Add dev docker-compose file to manage supporting services #525
base: next
Are you sure you want to change the base?
Conversation
0821161
to
67c6397
Compare
Is work still ongoing on this PR? I have just set up my own dev environment to work on central-backend and central-frontend & documented the process. I plan to submit my documentation for review, but should I also commit the dev setup changes? |
Hi @spwoodcock, I will be working again on this PR next week, particularly removing duplicate *.json.dev.template from the individual services. Can you please share your setup, is it a different approach? Maybe we can combine both. |
Certainly! I made a PR in our repo to more easily show the changes: https://github.com/hotosm/odkcentral/pull/1/files My main goal was to make setting up a dev environment as easy as possible, with files mounted in the container for hot reload (on the backend). I planned to do the same for the frontend, running the dev server with hot reloading, but we may need to update I extended from the existing Hope this helps - I'm more than happy to contribute to this PR if needed. |
73d14ba
to
5f75938
Compare
@@ -1,7 +1,7 @@ | |||
#!/bin/bash -eu | |||
set -o pipefail | |||
|
|||
flag_upgradeCompletedOk="$PGDATA/../.postgres14-upgrade-successful" | |||
flag_upgradeCompletedOk=$(readlink -f -m "$PGDATA/../.postgres14-upgrade-successful") |
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.
data
directory is not there when running for the first time without postgres upgrade. Another approach is to create the data directory if it's absent via make upgrade-successful
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.
What happens currently when the "data
" directory is missing?
849db32
to
1f84b0b
Compare
* Added Makefile for quick start and stop * Modified start-enketo.sh for dev with hardcode secrets, single redis config * Modified start-postgres.sh to listen postgres14-upgrade even if data directory is absent * Added instruction in README.md
1f84b0b
to
c32828c
Compare
-e 's/6380/6379/g' \ | ||
-e 's/${SECRET}/s0m3v3rys3cr3tk3y/g' \ | ||
-e 's/${LESS_SECRET}/this $3cr3t key is crackable/g' \ | ||
-e 's/${API_KEY}/enketorules/g' "$CONFIG_PATH.template" |
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.
Is there a reason these env vars can't be handled in docker-compose.dev.yml
?
Anything to make this easier v welcome 👏 I've run |
@sadiqkhoja is away for the next couple weeks so I'll try to answer questions as best I can!
I believe the current intended usage is that you would then run frontend and backend locally and they would have access to Enketo, pyxform, etc. |
# Sets profiles for each service depending on whether that | ||
# service is required for development of that particular application | ||
# For Central be/fe development, we need postgres14, pyxform, enketo, redis_main | ||
# For Enketo development, we need postgres14, service, nginx, redis_main |
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.
Remove stale comment.
I believe the idea is that the supporting services are more complex to get up and running. The involve knowledge Central dev doesn't require and some have lots of dependencies to manage. The goal is to have a way to get them up and running that is as close to the production configuration as possible and that doesn't risk getting out of date. You can see a different angle from @spwoodcock which targets also containerizing frontend and backend for dev: https://github.com/hotosm/odkcentral/pull/1/files#diff-97db29a7915320e63d41d38a0440360a87055ee8ed03757aa263116dbbb4aabe That approach gets to what @moise10r is after with getodk/central-frontend#1048 If we go in that direction, we should make sure there is an answer for hot reloading and debugging. We should also make sure the maintenance burden/risk of it getting out of sync is worth it. |
Changes
profiles
attribute to control which services are needed for the development workflow. Additionally, network_mode is set tohost
driver so that bidirectional communication is possible. Bottleneck forbridge
mode is Enketo which for some reason does not honor /etc/hosts for localhost, I was able to make it work with code modification on the fly, which looked dirty to me. One caveat forhost
mode: this is not available for "Docker Desktop for Mac", works great with OrbStackAdded dev config templates fornginx
,enketo
andservice(central)
services. These dev templates have hardcodedlocalhost
endpointsTwo objectives I've kept in my mind to achieve this 1) Not to touch main
docker-compose.yml
that might cause unintended consequences 2) Not to modify application source codeWhat has been done to verify that this works as intended?
Verified locally. It would be great if all can try this and see if this is helpful.
How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?
Although I have modified enketo startup scripts, changes are contained in dev specific conditional block
Does this change require updates to documentation? If so, please file an issue here and include the link below.
None
Before submitting this PR, please make sure you have: