Skip to content

Conversation

@aftermath2
Copy link
Contributor

What does this PR do?

Fixes #2161.

This PR basically mounts the frontend/static folder 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
web-dev-frontend  | webpack 5.100.2 compiled with 2 warnings in 49944 ms
web-dev-frontend exited with code 0
web-dev-nginx     | 172.18.0.1 - - [11/Aug/2025:11:13:42 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0" "-"
web-dev-nginx     | 172.18.0.1 - - [11/Aug/2025:11:13:42 +0000] "GET /static/css/fonts.css HTTP/1.1" 200 7679 "http://localhost:8080/" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0" "-"
web-dev-nginx     | 172.18.0.1 - - [11/Aug/2025:11:13:42 +0000] "GET /static/css/loader.css HTTP/1.1" 200 4556 "http://localhost:8080/" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0" "-"
web-dev-nginx     | 172.18.0.1 - - [11/Aug/2025:11:13:42 +0000] "GET /static/css/index.css HTTP/1.1" 200 3330 "http://localhost:8080/" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0" "-"
web-dev-nginx     | 172.18.0.1 - - [11/Aug/2025:11:13:42 +0000] "GET /static/css/leaflet.css HTTP/1.1" 200 16429 "http://localhost:8080/" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0" "-"
web-dev-nginx     | 172.18.0.1 - - [11/Aug/2025:11:13:42 +0000] "GET /static/frontend/main.v0.8.1.250914b65da7e6a60e99.js HTTP/1.1" 200 3386206 "http://localhost:8080/" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0" "-"
web-dev-nginx     | 172.18.0.1 - - [11/Aug/2025:11:13:42 +0000] "GET /static/css/fonts/roboto-14.woff2 HTTP/1.1" 200 15688 "http://localhost:8080/static/css/fonts.css" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0" "-"
web-dev-nginx     | 172.18.0.1 - - [11/Aug/2025:11:13:42 +0000] "GET /static/frontend/30709cffba13a782af5d.module.wasm HTTP/1.1" 200 1070846 "http://localhost:8080/" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0" "-"
web-dev-nginx     | 172.18.0.1 - - [11/Aug/2025:11:13:42 +0000] "GET /static/frontend/main.v0.8.1.a1da0f820829081dbebc.js HTTP/1.1" 200 12261 "http://localhost:8080/" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0" "-"
web-dev-nginx     | 172.18.0.1 - - [11/Aug/2025:11:13:42 +0000] "GET /static/frontend/main.v0.8.1.a1da0f820829081dbebc.js HTTP/1.1" 200 12261 "http://localhost:8080/" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0" "-"
web-dev-nginx     | 172.18.0.1 - - [11/Aug/2025:11:13:42 +0000] "GET /static/locales/en.json HTTP/1.1" 200 64385 "http://localhost:8080/" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0" "-"
web-dev-nginx     | 172.18.0.1 - - [11/Aug/2025:11:13:42 +0000] "GET /static/frontend/5cffdf4359cd0a3c3069.module.wasm HTTP/1.1" 200 1070846 "http://localhost:8080/static/frontend/main.v0.8.1.a1da0f820829081dbebc.js" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0" "-"
web-dev-nginx     | 172.18.0.1 - - [11/Aug/2025:11:13:42 +0000] "GET /static/css/fonts/roboto-21.woff2 HTTP/1.1" 200 15920 "http://localhost:8080/static/css/fonts.css" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0" "-"
web-dev-nginx     | 172.18.0.1 - - [11/Aug/2025:11:13:42 +0000] "GET /static/assets/sounds/chat-open.mp3 HTTP/1.1" 206 2088 "http://localhost:8080/" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0" "-"
web-dev-nginx     | 172.18.0.1 - - [11/Aug/2025:11:13:42 +0000] "GET /static/assets/sounds/taker-found.mp3 HTTP/1.1" 206 111176 "http://localhost:8080/" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0" "-"
web-dev-nginx     | 172.18.0.1 - - [11/Aug/2025:11:13:42 +0000] "GET /static/assets/sounds/locked-invoice.mp3 HTTP/1.1" 206 92368 "http://localhost:8080/" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0" "-"
web-dev-nginx     | 172.18.0.1 - - [11/Aug/2025:11:13:42 +0000] "GET /static/assets/sounds/successful.mp3 HTTP/1.1" 206 64364 "http://localhost:8080/" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0" "-"
web-dev-nginx     | 172.18.0.1 - - [11/Aug/2025:11:13:42 +0000] "GET /null/relay/ HTTP/1.1" 200 3148 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0" "-"
web-dev-nginx     | 172.18.0.1 - - [11/Aug/2025:11:13:42 +0000] "GET /relay/ HTTP/1.1" 200 3148 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0" "-"
web-dev-nginx     | 172.18.0.1 - - [11/Aug/2025:11:13:45 +0000] "GET /static/css/fonts/roboto-28.woff2 HTTP/1.1" 200 15828 "http://localhost:8080/static/css/fonts.css" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0" "-"
web-dev-nginx     | 172.18.0.1 - - [11/Aug/2025:11:13:48 +0000] "GET /api/robot/ HTTP/1.1" 200 3148 "http://localhost:8080/" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0" "-"
web-dev-nginx     | 172.18.0.1 - - [11/Aug/2025:11:13:48 +0000] "GET /null/api/robot/ HTTP/1.1" 200 3148 "http://localhost:8080/" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0" "-"
web-dev-nginx     | 172.18.0.1 - - [11/Aug/2025:11:13:51 +0000] "GET /static/assets/geo/countries-coastline-10km.geo.json HTTP/1.1" 200 1053540 "http://localhost:8080/offers" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0" "-"
web-dev-nginx     | 172.18.0.1 - - [11/Aug/2025:11:13:52 +0000] "GET /static/federation/avatars/temple.small.webp HTTP/1.1" 200 3208 "http://localhost:8080/offers" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0" "-"
web-dev-nginx     | 172.18.0.1 - - [11/Aug/2025:11:13:52 +0000] "GET /static/federation/avatars/lake.small.webp HTTP/1.1" 200 2850 "http://localhost:8080/offers" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0" "-"
web-dev-nginx     | 172.18.0.1 - - [11/Aug/2025:11:13:52 +0000] "GET /static/federation/avatars/moon.small.webp HTTP/1.1" 200 2082 "http://localhost:8080/offers" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0" "-"
web-dev-nginx     | 172.18.0.1 - - [11/Aug/2025:11:13:52 +0000] "GET /static/federation/avatars/veneto.small.webp HTTP/1.1" 200 3576 "http://localhost:8080/offers" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0" "-"
web-dev-nginx     | 172.18.0.1 - - [11/Aug/2025:11:13:57 +0000] "GET /null/relay/ HTTP/1.1" 200 3148 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0" "-"
web-dev-nginx     | 172.18.0.1 - - [11/Aug/2025:11:13:57 +0000] "GET /relay/ HTTP/1.1" 200 3148 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0" "-"
web-dev-nginx     | 172.18.0.1 - - [11/Aug/2025:11:14:27 +0000] "GET /null/relay/ HTTP/1.1" 200 3148 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0" "-"
web-dev-nginx     | 172.18.0.1 - - [11/Aug/2025:11:14:27 +0000] "GET /relay/ HTTP/1.1" 200 3148 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0" "-"
screenshot

Checklist before merging

  • Install pre-commit and initialize it: pip install pre-commit, then pre-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.

- ../web:/usr/src/web
- ./static/frontend:/usr/src/web/static/frontend
- ../web/nginx.conf:/etc/nginx/nginx.conf
- ../web/coordinators/:/etc/nginx/conf.d/
Copy link
Contributor Author

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
Copy link
Member

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

Copy link
Contributor Author

@aftermath2 aftermath2 Aug 11, 2025

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

Copy link
Contributor Author

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.json

Copy link
Contributor Author

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

# 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

Copy link
Member

@KoalaSat KoalaSat Aug 11, 2025

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

Copy link
Contributor Author

@aftermath2 aftermath2 Aug 12, 2025

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
Copy link
Member

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

Copy link
Contributor Author

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

@aftermath2
Copy link
Contributor Author

By the way, somewhat related to this PR. I'm trying to include the frontend in the docker-test.yml file to be able to test everything end to end using regtest instead of relying to mainnet/testnet which is not practical at all. This would boost the productivity a lot and facilitate testing changes from other developers.

I'm facing some issues though, I tried adding a local coordinator to the federation.json file but it is not loading any orders because it can't connect to the websocket nor API. Have you ever tried to do this?

@KoalaSat
Copy link
Member

By the way, somewhat related to this PR. I'm trying to include the frontend in the docker-test.yml file to be able to test everything end to end using regtest instead of relying to mainnet/testnet which is not practical at all. This would boost the productivity a lot and facilitate testing changes from other developers.

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.

I'm facing some issues though, I tried adding a local coordinator to the federation.json file but it is not loading any orders because it can't connect to the websocket nor API. Have you ever tried to do this?

What's the error?

@aftermath2
Copy link
Contributor Author

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.

Awesome, I will give it a try and get back with feedback

@KoalaSat
Copy link
Member

KoalaSat commented Aug 13, 2025

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

@aftermath2
Copy link
Contributor Author

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 KoalaSat self-requested a review August 13, 2025 10:31
@aftermath2
Copy link
Contributor Author

@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

@KoalaSat
Copy link
Member

@aftermath2 fs-extra is a npm library that should have been installed with npm install , didn't it?

@aftermath2
Copy link
Contributor Author

@aftermath2 fs-extra is a npm library that should have been installed with npm install , didn't it?

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

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.

Web and frontend docker environments not working

2 participants