feat: Caddy reverse proxy

chore: clean up README
This commit is contained in:
Paul Makles
2023-02-05 12:35:49 +00:00
parent 0e751b3d7e
commit 4dcde911e9
4 changed files with 134 additions and 83 deletions

View File

@@ -9,23 +9,20 @@ MONGODB=mongodb://database
REDIS_URI=redis://redis/
# URL to where the Revolt app is publicly accessible
REVOLT_APP_URL=http://local.revolt.chat:5000
REVOLT_APP_URL=http://local.revolt.chat
# URL to where the API is publicly accessible
REVOLT_PUBLIC_URL=http://local.revolt.chat:8000
VITE_API_URL=http://local.revolt.chat:8000
REVOLT_PUBLIC_URL=http://local.revolt.chat/api
VITE_API_URL=http://local.revolt.chat/api
# URL to where the WebSocket server is publicly accessible
REVOLT_EXTERNAL_WS_URL=ws://local.revolt.chat:9000
REVOLT_EXTERNAL_WS_URL=ws://local.revolt.chat/ws
# URL to where Autumn is publicly available
AUTUMN_PUBLIC_URL=http://local.revolt.chat:3000
AUTUMN_PUBLIC_URL=http://local.revolt.chat/autumn
# URL to where January is publicly available
JANUARY_PUBLIC_URL=http://local.revolt.chat:7000
# URL to where Vortex is publicly available
# VOSO_PUBLIC_URL=https://voso.revolt.chat
JANUARY_PUBLIC_URL=http://local.revolt.chat/january
##
@@ -100,10 +97,3 @@ AWS_ACCESS_KEY_ID=minioautumn
# AWS Secret Key
AWS_SECRET_ACCESS_KEY=minioautumn
##
## Vortex configuration
##
# VOSO_MANAGE_TOKEN=CHANGEME

28
Caddyfile Normal file
View File

@@ -0,0 +1,28 @@
{$REVOLT_APP_URL} {
route /api* {
uri strip_prefix /api
reverse_proxy http://api:8000
}
route /ws {
@upgrade {
header Connection *Upgrade*
header Upgrade websocket
}
uri strip_prefix /ws
reverse_proxy @upgrade http://events:9000
}
route /autumn* {
uri strip_prefix /autumn
reverse_proxy http://autumn:3000
}
route /january* {
uri strip_prefix /january
reverse_proxy http://january:7000
}
reverse_proxy http://web:5000
}

View File

