Skip to content

Commit 89612bd

Browse files
Valienclaude
andcommitted
docs: add deployment section to README
Covers auth key setup, production deployment, data persistence and backups, updating, logs and troubleshooting, and testing locally without Tailscale. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent fd652cf commit 89612bd

1 file changed

Lines changed: 129 additions & 0 deletions

File tree

README.md

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,135 @@ docker compose up -d
4545

4646
Fishscale will be available at `https://fishscale.<your-tailnet>.ts.net`.
4747

48+
## Deployment
49+
50+
### Prerequisites
51+
52+
- Docker and Docker Compose
53+
- A [Tailscale](https://tailscale.com) account
54+
- A Tailscale auth key
55+
56+
### Auth Key Setup
57+
58+
Generate an auth key from the [Tailscale admin console](https://login.tailscale.com/admin/settings/keys):
59+
60+
- **Reusable** — recommended so the container can restart without a new key.
61+
- **Ephemeral** — optional. The node will be automatically removed from your tailnet when the container stops. Good for testing.
62+
- **Tagged** — if you use [ACL tags](https://tailscale.com/kb/1068/acl-tags), tag the key (e.g., `tag:fishscale`) so it gets the right permissions.
63+
64+
Auth keys expire after 90 days by default. If the container fails to start after that, generate a new key and update your `.env` file.
65+
66+
### Production Setup
67+
68+
1. Clone the repo and create a `.env` file:
69+
70+
```bash
71+
git clone https://github.com/Valien/fishscale.git
72+
cd fishscale
73+
74+
cat > .env <<'EOF'
75+
TS_AUTHKEY=tskey-auth-...
76+
TS_HOSTNAME=fishscale
77+
EOF
78+
```
79+
80+
2. Start the container:
81+
82+
```bash
83+
docker compose up -d
84+
```
85+
86+
Fishscale will join your tailnet and be available at `https://fishscale.<your-tailnet>.ts.net`.
87+
88+
The `docker-compose.yml` includes:
89+
90+
- **Named volume** (`fishscale-data`) mounted at `/data` — stores the SQLite database, photos, and Tailscale state.
91+
- **`/dev/net/tun`** device + **`NET_ADMIN`** capability — required for Tailscale's userspace networking.
92+
- **Resource limits** — 256 MB memory, 1 CPU. Adjust in `docker-compose.yml` if needed.
93+
- **Log rotation** — JSON file driver, 10 MB max, 3 files.
94+
95+
### Data Persistence
96+
97+
All data lives in the `fishscale-data` Docker volume:
98+
99+
```
100+
/data/
101+
fish.db SQLite database (catches, trips, settings)
102+
photos/ Uploaded catch photos
103+
tsnet-state/ Tailscale node identity and keys
104+
```
105+
106+
**Back up your data:**
107+
108+
```bash
109+
# Copy the database and photos out of the container
110+
docker cp fishscale:/data/fish.db ./fish.db.backup
111+
docker cp fishscale:/data/photos ./photos-backup
112+
113+
# Or find the volume on disk
114+
docker volume inspect fishscale_fishscale-data --format '{{ .Mountpoint }}'
115+
```
116+
117+
**Restore from backup:**
118+
119+
```bash
120+
docker compose down
121+
docker cp ./fish.db.backup fishscale:/data/fish.db
122+
docker cp ./photos-backup/. fishscale:/data/photos/
123+
docker compose up -d
124+
```
125+
126+
### Updating
127+
128+
Pull the latest code and rebuild:
129+
130+
```bash
131+
git pull
132+
docker compose up -d --build
133+
```
134+
135+
Your data volume is preserved across rebuilds.
136+
137+
### Logs & Troubleshooting
138+
139+
```bash
140+
# Follow logs
141+
docker compose logs -f
142+
143+
# Check container status
144+
docker compose ps
145+
```
146+
147+
**Common issues:**
148+
149+
| Symptom | Cause | Fix |
150+
|---------|-------|-----|
151+
| Container exits immediately | Auth key expired or invalid | Generate a new key, update `.env`, restart |
152+
| `TUN device not found` | Missing `/dev/net/tun` mount | Ensure `docker-compose.yml` has the `/dev/net/tun:/dev/net/tun` volume and `NET_ADMIN` cap |
153+
| Not reachable on tailnet | Firewall or ACL blocking | Check [Tailscale admin](https://login.tailscale.com/admin/machines) for the node, verify ACLs |
154+
| `permission denied` on `/data` | Volume ownership mismatch | The container runs as user `fishscale` (non-root). Ensure the volume has correct permissions |
155+
156+
### Testing Locally Without Tailscale
157+
158+
To test Fishscale without joining a tailnet, use dev mode. This skips Tailscale entirely and serves over plain HTTP on port 8080:
159+
160+
```bash
161+
docker run --rm -p 8080:8080 \
162+
-e FISHSCALE_DEV_MODE=true \
163+
-e FISHSCALE_DB_PATH=/data/fish.db \
164+
-e FISHSCALE_PHOTO_DIR=/data/photos \
165+
-v fishscale-data:/data \
166+
$(docker compose build --quiet fishscale && echo fishscale-fishscale)
167+
```
168+
169+
Or build and run directly without Docker:
170+
171+
```bash
172+
FISHSCALE_DEV_MODE=true FISHSCALE_DB_PATH=./fish.db FISHSCALE_PHOTO_DIR=./photos go run ./cmd/fishscale
173+
```
174+
175+
Open http://localhost:8080. Dev mode uses a fake user identity — no authentication is required.
176+
48177
## Development
49178

50179
### Prerequisites

0 commit comments

Comments
 (0)