Skip to main content
  1. Posts/

How to Self-Host Outline Alongside Caddy

·744 words·4 mins· loading · loading · ·
categories: Tutorial
tags: Tutorial Docker Ubuntu Linux Mint Caddy Install
Table of Contents

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.

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.

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 -L s.revonzev.com/install-outline-docker-curl | bash

Here’s the docker-compose.yml for my Outline:

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

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

#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=

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

openssl rand -hex 32

Add your own password for the Postgres database (POSTGRES_PASSWORD) and change your Outline URL (WIKI_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

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

http://outline.localhost {
    reverse_proxy outline
}

After all that, run Outline with Docker:

docker compose up -d

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

The link to the tutorial I found most useful in installing Outline (although I still got errors when following it, mostly with MinIO) is here.

I hope you find this helpful because I certainly would.

Revon Zev
Author
Revon Zev
A game streamer on Twitch, and a game VTuber on YouTube with a hobby of creating art and programming.

Related

How to Install Caddy with Docker
·428 words·3 mins· loading · loading
categories: Tutorial
tags: Tutorial Docker Ubuntu Linux Mint Install
How to Install Docker on Linux Mint in One Command
·299 words·2 mins· loading · loading
categories: Tutorial
tags: Tutorial Docker Ubuntu Linux Mint Install
Fist Post
·480 words·3 mins· loading · loading
categories: Uncategorized
tags: Other