diff --git a/apps/dokploy/public/templates/discordtickets.png b/apps/dokploy/public/templates/discordtickets.png new file mode 100644 index 00000000..030c3a4c Binary files /dev/null and b/apps/dokploy/public/templates/discordtickets.png differ diff --git a/apps/dokploy/templates/discord-tickets/docker-compose.yml b/apps/dokploy/templates/discord-tickets/docker-compose.yml new file mode 100644 index 00000000..44324e1e --- /dev/null +++ b/apps/dokploy/templates/discord-tickets/docker-compose.yml @@ -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: \ No newline at end of file diff --git a/apps/dokploy/templates/discord-tickets/index.ts b/apps/dokploy/templates/discord-tickets/index.ts new file mode 100644 index 00000000..e2a42649 --- /dev/null +++ b/apps/dokploy/templates/discord-tickets/index.ts @@ -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, + }; +} \ No newline at end of file diff --git a/apps/dokploy/templates/templates.ts b/apps/dokploy/templates/templates.ts index bae9a8f7..d3ba44e8 100644 --- a/apps/dokploy/templates/templates.ts +++ b/apps/dokploy/templates/templates.ts @@ -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), + }, ];