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

Add devcontainers configuration #1212

Draft
wants to merge 10 commits into
base: staging
Choose a base branch
from

Conversation

ggvbo
Copy link
Contributor

@ggvbo ggvbo commented Apr 30, 2023

Allows the quick creation of GitHub Codespaces & others that support devcontainers by adding an .devcontainers/devcontainer.json file containing port labelling, VSCode extensions, and the required features to get an bare-bones Hangar application working (database and email Docker containers, Maven dependencies for the backend application and PNPM dependencies for the frontend), which are setup by an post-create.sh Shell script. This allows developers to get coding faster, rather than spend time setting up their development environments.

@MiniDigger
Copy link
Member

tried it out locally, seems like we need to add .pnpm-store to the gitignore, lol
https://i.imgur.com/3agOUXc.png
I also dont see that it did stuff with ports, but that could also be a me issue, literally first time playing with this, but I was expecting them to show up here?
https://i.imgur.com/NTVxxNF.png

@ggvbo
Copy link
Contributor Author

ggvbo commented Apr 30, 2023

I also dont see that it did stuff with ports, but that could also be a me issue, literally first time playing with this, but I was expecting them to show up here? https://i.imgur.com/NTVxxNF.png

The port needs to be "active" for it to appear there,
image

@ggvbo
Copy link
Contributor Author

ggvbo commented Apr 30, 2023

Also, I'm not facing the .pnpm-store issue myself, but I can add it to the .gitignore if you agree.

@MiniDigger
Copy link
Member

how do you test? using vscode locally or using something like codespaces?
and yeah, please add it to the gitignore as part of the PR

@ggvbo
Copy link
Contributor Author

ggvbo commented Apr 30, 2023

how do you test? using vscode locally or using something like codespaces? and yeah, please add it to the gitignore as part of the PR

Currently, I'm testing using codespaces.

I'm facing an issue where the frontend crashes right after startup, I've tried to change the logging level to verbose with no luck.

  Plugin: vite:dynamic-import-vars
  File: /workspaces/Hangar/frontend/src/store/prism.ts


 WARN  Sourcemap for "/workspaces/Hangar/frontend/src/pages/api-docs.vue" points to missing source files      9:24:08 PM

@GNosii ➜ /workspaces/Hangar/frontend (feature/devcontainers) $ 

@ggvbo
Copy link
Contributor Author

ggvbo commented Apr 30, 2023

got it working without crashing, only thing left is fix the CORS & WSS issues:

Mixed Content: The page at 'https://codespace-3333.preview.app.github.dev/' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://codespace-3333.preview.app.github.dev:24678/_nuxt/'. This request has been blocked; this endpoint must be available over WSS.

@MiniDigger
Copy link
Member

nuxt has an https/ssl mode somewhere iirc

ggvbo added 4 commits April 30, 2023 22:21
sadly this is the only way of getting this to work.
it's attempting to connect to localhost:24678, but the codespaces syntax includes the port in the host, might need to manually override this, as it's preventing hmr from working at all.
@ggvbo
Copy link
Contributor Author

ggvbo commented May 1, 2023

Not working because of the way Codespaces exposes ports (in the hostname, not as an "real" port), I had to change this in frontend/node_modules/vite/dist/client/client.mjs

-- const socketHost = `${__HMR_HOSTNAME__ || importMetaUrl.hostname}:${hmrPort || importMetaUrl.port}${__HMR_BASE__}`;
++ const socketHost = `${__HMR_HOSTNAME__ || importMetaUrl}${__HMR_BASE__}`;

This could be fixed by forking the module, or by applying an patch. Even if we set server.hmr is set to false, this issue still happens.

needs fixing: http proxy error:Error: write EPROTO 00178A8AFB7E0000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:355
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