Outline

From NixOS Wiki
Revision as of 10:57, 10 April 2023 by imported>Onny

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
networking.extraHosts = ''
  127.0.0.1 dex.localhost
'';

services = {

  outline = {
    enable = true;
    publicUrl = "http://localhost:3000";
    forceHttps = false;

    # Defined but not used in this minimal setup
    storage = {
      accessKey = "outline";
      secretKeyFile = "/var/lib/outline/storage_secret";
      uploadBucketUrl = "http://127.0.0.1:9000";
      uploadBucketName = "outline";
    };

    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";
        config.file = "/var/lib/dex/db.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";
          };
        }
      ]; 
    };
  };

  systemd.services.dex = {
    serviceConfig.StateDirectory = "dex";
  };

  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.

Configuration

Storage backend

It is possible to host a S3-compatible object storage using Minio. The following configuration enables a minimal, local Minio instance:

 
/etc/nixos/configuration.nix
services.minio = {
  enable = true;
  listenAddress = "127.0.0.1:9000";
  consoleAddress = "127.0.0.1:9001";
  # Storing secrets world-readable in the Nix store is not recommended.
  # This is only for demonstration purpose.
  rootCredentialsFile = "${pkgs.writeText "minio-secret" "test123"}";
};

Login into the Minio web console on http://127.0.0.1:9001 using the default credentials with user minioadmin nad password minioadmin.

  • Create a new bucket and name it, for example outline.
  • Create a new user. For demonstration purpose call it outline with the password outline123

See also

  • Mediawiki, PHP- and web-based wiki software.
  • Dokuwiki, simple PHP- and web-based wiki software which uses file based storage for its content.