Skip to content

Commit 4bc02f6

Browse files
authored
Add Portracker (#121)
* Add Portracker service with Tailscale sidecar configuration * Remove redundant configuration details for Copyparty from Portracker README * Update docker-compose.yml Added healthcheck and fixed spacing between sidecar and application in .yml file.
1 parent 89c97bb commit 4bc02f6

File tree

5 files changed

+107
-0
lines changed

5 files changed

+107
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ If you would like to add your own config, you can use the [service-template](tem
117117
| 📊 **Uptime Kuma** | A self-hosted monitoring tool like "Uptime Robot". | [Details](services/uptime-kuma) |
118118
| 📉 **Beszel** | A lightweight server monitoring hub with historical data, Docker stats, and alerts. | [Details](services/beszel) |
119119
| 🚀 **Speedtest Tracker** | A self-hosted tool to monitor and log internet speed tests with detailed visualizations. | [Details](services/speedtest-tracker) |
120+
| 🔎 **Portracker** | A simple, self-hosted port monitoring and tracking tool for auditing open ports. | [Details](services/portracker) |
120121

121122
### 🏠 Smart Home
122123

services/portracker/.env

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#version=1.0
2+
#url=https://github.com/2Tiny2Scale/tailscale-docker-sidecar-configs
3+
#COMPOSE_PROJECT_NAME= // only use in multiple deployments on the same infra
4+
SERVICE=portracker
5+
IMAGE_URL=mostafawahied/portracker
6+
SERVICEPORT=4999
7+
TS_AUTHKEY=
8+
DNS_SERVER=9.9.9.9

services/portracker/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Portracker with Tailscale Sidecar Configuration
2+
3+
This Docker Compose configuration sets up [Portracker](https://github.com/mostafa-wahied/portracker) with Tailscale as a sidecar container to securely access your lightweight port monitoring and tracking tool over a private Tailscale network. By using Tailscale in a sidecar configuration, you can enhance the security and accessibility of your Portracker instance, ensuring it is only available within your Tailscale network.
4+
5+
## Portracker
6+
7+
[Portracker](https://github.com/mostafa-wahied/portracker) is a simple, self-hosted port monitoring tool that helps you keep track of open ports on your servers. It provides a web interface for viewing, searching, and exporting port information, making it easy to audit and manage your network exposure. Portracker is lightweight, easy to deploy, and requires minimal configuration. With this setup, Portracker is exposed only to your Tailscale network, providing secure, peer-to-peer access from your devices.
8+
9+
**Key Features:**
10+
11+
- 🔍 Real-time port monitoring and listing
12+
- 📊 Export port data to CSV for audits
13+
- 🖥️ Simple web interface for browsing and searching
14+
- 🛡️ Helps identify open ports and potential vulnerabilities
15+
- ⚡ Lightweight and fast deployment
16+
- 🔧 Minimal configuration required
17+
18+
With Tailscale in place, all of these features are securely tunneled through your private mesh network—no need to expose ports to the public internet.
19+
20+
## Configuration Overview
21+
22+
In this setup, the `tailscale-portracker` service runs Tailscale, which handles the secure networking layer. The `portracker` service uses Docker’s `network_mode: service:` setting to share the network stack of the Tailscale container. This means the Portracker web interface and all monitoring functionality are only accessible via the Tailscale network (or locally if preferred), adding a strong privacy layer to your self-hosted port tracker.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"TCP": {
3+
"443": {
4+
"HTTPS": true
5+
}
6+
},
7+
"Web": {
8+
"${TS_CERT_DOMAIN}:443": {
9+
"Handlers": {
10+
"/": {
11+
"Proxy": "http://127.0.0.1:4999"
12+
}
13+
}
14+
}
15+
}
16+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
services:
2+
# Make sure you have updated/checked the .env file with the correct variables.
3+
# All the ${ xx } need to be defined there.
4+
# Tailscale Sidecar Configuration
5+
tailscale:
6+
image: tailscale/tailscale:latest # Image to be used
7+
container_name: tailscale-${SERVICE} # Name for local container management
8+
hostname: ${SERVICE} # Name used within your Tailscale environment
9+
environment:
10+
- TS_AUTHKEY=${TS_AUTHKEY}
11+
- TS_STATE_DIR=/var/lib/tailscale
12+
- TS_SERVE_CONFIG=/config/serve.json # Tailsacale Serve configuration to expose the web interface on your local Tailnet - remove this line if not required
13+
- TS_USERSPACE=false
14+
- TS_ENABLE_HEALTH_CHECK=true # Enable healthcheck endpoint: "/healthz"
15+
- TS_LOCAL_ADDR_PORT=127.0.0.1:41234 # The <addr>:<port> for the healthz endpoint
16+
#- TS_ACCEPT_DNS=true # Uncomment when using MagicDNS
17+
volumes:
18+
- ${PWD}/config:/config # Config folder used to store Tailscale files - you may need to change the path
19+
- ${PWD}/ts/state:/var/lib/tailscale # Tailscale requirement - you may need to change the path
20+
devices:
21+
- /dev/net/tun:/dev/net/tun # Network configuration for Tailscale to work
22+
cap_add:
23+
- net_admin # Tailscale requirement
24+
- sys_module # Tailscale requirement
25+
# ports:
26+
# - 0.0.0.0:${SERVICEPORT}:${SERVICEPORT} # Binding port ${SERVICE}PORT to the local network - may be removed if only exposure to your Tailnet is required
27+
# If any DNS issues arise, use your preferred DNS provider by uncommenting the config below
28+
#dns:
29+
# - ${DNS_SERVER}
30+
healthcheck:
31+
test: ["CMD", "wget", "--spider", "-q", "http://127.0.0.1:41234/healthz"] # Check Tailscale has a Tailnet IP and is operational
32+
interval: 1m # How often to perform the check
33+
timeout: 10s # Time to wait for the check to succeed
34+
retries: 3 # Number of retries before marking as unhealthy
35+
start_period: 10s # Time to wait before starting health checks
36+
restart: always
37+
38+
# ${SERVICE}
39+
application:
40+
image: ${IMAGE_URL} # Image to be used
41+
network_mode: service:tailscale # Sidecar configuration to route ${SERVICE} through Tailscale
42+
container_name: app-${SERVICE} # Name for local container management
43+
# network_mode: "host" Disabled as it is not possible to use host networking with Tailscale sidecar.
44+
volumes:
45+
# Required for data persistence
46+
- ${PWD}/${SERVICE}-data/data:/data
47+
# Required for discovering services running in Docker
48+
- /var/run/docker.sock:/var/run/docker.sock:ro
49+
environment:
50+
- DATABASE_PATH=/data/portracker.db
51+
depends_on:
52+
tailscale:
53+
condition: service_healthy
54+
healthcheck:
55+
test: ["CMD", "pgrep", "-f", "index.js"] # Check if ${SERVICE} process is running
56+
interval: 1m # How often to perform the check
57+
timeout: 10s # Time to wait for the check to succeed
58+
retries: 3 # Number of retries before marking as unhealthy
59+
start_period: 30s # Time to wait before starting health checks
60+
restart: always

0 commit comments

Comments
 (0)