This guide is written for Linux systems.
The process is similar on Windows, but the commands may differ.
Before you start, you need to make sure your system meets the requirements.
Unless you know what you're doing and already have a database and reverse proxy set up,
using the provided docker-compose.yml file is recommended over pure Docker.
Open docker-compose.yml in your preferred text editor and modify the highlighted lines.
Bug
The value of HTTP_EXTERNAL must be resolvable both from within the container and the host,
which means when HTTP_EXTERNAL is an internal address (e.g. http://127.0.0.1), the container and host ports must be the same.
This is because the SvelteKit application uses server-side rendering, so the bot makes HTTP requests to itself.
Alternatively, you can set the HTTP_INTERNAL value with a different port.
If you are using a reverse proxy and a domain name, this shouldn't be a problem.
Tip
You can middle-click on links to open them in a new tab
so you can easily come back to the documentation!
Refer to the configuration documentation for more information about the available environment variables,
and return to this page when you have finished.
version:"3.9"services:mysql:image:mysql:8restart:unless-stoppedhostname:mysqlnetworks:-discord-ticketsvolumes:-tickets-mysql:/var/lib/mysqlenvironment:MYSQL_DATABASE:ticketsMYSQL_PASSWORD:insecureMYSQL_ROOT_PASSWORD:insecureMYSQL_USER:ticketsbot:image:eartharoid/discord-tickets:4.0depends_on:-mysqlrestart:unless-stoppedhostname:botnetworks:-discord-ticketsports:-8169:8169volumes:-tickets-bot:/home/container/user-/etc/timezone:/etc/timezone:ro-/etc/localtime:/etc/localtime:rotty:truestdin_open:true# Please refer to the documentation:# https://discordtickets.app/self-hosting/configuration/#environment-variablesenvironment:DB_CONNECTION_URL:mysql://tickets:insecure@mysql/ticketsDISCORD_SECRET:DISCORD_TOKEN:ENCRYPTION_KEY:DB_PROVIDER:mysqlHTTP_EXTERNAL:http://127.0.0.1:8169HTTP_HOST:0.0.0.0HTTP_PORT:8169HTTP_TRUST_PROXY:"false"PUBLIC_BOT:"false"PUBLISH_COMMANDS:"false"OVERRIDE_ARCHIVE:nullSUPER:319467558166069248# TZ: Etc/UTCnetworks:discord-tickets:volumes:tickets-mysql:tickets-bot:
Don't skip this section if you already know how to create a Discord application;
Discord Tickets requires additional configuration.
Using an existing application is not recommended.
Give your application a name, accept the terms of service and click Create
3. Add a logo, description, and links to your terms of service and privacy policy, then click Save Changes.
4. Go to the OAuth2 page and click Reset Secret, then Yes, do it!.
Copy the new secret and set it as your DISCORD_SECRET environment variable.
5. Click Add Redirect and enter the value of your HTTP_EXTERNAL environment variable, followed by /auth/callback.
Then click Save Changes.
Examples
http://12.345.67.89:8080/auth/callback
https://tickets.example.com/auth/callback
If you set this to https://tickets.example.com/auth/callback,
your HTTP_EXTERNAL environment variable must be set to https://tickets.example.com(without a trailing /).
6. Create the bot user
Go to the Bot page and click Add Bot, then Yes, do it!
Click View Token, then copy the token and set it as your DISCORD_TOKEN environment variable.
7. Configure the bot
Optionally, disable the "public bot" option to prevent other people from adding your bot to their servers.
Enable the presence, server members and message content intents.
Don't add the bot to your Discord server yet; you'll do that later.
You can now interact with the bot's console and publish the commands to Discord:
commands publish
To disconnect from the container, press Ctrl+PCtrl+Q.
If that doesn't work (e.g. if you using the terminal in VS Code), press Ctrl+C instead (which will also restart the bot).
This is a very short overview; refer to the Docker Compose guide for more information.
Some required environment variables that you are unlikely to change have defaults set in the Dockerfile:
Name
Value
HTTP_HOST
0.0.0.0
HTTP_PORT
80
You need to set the other required environment variables.
Tip
You can middle-click on links to open them in a new tab
so you can easily come back to the documentation!
Refer to the configuration documentation for more information about the available environment variables,
and return to this page when you have finished.
The first time you start the container, don't use the -d flag so you can type commands publish in the console to publish the commands to Discord.
You can then restart the container in detached mode.
Alternatively, set the PUBLISH_COMMANDS environment variable to true to publish commands automatically at startup.