Skip to content

Commit c2e8d16

Browse files
add minimal Fly.io deployment tooling
1 parent bd917ab commit c2e8d16

File tree

11 files changed

+928
-10
lines changed

11 files changed

+928
-10
lines changed

.env.production.example

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Deployment secrets
2+
# Copy to .env.production and fill in values
3+
4+
# Path to SQLite database file
5+
DB_PATH=/data/db.sqlite3
6+
7+
# Your site URL (auto-filled from app name, change if using custom domain)
8+
ORIGIN=https://editable-test.fly.dev
9+

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Thumbs.db
1717
.env.*
1818
!.env.example
1919
!.env.test
20+
!.env.production.example
2021

2122

2223
# Data

README.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,73 @@ npm run dev
3939

4040
This is v2, a complete rewrite using [Svedit](https://github.com/michael/svedit). It's under active development — feel free to explore locally, but hold off on production deployments for now.
4141

42+
## Deploying to Fly.io
43+
44+
### Prerequisites
45+
46+
1. Install the Fly CLI: https://fly.io/docs/flyctl/install/
47+
2. Sign up or log in: `fly auth login`
48+
49+
### First-time setup
50+
51+
Run the init command to create your deployment configuration:
52+
53+
```sh
54+
npm run deploy:init
55+
```
56+
57+
This will ask for your app name and region, then create:
58+
- `fly.toml` — Fly.io configuration
59+
- `Dockerfile` — Container build instructions
60+
- `.env.production.example` — Template for your secrets
61+
62+
Copy the example and add your values:
63+
64+
```sh
65+
cp .env.production.example .env.production
66+
```
67+
68+
Edit `.env.production` with your actual values (this file is gitignored).
69+
70+
### Deploy
71+
72+
Build and deploy your site:
73+
74+
```sh
75+
npm run build
76+
npm run deploy
77+
```
78+
79+
Your site will be live at `https://your-app-name.fly.dev`
80+
81+
### Updating secrets
82+
83+
When you add new secrets to `deploy/config.js`:
84+
85+
1. Add the value to `.env.production`
86+
2. Run `npm run deploy:secrets`
87+
88+
### Custom domain
89+
90+
```sh
91+
fly certs add yourdomain.com
92+
```
93+
94+
Then add a CNAME record pointing to your Fly.io app:
95+
96+
| Type | Name | Value |
97+
|-------|------|--------------------------|
98+
| CNAME | @ | your-app-name.fly.dev |
99+
| CNAME | www | your-app-name.fly.dev |
100+
101+
Note: Some DNS providers don't allow CNAME on the root domain (@). In that case, use an ALIAS/ANAME record, or get your app's IPs with `fly ips list` and create A/AAAA records.
102+
103+
## Deploying to other platforms
104+
105+
This repo is configured for Fly.io deployment by default (using `@sveltejs/adapter-node`).
106+
107+
**For Vercel or Cloudflare Pages:** You'll need to switch the adapter in `svelte.config.js`.
108+
42109
## Looking for v1?
43110

44111
Find it [here](https://github.com/michael/editable-website/tree/v1).

deploy/config.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/**
2+
* Deployment configuration
3+
*
4+
* This file defines the secrets schema for your application.
5+
* Values go in .env.production (which is gitignored).
6+
*
7+
* Add new secrets here as your app grows, then run:
8+
* npm run deploy:secrets
9+
*/
10+
11+
export default {
12+
secrets: {
13+
DB_PATH: {
14+
required: true,
15+
default: '/data/db.sqlite3',
16+
validate: (v) => v.endsWith('.sqlite3') || v.endsWith('.db'),
17+
hint: 'Path to SQLite database file',
18+
},
19+
ORIGIN: {
20+
required: true,
21+
validate: (v) => v.startsWith('https://') && !v.endsWith('/'),
22+
hint: 'Your site URL (auto-filled from app name, change if using custom domain)',
23+
},
24+
// Add more secrets as needed:
25+
// AUTH_SECRET: {
26+
// required: true,
27+
// validate: (v) => v.length >= 32,
28+
// hint: 'Random string for session encryption (min 32 chars)',
29+
// },
30+
},
31+
};

0 commit comments

Comments
 (0)