m1k1o / neko

A self hosted virtual browser that runs in docker and uses WebRTC.
https://neko.m1k1o.net/
Apache License 2.0
5.96k stars 449 forks source link

Questions about PRs contribution and development environment #286

Closed innerop closed 1 year ago

innerop commented 1 year ago

On PRs,

the .env.default in .docker I assume is only used for starting server and serving client when developing with the server and you don't want to rebuild the base image each time. It diverges from the docker compose config in several places like the UDP port range and using separate ports for client and server.

I also noticed in server.go the http/ws port on the host is hardcoded to 8080 but start-server takes the var from .env.default for the port on docker.

Also, I didn't get the part in the getting started doc on why the docker port has to match the host port. I recall having done arbitrary mapping on my docker apps before.

innerop commented 1 year ago

One more question:

"Libclipboard files can be retrieved from neko_dev_server container:"

Are these needed when recompiling the server for local testing (without rebuilding the base image) ?

m1k1o commented 1 year ago

the .env.default in .docker I assume is only used for starting server and serving client when developing with the server and you don't want to rebuild the base image each time.

Yes, it is only simplified development environment. Since neko needs many dependencies, not everyone want to install them to change just minor things. We could have development in a container, but that would be different environemnt that the production and we would need to maintain both of them.

It diverges from the docker compose config in several places like the UDP port range and using separate ports for client and server.

That is purely for debugging, so that you can start interactive npm client server. That means, if you change something in client you don't need to recompile full neko. In order to use this different client, you need to bypass CORS because server and client are on different port. That is solved by proxying everyting from client port to the server.

Also, I didn't get the part in the getting started doc on why the docker port has to match the host port. I recall having done arbitrary mapping on my docker apps before.

That is only for WebRTC, because it sends server-ip:server-port to the client and client is going to connect to that. If you would change port nubmers, they would not be valid. And neko has no way of knowing what is the actual port number (without STUN server).

Are these needed when recompiling the server for local testing (without rebuilding the base image) ?

Yes, if you would do it on your host without docker image, you would need libclipboard dependency. You can either build it (looking into Dockerfile how its done) or just copy the libraries that were built inside docker.

innerop commented 1 year ago

Thanks, I was just noticing things at a glance, and not paying much attention.

It makes sense now.

innerop commented 1 year ago

One more

Screen Shot 2023-04-11 at 6 38 59 PM

Seems like VSCode analyzes the Go and TS code for missing dependencies. I did an npm install in client which took care of the TS errors. What do I need to do for the Go errors?

m1k1o commented 1 year ago

You need to install development dependencies, all needed libraries: https://github.com/m1k1o/neko/blob/b2080649ea50d942c3e9887813d867edbfc21052/.docker/base/Dockerfile#L10-L21

innerop commented 1 year ago

maybe we need to add that to the docs (this part: libgstreamer-plugins-base1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly)

but i can see it's in the base docker