Add: Discord Tickets

This commit is contained in:
DrMxrcy
2024-11-12 16:37:51 -05:00
parent 5c17797749
commit deeea11428
4 changed files with 114 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -0,0 +1,54 @@
version: "3.8"
services:
mysql:
image: mysql:8
restart: unless-stopped
hostname: mysql
networks:
- dokploy-network
volumes:
- tickets-mysql:/var/lib/mysql
environment:
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_USER: ${MYSQL_USER}
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u${MYSQL_USER}", "-p${MYSQL_PASSWORD}"]
interval: 10s
timeout: 5s
retries: 5
bot:
image: eartharoid/discord-tickets:4.0.21
depends_on:
mysql:
condition: service_healthy
restart: unless-stopped
hostname: bot
networks:
- dokploy-network
volumes:
- tickets-bot:/home/container/user
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
tty: true
stdin_open: true
environment:
DB_CONNECTION_URL: mysql://${MYSQL_USER}:${MYSQL_PASSWORD}@mysql/${MYSQL_DATABASE}
DISCORD_SECRET: ${DISCORD_SECRET}
DISCORD_TOKEN: ${DISCORD_TOKEN}
ENCRYPTION_KEY: ${ENCRYPTION_KEY}
DB_PROVIDER: mysql
HTTP_EXTERNAL: https://${TICKETS_HOST}
HTTP_HOST: 0.0.0.0
HTTP_PORT: 8169
HTTP_TRUST_PROXY: "true"
PUBLIC_BOT: "false"
PUBLISH_COMMANDS: "true"
SUPER: ${SUPER_USERS}
volumes:
tickets-mysql:
tickets-bot:

View File

@@ -0,0 +1,46 @@
import {
type DomainSchema,
type Schema,
type Template,
generatePassword,
generateRandomDomain,
} from "../utils";
export function generate(schema: Schema): Template {
const mainDomain = generateRandomDomain(schema);
const mysqlPassword = generatePassword();
const mysqlRootPassword = generatePassword();
const mysqlUser = "tickets";
const mysqlDatabase = "tickets";
// Generate encryption key in the format they use
const encryptionKey = Array.from({length: 48}, () =>
Math.floor(Math.random() * 16).toString(16)).join('');
const domains: DomainSchema[] = [
{
host: mainDomain,
port: 8169,
serviceName: "bot",
},
];
const envs = [
`TICKETS_HOST=${mainDomain}`,
`MYSQL_DATABASE=${mysqlDatabase}`,
`MYSQL_PASSWORD=${mysqlPassword}`,
`MYSQL_ROOT_PASSWORD=${mysqlRootPassword}`,
`MYSQL_USER=${mysqlUser}`,
`ENCRYPTION_KEY=${encryptionKey}`,
// These need to be set by the user through the UI
`# Follow the guide at: https://discordtickets.app/self-hosting/installation/docker/#creating-the-discord-application`,
`DISCORD_SECRET=`,
`DISCORD_TOKEN=`,
`SUPER_USERS=YOUR_DISCORD_USER_ID`, // Default super user
];
return {
domains,
envs,
};
}

View File

@@ -814,4 +814,18 @@ export const templates: TemplateData[] = [
tags: ["customer-support", "live-chat", "helpdesk"],
load: () => import("./chatwoot/index").then((m) => m.generate),
},
{
id: "discord-tickets",
name: "Discord Tickets",
version: "4.0.21",
description: "An open-source Discord bot for creating and managing support ticket channels.",
logo: "discord-tickets.svg",
links: {
github: "https://github.com/discord-tickets/bot",
website: "https://discordtickets.app",
docs: "https://discordtickets.app/self-hosting/installation/docker/",
},
tags: ["discord", "tickets", "support"],
load: () => import("./discord-tickets/index").then((m) => m.generate),
},
];