- Published on
How to Self-Host Outline: A Docker and Traefik Guide
- Authors
- Name
- Ayden Jahola
Table of Contents
Introduction
Outline is a powerful, open-source wiki tool that allows you to create and share knowledge with your team. It's a great alternative to Notion, Confluence, and other similar tools. In this guide, I'll show you how to self-host Outline on your homelab using Docker and Traefik.
Why Self-Host Outline?
Currently we are using Notion for our internal documents at DCU Solar Racing and it's been great. However, we hit the block limit for the free plan and Notion doesn't recognise DCU as A university for a free student plan so I starting looking for an alternative.
I came across different options like Affine, I looked for a docker image and found the offical docker compose image for Affine, so I grabbed it and started hosting it on my homelab. It was great but it's not the solution I was looking for a team with 20+ members as Affine limit the workplace to only 3 members.
So I started looking for an alternative and came across Outline, I looked for the official docker image and found it. I grabbed it and started the hosting process. The documentation Outline provides arent great and doesn't help and I couldnt find a solution to just "work", so I started pocking around and eventually got it to work.
so I decided to write this guide to help others who are looking to self-host Outline on their homelab with Docker and Traefik.
Prerequisites
Before we get started, you'll need the following:
- A server or homelab where you can run Docker containers.
- Docker and Docker Compose installed on your server.
- A domain name that you can point to your server.
- Traefik installed and configured on your server.
- Basic knowledge of Docker and Traefik.
Showcase
Here's a quick showcase of what the final product will look like:
Step-by-Step Guide
Step 1: Grab the Docker Compose File
The first step is to grab the Docker Compose file for Outline. You can find the official Docker Compose file on the Outline Documentation Page.
Create a new directory on your server and create a new file called docker-compose.yml
. Copy the contents of the official Docker Compose file into your docker-compose.yml
file.
.env
example file
Step 2: Grab the The second step is to grab the .env
example file for Outline. You can find the official .env
example file on the Outline Github Repo.
Copy the contents of the official .env
example file into a new file called docker.env
in the same directory as your docker-compose.yml
file. this is crucial as the docker-compose file will look for the .env
file by default to get the environment variables.
Step 3: Configure the Docker Compose File
Next, it's time to configure our docker-compose.yml
file to with with Traefik and our domain name. Outline suggests using Nginx as a reverse proxy, but we'll be using Traefik instead.
Here's an example of how you can configure your docker-compose.yml
file to work with Traefik:
version: '3.2'
services:
outline:
image: docker.getoutline.com/outlinewiki/outline:latest
container_name: outline
env_file: ./docker.env
volumes:
- storage-data:/var/lib/outline/data
depends_on:
- postgres
- redis
labels:
- 'traefik.enable=true'
- 'traefik.http.routers.outline.rule=Host(`example.com`)' # Change this to your domain name
- 'traefik.http.routers.outline.entrypoints=https'
- 'traefik.http.services.outline.loadbalancer.server.port=3000'
networks:
- internal
- proxy
redis:
image: redis
container_name: outline-redis
env_file: ./docker.env
ports:
- '6379:6379'
volumes:
- ./redis.conf:/redis.conf
command: ['redis-server', '/redis.conf']
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
interval: 10s
timeout: 30s
retries: 3
networks:
- internal
postgres:
image: postgres
container_name: outline-db
env_file: ./docker.env
ports:
- '5432:5432'
volumes:
- database-data:/var/lib/postgresql/data
healthcheck:
test: ['CMD', 'pg_isready', '-d', 'outline', '-U', 'user']
interval: 30s
timeout: 20s
retries: 3
environment:
POSTGRES_USER: ${PG_USER}
POSTGRES_PASSWORD: ${PG_PASS}
POSTGRES_DB: ${PG_DB}
networks:
- internal
volumes:
storage-data:
database-data:
networks:
proxy:
external: true
internal:
external: false
In Outline's official Docker Compose File you'll see that there is a https-portal
but we dont need that as we are using Traefik so it's safe to delete.
docker.env
File
Step 4: Configure the Next, let's configure the docker.env
file with the necessary environment variables. Be sure to include all of the values in the Required
section and at least one authentication provider from the Optional
section to have the application successfully start.
fill in the values for your application and make sure to have the below set correctly:
URL= # The URL of your Outline instance, same as the domain you set in the docker-compose file
also make sure to have the below set correctly:
you can configure Google Auth at Google Cloud Console
# When configuring the Client ID, add an Authorized redirect URI:
# https://<URL>/auth/google.callback
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
Step 5: Start the Docker Containers
Once you've configured your docker-compose.yml
and docker.env
files, you can start the Outline Docker containers by running the following command in the same directory as your docker-compose.yml
file:
docker-compose up -d
This will start the Outline, Postgres, and Redis containers and create the necessary volumes and networks. You should now be able to access your Outline instance by navigating to your domain name in your web browser.
Conclusion
Implementing this solution has been a great success for me and my team. We now have a self-hosted wiki tool that we can use to create and share knowledge with each other without any storage limitations or being stuck behind a paywall. I hope this guide has been helpful to you and that you're able to successfully self-host Outline on your homelab using Docker and Traefik.