Skip to content

Commit a15d1da

Browse files
committed
feat: improve Fly.io deployment with SQLite storage
- Use SQLite storage instead of PostgreSQL for simpler Fly.io deployment - Update dagster_fly.yaml with optimized settings for single-container deployment - Improve deployment scripts with better error handling and validation - Update documentation with SQLite-specific deployment instructions - Streamline Docker image for Fly.io environment - Add support for persistent volume model storage configuration
1 parent f815af3 commit a15d1da

File tree

7 files changed

+33
-47
lines changed

7 files changed

+33
-47
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,7 @@ make fly-deploy # Deploy with your environment variables
477477
- 🔐 **Configurable admin credentials**
478478
- 📊 **Public dashboard** + protected admin interface
479479
- 🌐 **Global edge deployment** with auto-scaling
480+
- 🗄️ **SQLite simplicity** - No separate database required!
480481

481482
See [full deployment docs](docs/docs/deployment/fly.md) for detailed instructions.
482483

dagster_fly.yaml

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,10 @@ run_launcher:
2020
module: dagster.core.launcher.default_run_launcher
2121
class: DefaultRunLauncher
2222

23-
run_storage:
24-
module: dagster_postgres.run_storage
25-
class: PostgresRunStorage
26-
config:
27-
postgres_url:
28-
env: DATABASE_URL
23+
# Use SQLite storage instead of PostgreSQL for simpler deployment
24+
storage:
25+
sqlite:
26+
base_dir: "/data/dagster_storage"
2927

3028
run_retries:
3129
enabled: true
@@ -61,22 +59,15 @@ sensors:
6159
use_threads: true
6260
num_workers: 2 # Conservative for Fly.io
6361

64-
schedule_storage:
65-
module: dagster_postgres.schedule_storage
66-
class: PostgresScheduleStorage
67-
config:
68-
postgres_url:
69-
env: DATABASE_URL
70-
71-
event_log_storage:
72-
module: dagster_postgres.event_log
73-
class: PostgresEventLogStorage
74-
config:
75-
postgres_url:
76-
env: DATABASE_URL
77-
7862
compute_logs:
7963
module: dagster.core.storage.local_compute_log_manager
8064
class: LocalComputeLogManager
8165
config:
82-
base_dir: "/tmp/dagster/compute_logs"
66+
base_dir: "/tmp/dagster/compute_logs"
67+
68+
# Local artifact storage for Fly.io persistent volume
69+
local_artifact_storage:
70+
module: dagster.core.storage.root
71+
class: LocalArtifactStorage
72+
config:
73+
base_dir: "/data/artifacts"

docker/Dockerfile.fly

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ RUN ls -la ./dagster_home/ && \
3434
ls -la /opt/dagster/dagster_home/ && \
3535
chmod +x /opt/dagster/start.sh
3636

37-
# Create necessary directories
38-
RUN mkdir -p /data/models /tmp/dagster/compute_logs
37+
# Create necessary directories for SQLite storage and artifacts
38+
RUN mkdir -p /data/models /data/dagster_storage /data/artifacts /tmp/dagster/compute_logs
3939

4040
# Environment setup
4141
ENV DAGSTER_HOME=/opt/dagster/dagster_home

docs/docs/deployment/fly.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -206,24 +206,23 @@ For more control over the deployment process:
206206
fly apps create my-anomstack
207207
```
208208

209-
### 2. Set Up Database
209+
### 2. ~~Set Up Database~~ (No longer needed!)
210210

211-
```bash
212-
# Create PostgreSQL cluster
213-
fly postgres create --name my-anomstack-db --region ord
211+
**🎉 SQLite simplification!** Anomstack now uses SQLite storage on the persistent volume, eliminating the need for a separate PostgreSQL database. This makes deployment simpler, faster, and more cost-effective.
214212

215-
# Attach to your app (creates DATABASE_URL secret automatically)
216-
fly postgres attach my-anomstack-db -a my-anomstack
213+
```bash
214+
# No database setup required - SQLite files are created automatically!
215+
echo "✅ Using SQLite storage on persistent volume"
217216
```
218217

219218
### 3. Create Persistent Volume
220219

221220
```bash
222-
# Create 10GB volume for metrics data
221+
# Create 10GB volume for metrics data and SQLite storage
223222
fly volumes create anomstack_data --region ord --size 10 -a my-anomstack
224223
```
225224

226-
### 4. Configure Secrets (Optional)
225+
### 3. Configure Secrets (Optional)
227226

228227
Set up alerts and integrations:
229228

@@ -247,7 +246,7 @@ fly secrets set \
247246
-a my-anomstack
248247
```
249248

250-
### 5. Deploy
249+
### 4. Deploy
251250

252251
```bash
253252
fly deploy -a my-anomstack

fly.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
- **📊 Public Dashboard**: https://anomstack-demo.fly.dev/ (no authentication)
88
- **🔐 Protected Dagster**: https://anomstack-demo.fly.dev/dagster (configurable admin credentials)
99
- **🌐 nginx Reverse Proxy**: Routes and protects services
10-
- **🗄️ Managed PostgreSQL**: Fly.io hosted database
10+
- **🗄️ SQLite Storage**: Simple, reliable file-based storage on persistent volume
1111
- **📦 Persistent Volume**: 10GB for DuckDB and models
1212

1313
## Quick Deploy
@@ -53,7 +53,7 @@ fly secrets set ANOMSTACK_ALERT_EMAIL_TO="[email protected]"
5353
- `fly.toml` - App configuration
5454
- `nginx.conf` - Reverse proxy with auth
5555
- `docker/Dockerfile.fly` - Multi-service container
56-
- `dagster_fly.yaml` - PostgreSQL Dagster config
56+
- `dagster_fly.yaml` - SQLite Dagster config
5757
- `scripts/deployment/start.sh` - Service startup script
5858

5959
## Access

scripts/deployment/deploy_fly.sh

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -102,19 +102,8 @@ else
102102
echo "✅ Volume anomstack_data already exists"
103103
fi
104104

105-
# Create Postgres database
106-
echo "🗄️ Setting up PostgreSQL database..."
107-
if ! fly postgres list | grep -q "$APP_NAME-db"; then
108-
echo "Creating new Postgres cluster..."
109-
fly postgres create --name "$APP_NAME-db" --region ord --initial-cluster-size 1 --vm-size shared-cpu-1x --volume-size 10
110-
echo "✅ PostgreSQL database created"
111-
else
112-
echo "✅ PostgreSQL database already exists"
113-
fi
114-
115-
# Attach the database to the app
116-
echo "🔗 Attaching database to app..."
117-
fly postgres attach "$APP_NAME-db" -a "$APP_NAME" || echo "Database may already be attached"
105+
# Note: Using SQLite storage on persistent volume instead of PostgreSQL
106+
echo "📁 SQLite storage will be created automatically on persistent volume at /data/dagster_storage"
118107

119108
echo "⚙️ Setting environment variables..."
120109

scripts/deployment/validate_fly_config.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ if [[ -f "dagster_fly.yaml" ]]; then
6767
echo "❌ Not using DefaultRunLauncher - this won't work on Fly.io"
6868
exit 1
6969
fi
70+
71+
if grep -q "sqlite:" dagster_fly.yaml; then
72+
echo "✅ Using SQLite storage (simplified deployment)"
73+
else
74+
echo "⚠️ Warning: Not using SQLite storage - PostgreSQL dependency required"
75+
fi
7076
else
7177
echo "❌ dagster_fly.yaml not found"
7278
exit 1

0 commit comments

Comments
 (0)