-
Notifications
You must be signed in to change notification settings - Fork 152
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
Docker for local dev #525
base: next
Are you sure you want to change the base?
Docker for local dev #525
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. |
It is supposed to be executed in conjuction with main file i.e. docker-compose.yml. Added Makefile to run containers for enketo/central development
Fixes start-postgres.sh: unable to see .postgres14-upgrade-successful when data directory is not present
837fb5e
to
73d14ba
Compare
73d14ba
to
5f75938
Compare
…e provided; this is required for running the setup on Apple chip. Get ride of it's not available on all docker compose versions
@@ -0,0 +1,17 @@ | |||
.PHONY: for-central-dev | |||
for-central-dev: | |||
docker compose --profile secrets -f docker-compose.yml -f docker-compose.dev.yml up |
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.
Running secrets
container first to generate hardcoded secrets for dev.
can't override depends_on
in docker-compose.dev.yml because !override
is not released in OrbStack
@@ -1,5 +1,5 @@ | |||
# see: https://github.com/tianon/docker-postgres-upgrade/blob/master/9.6-to-14/Dockerfile | |||
FROM tianon/postgres-upgrade:9.6-to-14 | |||
FROM --platform=linux/amd64 tianon/postgres-upgrade:9.6-to-14 |
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.
this image is available for amd64 architecture, we need to specify this we running it on apple chip (M1/M2/arm64)
docker compose --profile secrets -f docker-compose.yml -f docker-compose.dev.yml up | ||
docker compose --profile enketo -f docker-compose.yml -f docker-compose.dev.yml up -d | ||
|
||
.PHONE: 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.
☎️
Changes
profiles
attribute to control which services are needed for particular 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 honour /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 OrbStacknginx
,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 three 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: