Deploying Neko - A Shared Virtual Browser
Steps
services:
neko:
image: "ghcr.io/m1k1o/neko/chromium:latest"
restart: "unless-stopped"
shm_size: "2gb"
ports:
- "80:8080"
- "52000-52100:52000-52100/udp"
cap_add:
- SYS_ADMIN
environment:
- NEKO_DESKTOP_SCREEN='1280x720@30'
- NEKO_PROXY=true
# - NEKO_SCREEN='1920x1080@30'
- NEKO_MEMBER_MULTIUSER_USER_PASSWORD
- NEKO_MEMBER_MULTIUSER_ADMIN_PASSWORD
- NEKO_WEBRTC_EPR=52000-52100
- NEKO_WEBRTC_NAT1TO1
- NEKO_VIDEO_BITRATE=5000
- NEKO_CAPTURE_VIDEO_CODEC=h264
- NEKO_MAX_FPS=30
- NEKO_WEBRTC_ICELITE=1
Create a .env file with your passwords. E.g.
# Specify the public IP of your server.
NEKO_WEBRTC_NAT1TO1=xxx.xxx.xxx.xxx"
NEKO_MEMBER_MULTIUSER_PASSWORD=someNormalUserPasswordHere
NEKO_MEMBER_MULTIUSER_ADMIN_PASSWORD=someAdminUserPasswordHere
Setting The Resolution
Setting the resolution to be 720p rather than 1080p has several advantages, which is why I stuck with it.
- It reduces the load on the server in terms of both bandwidth and the encoding for the streaming.
- It helps with the fact that you may be viewing the browser on a smaller screen (e.g. I was using both my desktop and laptop)
- It helps with the fact that you are often viewing the browser, within your own browser (windows within windows).
- Lots of online video streaming platforms are often only around 720p anyway, although I did find quality was improved by setting youtube videos to 1080p within the browser rather than 720p, just to increase the bitrate quality of the incoming video.
Setting the Framerate
Setting the framerate to just 30fps makes sense as video streams are usually around 30 fps or lower anyway, and this also helps with the load on the server (bandwidth and encoding).
Setting the Encoder And Bitrate
You will see that I manually set the encoder to h264
and the bitrate to 5000
whereas the default encoder is vp8
with a much lower bitrate.
I did this because the virtual private server (VPS) I was using did not have that much CPU power, only having
4 vCPUs on a host that is shared with others. I found that by setting this to h264
, I had a smoother video stream with less video stuttering.
If you have a more powerful server, then leaving this as vp8
, or even setting to vp9
may be beneficial, as these codecs provide better video quality
when fitting within the same bitrate. However, I had plenty of bandwidth (and only 2 viewers at a time), and minimal compute, so it was better for me
to use a simpler codec (h264), and increase the bitrate (NEKO_VIDEO_BITRATE
).
Loggig In And User Management
There is no user management, only passwords. When logging in, pick any username you like that you wish for other users to see. The password you use determines whether you can login (authentication), and is also used to determine your access level (admin or normal user).
Control Management
The controls cannot be shared with only one user having access to them at a time. Also, controls are gained by pressing the keyboard icon in the UI, and if a user has that enabled, another user cannot get the controls by clicking on the icon. This does mean that if you take the controls, and leave your browser running whilst switching to another device like a laptop or tablet, you wont be able to control the session. You have to go back to your original machine and make sure to click the keyboard again to release the controls. This can be quite annoying, and I wish that there was some kind of mechanism that if a user asks for the controls, if the person who has them doesn't respond within a time period, then the controls would be handed over to prevent AFK control hogging.
Saving State
Unfortunately, if the container restarts, such as from you changing the settings and re-deploying, then all the state is lost. This means that if you logged into any online platforms, those sessions are gone and you are going to have to log in all over again.
References
First published: 19th April 2025