Introduction
This article mainly introduces how to use Docker to locally deploy Code Server on the Orange Pi Zero3 with the CasaOS light NAS system, and how to achieve remote access to the development environment via browser using cpolar for intranet penetration, allowing you to write, edit, and run code consistently across different devices and operating systems. No public IP is needed, and there’s no hassle of router configuration.
Previously, I shared how to install the CasaOS light NAS system that supports Docker on the Orange Pi Zero3 and deployed the Talebook e-book library for remote reading. Such a small host, which is always connected to the internet, is very suitable for deploying some frequently used services, whether for reading novels, listening to music, watching videos, backing up photos, etc. However, apart from entertainment, we can also install Code Server on it to implement applications in work productivity scenarios.
Code Server is a powerful open-source tool that brings Visual Studio Code (VS Code) into a web-based online environment. It allows you to remotely access and use the features of VS Code through a web browser without needing to install the VS Code application locally. Moreover, it is a lightweight application with low resource consumption, making it efficient to run on such resource-limited small host servers.
Deploying Code Server locally on the Orange Pi Zero3 is very simple, and below I will introduce the specific operations.
1. Add Image Source
The environment I demonstrate here is the Orange Pi Zero3 small host that has already installed CasaOS.
If you don’t know how to operate, you can refer to this tutorial: How to Install CasaOS Light NAS System on Orange Pi Zero3
First, we need to enter the Orange Pi IP address in the browser to access the CasaOS management interface.
Then enter the terminal and log in using the root account password.
After entering the terminal, execute the command below:
nano /etc/docker/daemon.json
In the editor, enter the new image source address:
{
"registry-mirrors": [
"https://docker.m.daocloud.io",
"https://docker.1panel.live"
]
}
Then press Ctrl+X to save this image source, exit the editor, and return to the terminal to execute the command below to restart the docker service:
systemctl restart docker
2. Deploy Code Server
After completing the above operations, we return to the CasaOS main interface and click on the built-in App Store application center.
Some users may say that the applications here are too few right after flashing the system. In fact, the official provides a method to manually add more applications; just click on more applications in the current APP dropdown box.
Then click the question mark, which will automatically open a page in the browser to add more applications:
Copy these addresses from this page, then return to the CasaOS application center interface.
Paste the address into the input box that has a question mark, then click add; the system will automatically update more applications to the application center interface, which can increase from dozens to hundreds.
Now, we can see Code Server in the application store; just click install to automatically deploy it:
After deployment is complete, click open to access the web operation interface of Code Server in the browser:
3. Install Intranet Penetration Tool
At this point, we have successfully deployed Code Server on the local CasaOS Orange Pi host, but it can only be used within the local area network. If we want to remotely use the home Code Server to write code while on a business trip, what should we do?
It’s simple; just install a cpolar intranet penetration tool on the Orange Pi to easily achieve remote access to the services deployed in the intranet host. Next, I will introduce how to install the cpolar intranet penetration tool.
First, click the upper left corner to enter the terminal:
Then enter the root account password to log in:
Then execute the command below in the terminal to install the cpolar intranet penetration tool:
curl -fsSL https://get.cpolar.sh | sudo sh
The image below shows that the cpolar intranet penetration service is running normally.
4. Configure Public Address
We then use the CasaOS Orange Pi IP address plus 9200 to open a new browser to log in to the cpolar management interface:
If you don’t have an account, you can click to register for free to access the cpolar official website: https://www.cpolar.com
After entering the account password to log in to the cpolar web UI management interface, click on the tunnel management in the left dashboard — create a tunnel:
Tunnel name: customizable, ensure it does not duplicate with existing tunnel names, in this example, we used: mycodes
Protocol: http
Local address: 8443
Domain type: random domain
Region: choose China Top
Click create
After the tunnel is created successfully, click on the status on the left — online tunnel list to view the generated public access address. There are two access methods: one is http and the other is https; you can choose either to access in the browser.
Now we can use mobile phones, tablets, and other devices to enter the public address generated by cpolar in the browser’s address bar and see that we can successfully access the web management interface of Code Server deployed in the local CasaOS Orange Pi!
Summary
For demonstration purposes, the public address generated by cpolar in the above operations is randomly generated. The advantage of this random address is that it is fast to establish and can be used immediately. However, its disadvantage is that the URL is randomly generated, making it hard to remember, and this address will change randomly within 24 hours, making it more suitable for temporary testing.
If there is a need for long-term remote access to the Code Server in the local CasaOS Orange Pi to code at any time, or to access other local services remotely without wanting to reconfigure the public address every day, and also wanting the address to be nice and easy to remember, I recommend choosing to configure a fixed public address for remote access.
5. Configure Fixed Public Address
Log in to the cpolar official website, click on the left reserved options, select to reserve a secondary subdomain, and choose the region as China VIP. Set a secondary subdomain name, and click reserve. After successfully reserving, copy the reserved secondary subdomain name, here I filled in mycodes1
, and you can customize your favorite name.
After successfully reserving, copy the name of the reserved secondary subdomain:mycodes1
, return to the cpolar web UI management interface, click on the left dashboard’s tunnel management — tunnel list, find the tunnel you want to configure mycodes
, and click edit on the right:
Modify the tunnel information to configure the successfully reserved secondary subdomain into the tunnel
-
Domain type: select secondary subdomain
-
Sub Domain: fill in the successfully reserved secondary subdomain: mycodes1
-
Region: select China VIP
Click Update
(Note: click update only once, no need to submit repeatedly)
After the update is complete, open the online tunnel list, and you can see that the public address has changed from a random address name to two fixed secondary subdomains (fixed public address):
Finally, we can use any fixed public address to access in the browser, and we can see that the access is successful. Thus, a fixed and permanent public address has been set up, allowing you to remotely access the Code Server on the local CasaOS Orange Pi host to write code online anytime, anywhere!
Above is how to deploy Code Server on the CasaOS light NAS system Orange Pi Zero3, and install the cpolar intranet penetration tool to configure a fixed secondary subdomain public address, achieving remote development and coding anytime and anywhere. Thank you for watching, and feel free to leave comments and exchanges if you have any questions.
If you need to reprint, please indicate the source!
Click on the image to participate in the activity
Leave a Comment
Your email address will not be published. Required fields are marked *