Hi,
I recently flashed the ‘Code-server’ project on my Rpi4 and it seems to work on the deviceIP:8080 on the same network.
To access it remotely,
I turned on Public Url from the dashboard
I added the Environment Variable ‘PROXY_DOMAIN’ variable
Set the value for ‘PROXY_DOMAIN’ to one of my domains from dyndns
As I was getting an error after that, I edited nginx.conf (inside the code-server instance) to -
`
server {
listen 80;
server_name ;
location {
proxy_pass http://192.168.4.120:8080;
include proxy_params;
}
},
`
Further I found I could edit the docker-compose file to something similar here -nginx-reverse-proxy/nginx.conf at master · balena-io-examples/nginx-reverse-proxy · GitHub
But I already spent hours looking for the docker-compose.yml
in host OS and code-server instance with no luck, meanwhile the zsh doesn’t support some basic commands such as systemctl, locate, etc. so it’s really making it difficult to configure anything.
Any help is appreciated. Thanks.
Hi @vishjoisar
Welcome to the forums!
I’d like to ask you a few questions to better understand the issue you’re experiencing and provide some references that may be helpful.
To better understand the issue:
About the docker-compose.yml
file, it is usually edited on your development machine and then pushed to the device as part of the release, and not edited locally.
Regards
Ramiro
Hi @vishjoisar
You also mention that you’re having issues finding systemctl
and locate
. You usually don’t need to use those commands as part of developing and deploying a new app, but anyway I wanted to look into it because they may be indicators of some other issue.
First, systemctl
is available on the host OS shell so you should be able to run it. How are you accessing the shell?
And in general, if you find a command that is not available on the host OS shell, you could create an app, and add the commands you need ( for example as is done here balena-nodejs-hello-world/Dockerfile.template at master · balena-io-examples/balena-nodejs-hello-world · GitHub )
Cheers,
Ramiro
Hi @ramirogm
Thanks for your response and helping me troubleshoot!
I’m using this image from BalenaHub that I flashed using Etcher.
I installed nginx on the code-server container from BalenaHub, and then I edited the nginx.conf
file through SSH from dashboard.balena-cloud.com into the container. I haven’t touched the Host OS. Then I tried to restart the nginx service but the systemctl
command wouldn’t run as seen in this screenshot.

I looked into the image you mentioned - Github Balena-io-playground but it seems that image is only for x86 boards and most likely won’t run on Rpi4.
Also I tried restarting nginx with 'sudo service nginx restartinstead of
sudo systemctl restart nginx` and the command worked giving me a fail error. I have attached a screenshot for your reference.
Hi @@vishjoisar
To summarize, there are two possible apps that you could deploy to have a vs-code server. The one on the balena playground has support for Raspberry Pi 4 and 3 ( see balena-ide/Dockerfile.raspberrypi4-64 at master · balena-io-playground/balena-ide · GitHub and balena-ide/Dockerfile.raspberrypi3 at master · balena-io-playground/balena-ide · GitHub ) so it should work.
Going back to the version you’re using. I would suggest that if you want to change the application, for example adding an nginx.conf
file, you could fork the original repo ( GitHub - SamEureka/balenaCodeServer: balenaCodeServer is a free Visual Studio Code based IDE that runs in your browser, served from your Raspberry Pi! ), make the changes locally, and then deploy your version to the Pi. I’m not sure I understand how you deployed it ( from "I installed nginx on the code-server container " ), but I think it would be better to deploy nginx
itself as a container. Then you can use the restart icons from the dashboard if you need to restart it. You could use the same process ( fork and edit ) if you want to add something to the “playground” version.
About the configuration: even though you can actually ssh into a container, for this kind of change - editing a config file - it’s better to make the changes locally and deploy the changes as part of the app. You can even use local mode which provides a better dev experience than going through balena cloud ( which works, but the deploy cycle takes longer ).
Regards
Ramiro
One note, I’ve just checked the balena-ide repo and on the README it says that “Currently this project only runs in x86 based systems”, which I haven’t noticed. So, running on a Pi3 will probably take some tweaking.
I’ve managed to run the balena-ide on a Balena Fin with a Raspberry ComputeModule 3 ( so, simialr to a Raspberry Pi 3 ) after some tweaking that I’ll later update.
Once I had it running I got the same “500 , port not shared error”. I fixed that by defining an environment variable PORT
with value of 80
.
Maybe you can try that?