Skip to content

Commit 6e5341e

Browse files
authored
Update docs for railway deploy (#36)
* docs to railway * add other options * nitpick
1 parent d2c646f commit 6e5341e

File tree

2 files changed

+50
-93
lines changed

2 files changed

+50
-93
lines changed

bun.lockb

-6.23 KB
Binary file not shown.

docs/docs/developers/deployment.md

Lines changed: 50 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -6,131 +6,88 @@ sidebar_position: 2
66

77
Deploy your curate.fun instance to production ⚡
88

9-
## 🌥️ Deploying to Fly.io
9+
## 🚂 Deploying to Railway (Recommended)
1010

11-
The backend service can be deployed to Fly.io with SQLite support.
11+
The backend service can be deployed to Railway using their built-in Postgres service. This service also serves the frontend dashboard.
1212

1313
### 📋 Prerequisites
1414

15-
Install the Fly CLI:
15+
- A [Railway](https://railway.app/) account
16+
- A GitHub account (optional, for CI/CD setup)
1617

17-
```bash
18-
# 🍎 macOS
19-
brew install flyctl
18+
### 🚀 Quick Deployment
2019

21-
# 🪟 Windows
22-
powershell -Command "iwr https://fly.io/install.ps1 -useb | iex"
20+
The fastest way to deploy is using the Railway template:
2321

24-
# 🐧 Linux
25-
curl -L https://fly.io/install.sh | sh
26-
```
22+
[![Deploy on Railway](https://railway.com/button.svg)](https://railway.com/template/RiUi5U?referralCode=3O4l1-)
2723

28-
### 🔑 Authentication
24+
You can also access the template directly at: <https://railway.com/template/RiUi5U?referralCode=3O4l1->
2925

30-
Sign up and authenticate with Fly.io:
26+
### ⚙️ Configuration
3127

32-
```bash
33-
fly auth signup
34-
# or
35-
fly auth login
36-
```
28+
After deploying the template, you'll need to configure the following environment variables in the Railway dashboard:
3729

38-
### 🛫 Deployment Steps
30+
#### Required Environment Variables
3931

40-
1. 🎬 Initialize your Fly.io application:
32+
- `TWITTER_USERNAME`: Your Twitter username.
33+
- `TWITTER_PASSWORD`: Your Twitter password.
34+
- `TWITTER_EMAIL`: Your Twitter email.
35+
- `TWITTER_2FA`: Your Twitter 2FA code.
4136

42-
```bash
43-
bun run deploy:init
44-
```
37+
#### Optional Environment Variables
4538

46-
This will:
39+
- `TELEGRAM_BOT_TOKEN`: Your Telegram bot token (required for the [Telegram plugin](../plugins/distributors/telegram.md)).
40+
- `OPENROUTER_API_KEY`: Your OpenRouter API key (required for the [AI Transform plugin](../plugins/transformers/ai-transform.md)).
4741

48-
- 📦 Create the Fly App
49-
- 💾 Set up LiteFS volume ([LiteFS Speedrun](https://fly.io/docs/litefs/speedrun/))
50-
- 🔄 Attach Consul for LiteFS cluster management
42+
### 🔧 Customization
5143

52-
2. ⚙️ Configure environment variables:
44+
You'll need to customize your `curate.config.json` file to match your specific curation needs. See the [configuration documentation](./configuration.md) for details on how to set up your configuration.
5345

54-
```bash
55-
# 🐦 Twitter Authentication
56-
fly secrets set TWITTER_USERNAME=your_twitter_username
57-
fly secrets set TWITTER_PASSWORD=your_twitter_password
58-
fly secrets set TWITTER_EMAIL=your_twitter_email
59-
60-
# 📢 Distribution Services
61-
fly secrets set TELEGRAM_BOT_TOKEN=your_bot_token
62-
fly secrets set TELEGRAM_CHANNEL_ID=your_channel_id
63-
```
64-
65-
3. 🚀 Deploy the application:
66-
67-
```bash
68-
bun run deploy
69-
```
70-
71-
### 🏗️ Architecture
72-
73-
- ✨ Distributed SQLite using LiteFS
74-
- 🔄 Automatic file replication across instances
75-
- 🎯 Primary/replica configuration using Consul
76-
- 🔒 HTTPS enabled by default
77-
78-
#### 🔍 Details
79-
80-
- 📍 Primary instance (LAX region) handles write operations
81-
- 🔄 Replicas automatically sync data from primary
82-
- 🎛️ Consul manages primary/replica coordination
83-
- ⚡ Automatic failover if primary becomes unavailable
46+
### 🔧 Troubleshooting
8447

85-
#### 📁 Key Files
48+
Common issues and solutions:
8649

87-
- `fly.toml`: Main Fly.io configuration
88-
- `litefs.yml`: LiteFS configuration
89-
- `Dockerfile`: Container and LiteFS setup
50+
1. **Database Connection Issues**
51+
- Verify that the Postgres service is properly linked to your application
52+
- Check the connection string in the environment variables (`DATABASE_URL` should be a shared environment variable `${{ Postgres.DATABASE_URL }}`)
9053

91-
### 📊 Monitoring
54+
2. **Twitter Authentication Problems**
55+
- Ensure all Twitter credentials are correctly set in the environment variables
56+
- If locked out, use Twitter cookies instead
9257

93-
Monitor your deployment:
58+
3. **Deployment Failures**
59+
- Check the deployment logs in the Railway dashboard
60+
- Verify that your repository has the correct structure and dependencies
9461

95-
```bash
96-
# 👀 View deployment status
97-
fly status
62+
📚 For more help:
9863

99-
# 📝 View logs
100-
fly logs
64+
- [Railway Documentation](https://docs.railway.app/)
65+
- [Railway Discord Community](https://discord.com/invite/railway)
10166

102-
# 🖥️ Access dashboard
103-
fly dashboard
104-
```
67+
## 🐳 Alternative Deployment Options
10568

106-
### 🔧 Troubleshooting
69+
### Using Docker with External Postgres
10770

108-
Common issues and solutions:
71+
You can deploy the application using the [Dockerfile](https://github.com/PotLock/curatedotfun/blob/main/Dockerfile) and connect it to your own Postgres database:
10972

110-
1. **🗄️ Container issues**
73+
1. **Build the Docker image**:
11174

11275
```bash
113-
# Explore container
114-
fly ssh console
115-
116-
# Verify Consul
117-
fly consul status
118-
119-
# Check status
120-
fly logs
76+
docker build -t curatedotfun .
12177
```
12278

123-
3. **💻 Scale up or downtown**
79+
2. **Run the container with environment variables**:
12480

12581
```bash
126-
# Increase count (# is number of machines)
127-
fly scale count #
128-
129-
# Check distribution
130-
fly scale show
82+
docker run -d \
83+
-p 3000:3000 \
84+
-e DATABASE_URL=postgres://username:password@host:port/database \
85+
-e TWITTER_USERNAME=your_twitter_username \
86+
-e TWITTER_PASSWORD=your_twitter_password \
87+
-e TWITTER_EMAIL=your_twitter_email \
88+
-e TWITTER_2FA=your_twitter_2fa \
89+
--name curatedotfun \
90+
curatedotfun
13191
```
13292

133-
📚 For more help:
134-
135-
- [Fly.io Documentation](https://fly.io/docs/)
136-
- [Community Discord](https://fly.io/discord)
93+
This approach works with any hosting provider that supports Docker containers, such as [DigitalOcean App Platform](https://www.digitalocean.com/products/app-platform), [AWS App Runner](https://aws.amazon.com/apprunner/), [Google Cloud Run](https://cloud.google.com/run), or [Azure Container Instances](https://azure.microsoft.com/en-us/products/container-instances).

0 commit comments

Comments
 (0)