How to quickly deploy StackEdit using Docker and achieve remote office access to the local editor over the public network

StackEdit is a popular Markdown editor with 20.7k stars on GitHub! , which supports saving Markdown notes to multiple repositories, including Gitee, GitHub and Gitea. This online note-taking tool also provides some convenient features, such as dragging or pasting to upload images, file search functions, and the ability to switch to a cool dark theme. These features are especially suitable for users who like to use Markdown to record notes. At the same time, StackEdit is open source. Individuals can deploy their own Markdown editor locally and access it quickly through a browser. Of course, local access is too limited. Combined with the cpolar intranet penetration tool, it can be achieved remotely and anytime, anywhere. , any browser can access our locally deployed Markdown editor to improve productivity!!

The following describes how to quickly deploy and run StackEdit in Linux using docker-compose, and combine it with cpolar intranet penetration to achieve remote access. Since it is docker deployment and operation, the device needs to install docker and docker compose in advance!

1. docker deployment Stackedit

In any directory on Linux, create a docker-compose.yml file and press iEdit

vim docker-compose.yml

Then copy the following content into the file, copy and save. The following ports mounting port can be modified by yourself. If you do not want to modify it, you can default to port 8080, which is the default in this example!

services:
  stackedit:
    image: mafgwo/stackedit:5.15.20-8
    container_name: stackedit
    environment:
      - LISTENING_PORT=8080
      - ROOT_URL=/
      - USER_BUCKET_NAME=root
    ports:
      - 8080:8080/tcp
    network_mode: bridge
    restart: always 

After saving the file, execute the following command to start it with one click

docker-compose up -d

After execution, wait for the installation to complete. After completion, enter docker psto see the running Stackedit

image-20230925145100176

2. Local access

The personal Markdown editor has been successfully deployed and started using docker. Now open the browser and access the 8080 port mounted on the container via LAN. Then click on the top of the interface to start writing. You will see our Markdown editor interface, as shown below. We install the cpolar intranet penetration tool to achieve remote access

image-20230925150315436

3. Linux installation cpolar

Above we successfully installed Stackedit, and LAN access is ok. Next we install the cpolar intranet penetration tool on Linux, and forward the http public network address mapped to the local port through cpolar. We can easily achieve remote access without having to register a domain name ourselves. Cloud server. The following are the steps to install cpolar

cpolar official website address: https://www.cpolar.com

  • Use one-click script installation command
curl -L https://www.cpolar.com/static/downloads/install-release-cpolar.sh | sudo bash
  • Add services to the system
sudo systemctl enable cpolar
  • Start cpolar service
sudo systemctl start cpolar

After cpolar is successfully installed, access Linux port 9200 on an external browser: [http://LAN ip:9200]. Log in using your cpolar account. After logging in, you can see the cpolar web configuration interface, which is connected to the web management interface. Just configure

image-20230831171159175

4. Configure Stackedit public network access address

Click Tunnel Management - Create Tunnel on the left dashboard to create a Stackedit cpolar public network address tunnel!

  • Tunnel name: You can customize the name. Be careful not to duplicate the existing tunnel name.
  • Protocol: Select http
  • Local address: 8080 (docker mounted port)
  • Domain name type: Choose a random domain name for free
  • Region: Select China vip

Click创建

image-20230925152323220

After the tunnel is successfully created, click the status on the left - online tunnel list to view the generated public network access address. There are two access methods, one is http and https

image-20230925152428046

5. Access Stackedit remotely from the public network

Use the above https public network address to access it in the browser of any device, and you can successfully see our Stackedit interface. In this way, a public network address that can be accessed remotely is created.

image-20230925152527966

6. Fixed Stackedit public network address

Since the tunnel created using cpolar above uses a random public network address, it will change randomly within 24 hours, which is not conducive to long-term remote access. Therefore, we can configure a second-level subdomain name for it. This address is a fixed address and will not change randomly [ps: cpolar.cn has been filed]

Note that you need to upgrade the cpolar package to a basic package or above, and the bandwidth corresponding to each package is different. [cpolar.cn has been registered]

Log in to the cpolar official website , click Reserve on the left, select to reserve the second-level subdomain name, set a second-level subdomain name, click Reserve, and copy the reserved second-level subdomain name after the reservation is successful.

image-20230925152655519

After the reservation is successful, copy the name of the second-level subdomain name that was successfully reserved.

image-20230925152723068

Return to the cpolar web UI management interface, click Tunnel Management - Tunnel List on the left dashboard, find the tunnel you want to configure, and click Edit on the right

image-20230925152751096

Modify the tunnel information and configure the successfully reserved second-level subdomain name into the tunnel.

  • Domain name type: Select a second-level subdomain name
  • Sub Domain: Fill in the successfully reserved second-level subdomain name

Click 更新(note, click once to update, no need to submit again)

image-20230925152848058

After the update is completed, open the online tunnel list. At this time, you can see that the public network address has changed and the address name has become a fixed second-level subdomain name.

image-20230925152943669

Finally, we use the fixed public network address to access the Stackedit markdown editor. We can see that the access is successful. In this way, a fixed and permanent public network address is set.

image-20230925153044642

Guess you like

Origin blog.csdn.net/qq_73017178/article/details/135066993