Deploy Swagger Editor with Docker
Docker simplifies deployment by handling dependencies automatically. Begin by pulling the Swagger Editor image from the Docker registry.
docker pull swaggerapi/swagger-editor
Launch the container, mapping its internal port 8080 to a host port of your choice, such as 8088.
docker run -p 8088:8080 -d swaggerapi/swagger-editor
After execution, access Swagger Editor locally by navigating to http://localhost:8088 in a browser. This confirms a successful local setup. To enable remote access, proceed to install an internal penetration tool.
Install Cpolar on Linux
Cpolar facilitates exteranl access by creating a public URL for local services without requiring a public IP or domain registration. Follow these steps for installation.
Use the automated installation script provided by Cpolar.
curl -L https://www.cpolar.com/static/downloads/install-release-cpolar.sh | sudo bash
Register Cpolar as a system service to ensure it starts automatically.
sudo systemctl enable cpolar
Start the service immediately.
sudo systemctl start cpolar
Once installed, access the Cpolar web interface by browsing to http://<local-ip>:9200 from any machine on the same network. Log in with your Cpolar account to proceed with configuration.
Configure Public Access for Swagger Editor
In the Cpolar dashboard, navigate to Tunnel Management and create a new tunnel.
- Tunnel Name: Assign a unique identifier.
- Protocol: Select HTTP.
- Local Address: Enter the port used earlier, e.g., 8088.
- Domain Type: Choose a random domain for testing.
- Region: Select an appropriate location, such as China.
Click Create to generate the tunnel. The status page will display the public URLs (HTTP and HTTPS) for remote access.
Access Swagger Editor Remotely
Use the provided public URL from any device's browser to reach the Swagger Editor interface. This setup enables collaborative API documentation editing without deploying to a cloud server.
Assign a Permanent Public Address
Random domains expire after 24 hours. For stable access, configure a fixed subdomain under Cpolar's resevred domains feature.
Upgrade to a Cpolar plan that supports custom subdomains. In the Cpolar web panel, go to Reservations and secure a subdomain name. Return to the tunnel list, edit the existing tunnel, and update the domain settings:
- Domain Type: Select Subdomain.
- Sub Domain: Enter the reserved subdomain.
Apply changes. The tunnel will now use a persistent address, allowing consistent remote access to Swagger Editor.