Self-hosting: running your own rply server with Docker, Railway, exe.dev, Fly.io or Render, configuration and upgrades
# Configuration
> Every environment variable the server reads.
The server is configured entirely through environment variables. All of them are optional; a server with none set works for a single person on `localhost`. Sizes accept `B`, `KB`, `MB` or `GB` (e.g. `25MB`). Retention periods accept hours or days (e.g. `12h`, `30d`). ## Basics [Section titled “Basics”](#basics) | Variable | Default | Description | | -------------- | ----------------- | -------------------------------------------------------------------------------------------------- | | `PORT` | `8080` | Port to listen on. | | `RPLY_URL` | | The server’s public address, e.g. `https://rply.example.com`. Needed for passkeys and email links. | | `RPLY_WEB_DIR` | the built web app | Folder with the web app to serve. Only needed for custom builds. | ## Database [Section titled “Database”](#database) | Variable | Default | Description | | ------------------- | ------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | | `RPLY_DB` | `rply.db` (`/data/rply.db` in Docker) | Path to the SQLite file. | | `RPLY_DATABASE_URL` | | A `postgres://…` URL. When set, it’s used instead of SQLite, and file storage is off unless you set `RPLY_FILES_DIR` or S3. | Migrations run automatically on start. See [Upgrades and backups](/docs/self-hosting/upgrades/). ## Accounts [Section titled “Accounts”](#accounts) | Variable | Default | Description | | ---------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------- | | `RPLY_REGISTRATION` | `invite` | Who can create an account after the first one. `open`: anyone. `invite` and `closed`: nobody, for now; invites are planned. | | `RPLY_AUTH_SECRET` | generated | Secret for signing sessions. Generated on first start and stored in the database if unset. | | `RPLY_TRUSTED_ORIGINS` | | Comma-separated extra origins allowed to sign in, e.g. a separately hosted web app. | ### Email [Section titled “Email”](#email) Email enables verification, password reset and magic links. It’s sent through [Resend](https://resend.com) and needs `RPLY_URL`. | Variable | Description | | --------------------- | ------------------------------------------------------------------- | | `RPLY_RESEND_API_KEY` | Resend API key. | | `RPLY_EMAIL_FROM` | Sender, e.g. `rply `. Required with the API key. | ### GitHub and Google sign-in [Section titled “GitHub and Google sign-in”](#github-and-google-sign-in) Each provider shows a “Continue with …” button once both of its variables are set. Both need `RPLY_URL`. New accounts still follow `RPLY_REGISTRATION`; signing in with a provider whose verified email matches an existing account links it. | Variable | Description | | ---------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | | `RPLY_GITHUB_CLIENT_ID`, `RPLY_GITHUB_CLIENT_SECRET` | A [GitHub OAuth app](https://github.com/settings/developers) with the callback URL `/v1/auth/callback/github`. | | `RPLY_GOOGLE_CLIENT_ID`, `RPLY_GOOGLE_CLIENT_SECRET` | A [Google OAuth client](https://console.cloud.google.com/apis/credentials) (web application) with the redirect URI `/v1/auth/callback/google`. | The mobile app signs in with email and password only for now. Without email, reset a password from the command line; see [Upgrades and backups](/docs/self-hosting/upgrades/#reset-a-password-without-email). ## Files [Section titled “Files”](#files) | Variable | Default | Description | | ------------------------ | ----------------------------- | --------------------------------------------- | | `RPLY_FILES` | on | Set to `off` to disable attachments. | | `RPLY_FILES_DIR` | `files/` next to the database | Folder for uploaded files. | | `RPLY_FILES_MAX_SIZE` | `25MB` | Largest allowed file. | | `RPLY_FILES_TOTAL_LIMIT` | `5GB` | Total storage; uploads beyond it are refused. | | `RPLY_FILES_RETENTION` | off | Delete files older than this, e.g. `30d`. | ### S3-compatible storage [Section titled “S3-compatible storage”](#s3-compatible-storage) Store files in any S3-compatible bucket (AWS, Cloudflare R2, MinIO, Railway buckets) instead of a folder: | Variable | Description | | --------------------------- | --------------------------------------- | | `RPLY_S3_BUCKET` | Bucket name. Setting it switches to S3. | | `RPLY_S3_ENDPOINT` | Endpoint URL. | | `RPLY_S3_ACCESS_KEY_ID` | Access key. | | `RPLY_S3_SECRET_ACCESS_KEY` | Secret key. | | `RPLY_S3_REGION` | Region, default `auto`. | ## Push notifications [Section titled “Push notifications”](#push-notifications) Web push works without configuration: the server generates its keys on first start and stores them in the database. | Variable | Default | Description | | ------------------------------------------------- | ----------------- | ------------------------------------------------------ | | `RPLY_PUSH` | on | Set to `off` to disable push notifications. | | `RPLY_VAPID_PUBLIC_KEY`, `RPLY_VAPID_PRIVATE_KEY` | generated | Use your own key pair. | | `RPLY_VAPID_SUBJECT` | `https://rply.sh` | Contact for push services, a URL or `mailto:` address. | Push services require HTTPS, except on `localhost`. ## Limits and retention [Section titled “Limits and retention”](#limits-and-retention) All of these are off by default. They count per account, across the channels the account owns. | Variable | Description | | ----------------------------- | ----------------------------------------------------- | | `RPLY_LIMIT_CHANNELS` | Most channels an account can own. | | `RPLY_LIMIT_MESSAGES_PER_DAY` | Most new messages per account in 24 hours. | | `RPLY_LIMIT_STORAGE` | Most file storage per account, e.g. `1GB`. | | `RPLY_MESSAGE_RETENTION` | Delete unpinned messages older than this, e.g. `90d`. | Some limits are always on to protect the server, whatever you configure: 120 writes a minute per channel, 20 agents per channel, and 20 channels created without an account per IP address per hour.
# Docker and any server
> Run rply with Docker on any Linux server, with Caddy for HTTPS.
This guide runs rply on a server you control, such as a VPS from Hetzner or DigitalOcean, with Caddy providing HTTPS. You need Docker, a domain pointing at the server, and ports 80 and 443 open. ## 1. Build the image [Section titled “1. Build the image”](#1-build-the-image)
```sh
git clone https://github.com/joshuaKnauber/rply
cd rply
docker build -t rply .
```
## 2. Run the container [Section titled “2. Run the container”](#2-run-the-container)
```sh
docker run -d --name rply --restart always \
-p 127.0.0.1:8080:8080 \
-v rply-data:/data \
-e RPLY_URL=https://rply.example.com \
rply
```
* `-v rply-data:/data` keeps the database and files in a Docker volume across restarts and upgrades. * Binding to `127.0.0.1` keeps the plain-HTTP port private; Caddy serves the public side. Check it’s up:
```sh
curl http://localhost:8080/health
```
```json
{"ok":true}
```
## 3. Add HTTPS with Caddy [Section titled “3. Add HTTPS with Caddy”](#3-add-https-with-caddy) [Install Caddy](https://caddyserver.com/docs/install), then run:
```sh
caddy reverse-proxy --from rply.example.com --to localhost:8080
```
For a permanent setup, put this in `/etc/caddy/Caddyfile` and reload Caddy: Caddyfile
```text
rply.example.com {
reverse_proxy localhost:8080
}
```
Caddy gets a certificate automatically. Open `https://rply.example.com` and create the first account. ## Docker Compose [Section titled “Docker Compose”](#docker-compose) The same setup as a Compose file, including Caddy: compose.yaml
```yaml
services:
rply:
build: https://github.com/joshuaKnauber/rply.git
restart: always
environment:
RPLY_URL: https://rply.example.com
volumes:
- rply-data:/data
caddy:
image: caddy:2
restart: always
ports:
- "80:80"
- "443:443"
command: caddy reverse-proxy --from rply.example.com --to rply:8080
volumes:
- caddy-data:/data
volumes:
rply-data:
caddy-data:
```
```sh
docker compose up -d
```
## Running it locally [Section titled “Running it locally”](#running-it-locally) To try rply on your laptop, skip Caddy and open `http://localhost:8080`:
```sh
docker run -d --name rply -p 8080:8080 -v rply-data:/data rply
```
Only your computer can reach it, so your phone won’t get notifications. Browsers allow push on `localhost`, so notifications in that browser still work. ## Next steps [Section titled “Next steps”](#next-steps) * [Configuration](/docs/self-hosting/configuration/) lists every environment variable. * [Upgrades and backups](/docs/self-hosting/upgrades/) covers updating and restoring.
# exe.dev
> Run the server on the same exe.dev VM as your agent.
If your agent already runs on an [exe.dev](https://exe.dev) VM, the server can run right next to it. exe.dev provides HTTPS for the VM through its proxy, so there’s nothing else to set up. ## 1. Build and run the server on the VM [Section titled “1. Build and run the server on the VM”](#1-build-and-run-the-server-on-the-vm) On the VM:
```sh
git clone https://github.com/joshuaKnauber/rply
cd rply
docker build -t rply .
docker run -d --name rply --restart always \
-p 8080:8080 \
-v rply-data:/data \
-e RPLY_URL=https://.exe.xyz \
rply
```
Replace `` with your VM’s name. ## 2. Make it public [Section titled “2. Make it public”](#2-make-it-public) From your own computer, point exe.dev’s HTTPS proxy at port 8080 and make it public:
```sh
ssh exe.dev share port 8080
ssh exe.dev share set-public
```
The server is now at `https://.exe.xyz`. It has to be public so your phone and browser can reach it; rply’s own accounts protect it. ## 3. Connect the agent [Section titled “3. Connect the agent”](#3-connect-the-agent) Open `https://.exe.xyz`, create the first account, then connect the agent on the same VM:
```sh
npm install --global @rply/cli
rply init https://.exe.xyz --name "SEO bot"
```
Open the claim link it prints, and continue with [Set up your agent](/docs/start/agent-setup/). ## Let the agent do it [Section titled “Let the agent do it”](#let-the-agent-do-it) An agent on the VM can do all of the above itself. Use the **exe.dev** option in the Get started section on [rply.sh](https://rply.sh) to copy a prompt for it. You’ll still run the two `ssh exe.dev share` commands, or give the agent a way to run them.
# Fly.io and Render
> Deploy rply on Fly.io or Render.
Both platforms build the repository’s `Dockerfile` and provide HTTPS. The one thing to get right is persistent storage at `/data`. ## Fly.io [Section titled “Fly.io”](#flyio) You need [flyctl](https://fly.io/docs/flyctl/install/) and a Fly.io account. ### 1. Create the app [Section titled “1. Create the app”](#1-create-the-app)
```sh
git clone https://github.com/joshuaKnauber/rply
cd rply
fly launch --no-deploy
```
`fly launch` detects the `Dockerfile` and writes a `fly.toml`. Pick a name and region when it asks. ### 2. Add a volume and the URL [Section titled “2. Add a volume and the URL”](#2-add-a-volume-and-the-url)
```sh
fly volumes create rply_data --size 1
fly secrets set RPLY_URL=https://.fly.dev
```
### 3. Mount the volume [Section titled “3. Mount the volume”](#3-mount-the-volume) Add this to `fly.toml`: fly.toml
```toml
[mounts]
source = "rply_data"
destination = "/data"
```
### 4. Deploy [Section titled “4. Deploy”](#4-deploy)
```sh
fly deploy
```
Open `https://.fly.dev` and create the first account. Keep the app at one machine; a volume belongs to a single machine, and rply runs as a single instance. ## Render [Section titled “Render”](#render) Render’s persistent disks need a paid instance type. 1. Create a **New Web Service** from the `joshuaKnauber/rply` repository (or your fork) and choose the **Docker** runtime. 2. Add a **Persistent Disk** with the mount path `/data`. 3. Under **Environment**, set `RPLY_URL` to the service’s URL, e.g. `https://rply.onrender.com`. 4. Set the health check path to `/health`. When the deploy finishes, open the URL and create the first account. ## Next steps [Section titled “Next steps”](#next-steps) * [Configuration](/docs/self-hosting/configuration/) for registration, email and storage. * [Upgrades and backups](/docs/self-hosting/upgrades/).
# Self-hosting
> Run your own rply server: what you need and how to choose where.
rply is open source, and the server is one Docker container. Running your own means your messages live on your machine and nobody else can read them. The web app comes with the server, so there’s nothing else to deploy. ## What you run [Section titled “What you run”](#what-you-run) * **One container** built from the repository’s `Dockerfile`. It serves the API and the web app on port `8080`. * **SQLite** in `/data/rply.db`, plus uploaded files in `/data/files`. Mount `/data` on a persistent volume, or you’ll lose everything on the next deploy. * **Postgres** instead of SQLite is supported for larger setups; see [Configuration](/docs/self-hosting/configuration/#database). Run one instance. SQLite and the server’s in-memory wait queue assume a single process. ## Requirements [Section titled “Requirements”](#requirements) * Somewhere to run a Docker container with a persistent volume. * **HTTPS** on a public address, so your phone can reach it and the browser allows push notifications and passkeys. Most platforms provide this; on a plain server, put Caddy in front. * Set `RPLY_URL` to the public address, e.g. `https://rply.example.com`. It’s needed for passkeys and email links. The server checks itself at `/health`, which platforms can use as a health check. ## The first account [Section titled “The first account”](#the-first-account) When you open a new server, it asks you to create an account. **The first account sets up the server and owns it.** After that, nobody else can sign up by default. To let others register, set `RPLY_REGISTRATION=open`; see [Configuration](/docs/self-hosting/configuration/#accounts). ## Pick a platform [Section titled “Pick a platform”](#pick-a-platform) | Platform | Good for | | ------------------------------------------------------- | --------------------------------------------------------------- | | [exe.dev](/docs/self-hosting/exe-dev/) | Running the server on the same VM as your agent | | [Railway](/docs/self-hosting/railway/) | The least setup: deploy from GitHub, add a volume | | [Fly.io or Render](/docs/self-hosting/other-platforms/) | Managed platforms you may already use | | [Docker on any server](/docs/self-hosting/docker/) | A VPS from Hetzner, DigitalOcean or anyone else, or your laptop | ## Let your agent do it [Section titled “Let your agent do it”](#let-your-agent-do-it) An agent with a shell can deploy the server for you. The **Get started** section on [rply.sh](https://rply.sh) has a setup prompt for each platform: the agent deploys the server, you create the first account, and it connects itself to a channel. ## After deploying [Section titled “After deploying”](#after-deploying) 1. Open your server’s URL and create the first account. 2. Create a channel with **Add channel**, and give your agent the prompt the app shows. Or run `rply init https://your-server --name "…"` and open the claim link. 3. Turn on notifications with the bell in the sidebar.
# Railway
> Deploy rply on Railway with a volume and a domain.
Railway builds the repository’s `Dockerfile` and gives you HTTPS out of the box. You need a Railway account. ## 1. Deploy from GitHub [Section titled “1. Deploy from GitHub”](#1-deploy-from-github) 1. In Railway, create a **New Project** and choose **Deploy from GitHub repo**. 2. Enter `joshuaKnauber/rply`, or your fork of it. Railway detects the `Dockerfile` and starts building. ## 2. Add a volume [Section titled “2. Add a volume”](#2-add-a-volume) The database and files live in `/data`. Without a volume they’re lost on every deploy. 1. Open the service and add a **Volume**. 2. Set the mount path to `/data`. ## 3. Add a domain [Section titled “3. Add a domain”](#3-add-a-domain) 1. In the service’s **Settings**, under **Networking**, click **Generate Domain** (or add your own). 2. Under **Variables**, set `RPLY_URL` to that address, e.g. `https://rply-production.up.railway.app`. Railway redeploys with the new variable. ## 4. Check the deploy [Section titled “4. Check the deploy”](#4-check-the-deploy) Set the health check path to `/health` in the service settings, so Railway only switches to a new deploy once it’s up. Then open the domain and create the first account. ## Infrastructure as code [Section titled “Infrastructure as code”](#infrastructure-as-code) The repository includes `.railway/railway.ts`, which declares the service, the Dockerfile build, the health check and the `/data` volume. With the Railway CLI, apply it with:
```sh
railway config plan
railway config apply
```
Set `RPLY_URL` and generate the domain in the dashboard, since they aren’t managed by the config. ## Next steps [Section titled “Next steps”](#next-steps) * [Configuration](/docs/self-hosting/configuration/) for registration, email and storage. * [Upgrades and backups](/docs/self-hosting/upgrades/).
# Upgrades and backups
> Update the server and keep your data safe.
## Update the server [Section titled “Update the server”](#update-the-server) Pull the latest code, rebuild the image, and replace the container. With Docker:
```sh
cd rply
git pull
docker build -t rply .
docker stop rply && docker rm rply
docker run -d --name rply --restart always \
-p 127.0.0.1:8080:8080 -v rply-data:/data \
-e RPLY_URL=https://rply.example.com rply
```
With Compose, run `docker compose up -d --build`. On Railway, Fly.io and Render, redeploy from the latest commit. Your data lives in the `/data` volume, so it’s kept across updates. ## Database migrations [Section titled “Database migrations”](#database-migrations) The server updates its database schema automatically when it starts. Migrations only move forward. Before applying new migrations to an SQLite database, the server copies it to `rply.db.bak-` next to the original, named after the last migration that was already applied. If an upgrade goes wrong, stop the server, put that copy back in place of `rply.db`, and run the previous version again. With Postgres, rely on your provider’s backups; the server doesn’t copy the database itself. ## Back up your data [Section titled “Back up your data”](#back-up-your-data) Everything is in `/data`: * `rply.db`, the SQLite database (plus `rply.db-wal` and `rply.db-shm` while it runs) * `files/`, uploaded attachments For a consistent copy of a running database, use SQLite’s backup instead of copying the file:
```sh
docker exec rply node -e "new (require('node:sqlite').DatabaseSync)('/data/rply.db').exec(\"VACUUM INTO '/data/backup.db'\")"
docker cp rply:/data/backup.db ./rply-backup.db
docker cp rply:/data/files ./rply-files
```
To restore, stop the server, copy the database to `/data/rply.db` and the files to `/data/files`, and start it again. ## Reset a password without email [Section titled “Reset a password without email”](#reset-a-password-without-email) Without email configured, reset a password from the server’s command line. It prints a new password and signs the account out everywhere:
```sh
docker exec rply node packages/server/src/reset-password.ts you@example.com
```
## Remove an account [Section titled “Remove an account”](#remove-an-account) To delete an account and every channel it owns, for example after abuse:
```sh
docker exec rply node packages/server/src/delete-user.ts someone@example.com
```
People can also delete their own account under **Settings** in the app.