mirror of
https://github.com/Dokploy/templates
synced 2025-06-26 18:16:07 +00:00
feat: migrate templates
This commit is contained in:
@@ -1,90 +0,0 @@
|
||||
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,
|
||||
};
|
||||
}
|
||||
64
blueprints/outline/template.yml
Normal file
64
blueprints/outline/template.yml
Normal file
@@ -0,0 +1,64 @@
|
||||
variables:
|
||||
main_domain: ${randomDomain}
|
||||
dex_domain: ${randomDomain}
|
||||
secret_key: ${generateBase64(32)}
|
||||
utils_secret: ${generateBase64(32)}
|
||||
client_secret: ${generateBase64(32)}
|
||||
postgres_password: ${generatePassword()}
|
||||
|
||||
config:
|
||||
domains:
|
||||
- serviceName: outline
|
||||
port: 3000
|
||||
host: ${main_domain}
|
||||
- serviceName: dex
|
||||
port: 5556
|
||||
host: ${dex_domain}
|
||||
|
||||
env:
|
||||
URL: http://${main_domain}
|
||||
DEX_URL: http://${dex_domain}
|
||||
DOMAIN_NAME: ${main_domain}
|
||||
POSTGRES_PASSWORD: ${postgres_password}
|
||||
SECRET_KEY: ${secret_key}
|
||||
UTILS_SECRET: ${utils_secret}
|
||||
CLIENT_SECRET: ${client_secret}
|
||||
|
||||
mounts:
|
||||
- filePath: /etc/dex/config.yaml
|
||||
content: |
|
||||
issuer: http://${dex_domain}
|
||||
|
||||
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:
|
||||
- http://${main_domain}/auth/oidc.callback
|
||||
name: "Outline"
|
||||
secret: "${client_secret}"
|
||||
Reference in New Issue
Block a user