Skip to content

Add local Docker development setup#53

Draft
HenkKalkwater wants to merge 3 commits into
mainfrom
local-dev
Draft

Add local Docker development setup#53
HenkKalkwater wants to merge 3 commits into
mainfrom
local-dev

Conversation

@HenkKalkwater

Copy link
Copy Markdown
  • Add docker-compose.dev.yml, which extends docker-compose.yml, builds finmars images locally instead of pulling them and enables hot reload for finmars-core, finmars-vue-portal, finmars-workflow and finmars-workflow-portal
  • Update README with local development instructions and created a prerequisites section that applies both to running and deploying.
  • Updates the NGINX configuration to proxy requests differently to Nuxt assets when running in development mode. This took the most time to figure out, as simply replacing node run .output/server/index.mjs with nuxt dev caused rather unhelpful HTTP errors due to difference in how these servers resolve paths.

* Add docker-compose.dev.yml, which extends docker-compose.yml, builds finmars
  images locally instead of pulling them and enables hot reload for
  finmars-core, finmars-vue-portal, finmars-workflow and finmars-workflow-portal
* Update README with local development instructions and created a prerequisites
  section that applies both to running and deploying.
* Updates the NGINX configuration to proxy requests differently to Nuxt
  assets when running in development mode. This took the most time to figure
  out, as simply replacing `node run .output/server/index.mjs` with `nuxt dev`
  caused rather unhelpful HTTP errors due to difference in how these
  servers resolve paths.
@HenkKalkwater
HenkKalkwater marked this pull request as draft February 9, 2026 09:40
@HenkKalkwater

Copy link
Copy Markdown
Author

I still found some issues related to portal, I will fix this first.

Comment thread README.md Outdated
cd finmars-community-edition

# 4. Build and install envs, certificates, keycloak etc
make DEV=1 install

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be move setting DEV from CLI to ./scripts/install.sh?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The DEV variable needs to be read by the Makefile, since it changes the COMPOSE_FILE environment variable, which in turn changes which files docker compose use.

Ideally, I'd to read whether ENVIRONMENT_TYPE=development , however, it is not straightforward to read this in make. However, that does not mean it is really hard. I just did not want to overcomplicate the Makefile. I cannot guarantee that it would work on MacOS or Windows then.

The other option would be to write a -dev target for each make target, for example make up-dev, make down-dev et cetera. However, then I will need to duplicate each rule that invokes docker compose.

Now you need to either write each time make DEV=1, or use export DEV=1 once per session in your terminal. This is simple in make, but maybe not ideal from the user experience. It seemed to me to be the least worst solution for the problem I could find.

What way would you think is the best. If you have any other ideas, they are welcome.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THIS_MAKEFILE_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
-include $(THIS_MAKEFILE_DIR).env

ifneq ($(filter 1 true yes y on,$(strip $(DEV))),)
	COMPOSE_FILE := $(COMPOSE_FILE):docker-compose.dev.yml
endif

@HenkKalkwater HenkKalkwater Feb 11, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have used grep to read the variable for now. I have considered using include, however, it is quite prone to break, since it does not support variable assignments with quotes or values with #

Comment thread docker-compose.dev.yml
pull_policy: build
build:
context: ../finmars-vue-portal
dockerfile_inline: |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like a kludge. The best way is to update the Dockerfile in the project and delete the running script from it.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. However, these Dockerfiles are different than the production Dockerfile, since they do include development dependencies and may skip the build step.

What do you think about putting a "dev.Dockerfile" in the respective repositories?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dev.Dockerfile is good idea

/api/v1/portfolios/portfolio/ev-group/ returned `group_name` and
`group_identifier` as numbers instead of strings. Other endpoints, like
/api/v1/instruments/instrument/ev-group/ return strings correctly.
These numerical values were then shown in the UI, as showcased in
finmars-platform/finmars-core#149 (comment).

By marking `portfolio_type` as a relation, it now correctly shows the names when
invoking this API endpoint.
Comment thread docker-compose.dev.yml
ports:
- 5432:5432
core: &core-base
image: ~ # Force Docker to build images locally instead of pulling them

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you sure this is working properly?

The COMPOSE_FILE environment variable is used directly by docker
compose, no need to pass it as the `-f` flag. Moreover, the `-f` flag
doesn't handle multiple compose files separated by colons, which the
COMPOSE_FILE environment variable does. The Makefile relies on multiple
compose files.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants