NomNomzBot ships two Docker Compose setups in the project folder. Lite is one container with a SQLite database, and it pulls the ready-made image, so you build nothing. Full runs the bot next to Postgres, Redis and a Caddy proxy. For a bot that serves your own channel, start with lite.
Pick lite or full
Pick full only when you want a database server, or updates with no pause.
| Lite | Full | |
|---|---|---|
| Compose file | docker-compose.lite.yml | docker-compose.yml |
| Containers | The bot only | The bot, Postgres, Redis and a Caddy proxy |
| Database | A SQLite file | Postgres |
| Updates | The bot pauses for a few seconds | No pause |
.env file | Only to change the port or the address, or to build the image yourself | Needed |
What you need
- Docker with Compose v2, and Docker running before you start.
- A Twitch account for your channel. The first-run setup helps you choose the Twitch app the bot uses.
- The NomNomzBot project files in one folder, as in the next section.
Get the project files
The project files are on the NomNomzBot page on GitHub.
- Open that page and choose Code, then Download ZIP.
- Unpack the ZIP file where you want the bot to live.
The ZIP holds one folder,
nomnomzbot-master, and that folder is the project folder. It holdsdocker-compose.lite.yml,docker-compose.ymland.env.example. - Open a terminal in the project folder.
Open the folder in File Explorer. Right-click an empty part of the folder and choose Open in Terminal.
Open the Terminal app, type cd with a space, drag the folder into the window, and press Return.
Open a terminal, type cd with a space and the path of the folder, and press Enter.
If you use Git, you can clone the project instead.
The project folder is then nomnomzbot:
git clone https://github.com/NoMercyLabs/nomnomzbot.git
cd nomnomzbot
Install the lite setup
Lite runs without a .env file, unless you build the image yourself.
When the secret keys are empty, the bot makes its own keys on the first start and saves them in its data folder.
Two settings are best made before the first start. If you will open the bot from another computer, or port 5080 is taken, first do If you open the bot from another computer. If you want the data in a folder you can see and copy, first do If you want the data in a folder you can see. Otherwise, start now.
Start the lite bot
-
In the project folder, run this command and press Enter:
Shelldocker compose -f docker-compose.lite.yml up -dDocker downloads the ready-made stable image and starts the bot. In the Compose file the bot is the service
api, and Docker names its containernomnomzbot-lite. Commands that start withdocker composeuse the service name, and commands that start with plaindockeruse the container name. -
Run this command and press Enter to check the bot:
Shelldocker compose -f docker-compose.lite.yml psThe container shows as running, and it turns healthy after a short start-up.
-
Open the setup page in your browser. On the computer that runs the bot, open
http://localhost:5080/setup. If you set another port inAPI_HTTP_PORT, use that port instead of5080. From another computer, open yourAPI_BASE_URLwith/setupadded, such ashttp://192.168.1.20:5080/setup. -
Follow the first-run setup. You can enter your Twitch client ID and client secret there.
When the setup page loads, the bot is installed.
After the setup, you sign in, and the dashboard opens at /app on the same address.
If you change .env later, run the same up -d command again.
Docker recreates the container with the new values, and your data stays where it is.
Build the image yourself
This needs a .env file, so make one first.
The copied .env.example holds the development ENCRYPTION_KEY, and the bot does not start with it.
- Copy
.env.exampleto.envin the project folder.
Copy-Item .env.example .env
cp .env.example .env
-
Open
.envin a text editor. MakeENCRYPTION_KEYempty, asENCRYPTION_KEY=, so the bot creates its own key. Check thatAPI_IMAGEisnomnomzbot-api:local, which is the value in the example, and save the file. -
Add
--buildto the start command:Shelldocker compose -f docker-compose.lite.yml up -d --build
The build needs a lot of memory for Docker. With too little memory, the build stops with an out-of-memory error. Give Docker more memory, or use the ready-made image.
If you open the bot from another computer
Do this before the first start, and before you register your Twitch app in the first-run setup.
Use it when the bot runs on another computer, such as a small home server you open from your laptop, or when port 5080 is taken.
The bot builds the Twitch sign-in return address from API_BASE_URL.
- Copy
.env.exampleto.envin the project folder.
Copy-Item .env.example .env
cp .env.example .env
-
Open
.envin a text editor, change these four lines, and save the file.Line in .envWhat to do Why ENCRYPTION_KEYMake it empty, as ENCRYPTION_KEY=.The example value is the development key, and the bot does not start with it. Empty makes the bot create its own key. API_IMAGEMake it ghcr.io/nomercylabs/nomnomzbot:stable.The example value makes Docker build the image on your machine. API_HTTP_PORTKeep 5080, or set a free port.The bot is reached on this port. API_BASE_URLSet the address you will open the bot at, with the port, such as http://192.168.1.20:5080.Twitch sends you back to this address after you sign in. Leave the other lines as they are.
JWT_SECRETholds an example value too, and the bot replaces it with a key of its own. -
If a firewall runs on the computer with the bot, allow incoming connections on the port in
API_HTTP_PORT. You need this only so another computer can reach the bot. This page cannot cover every firewall, so look up “allow an incoming port” in the help for yours: Windows Defender Firewall on Windows, ufw or firewalld on Linux, or the firewall in System Settings on macOS. -
Start the bot as in Start the lite bot.
Open the bot at the exact address you set in API_BASE_URL.
On a plain http address other than localhost, the browser does not count the page as secure, so the sign-in page offers only the code sign-in.
With the code sign-in, the page shows a short code, and you enter that code on Twitch’s own site to sign in.
For a public address, Twitch needs HTTPS, and the bot itself serves only plain http.
This page cannot cover HTTPS setup.
Pick one tool to handle HTTPS in front of the bot: a tunnel or a reverse proxy.
Point it at the bot’s address on your network, such as http://192.168.1.20:5080, then set API_BASE_URL to the https address the tool gives you.
If you want the data in a folder you can see
Do this before the first start. If the bot has already started, its data is in the Docker volume, and a new folder starts empty. In that case, first do steps 1 and 2 of Back up the lite data and skip its step 3, so the bot stays stopped.
By default, lite keeps its data in the Docker volume nomnomzbot_lite_data.
These steps keep it in a data folder inside the project folder instead.
- Open
docker-compose.lite.ymlin a text editor. - Remove the
#before the line./data:/app/data. - Remove the line with
lite_data:/app/data, and save the file. Thelite_data:block at the bottom of the file can stay, because no service uses it after this change. - Make the folder.
mkdir data
mkdir data
sudo chown 1654:1654 data
The second command gives the folder to the user the bot runs as inside the container, so the bot can write to it.
-
Only if you made a backup: with
nomnomzbot-backup.tgzin the project folder, run this command to unpack it into the new folder. It is one command, so copy it whole.Shelldocker run --rm -v "$PWD/data":/data -v "$PWD":/backup:ro alpine tar xzf /backup/nomnomzbot-backup.tgz -C /dataOn Linux, the unpacked files keep the owner they had in the backup, which is the bot’s user.
-
Start the bot as in Start the lite bot.
Install the full setup
Full always needs a .env file.
You open the bot on the port in API_HTTP_PORT, as in lite.
By default, full builds the image on your machine. The build needs a lot of memory for Docker, and with too little it stops with an out-of-memory error.
Start full with the script
The project folder has a script that makes .env and starts the stack for you.
Run it in a project folder that has no .env yet.
.\deploy.ps1 docker
./deploy.sh docker
The word docker picks the full setup. Without it, the script only lists its choices.
The script copies .env.example to .env and fills in new values for ENCRYPTION_KEY, JWT_SECRET and POSTGRES_PASSWORD.
It then asks for the Twitch client ID, the client secret, the bot username and the bot user ID.
Press Enter to skip each one, and enter the Twitch client ID and client secret in the first-run setup instead.
Then it builds the image, starts the stack and waits until the bot is ready, which takes up to 3 minutes.
The script does not ask for the port or the address.
It leaves them at 5080 and http://localhost:5080, and it prints that address when the bot is ready.
If you will open the bot from another computer, or port 5080 is taken, set the port and the address now, before you register your Twitch app in the first-run setup.
The bot builds the Twitch sign-in return address from API_BASE_URL.
- Open
.envin the project folder in a text editor. - Set
API_HTTP_PORTto the port you will open, andAPI_BASE_URLto the address you will open, such ashttp://192.168.1.20:5080. Leave the other lines as they are, and save the file. - Run
docker compose up -d. Docker recreates the container with the new values.
Then open your API_BASE_URL with /setup added and follow the first-run setup.
If you open the bot only on this computer, open the address the script printed with /setup added instead.
For a plain http address, a public address and the firewall, see If you open the bot from another computer.
Start full by hand
To skip the build, also set API_IMAGE=ghcr.io/nomercylabs/nomnomzbot:stable in .env, and in step 7 run docker compose up -d without --build.
- Copy
.env.exampleto.envin the project folder.
Copy-Item .env.example .env
cp .env.example .env
- Make a random value, and set
ENCRYPTION_KEYto it in.env. The example value is the development key, and the bot does not start with it.
$b = New-Object byte[] 32; [Security.Cryptography.RandomNumberGenerator]::Create().GetBytes($b); [Convert]::ToBase64String($b)
openssl rand -base64 32
- Run the same command again, and set
JWT_SECRETto the new value. - Make a password, and set
POSTGRES_PASSWORDto it.
$b = New-Object byte[] 32; [Security.Cryptography.RandomNumberGenerator]::Create().GetBytes($b); -join ($b | ForEach-Object { $_.ToString('x2') })
openssl rand -hex 32
-
Set
API_HTTP_PORTto the port you will open, andAPI_BASE_URLto the address you will open, as in If you open the bot from another computer. Change only these two lines from that table, and keep your ownENCRYPTION_KEYfrom step 2. -
Fill in
TWITCH_CLIENT_IDandTWITCH_CLIENT_SECRETwith the Twitch client ID and client secret, or leave them blank and enter them in the first-run setup. Save the file. -
Run this command and press Enter:
Shelldocker compose up -d --buildDocker builds the image, then starts Postgres, Redis, Caddy and the bot.
-
Open the setup page at your
API_BASE_URLwith/setupadded, such ashttp://localhost:5080/setup, and follow the first-run setup.
Never share your .env file.
It holds your secrets.
If you change ENCRYPTION_KEY later, the bot can no longer read the secrets it saved, so you enter your Twitch client ID and client secret again in the first-run setup and sign in again.
Where your data lives
Inside the container, the bot keeps its files in its data folder, /app/data.
In lite, that is everything: the SQLite database, the keys the bot made, your uploads and the logs.
Outside the container, Docker keeps that folder in a Docker volume, or in the visible data folder if you made one.
| Setup | Where Docker keeps the data |
|---|---|
| Lite | The Docker volume nomnomzbot_lite_data, or your visible data folder |
| Full | The postgres_data volume for the database, and the api_data volume for the bot’s files |
The lite volume has a fixed name.
In full, Compose puts the project folder’s name in front of each volume name, such as nomnomzbot_postgres_data after a clone.
An update replaces the container and keeps the volume.
Removing a volume removes the data, so never use docker compose down -v to update.
When ENCRYPTION_KEY is empty, the bot saves its own key in keys/root-kek.key in the data folder.
Without that file, the bot can no longer read the secrets it saved, so you enter your Twitch client ID and client secret again in the first-run setup and sign in again.
Keep the whole data folder together, and never copy the database file alone.
Back up the lite data
Stop the bot before you copy its data, so the database is complete.
If you keep the data in a visible data folder, stop the bot, copy that whole folder, and start the bot again.
-
Run this command and press Enter to stop the bot:
Shelldocker compose -f docker-compose.lite.yml stop -
Copy the whole volume to
nomnomzbot-backup.tgzin the current folder. It is one command, so copy it whole. If you restored a backup before, put the volume name from thename:line at the bottom ofdocker-compose.lite.ymlin place ofnomnomzbot_lite_data.Shelldocker run --rm -v nomnomzbot_lite_data:/data -v "$PWD":/backup alpine tar czf /backup/nomnomzbot-backup.tgz -C /data . -
Run this command and press Enter to start the bot:
Shelldocker compose -f docker-compose.lite.yml start
The backup holds keys/root-kek.key, the key file the bot made.
If you set your own ENCRYPTION_KEY in .env, there is no key file, so keep a private copy of .env with the backup.
Restore a lite backup
Restore into a new volume, so the old data stays as it is until you have checked the result.
Pick a name no volume has yet, such as nomnomzbot_lite_restored, and nomnomzbot_lite_restored_2 the next time.
Put your name in place of nomnomzbot_lite_restored in steps 2 to 4.
-
Stop the bot with the same
stopcommand. -
Run this command and press Enter to make the new volume:
Shelldocker volume create nomnomzbot_lite_restored -
With
nomnomzbot-backup.tgzin the current folder, run this command to unpack it into the new volume. It is one command, so copy it whole.Shelldocker run --rm -v nomnomzbot_lite_restored:/data -v "$PWD":/backup:ro alpine tar xzf /backup/nomnomzbot-backup.tgz -C /dataOn Linux, the unpacked files keep the owner they had in the backup, which is the bot’s user.
-
At the bottom of
docker-compose.lite.yml, change thename:line to the new volume, such asname: nomnomzbot_lite_restored, and save the file. -
Run
docker compose -f docker-compose.lite.yml up -d. Check the dashboard and your saved settings before you remove the old volume.
From now on, the bot uses the new volume, and the backup command names it through the name: line.
If you keep the data in a visible data folder, stop the bot, put the whole saved folder back in place of data, and start the bot.
Never mix files from two backups.
Back up the full setup
In full, the bot runs in one of two containers, api-blue or api-green, and an update can switch between them.
Both use the same api_data volume.
Compose leaves api-green out of its commands unless you add --profile green, so the commands below add it where both must be seen.
A full backup needs both volumes, your .env file and your Compose file.
-
Run
docker compose --profile green ps, and note which one runs,api-blueorapi-green. -
Run this command and press Enter to stop the whole stack:
Shelldocker compose --profile green stop -
Run
docker volume ls, and note the two names that end in_postgres_dataand_api_data. -
Copy each volume to its own file. Replace
YOUR_DATABASE_VOLUMEandYOUR_BOT_VOLUMEwith the names from step 3. ReplaceYOUR_DATABASE_BACKUPandYOUR_BOT_BACKUPwith file names of your choice. Each line is one command, so copy each one whole and press Enter after it.Shelldocker run --rm -v YOUR_DATABASE_VOLUME:/data:ro -v "$PWD":/backup alpine tar czf /backup/YOUR_DATABASE_BACKUP.tgz -C /data .
docker run --rm -v YOUR_BOT_VOLUME:/data:ro -v "$PWD":/backup alpine tar czf /backup/YOUR_BOT_BACKUP.tgz -C /data . -
Copy
.envanddocker-compose.ymlfrom the project folder to a safe place, next to the two backup files..envholds yourENCRYPTION_KEY, so keep this copy private. -
Start the stack again with the container you noted. For
api-blue, rundocker compose start postgres redis api-blue caddy. Forapi-green, rundocker compose --profile green start postgres redis api-green caddy.
To restore, put each file into a new, empty volume, then point the Compose file at the new volumes.
Restore on a new computer in a fresh project folder, with the saved .env and docker-compose.yml copied into it before you start.
-
Stop the whole stack with
docker compose --profile green stop. -
Make two new volumes, and press Enter after each command:
Shelldocker volume create nomnomzbot_postgres_restored
docker volume create nomnomzbot_api_restored -
Unpack each backup file into its new volume. Use the same
YOUR_DATABASE_BACKUPandYOUR_BOT_BACKUPfile names as in the backup. Each line is one command, so copy each one whole and press Enter after it.Shelldocker run --rm -v nomnomzbot_postgres_restored:/data -v "$PWD":/backup:ro alpine tar xzf /backup/YOUR_DATABASE_BACKUP.tgz -C /data
docker run --rm -v nomnomzbot_api_restored:/data -v "$PWD":/backup:ro alpine tar xzf /backup/YOUR_BOT_BACKUP.tgz -C /data -
At the bottom of
docker-compose.yml, give each volume aname:line with its new volume, and save the file:YAMLvolumes:
postgres_data:
name: nomnomzbot_postgres_restored
api_data:
name: nomnomzbot_api_restored -
Run
docker compose up -d. Docker recreates the containers on the new volumes and startsapi-blue. Check the dashboard and your saved settings before you remove the old volumes.
Limits of lite
- Run one lite container only. SQLite allows one writer, so never run two copies on the same data.
- Each update pauses the bot for a few seconds.
- Keep the data on a local disk, not on a network drive. SQLite needs a local disk.
If the dashboard does not open
This covers the setup page and the dashboard alike.
Check the container with the ps command from Start the lite bot, then read the startup messages:
docker compose -f docker-compose.lite.yml logs --tail 100 api
For full, use docker compose --profile green ps and docker compose logs --tail 100 api-blue, or api-green when that one runs.
A container that stays unhealthy names its startup error in these messages.
If the error says the encryption key is still the development key, set your own ENCRYPTION_KEY in .env, or make it empty in lite, and run up -d again.
If the container is healthy, check that you opened the address in API_BASE_URL, with the port you set in API_HTTP_PORT.