Skip to content
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-compose port use .env variable or default :3000 #73

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

wivaku
Copy link

@wivaku wivaku commented Jan 18, 2022

make it possible to overwrite the :3000 port using .env instead of modifying docker-compose.yaml file

make it possible to overwrite the :3000 port using .env instead of modifying docker-compose.yaml file
@krumware
Copy link
Member

@wivaku thanks for the suggested change here!

If I use the port env variable which now also updates the host port in addition to the calendso service port, wouldn't the container port also need to be updated?

@wivaku
Copy link
Author

wivaku commented Jan 21, 2022

Not sure if I fully understand your question. In general the exposed and the internal port are separate. So, internally the container could still be based on the default :3000 port, and only the external port is changed.

In the past I have manually changed the docker-compose.yaml file (e.g. 3021:3000) and that worked. To be fair, I have not tested it recently for Calendso as I am having some trouble with the recent builds.

Not sure what the .env values should be in this case: the internal :3000 port or the changed external port.
I have not tested that.

E.g. this?

PORT=3021
# BASE_URL="http://localhost:3000"
BASE_URL="http://localhost:${PORT}"
# NEXT_PUBLIC_APP_URL="http://localhost:3000"
NEXT_PUBLIC_APP_URL="http://localhost:${PORT}"

@krumware
Copy link
Member

krumware commented Jan 21, 2022

Yea, that was a rough misunderstanding for me there, since most JS framework projects leverage that env pattern where PORT is used separately from the host URL, unlike the method used by calendso here. I hadn't considered that the port is hardcoded in the base_url for some reason.

In the case you show in your e.g., the internal port would no longer map to the process (which is where my thought process was)

Maybe we can also suggest a change upstream in calendso/calendso for the .env.example to use your pattern in the e.g. above? so that we have parity in the method used to change the port

@wivaku
Copy link
Author

wivaku commented Jan 21, 2022

As a next step it would definitely be interesting to modify the .env.example. Before that is done it would be good to do some more testing so that we have an actual working example of using a different port than :3000. This pull request is a safe first step.

@krumware
Copy link
Member

Yea I think this is a good start. The way I approach this in internal projects is to leverage a load balancer in the docker-compose to keep the ingress configuration separate from the workload's. That way the frontend's port can be remain specific to the workload itself. Another piece for another day as well. Thanks for the discussion! let's keep this rolling

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