Skip to content

Commit

Permalink
fly documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
elliotBraem committed Dec 18, 2024
1 parent 5ae9dd1 commit 58f8f16
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 5 deletions.
53 changes: 49 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
- [Environment Setup](#environment-setup)
- [Running the app](#running-the-app)
- [Building for production](#building-for-production)
- [Deploying to Fly.io](#deploying-to-flyio)
- [Running tests](#running-tests)
- [Configuration](#configuration)
- [Twitter Setup](#twitter-setup)
Expand All @@ -46,12 +47,12 @@

This project uses a monorepo structure managed with [Turborepo](https://turbo.build/repo) for efficient build orchestration:

```
```bash
public-goods-news/
├── frontend/ # React frontend application
├── backend/ # Bun-powered backend service
├── package.json # Root package.json for shared dependencies
└── turbo.json # Turborepo configuration
├── backend/ # Bun-powered backend service
├── package.json # Root package.json for shared dependencies
└── turbo.json # Turborepo configuration
```

### Key Components
Expand Down Expand Up @@ -111,6 +112,7 @@ bun run dev
```

This will launch:

- Frontend at http://localhost:5173
- Backend at http://localhost:3000

Expand All @@ -122,6 +124,49 @@ Build all packages:
bun run build
```

### Deploying to Fly.io

The backend service can be deployed to Fly.io with SQLite support. First, install the Fly CLI:

```bash
# macOS
brew install flyctl

# Windows
powershell -Command "iwr https://fly.io/install.ps1 -useb | iex"

# Linux
curl -L https://fly.io/install.sh | sh
```

Then sign up and authenticate:

```bash
fly auth signup
# or
fly auth login
```

Deploy the application using the provided npm scripts:

```bash
# Initialize Fly.io app
bun run deploy:init

# Create persistent volumes for SQLite and cache
bun run deploy:volumes

# Deploy the application
bun run deploy
```

The deployment configuration includes:

- Persistent storage for SQLite database
- Cache directory support
- Auto-scaling configuration
- HTTPS enabled by default

### Running tests

```bash
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
"scripts": {
"dev": "bunx turbo run dev",
"build": "bunx turbo run build",
"lint": "bunx turbo run lint"
"lint": "bunx turbo run lint",
"deploy:init": "fly launch",
"deploy:volumes": "fly volumes create sqlite --size 1 --region lax && fly volumes create cache --size 1 --region lax",
"deploy": "fly deploy"
},
"workspaces": [
"frontend",
Expand Down

0 comments on commit 58f8f16

Please sign in to comment.