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

#1806 Add DevContainer configuration #1807

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

MarianPalkus
Copy link

@MarianPalkus MarianPalkus commented Oct 18, 2024

Description

Add DevContainers based on quickstart-project to improve the handling of the development environment. Ports 80 (quickstart project) and 8025 (mailhog) are forwarded within the DevContainer setup.

Addressing #1806.

Implementation

  • add devcontainer.json based on docker compose
  • add a docker-compose file for devcontainer setup
  • there were issues to make mailslurper accessible through codespace port forwarding therefore it has been replaced by mailhog

Tests

The setup can be tried here:

  • https://github.com/MarianPalkus/hanko
  • "Code" -> "Codespaces ..." -> "New with options..."
  • Screenshot 2024-10-19 at 00 55 50
  • Select branch "devcontainers" and "create codespace"
  • Screenshot 2024-10-19 at 00 57 38
  • the codespace should be opened
  • After initialization has finished (might take some minutes) the quickstart-page can be accessed via "Ports" -> Port 80 -> "Open in Browser"
  • Screenshot 2024-10-19 at 00 44 26
  • mailhog can be accessed via "Ports" -> Port 8025 -> "Open in Browser"

The quickstart-example should be fully working:

Screenshot 2024-10-19 at 00 44 50 Screenshot 2024-10-19 at 00 44 42

Todos

  • the service entry in the devcontainer docker-compose file might not be required
  • code changes should directly be visible in the quickstart-page: configure hmr/fast refresh for elements and frontend-sdk and watch-build for backend
  • devcontainer-docker-compose-file and custom config files might be moved to the .devcontainers directory
  • webauthn origin config might be wrong

Additional context

This commit introduces DevContainers based on quickstart, improving the handling of the development environment.
Ports 80 (quickstart project) and 8025 (mailhog) are forwarded within the DevContainer setup. This enhances connectivity and ease of access for local development and debugging with frontend services running inside the container.
Introduce a new "build:dev" script in the frontend package.json to allow parallel builds. Modify related development commands in frontend-sdk and elements to use the correct "build:dev" command. Adjust docker-compose setup to run the new "build:dev" script.
Simplify the Nginx setup by removing the elements-nginx service and directly serving static files from the main Nginx container. Updated volume mounts and configuration to reflect these changes.
…cture

Moved dev containers related files to .devcontainer for better organization and simplified path references in devcontainers-full-setup.yaml.
@MarianPalkus
Copy link
Author

Updates on Todos:

the service entry in the devcontainer docker-compose file might not be required

The entry service seems to be needed to expose all endpoints without custom ports when running in github codespaces. But the elements-nginx service has been removed from the dev container docker-compose setup.

code changes should directly be visible in the quickstart-page: configure hmr/fast refresh for elements and frontend-sdk and watch-build for backend

Updated the frontend build:dev tasks run in watch-mode. For backend I am not sure, which way would be best for watch-mode.

webauthn origin config might be wrong

Copied the quickstart config to .devcontainer/config-devcontainer.yaml :

webauthn:
  relying_party:
    origins:
      - "http://localhost:8888"

MarianPalkus and others added 2 commits October 28, 2024 21:45
The /mail/ proxy location block has been deleted from the devcontainer-nginx.conf file.
@FlxMgdnz
Copy link
Member

/award 1500

Copy link

oss-gg bot commented Oct 31, 2024

Awarding MarianPalkus: 1500 points 🕹️ Well done! Check out your new contribution on oss.gg/MarianPalkus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 New
Development

Successfully merging this pull request may close these issues.

2 participants