-
Notifications
You must be signed in to change notification settings - Fork 187
Fix frontend and web docker environments #2162
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
base: main
Are you sure you want to change the base?
Conversation
| - ../web:/usr/src/web | ||
| - ./static/frontend:/usr/src/web/static/frontend | ||
| - ../web/nginx.conf:/etc/nginx/nginx.conf | ||
| - ../web/coordinators/:/etc/nginx/conf.d/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/etc/nginx/conf.d/ doesn't exist in the container, it just created an empty folder in the host.
| restart: always | ||
| volumes: | ||
| - ./:/usr/src/web | ||
| - ../frontend/static/frontend:/usr/src/web/static/frontend |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Running npm run dev should create the specific files required for web in /web, and thatś important because every index.html file is different: https://github.com/RoboSats/robosats/blob/main/frontend/webpack.config.ts#L122
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't that be done in the Dockerfile instead of requiring installing dependencies on the host and manual compilation? I would expect the docker environment to set everything up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what's inside the /usr/src/web folder after running the web docker compose with no pre-existing volumes
/usr/src/robosats # ls -la /usr/src/web/static/
total 60
drwxr-xr-x 7 root root 4096 Aug 11 20:48 .
drwxr-xr-x 4 1000 1000 4096 Aug 11 20:48 ..
drwxr-xr-x 6 root root 4096 Aug 11 20:48 assets
drwxr-xr-x 3 root root 4096 Aug 11 20:48 css
drwxr-xr-x 2 root root 4096 Aug 11 20:48 css_pro
drwxr-xr-x 4 root root 4096 Aug 11 20:48 federation
-rw-r--r-- 1 root root 21333 Aug 11 20:48 federation.json
-rw-r--r-- 1 root root 485 Aug 11 20:48 lnproxies.json
drwxr-xr-x 3 root root 4096 Aug 11 20:48 locales
-rw-r--r-- 1 root root 1882 Aug 11 20:48 thirdparties.jsonThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've just read this comment on the web Dockerfile
Lines 5 to 6 in ef4b96c
| # Needs a copy or symlink of /frontend/static in /nodeapp/static | |
| # Github client release workflow copies /frontend/static here |
Which is essentially the same as the bind mount I added. I think a bind mount is better because it is handled by Docker and requires no host changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. I think we need to rethink the whole thing. Maybe increase the picture and spot a definitive solution, I think that organically we have been overlapping functionalities with time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, I would leave the mainnet environment (root docker-compose.yml) aside for now and focus on testing environments (mainly docker-tests.yml), to not mess up with anyone running the former in production.
All the other docker-compose files aren't necessary in my opinion, except perhaps a frontend-only environment to spin up the UI easily. If someone needs a custom setup he could create it using the individual component images.
| container_name: dev-nginx | ||
| restart: always | ||
| volumes: | ||
| - ./:/usr/src/frontend |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why? That way you are missing all other assets
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The assets are used by the frontend container to compile the final js and wasm files. The web container lacks the dependencies to re-compile so it doesn't make much sense having them there.
nginx isn't using them neither so I figured it would be better to remove that. Does the UI access that path in any scenario? Haven't noticed any issues while testing it
|
By the way, somewhat related to this PR. I'm trying to include the frontend in the I'm facing some issues though, I tried adding a local coordinator to the |
We had this local coordinator at some point: 764ed38#diff-cecbb5766287fa87c50f307cd6f17af5d912ef726d583088ea4755cfc8bfba05 But it was removed for causing some issues, maybe we can give it another try.
What's the error? |
Awesome, I will give it a try and get back with feedback |
|
Heads up seems like most recent comments broke webpack, latest commit modifies its configuration and fixes it. Maybe that was the reason it was not working for you |
Great, I'll try it today with the latest changes 👍 |
|
@KoalaSat Built from scratch the web docker compose and now I'm getting the following error [+] Running 3/3
✔ Network robosats-web-frontend_default Created 0.0s
✔ Container web-dev-frontend Created 0.0s
✔ Container web-dev-nginx Created 0.0s
Attaching to web-dev-frontend, web-dev-nginx
web-dev-frontend |
web-dev-frontend | > [email protected] build
web-dev-frontend | > webpack --config webpack.config.ts --mode production
web-dev-frontend |
web-dev-frontend | [webpack-cli] Failed to load '/usr/src/frontend/webpack.config.ts' config
web-dev-frontend | [webpack-cli] webpack.config.ts(7,16): error TS2307: Cannot find module 'fs-extra' or its corresponding type declarations.
web-dev-frontend | webpack.config.ts(150,27): error TS7006: Parameter 'err' implicitly has an 'any' type.
web-dev-frontend |
web-dev-frontend exited with code 2 |
|
@aftermath2 |
Apparently the frontend image is not installing it, I also get a warning in the IDE that the package can't be found. I tried changing the compilation options but it didn't help |
What does this PR do?
Fixes #2161.
This PR basically mounts the
frontend/staticfolder created during the webpack compilation into both environments. Otherwise, they can't find the main files to load the user interface.Tests
Tested using a fresh install (after deleting all volumes) and with previous volumes untouched.
Logs
Checklist before merging
pip install pre-commit, thenpre-commit install. Pre-commit installs git hooks that automatically check the codebase. If pre-commit fails when you commit your changes, please fix the problems it points out.