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

Dynamic localhost ports #124

Merged
merged 8 commits into from
Oct 1, 2021
Merged

Dynamic localhost ports #124

merged 8 commits into from
Oct 1, 2021

Conversation

thekaveman
Copy link
Member

Closes #123 by removing all hardcoded localhost ports and allowing Docker to assign dynamically.

Relevant docs updated to describe how to find the dynamic port for various situations.

defining just the internal container ports allows Docker to dynamically
assign the corresponding localhost ports when a container is run

If `DJANGO_ADMIN=true`, the backend administrative interface can be accessed with the superuser you setup at
<http://localhost:8000/admin>.
After initialization, the client is running running on `http://localhost` at a port dynamically assigned by Docker. To find the
Copy link
Member

@machikoyasuda machikoyasuda Oct 1, 2021

Choose a reason for hiding this comment

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

What the Docker Desktop interface looks like: Click Containers / Apps,
image

image

Find $PORT at http://0.0.0.0:56760/ or http://localhost:56760/

or at

image

From within another Compose service container, the API is at `http://server:5000` using the service-forwarding features of
Compose.

In either case, the endpoint `/verify` serves as the Eligibility Verification API endpoint.
Copy link
Member

Choose a reason for hiding this comment

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

  • I am able to successfully build and run docker compose build server, docker compose up server

  • Note: This log might be confusing to users because the * Running on http://172.26.0.3:5000/ is now incorrect
    image

  • When I run the Docker app and the docker ps command, I see that the port is assigned to 57463:
    image
    image

  • When I have both the server and client running via docker-compose, I am able to go through a successful verification flow:

image
image

fixes an issue with docs being unable to start locally with e.g.

    $ docker compose up docs

use the same formatting on dev for consistency
@machikoyasuda machikoyasuda self-requested a review October 1, 2021 20:35
Copy link
Member

@machikoyasuda machikoyasuda left a comment

Choose a reason for hiding this comment

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

💯💯💯

After Rebuild and Reopening the Dev Container, restarting VSCode (for the Python extension), running the Django: Benefits Client debugger and checking the ports with docker ps, I was able to open:

  • the Docs
  • the Client
  • the Server

add some screenshots for clarity

normalize Dev Containter -> Devcontainer
@thekaveman thekaveman merged commit b13abf8 into dev Oct 1, 2021
@thekaveman thekaveman deleted the dynamic-localhost-ports branch October 1, 2021 21:24
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.

Figure out dynamic Docker ports for localhost
2 participants