@@ -61,9 +61,9 @@ TSFlow uses a **Go backend + React frontend** architecture for optimal performan
6161- ** Tailscale API key** with appropriate permissions
6262- ** Docker** (recommended) or Go 1.21+ and Node.js 18+
6363
64- ### Option 1: Using Docker (Recommended )
64+ ### Using Docker Compose (Fastest )
6565
66- The fastest way to get started:
66+ The quickest way to get started:
6767
6868``` bash
6969# Create environment file
@@ -79,74 +79,40 @@ docker-compose logs -f tsflow
7979
8080Then navigate to ` http://localhost:8080 ` to start exploring your network!
8181
82- ### Option 2: Development Setup
82+ ## Deployment Options
8383
84- 1 . ** Clone the repository**
85- ``` bash
86- git clone https://github.com/rajsinghtech/tsflow.git
87- cd tsflow
88- ```
89-
90- 2 . ** Configure environment**
91- ``` bash
92- cp env.example .env
93- ```
94-
95- Edit ` .env ` and add your Tailscale credentials:
96- ``` env
97- TAILSCALE_API_KEY=tskey-api-your-api-key-here
98- TAILSCALE_TAILNET=your-tailnet-name
99- PORT=8080
100- ENVIRONMENT=development
101- ```
102-
103- 3 . ** Build the frontend**
104- ``` bash
105- cd frontend
106- npm install
107- npm run build
108- cd ..
109- ```
84+ ### 🐳 Docker Deployment
11085
111- 4 . ** Run the backend**
112- ``` bash
113- cd backend
114- go mod download
115- go run main.go
116- ```
86+ #### Using Pre-built Images from GHCR
11787
118- 5 . ** Open your browser**
119- Navigate to ` http://localhost:8080 ` to start exploring your network!
120-
121- ## Docker Deployment
122-
123- ### Using Pre-built Images (Recommended)
124-
125- Pre-built container images are automatically built and published to GitHub Container Registry:
88+ Run directly using the pre-built container images from GitHub Container Registry:
12689
12790``` bash
128- # Pull and run the latest image
91+ # Simple docker run
12992docker run -d \
93+ --name tsflow \
13094 -p 8080:8080 \
13195 -e TAILSCALE_API_KEY=your-api-key \
13296 -e TAILSCALE_TAILNET=your-tailnet \
133- --name tsflow \
97+ -e ENVIRONMENT=production \
98+ --restart unless-stopped \
13499 ghcr.io/rajsinghtech/tsflow:latest
135100```
136101
137- ** Available tags:**
102+ ** Available image tags:**
138103- ` latest ` - Latest stable release from main branch
104+ - ` <version> ` - Tagged releases (e.g., ` v1.0.0 ` )
139105- ` <commit-sha> ` - Specific commit builds
140- - ` <version> ` - Tagged releases
141106
142- ### Using Docker Compose (Recommended)
107+ #### Using Docker Compose (Recommended)
143108
144- The included ` docker-compose.yml ` file provides the easiest deployment :
109+ Create a ` docker-compose.yml ` file:
145110
146111``` yaml
147112services :
148113 tsflow :
149- build : .
114+ image : ghcr.io/rajsinghtech/tsflow:latest
115+ container_name : tsflow
150116 ports :
151117 - " 8080:8080"
152118 environment :
@@ -157,6 +123,11 @@ services:
157123 env_file :
158124 - .env
159125 restart : unless-stopped
126+ healthcheck :
127+ test : ["CMD", "curl", "-f", "http://localhost:8080/health"]
128+ interval : 30s
129+ timeout : 10s
130+ retries : 3
160131` ` `
161132
162133**Commands:**
@@ -167,26 +138,169 @@ docker-compose up -d
167138# View logs
168139docker-compose logs -f tsflow
169140
170- # Rebuild and restart
171- docker-compose up --build -d
141+ # Update to latest version
142+ docker-compose pull && docker-compose up -d
172143
173144# Stop the application
174145docker-compose down
175146```
176147
177- ### Building from Source
148+ ### ☸️ Kubernetes Deployment
149+
150+ Deploy TSFlow on Kubernetes using the provided manifests:
151+
152+ #### Quick Deploy with Kustomize
153+
154+ ``` bash
155+ # Clone the repository
156+ git clone https://github.com/rajsinghtech/tsflow.git
157+ cd tsflow/k8s
158+
159+ # Set your Tailscale credentials
160+ export TAILSCALE_API_KEY=" your-api-key-here"
161+ export TAILSCALE_TAILNET=" your-tailnet-name"
162+
163+ # Deploy using Kustomize
164+ kubectl apply -k .
165+ ```
166+
167+ #### Manual Deployment
168+
169+ 1 . ** Create the namespace:**
170+ ``` bash
171+ kubectl create namespace tailscale
172+ ```
173+
174+ 2 . ** Create the secret with your credentials:**
175+ ``` bash
176+ kubectl create secret generic tsflow \
177+ --namespace=tailscale \
178+ --from-literal=TAILSCALE_API_KEY=" your-api-key" \
179+ --from-literal=TAILSCALE_TAILNET=" your-tailnet"
180+ ```
181+
182+ 3 . ** Deploy the application:**
183+ ``` bash
184+ # Apply all manifests
185+ kubectl apply -f k8s/deployment.yaml
186+ kubectl apply -f k8s/service.yaml
187+
188+ # Optional: Apply HTTPRoute for Gateway API
189+ kubectl apply -f k8s/httproute.yaml
190+ ```
191+
192+ 4 . ** Access the application:**
193+ ``` bash
194+ # Port forward for local access
195+ kubectl port-forward -n tailscale svc/tsflow 8080:80
196+
197+ # Or use ingress/gateway based on your cluster setup
198+ ```
199+
200+ #### Kubernetes Manifests Overview
201+
202+ The k8s directory contains:
203+ - ` deployment.yaml ` - Main application deployment
204+ - ` service.yaml ` - ClusterIP service
205+ - ` secret.yaml ` - Secret template for credentials
206+ - ` httproute.yaml ` - Gateway API route (optional)
207+ - ` kustomization.yaml ` - Kustomize configuration
208+
209+ ** Key features:**
210+ - Single replica with ` Recreate ` strategy
211+ - Health checks and resource limits
212+ - ConfigMap and Secret support
213+ - Gateway API compatibility
214+
215+ ### 🔧 Local Development Build
216+
217+ For developers who want to build and run TSFlow locally:
218+
219+ #### Prerequisites
220+ - ** Go 1.21+** for backend development
221+ - ** Node.js 18+** and ** npm** for frontend development
222+ - ** Git** for version control
223+
224+ #### Development Setup
225+
226+ 1 . ** Clone the repository:**
227+ ``` bash
228+ git clone https://github.com/rajsinghtech/tsflow.git
229+ cd tsflow
230+ ```
231+
232+ 2 . ** Configure environment:**
233+ ``` bash
234+ cp env.example .env
235+ ```
236+
237+ Edit ` .env ` and add your Tailscale credentials:
238+ ``` env
239+ TAILSCALE_API_KEY=tskey-api-your-api-key-here
240+ TAILSCALE_TAILNET=your-tailnet-name
241+ PORT=8080
242+ ENVIRONMENT=development
243+ ```
244+
245+ 3 . ** Build and run the frontend:**
246+ ``` bash
247+ cd frontend
248+ npm install
249+ npm run build
250+ cd ..
251+ ```
252+
253+ 4 . ** Run the backend:**
254+ ``` bash
255+ cd backend
256+ go mod download
257+ go run main.go
258+ ```
259+
260+ 5 . ** Development workflow:**
261+ ``` bash
262+ # For frontend development with hot reload
263+ cd frontend
264+ npm run dev # Runs on port 5173 with proxy to backend
265+
266+ # For backend development with auto-reload
267+ cd backend
268+ go install github.com/cosmtrek/air@latest
269+ air # Auto-reloads on Go file changes
270+ ```
271+
272+ #### Local Docker Build
273+
274+ Build the Docker image locally from source:
178275
179276``` bash
180277# Build the image
181- docker build -t tsflow .
278+ docker build -t tsflow:local .
182279
183280# Run the container
184281docker run -d \
282+ --name tsflow-local \
185283 -p 8080:8080 \
186284 -e TAILSCALE_API_KEY=your-api-key \
187285 -e TAILSCALE_TAILNET=your-tailnet \
188- --name tsflow \
189- tsflow
286+ --restart unless-stopped \
287+ tsflow:local
288+ ```
289+
290+ #### Development Testing
291+
292+ ``` bash
293+ # Frontend testing
294+ cd frontend
295+ npm run test # Run unit tests
296+ npm run lint # Check code style
297+ npm run type-check # TypeScript validation
298+
299+ # Backend testing
300+ cd backend
301+ go test ./... # Run tests
302+ go fmt ./... # Format code
303+ go vet ./... # Static analysis
190304```
191305
192306## Configuration
0 commit comments