@@ -21,7 +21,7 @@ Deploy Anomstack to Fly.io for a production-ready, scalable anomaly detection pl
2121- ** 🔐 Protected Admin UI** : Secure access to orchestration controls
2222- ** 📡 Global Edge Deployment** : Run close to your data sources worldwide
2323- ** ⚡ Auto-scaling** : Scale up/down based on demand
24- - ** 🗄️ Managed PostgreSQL ** : Fully managed database with automatic backups
24+ - ** 🗄️ SQLite Storage ** : Simple, reliable storage on persistent volumes
2525- ** 📦 Persistent Volumes** : Reliable storage for metrics and models
2626- ** 💰 Simple Pricing** : Pay only for what you use
2727
@@ -48,8 +48,7 @@ graph TB
4848 end
4949
5050 subgraph "Fly.io Services"
51- PG[(🗄️ Managed PostgreSQL)]
52- VOL[📦 Persistent Volume<br/>10GB]
51+ VOL[📦 Persistent Volume<br/>10GB<br/>SQLite Storage]
5352 end
5453
5554 USERS --> PROXY
@@ -58,8 +57,8 @@ graph TB
5857 PROXY -->|"/dagster (basic auth)"| WEB
5958 WEB --> CODE
6059 DAEMON --> CODE
61- WEB --> PG
62- DAEMON --> PG
60+ WEB --> VOL
61+ DAEMON --> VOL
6362 CODE --> VOL
6463```
6564
@@ -262,10 +261,13 @@ Our deployment uses several key configuration files:
262261app = " my-anomstack"
263262primary_region = " ord"
264263
265- # Single container with startup script
264+ [build ]
265+ dockerfile = " docker/Dockerfile.fly"
266+
267+ # nginx reverse proxy handles all routing
266268[[services ]]
267269 protocol = " tcp"
268- internal_port = 80 # nginx proxy port
270+ internal_port = 80
269271
270272 [[services .ports ]]
271273 port = 80
@@ -276,14 +278,16 @@ primary_region = "ord"
276278 port = 443
277279 handlers = [" tls" , " http" ]
278280
281+ # Persistent volumes for data
279282[mounts ]
280283 destination = " /data"
281284 source = " anomstack_data"
282285
286+ # VM configuration - Scaled for ML workloads
283287[vm ]
284- memory = " 2048 "
285- cpu_kind = " shared "
286- cpus = 1
288+ memory = " 8192 " # 8GB RAM for Dagster ML workloads
289+ cpu_kind = " performance "
290+ cpus = 4
287291```
288292
289293### ` nginx.conf ` - Reverse Proxy with Auth
@@ -294,10 +298,10 @@ Key features:
294298- ** Basic authentication** for admin features
295299- ** WebSocket support** for real-time updates
296300
297- ### ` dagster_fly.yaml ` - PostgreSQL Configuration
301+ ### ` dagster_fly.yaml ` - Storage Configuration
298302
299303Configured for:
300- - ** DATABASE_URL ** from Fly.io PostgreSQL
304+ - ** SQLite storage ** on persistent volume
301305- ** DefaultRunLauncher** (no Docker dependency)
302306- ** Persistent storage** on mounted volume
303307
@@ -415,14 +419,15 @@ curl -I -u admin:anomstack2024 https://your-app.fly.dev/dagster # Should get 20
415419### Database Management
416420
417421``` bash
418- # Connect to database
419- fly postgres connect -a my-anomstack-db
422+ # Access SQLite database via SSH
423+ fly ssh console -a my-anomstack
420424
421- # View database status
422- fly status -a my-anomstack- db
425+ # Create backup of SQLite database
426+ cp /data/anomstack.db /tmp/backup_ $( date +%Y%m%d_%H%M%S ) . db
423427
424- # Create backup
425- fly postgres backup my-anomstack-db
428+ # View database size and usage
429+ ls -lh /data/anomstack.db
430+ sqlite3 /data/anomstack.db " .tables"
426431```
427432
428433## Storage & Data Management
@@ -460,11 +465,11 @@ tar -czf /tmp/models_backup.tar.gz /data/models/
460465
461466Typical monthly costs for different workloads:
462467
463- | Workload | Memory | CPU | Storage | PostgreSQL | Est. Cost/Month* |
464- | ----------| --------| -----| ---------| ------------| ------------ -----|
465- | ** Light** (10 metrics) | 1GB | shared-cpu-1x | 10GB | 1 CPU | $15-25 |
466- | ** Medium** (100 metrics) | 2GB | shared-cpu-2x | 25GB | 1 CPU | $35-50 |
467- | ** Heavy** (1000+ metrics) | 4GB | dedicated-cpu-1x | 100GB | 2 CPU | $75-120 |
468+ | Workload | Memory | CPU | Storage | Est. Cost/Month* |
469+ | ----------| --------| -----| ---------| -----------------|
470+ | ** Light** (10 metrics) | 1GB | shared-cpu-1x | 10GB | $10-20 |
471+ | ** Medium** (100 metrics) | 2GB | shared-cpu-2x | 25GB | $25-40 |
472+ | ** Heavy** (1000+ metrics) | 4GB | dedicated-cpu-1x | 100GB | $50-80 |
468473
469474* Estimates based on Fly.io pricing. Check [ fly.io/docs/about/pricing] ( https://fly.io/docs/about/pricing/ ) for current rates.
470475
@@ -510,13 +515,15 @@ nginx -t # Test configuration
510515#### Database Connection Issues
511516
512517``` bash
513- # Test DATABASE_URL
518+ # Test SQLite database access
514519fly ssh console -a my-anomstack
515- echo $DATABASE_URL
516520python -c "
517- from sqlalchemy import create_engine
518- engine = create_engine('$DATABASE_URL ')
519- print('Database connection successful!')
521+ import sqlite3
522+ conn = sqlite3.connect('/data/anomstack.db')
523+ cursor = conn.cursor()
524+ cursor.execute('SELECT name FROM sqlite_master WHERE type=\" table\" ;')
525+ print('SQLite connection successful! Tables:', cursor.fetchall())
526+ conn.close()
520527"
521528```
522529
@@ -542,7 +549,7 @@ print('DuckDB connection successful!')
542549
5435501 . ** High Memory Usage** : Scale up with ` fly scale memory 4096 `
5445512 . ** Slow Queries** : Optimize your metric ingestion SQL
545- 3 . ** Database Bottlenecks ** : Upgrade PostgreSQL instance
552+ 3 . ** Storage I/O ** : Consider upgrading to faster storage or optimizing queries
5465534 . ** Network Issues** : Consider multi-region deployment
547554
548555## Advanced Configuration
0 commit comments