From 796e50ed5f43f9819c77d13cd494ee81581e8f62 Mon Sep 17 00:00:00 2001 From: Nicholas Penree Date: Sat, 15 Feb 2025 02:22:17 -0500 Subject: [PATCH] feat(template): add outline --- apps/dokploy/public/templates/outline.svg | 1 + .../templates/outline/docker-compose.yml | 57 ++++++++++++ apps/dokploy/templates/outline/index.ts | 90 +++++++++++++++++++ apps/dokploy/templates/templates.ts | 15 ++++ 4 files changed, 163 insertions(+) create mode 100644 apps/dokploy/public/templates/outline.svg create mode 100644 apps/dokploy/templates/outline/docker-compose.yml create mode 100644 apps/dokploy/templates/outline/index.ts diff --git a/apps/dokploy/public/templates/outline.svg b/apps/dokploy/public/templates/outline.svg new file mode 100644 index 00000000..5dfa63d0 --- /dev/null +++ b/apps/dokploy/public/templates/outline.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/apps/dokploy/templates/outline/docker-compose.yml b/apps/dokploy/templates/outline/docker-compose.yml new file mode 100644 index 00000000..90ec6d97 --- /dev/null +++ b/apps/dokploy/templates/outline/docker-compose.yml @@ -0,0 +1,57 @@ +services: + outline: + image: outlinewiki/outline:0.81.0 + restart: always + depends_on: + - postgres + - redis + - dex + ports: + - 3000 + environment: + NODE_ENV: production + URL: ${URL} + FORCE_HTTPS: 'false' + SECRET_KEY: ${SECRET_KEY} + UTILS_SECRET: ${UTILS_SECRET} + DATABASE_URL: postgres://outline:${POSTGRES_PASSWORD}@postgres:5432/outline + PGSSLMODE: disable + REDIS_URL: redis://redis:6379 + OIDC_CLIENT_ID: outline + OIDC_CLIENT_SECRET: ${CLIENT_SECRET} + OIDC_AUTH_URI: ${DEX_URL}/auth + OIDC_TOKEN_URI: ${DEX_URL}/token + OIDC_USERINFO_URI: ${DEX_URL}/userinfo + + dex: + image: ghcr.io/dexidp/dex:v2.37.0 + restart: always + volumes: + - ../files/etc/dex/config.yaml:/etc/dex/config.yaml + command: + - dex + - serve + - /etc/dex/config.yaml + ports: + - 5556 + + postgres: + image: postgres:15 + restart: always + environment: + POSTGRES_DB: outline + POSTGRES_USER: outline + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} + volumes: + - postgres_data-test-outline-khufpx:/var/lib/postgresql/data + + redis: + image: redis:latest + restart: always + command: redis-server --appendonly yes + volumes: + - redis_data-test-outline-khufpx:/data + +volumes: + postgres_data-test-outline-khufpx: + redis_data-test-outline-khufpx: \ No newline at end of file diff --git a/apps/dokploy/templates/outline/index.ts b/apps/dokploy/templates/outline/index.ts new file mode 100644 index 00000000..8431e568 --- /dev/null +++ b/apps/dokploy/templates/outline/index.ts @@ -0,0 +1,90 @@ +import { + type DomainSchema, + type Schema, + type Template, + generateBase64, + generatePassword, + generateRandomDomain, +} from "../utils"; + +export function generate(schema: Schema): Template { + const mainDomain = generateRandomDomain(schema); + const dexDomain = generateRandomDomain(schema); + const SECRET_KEY = generateBase64(32); + const UTILS_SECRET = generateBase64(32); + const CLIENT_SECRET = generateBase64(32); + const POSTGRES_PASSWORD = generatePassword(); + + const mainURL = `http://${mainDomain}`; + const dexURL = `http://${dexDomain}`; + + const domains: DomainSchema[] = [ + { + host: mainDomain, + port: 3000, + serviceName: "outline", + }, + { + host: dexDomain, + port: 5556, + serviceName: "dex", + }, + ]; + + const mounts: Template["mounts"] = [ + { + filePath: "/etc/dex/config.yaml", + content: `issuer: ${dexURL} + +web: + http: 0.0.0.0:5556 + +storage: + type: memory + +enablePasswordDB: true + +frontend: + issuer: Outline + +logger: + level: debug + +staticPasswords: + - email: "admin@example.com" + # bcrypt hash of the string "password": $(echo password | htpasswd -BinC 10 admin | cut -d: -f2) + hash: "$2y$10$jsRWHw54uxTUIfhjgUrB9u8HSzPk7TUuQri9sXZrKzRXcScvwYor." + username: "admin" + userID: "1" + + +oauth2: + skipApprovalScreen: true + alwaysShowLoginScreen: false + passwordConnector: local + +staticClients: + - id: "outline" + redirectURIs: + - ${mainURL}/auth/oidc.callback + name: "Outline" + secret: "${CLIENT_SECRET}"`, + }, + ]; + + const envs = [ + `URL=${mainURL}`, + `DEX_URL=${dexURL}`, + `DOMAIN_NAME=${mainDomain}`, + `POSTGRES_PASSWORD=${POSTGRES_PASSWORD}`, + `SECRET_KEY=${SECRET_KEY}`, + `UTILS_SECRET=${UTILS_SECRET}`, + `CLIENT_SECRET=${CLIENT_SECRET}`, + ]; + + return { + domains, + envs, + mounts, + }; +} diff --git a/apps/dokploy/templates/templates.ts b/apps/dokploy/templates/templates.ts index 8143bbb2..d04394a3 100644 --- a/apps/dokploy/templates/templates.ts +++ b/apps/dokploy/templates/templates.ts @@ -1,6 +1,21 @@ import type { TemplateData } from "./types/templates-data.type"; export const templates: TemplateData[] = [ + { + id: "outline", + name: "Outline", + version: "0.81.0", + description: + "Outline is a self-hosted knowledge base and documentation platform that allows you to build and manage your own knowledge base applications.", + links: { + github: "https://github.com/outline/outline", + website: "https://outline.com/", + docs: "https://docs.outline.com/", + }, + logo: "outline.svg", + load: () => import("./outline/index").then((m) => m.generate), + tags: ["documentation", "knowledge-base", "self-hosted"], + }, { id: "supabase", name: "SupaBase",