Throughout the installation, you might run into things you are not familiar with, here is a list of some resources you can use to find out more about the things you're doing
There is also the Zeppelin support server and Zeppelin self-hosting server
sudo apt update -y && sudo apt upgrade -y
sudo apt -y install mariadb-server git nano curl build-essential nginx- mariadb for the database, other SQL like databases such as mySQL will not work
- Git allows us to clone the bot and stay up to date with the main instance
- Nano is a text editor that will allow us to edit files
- Curl is required for certain installation scripts, this should already be installed
- build-essential is required for building the bot
- Nginx for the webserver will allow us to serve web files for the dashboard, which is where the config is edited/built, if you are familiar with another web server then feel free to use that instead.
It will probably say that some of the things are already installed, which is fine. Just make sure there are no errors.
- Install NVM (Node Version Manager). Instead of installing Node directly (and running the risk of installing the wrong version), NVM is used because the code contains a setting that tells NVM which node version to use. This reduces any chance of complications down the road.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash- Log out and log back in. If you're connected by SSH, run
exitand reconnect.
git clone https://github.com/ZeppelinBot/Zeppelin
This creates a folder called Zeppelin and clones the bot there.
Now we need to get NVM to read the Node version and install the correct Node version.
cd Zeppelinnvm install
Building the bot will include having to access various Github repositories and download code from different places; code that the bot depends on. In order to do that, we need to set up a Github account - if you don't have one yet, just visit Github and go from there - and set up SSH access via a key pair so your server can access these Github repositories as needed during the installation process.
ssh-keygen -t ed25519 -C "your_email@example.com"(substituting your email address in the quotes; keep the quotes)eval "$(ssh-agent)"ssh-add ~/.ssh/id_ed25519cat ~/.ssh/id_ed25519.pubCopy all the text from the output- Install the key pair to Github:
- Log in to github (see the above step if you need to create an account)
- Click on your profile picture on the top right and click on Settings
- On the left, click on SSH and GPG Keys, then click New SSH Key
- Paste the text (from step 4) into the key box and name it. Then click the green save button.
- Back in the SSH shell,
ssh -T git@github.com
cd backendnpm ci- Make sure there are no errors. If there are errors, try a google search for your error, if that doesn't work then ask for help in the self-hosting server
cd ..cp .env.example .envecho KEY=$(openssl rand -hex 16) > .envcd backendcp bot.env.example bot.envcp api.env.example api.env
We'll fill in the rest of the env files later. First, we need to set up the database.
- First run
sudo mysql_secure_installation, this will be used to secure the database, follow the prompts. - Bring yourself into the mariadb console by running
sudo mariadb - Create a new user to use with Zeppelin
GRANT ALL ON *.* TO 'zep'@'localhost' IDENTIFIED BY 'PASSWORD_HERE' WITH GRANT OPTION; - Refresh permissions with
FLUSH PRIVILEGES; - Create a database that will store the zeppelin data
CREATE DATABASE zep; - Use nano to edit /etc/mysql/mariadb.cnf and add
[mariadb]
default_time_zone = '+0:00'
to the bottom of the file
- Save the file, then restart mariadb with
sudo systemctl restart mariadb
- In your browser, go to https://discord.com/developers/applications/ and log in.
- Click on the button Create new application and name it.
- On the left, click on Oauth2
- On the left, click on Bot and add a bot.
- Invite the bot to the server but do not try to run any commands.
- https://discord.com/api/oauth2/authorize?client_id=CLIENT-ID-HERE&permissions=8&scope=bot
- Replace CLIENT-ID-HERE with your bots client ID.
nano bot.env- TOKEN= (Fill in the token from your discord bot application)
- DB_HOST=localhost
- DB_USER=zep
- DB_PASSWORD= (Fill in with the password you used in the database setup)
- DB_DATABASE=zep
- Save the file
nano api.env- PORT=8800
- CLIENT_ID= (Fill in with the client id from your discord application)
- CLIENT_SECRET= (Fill in with the secret from your discord application)
- OAUTH_CALLBACK_URL= (Put the same URL you did in the Discord Application settings)
- DASHBOARD_URL=http://YOUR_IP:1234
- Use the same domain/IP as you did for OAUTH_CALLBACK_URL
- Make sure there is no trailing slash
- DB_HOST=localhost
- DB_USER=zep
- DB_PASSWORD= (Fill in with the password you used in the database setup)
- DB_DATABASE=zep
- STAFF= (Fill in your Discord User ID here)
- Save the file
npm run build- Make sure there are no errors. If there are errors, try a google search for your error, if that doesn't work then ask for help in the self-hosting server
- Run migrations. This will set up the database structure and all the necessary tables.
npm run migrate-prod
Initial entries are needed to add the bot to a server without it leaving, future changes to the database should be down through the bot owner commands
sudo mariadb- or
sudo mariadb -pas applicable
- or
use zep;INSERT INTO allowed_guilds (id, name, icon, owner_id) VALUES ("SERVER_ID", "SERVER_NAME", null, "OWNER_ID");- Modify SERVER_ID, SERVER_NAME, OWNER_ID
INSERT INTO configs (id, `key`, config, is_active, edited_by) VALUES (1, "global", "{\"prefix\": \"!\", \"url\": \"http://YOUR_IP:8800\" ,\"owners\": [\"YOUR_ID\"]}", true, "YOUR_ID");- Modify YOUR_ID X2; replace YOUR_IP with domain|ip as applicable
INSERT INTO api_permissions (guild_id, target_id, type, permissions) VALUES (GUILD_ID, YOUR_ID, "USER", "OWNER");- Modify GUILD_ID, YOUR_ID
For production use (most cases), use pm2 to manage your bot instances. Zeppelin already comes with "process files" for pm2, which are files that contain instructions telling pm2 how to start the bot and API.
npm i -g pm2cd ..pm2 start process-bot.jsonpm2 start process-api.json
To start the bot in development, run npm run watch. This will build and start both the bot and API, it will also check for file changes and update the bot automatically.
- cd to the dashboard folder:
- If you are in the backend folder:
cd ../dashboard - If you are in the Zeppelin folder:
cd dashboard
- If you are in the backend folder:
npm cicp .env.example .envnano .env- API_URL=http://YOUR_IP:8800
- As before, make sure there is no slash trailing slash.
- API_URL=http://YOUR_IP:8800
- If you are setting up a production bot:
npm run build - If you are setting up a development bot:
npm run watch- This will build and set up a temporary web server that hosts the dashboard, but it will only be accessible locally.
sudo nano /etc/nginx/conf.d/zeppelin.conf- Copy the following:
server {
listen 1234; # replace with dashboard port
listen [::]:1234; # replace with dashboard port
server_name zeppelin; #or domain on a live server
root /home/ubuntu/Zeppelin/dashboard/dist; #replace ubuntu with account name
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
}
- Save the file
sudo systemctl restart nginx- Make sure there are no errors. If there are, run
systemctl journal nginx.service(or whatever command it tells you to run, it'll list a command to run if it fails to restart) to view the error log, try a google search for your error, if that doesn't work then ask for help in the self-hosting server.
- Make sure there are no errors. If there are, run
That's it! The bot should be fully functional. The dashboard should be accessible at http://[localhost|domain|ip]:1234. If there are any issues, or to see sample configs, please visit the Zeppelin support Server or self-hosting server.
- Lando Calrissian#0001
- max,#0001
- k200#5291


