revoltchat / self-hosted

Deploy Revolt using Docker.
854 stars 108 forks source link

feat: add docker-compose for Traefik and Caddy #18

Closed Tchoupinax closed 1 year ago

Tchoupinax commented 2 years ago

Hello!

I saw the todo list contains the action add Caddy so I made it and I add Traefik at the same time 😀

Be free to suggest any improvement or feedback

Thank you for your work! Have a nice day

iSwiftLiu commented 2 years ago

How to configure each domain name in .env after using caddy or traefik. For example, local.revolt.chat:5000 local.revolt.chat:8000.

Tchoupinax commented 2 years ago

Hello @iSwiftLiu,

For the moment, both configuration are configured with revolt.chat as the domain. After this pull request, the next one will be with a customized configuration that ask you the domain you want to use and deploy the configuration according it.

LivingWithHippos commented 2 years ago

A couple of notes: if you're using caddy you probably using https so the setup will be like

  1. docker-compose
 api:
    image: revoltchat/server:master
    container_name: revolt_api
    # you don't need to expose ports if all is connected with caddy
    #ports:
    #  - "8000:8000"
    #  - "9000:9000"
 ...
  1. Caddyfile
revolt.chat {
  route /api/* {
    uri strip_prefix api
    reverse_proxy revolt_api:8000
....

# also websocket needs CORS
ws.revolt.chat {

    header {
        Access-Control-Allow-Origin https://revolt.chat
        Access-Control-Allow-Headers https://revolt.chat
    }

    @websocket {
        header Connection *Upgrade*
        header upgrade websocket
    }
...
  1. .env file

all the links will be like

REVOLT_APP_URL=https://revolt.chat

REVOLT_PUBLIC_URL=https://revolt.chat/api
...
insertish commented 1 year ago

Closing as I'm cleaning up issues currently. This did have a few issues at the time I think, if you want it reconsidered please reply and we can figure out how to structure this.