Install Outline and Keycloak Using Docker Compose
This article is for those looking for a detailed and straightforward guide on installing Outline and Keycloak using Docker Compose.
Outline is a free standalone wiki engine and a collaborative knowledge base for teams.
đž You can find the repository used in this guide on GitHub.
NOTEIn this guide, Outline will use user accounts created in Keycloak for access to the Outline management panel, and MinIO for storing documents uploaded through Outline.
NOTEWeâll use Traefik as our reverse proxy. Itâll handle obtaining cryptographic certificates from Letâs Encrypt for your domain names and route requests to the corresponding services based on those domains.
CAUTIONRemember that without a secure connection, the services will not work.
CAUTIONTo obtain cryptographic certificates, you will need A-type records in the external DNS zone, which point to the IP address of your server where Traefik is installed. If you have created these records recently, you should wait before starting the installation of the services. Full replication of these records between DNS servers can take from a few minutes to 48 hours or even longer in rare cases.
IMPORTANTMinIO has a known limitation: you canât use your domain or subdomain as the bucket name. For instance, if your wiki address is
outline.<your-domain>.<tld>, choose a different name for your bucket.
CAUTIONEnsure that your
AWS_S3_UPLOAD_BUCKET_URLthat is set in the.envfile is a publicly accessible URL that corresponds to your domain. This is crucial because the Outline server will redirect traffic directly to MinIO.
IMPORTANTDocker Engine and Docker Compose must be installed on the server.
For a step-by-step guide on installing Docker Engine on Ubuntu Server, see Install Docker Engine and Docker Compose on Ubuntu Server
IMPORTANTOpenSSH must be installed on the server, and port 22 must be open in order to be able to connect to the server using the SSH protocol.
To install OpenSSH on the server you can use the command:
sudo apt install openssh-serverNOTETo connect to the server from a Windows system, you can use tools like PuTTY or MobaXterm.
NOTEThis guide walks you through connecting to a server with the iTerm2 terminal emulator on macOS.
CAUTIONYou will need to open the following TCP ports for access to the services:
- TCP port 80 - to obtain a free cryptographic certificate through the Letâs Encrypt certification center.
- TCP port 443 - to access the Outline web interface.
We connect to the server on which Outline is planned to be installed.
Now it is necessary to create networks for your services.
We create a network for Traefik using the command:
docker network create traefik-network
We create a network for Keycloak using the command:
docker network create keycloak-network
We create a network for Outline using the command:
docker network create outline-network
Next, you need to clone the repository that contains the configuration files, which include all the necessary conditions for Outline to work.
You can clone the repository using the command:
git clone https://github.com/heyvaldemar/outline-keycloak-traefik-letsencrypt-docker-compose.git
Navigate to the directory with the repository using the command:
cd outline-keycloak-traefik-letsencrypt-docker-compose
Next, you need to change the variables in the .env file according to your requirements.
IMPORTANTMinIO has a known limitation: you canât use your domain or subdomain as the bucket name. For instance, if your wiki address is
outline.<your-domain>.<tld>, choose a different name for your bucket.
CAUTIONEnsure that your
AWS_S3_UPLOAD_BUCKET_URLthat is set in the.envfile is a publicly accessible URL that corresponds to your domain. This is crucial because the Outline server will redirect traffic directly to MinIO.
IMPORTANTThe
.envfile should be in the same directory as01-traefik-outline-letsencrypt-docker-compose.yml,02-keycloak-outline-docker-compose.yml, and03-outline-minio-redis-docker-compose.yml.
CAUTIONThe value for the
OUTLINE_OIDC_CLIENT_SECRETvariable can be obtained after installing Keycloak using02-keycloak-outline-docker-compose.yml.
CAUTIONAdditionally, you need to specify your values for
OUTLINE_SECRET_KEYandOUTLINE_UTILS_SECRET.
The values for OUTLINE_SECRET_KEY and OUTLINE_UTILS_SECRET can be generated using the command:
openssl rand -hex 32Now we will start Traefik using the command:
docker compose -f 01-traefik-outline-letsencrypt-docker-compose.yml -p traefik up -d
Next, we will start Keycloak using the command:
docker compose -f 02-keycloak-outline-docker-compose.yml -p keycloak up -d
From the workstation, navigate to the link https://keycloak.outline.heyvaldemar.net, where keycloak.outline.heyvaldemar.net is the name of my subdomain for accessing the Keycloak management panel. Accordingly, you need to specify your domain name, which points to the IP address of your server with the installed Traefik service, which will redirect the request to Keycloak.
Click on the âAdministration Consoleâ button.

Enter the username and password that you previously set in the .env file, and click the âSign Inâ button.

Now you need to create a new Realm and configure it correctly so that users can log into Outline using Keycloak.
Click the âCreate Realmâ button in the upper left corner.

In the âRealm nameâ field, enter âoutlineâ (in lowercase) and click the âCreateâ button.

Next, select âClientsâ in the âManageâ section and click the âCreate clientâ button.

In the âClient typeâ field, select âOpenID Connectâ.
In the âClient IDâ field, enter âoutlineâ (in lowercase) and click the âNextâ button.

Next, you need to enable âClient authenticationâ and select âStandard flowâ in the âAuthentication flowâ section.
All other values should be disabled.
Click the âNextâ button.

In the âRoot URLâ field, enter https://outline.heyvaldemar.net/
In the âHome URLâ field, enter https://outline.heyvaldemar.net/
In the âValid redirect URIsâ field, enter https://outline.heyvaldemar.net/
NOTE
outline.heyvaldemar.netis the domain name of my service. Accordingly, you need to specify your domain name, which points to the IP address of your server with the installed Traefik service, which will redirect the request to Outline.
Click the âSaveâ button.

Navigate to the âCredentialsâ tab and copy the contents of the âClient secretâ field.

Paste the copied contents of the âClient secretâ field into the OUTLINE_OIDC_CLIENT_SECRET variable in the .env file.

Now letâs create a user who will be able to log into Outline using Keycloak.
Select âUsersâ in the âManageâ section and click the âAdd userâ button.

In the next step, you need to specify: username, email address, first name, last name, and password.
NOTEIf you provide an email address, the user will be able to log into Outline using not only the username but also the email.
Click the âCreateâ button.

Next, you need to set a password for the new user.
Go to the âCredentialsâ tab and click the âSet passwordâ button.

Enter a strong password and click the âSaveâ button.

Certainly! Below is the translation of the provided text:
Click the âSave passwordâ button to confirm the assignment of a new password for the user.

The new password has been successfully set.

Now you can launch Outline with accompanying services and log into Outline using the previously created user.
Letâs launch Outline with the following command:
docker compose -f 03-outline-minio-redis-docker-compose.yml -p outline up -d
To access the Outline management panel, go to https://outline.heyvaldemar.net from your workstation, where outline.heyvaldemar.net is the domain name of my service. Accordingly, you need to specify your domain name that points to the IP address of your server with the installed Traefik service, which will redirect the request to Outline.
NOTEYou need to specify the domain name of the service, previously defined in the
.envfile.
Click the âContinue with Keycloakâ button.

Enter the username or email address and password previously set in Keycloak.

Welcome to the Outline control panel.

To access the MinIO control panel, go to https://console.minio.outline.heyvaldemar.net from your workstation, where console.minio.outline.heyvaldemar.net is the domain name of my service. Accordingly, you need to specify your domain name that points to the IP address of your server with the installed Traefik service, which will redirect the request to MinIO.
NOTEYou need to specify the domain name of the service, previously defined in the
.envfile.
Enter the username and password previously set in the .env file, and click the âLoginâ button.

To access the Traefik control panel, go to https://traefik.outline.heyvaldemar.net from your workstation, where traefik.outline.heyvaldemar.net is the domain name of my service. Accordingly, you need to specify your domain name that points to the IP address of your server with the installed Traefik.
NOTEYou need to specify the domain name of the service, previously defined in the
.envfile.
Enter the username and password previously set in the .env file, and click the âOKâ button.

Welcome to the Traefik control panel.

SIGNAL & INTEL
- The Order: Stop being a grunt. Become an Architect. Join The Private Order.