Outline: Difference between revisions
imported>Sleepful m adds nginx example |
imported>Sleepful No edit summary |
||
Line 166: | Line 166: | ||
</nowiki>}} | </nowiki>}} | ||
== Reminder == | |||
If you see an error that says something like `option "services.outline.storage.storageType" does not exist"` you may need to update your channels (`nix-channel --update`) | |||
== See also == | == See also == |
Revision as of 07:04, 29 January 2024
Outline is a modern web based wiki and knowledge base for teams.
Setup
The most minimal local installation of Outline can be enabled with the following configuration
/etc/nixos/configuration.nix
{ config, pkgs, lib, ... }: {
networking.extraHosts = ''
127.0.0.1 dex.localhost
'';
services = {
outline = {
enable = true;
publicUrl = "http://localhost:3000";
forceHttps = false;
storage.storageType = "local";
oidcAuthentication = {
# Parts taken from
# http://dex.localhost/.well-known/openid-configuration
authUrl = "http://dex.localhost/auth";
tokenUrl = "http://dex.localhost/token";
userinfoUrl = "http://dex.localhost/userinfo";
clientId = "outline";
clientSecretFile = (builtins.elemAt config.services.dex.settings.staticClients 0).secretFile;
scopes = [ "openid" "email" "profile" ];
usernameClaim = "preferred_username";
displayName = "Dex";
};
};
dex = {
enable = true;
settings = {
issuer = "http://dex.localhost";
storage.type = "sqlite3";
web.http = "127.0.0.1:5556";
staticClients = [
{
id = "outline";
name = "Outline Client";
redirectURIs = [ "http://localhost:3000/auth/oidc.callback" ];
secretFile = "${pkgs.writeText "outline-oidc-secret" "test123"}";
}
];
connectors = [
{
type = "mockPassword";
id = "mock";
name = "Example";
config = {
username = "admin";
password = "password";
};
}
];
};
};
nginx = {
enable = true;
virtualHosts = {
"localhost" = {
locations."/" = {
proxyPass = "${config.services.outline.publicUrl}";
};
};
"dex.localhost" = {
locations."/" = {
proxyPass = "http://${config.services.dex.settings.web.http}";
};
};
};
};
};
Outline is available at http://localhost . Choose login provider "Dex" and authenticate with the example mock login admin
and password
.
Setup with Nginx
Similar as before but this time with Nginx handling SSL
/etc/nixos/configuration.nix
{ config, pkgs, lib, ... }: {
services.nginx = {
enable = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
virtualHosts = {
"outline.example.tld" = {
onlySSL = true;
useACMEHost = "example.tld"; # assuming security.acme.certs."example.tld" with `extraDomainNames = [ "outline.example.tld" ]`
locations."/" = {
proxyPass = "http://localhost:${toString config.services.outline.port}";
proxyWebsockets = true;
extraConfig = ''
proxy_set_header X-Scheme $scheme;
'';
};
};
"dex.example.tld" = {
onlySSL = true;
useACMEHost = "example.tld";
locations."/" = {
proxyPass = "http://${config.services.dex.settings.web.http}";
proxyWebsockets = true;
};
};
};
};
services.outline = {
enable = true;
publicUrl = "https://outline.example.tld";
port = 3003; # using 3003 instead of default 3000
forceHttps = false;
storage.storageType = "local";
oidcAuthentication = {
authUrl = "https://dex.example.tld/auth";
tokenUrl = "https://dex.example.tld/token";
userinfoUrl = "https://dex.example.tld/userinfo";
clientId = "outline";
clientSecretFile = (builtins.elemAt config.services.dex.settings.staticClients 0).secretFile;
scopes = [ "openid" "email" "profile" ];
usernameClaim = "preferred_username";
displayName = "Dex";
};
};
services.dex = {
enable = true;
settings = {
issuer = "https://dex.example.tld";
storage.type = "sqlite3";
web.http = "127.0.0.1:5556";
staticClients = [
{
id = "outline";
name = "Outline Client";
redirectURIs = [ "https://outline.example.tld/auth/oidc.callback" ];
secretFile = "${pkgs.writeText "outline-oidc-secret" "test123"}";
}
];
connectors = [
{
type = "mockPassword";
id = "mock";
name = "Test";
config = {
# this is the dex user/pass combo to log into outline
username = "testuser";
password = "pass123";
};
}
];
};
};
Reminder
If you see an error that says something like `option "services.outline.storage.storageType" does not exist"` you may need to update your channels (`nix-channel --update`)