@@ -1,16 +1,10 @@
# Before you get started
This is still a work-in-progress and some things may not work but for the most part everything has been tested without issue!
**Note**: the Revolt team is primarily focused on other components of the app, don't expect any immediate support, some issues may also be seen as out of scope for what this repo is trying to achieve so they may be marked as WONTFIX.
Please [read the FAQ before running your own server](https://developers.revolt.chat/faq/usage#guidelines-for-third-party-instances) and you may want to read about [additional notes relating to third-party instances](https://developers.revolt.chat/faq/instances).
## Errata Notice
amd64 builds are currently unavailable.
Related issue: https://github.com/revoltchat/delta/issues/116
amd64 builds are currently unavailable ([#116](https://github.com/revoltchat/delta/issues/116)).
## Quick Start
@@ -26,9 +20,15 @@ cp .env.example .env
docker-compose up -d
```
Then simply go to http://local.revolt.chat:5000
Then simply go to http://local.revolt.chat
## Setup
# Setup
Prerequisites before continuing:
- [Docker](https://www.docker.com/)
- [Docker Compose](https://docs.docker.com/compose/)
- [Git](https://git-scm.com/)
Clone this repository.
@@ -39,7 +39,7 @@ cd revolt
Copy the `.env` file and edit according to your needs.
> **Warning**: The default configuration is intended for testing and only works on your local machine. If you want to deploy to a remote server, you need to edit the URLs in the `.env` file. \
> **Warning**: The default configuration is intended for testing and only works on your local machine. If you want to deploy to a remote server, you need to edit the URLs in the `.env` file, please see the section below on [configuring a custom domain](#custom-domain). \
> If you get a network error when trying to log in, **double check your configuration before opening an issue.**
```bash
@@ -56,24 +56,45 @@ docker-compose up -d
To update Revolt, first pull the latest copy of this repository to ensure you have the latest tags:
```
```bash
git pull
```
Then pull all the latest images:
```
```bash
docker-compose pull
```
Now you can restart your services:
```
```bash
docker-compose up -d
```
## Additional Notes
### Custom domain
To configure a custom domain, you should be able to do a search and replace on `local.revolt.chat` in the `.env` file, like so:
```diff
# .env
- REVOLT_APP_URL=http://local.revolt.chat
+ REVOLT_APP_URL=http://my.domain
```
You will also want to change the protocols to enable HTTPS:
```diff
# .env
- REVOLT_APP_URL=http://my.domain
+ REVOLT_APP_URL=https://my.domain
- REVOLT_EXTERNAL_WS_URL=ws://my.domain/ws
+ REVOLT_EXTERNAL_WS_URL=wss://my.domain/ws
```
### Expose database
You can insecurely expose the database by adding a port definition:
@@ -101,9 +122,13 @@ services:
Enable invite-only mode by setting `REVOLT_INVITE_ONLY` in `.env` to `1`
Create an invite (Replace "YOUR INVITE HERE" with what you want the invite code to be)
Create an invite:
```bash
# drop into mongo shell
docker-compose exec database mongosh
# create the invite
use revolt
db.invites.insertOne({ _id: "YOUR INVITE HERE" })
db.invites.insertOne({ _id: "enter_an_invite_code_here" })
```

View File

@@ -1,4 +1,4 @@
version: '3.8'
version: "3.8"
services:
# MongoDB database
@@ -13,36 +13,6 @@ services:
image: eqalpha/keydb
restart: always
# API server (delta)
api:
image: ghcr.io/revoltchat/server:20220715-1
env_file: .env
depends_on:
- database
- redis
ports:
- "8000:8000"
restart: always
# Events service (quark)
events:
image: ghcr.io/revoltchat/bonfire:20220715-1
env_file: .env
depends_on:
- database
- redis
ports:
- "9000:9000"
restart: always
# Web App (revite)
web:
image: ghcr.io/revoltchat/client:master
env_file: .env
ports:
- "5000:5000"
restart: always
# S3-compatible storage server
minio:
image: minio/minio
@@ -50,8 +20,66 @@ services:
env_file: .env
volumes:
- ./data/minio:/data
restart: always
# Caddy web server
caddy:
image: caddy
restart: always
env_file: .env
ports:
- "10000:9000"
- "80:80"
- "443:443"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile
- ./data/caddy-data:/data
- ./data/caddy-config:/config
# API server (delta)
api:
image: ghcr.io/revoltchat/server:20220715-1
env_file: .env
depends_on:
- database
- redis
- caddy
restart: always
# Events service (quark)
events:
image: ghcr.io/revoltchat/bonfire:20220715-1
env_file: .env
depends_on:
- database
- redis
- caddy
restart: always
# Web App (revite)
web:
image: ghcr.io/revoltchat/client:master
env_file: .env
depends_on:
- caddy
restart: always
# File server (autumn)
autumn:
image: ghcr.io/revoltchat/autumn:1.1.5
env_file: .env
depends_on:
- database
- createbuckets
- caddy
environment:
- AUTUMN_MONGO_URI=mongodb://database
restart: always
# Metadata and image proxy (january)
january:
image: ghcr.io/revoltchat/january:master
depends_on:
- caddy
restart: always
# Create buckets for minio.
@@ -72,23 +100,3 @@ services:
/usr/bin/mc mb minio/emojis;
exit 0;
"
# File server (autumn)
autumn:
image: ghcr.io/revoltchat/autumn:1.1.5
env_file: .env
depends_on:
- database
- createbuckets
environment:
- AUTUMN_MONGO_URI=mongodb://database
ports:
- "3000:3000"
restart: always
# Metadata and image proxy (january)
january:
image: ghcr.io/revoltchat/january:master
ports:
- "7000:7000"
restart: always