How to Self-Host Outline Alongside Caddy

Skip to Installation Steps

Four days. That’s how long it took for me to self-host Outline and connect it to Caddy on my server. I’ve looked through a bunch of Outline’s and Caddy’s GitHub issues and discussions, StackOverflow, and their docs. I even changed my web server from Apache2 to Caddy.

I did try out Bookstack and Docmost halfway through. Bookstack is the easiest to get up and running, but there were no real-time collaborative features or conflict resolution. While Docmost… I had some problems running it over HTTPS.

Some problems that I ran into while I was installing Outline in no particular order were:

Expand
  • GitHub Integration, not GitHub Authentication thus the GitHub sign-in option didn’t show up
  • It wouldn’t connect from Outline to Apache2
  • MinIO Fatal glibc error: CPU does not support x86-64-v2
  • Redis is not connecting to Outline
  • I managed to run MinIO yet it didn’t connect to Outline
  • Changed Outline’s docker-compose.yml to use the host network but it still didn’t work
  • Replacing the Apache2 server with the Caddy server for an easier time with Docker networks
  • HTTPS conflict when running Caddy due to the existing Apache2 SSL certificate
  • Redis SequelizeConnectionRefusedError: connect ECONNREFUSED
  • Outline showing blank page
  • Outline connection refused due to incorrect port setting
  • MinIO Cross-Origin Request Blocked
  • Outline ERR_TOO_MANY_REDIRECTS loop due to incorrect site URL
  • Caddy spammed ACME for an SSL certificate and me needing to wait a day to try again

Safe to say, I had one hell of a time installing Outline.

Tested on

Installation Steps

Step 1: Install Docker

If you haven’t already installed Docker, here’s how to install Docker in one command in Linux Mint or for other distros, here.

Step 2: Install Caddy (Docker)

If you haven’t had the Caddy container running, here’s how to install it.

Step 3: Install Outline (Docker)

Here’s a command to download the docker-compose.yml and .env files rather than copy and paste (you’ll still need to set it up though):

Curl to download docker-compose.yml and .env for Outline
curl -L s.revonzev.com/install-outline-docker-curl | bash
Bash

Here’s the docker-compose for my Outline:

docker-compose.yml
services:
  outline_redis:
    image: redis
    restart: always
    container_name: outline_redis
    networks:
      - outline-internal


  outline_postgres:
    image: postgres:15
    restart: always
    container_name: outline_postgres
    security_opt:
      - label:disable
    environment:
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
      - POSTGRES_USER=outline
      - POSTGRES_DB=outline
    networks:
      - outline-internal
    volumes:
      - ./container-data/db:/var/lib/postgresql/data
      - /etc/localtime:/etc/localtime:ro


  outline:
    image: outlinewiki/outline:latest
    user: root
    restart: always
    container_name: outline
    command: sh -c "yarn start --env=production-ssl-disabled"
    depends_on:
      - outline_postgres
      - outline_redis
    environment:
      - WEBSOCKET=true
      - FORCE_HTTPS=false
      - PGSSLMODE=disable
      - SECRET_KEY=${SECRET_KEY}
      - UTILS_SECRET=${UTILS_SECRET}
      - DATABASE_URL=postgres://outline:${POSTGRES_PASSWORD}@outline_postgres:5432/outline
      - REDIS_URL=redis://outline_redis:6379
      - URL=${WIKI_URL}
      - PORT=80
      - FILE_STORAGE=local
      - FILE_STORAGE_UPLOAD_MAX_SIZE=26214400
      - FILE_STORAGE_IMPORT_MAX_SIZE=26214400
      - FILE_STORAGE_WORKSPACE_IMPORT_MAX_SIZE=26214400
      - DISCORD_CLIENT_ID=${DISCORD_CLIENT_ID}
      - DISCORD_CLIENT_SECRET=${DISCORD_CLIENT_SECRET}
      - DISCORD_SERVER_ID=${DISCORD_SERVER_ID}
    networks:
      - outline-internal
      - reverseproxy-nw
    volumes:
      - ./container-data/data:/var/lib/outline/data


networks:
  outline-internal:
  reverseproxy-nw:
    external: true
YAML

The .env file that’s in the same directory as the docker-compose:

Plaintext
#secrets/passwords
SECRET_KEY=
UTILS_SECRET=
POSTGRES_PASSWORD=

#domains
WIKI_URL=http://outline.localhost

#oidc information
DISCORD_CLIENT_ID=
DISCORD_CLIENT_SECRET=
DISCORD_SERVER_ID=
Plaintext

You can get the SECRET_KEY and UTILS_SECRET by running this in the terminal:

Key generation
openssl rand -hex 32
Bash

Add your own password for the Postgres database and change your Outline URL to your domain if you have one ready for it.

I use Discord’s OAuth to authenticate into my outline, here’s how to do it in order:

  • Go to Discord’s developer website, here
  • Login with your Discord
  • Click on the New Application button
  • Put in the name of the application, I put in outline
  • Click on the check button to accept Discord’s Developer Terms of Service and Developer Policy
  • Click on the Create Button
  • go to the OAuth2 in the SETTINGS on the left side bar
  • Copy the CLIENT ID
  • Paste the CLIENT ID at the end of the DISCORD_CLIENT_ID= inside of the .env file
  • Click the Reset Secret button on your application’s OAuth2 settings in the Discord developer website
  • Click the Yes, do it! button
  • Enter your Discord password
  • Click the Submit button
  • Copy the CLIENT SECRET
  • Paste the CLIENT SECRET at the end of the DISCORD_CLIENT_SECRET= inside the .env file
  • On your application’s OAuth2 settings in the Discord developer website add a Redirect to http://outline.localhost/auth/discord.callback you can change the http://outline.localhost to your Outline URL
  • Click on the Save Changes button

Add Outline to Caddyfile, you can change the http://outline.localhost to your Outline URL:

Outline’s Caddyfile lines
http://outline.localhost {
    reverse_proxy outline
}
Go

After all that, run Outline with Docker:

Bash
docker compose up -d
Bash

Then go to outline.localhost and login with your Discord. That’s it. Done.

Here’s a link to the tutorial I found most useful in installing Outline (although I still got errors when following it, mostly with MinIO): s.revonzev.com/gurucomputing-outline-tutorial

I hope you find this helpful because I certainly would.


Posted

in

by


Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments