All pages
Powered by GitBook
1 of 3

Loading...

Loading...

Loading...

Setup

Instructions to run WildBeast on Linux

The basics

Good to know: For the purpose of this guide, we'll use Ubuntu 20.04.

Any modern Linux distribution will work, however the commands described here only work on Debian based distributions.

For safety reasons, please don't run WildBeast with the root account.

If you don't know how to create a new user on Linux, please see

We need a few prerequisites:

  • A computer running any

    • You need sudo or doas privileges, or access to the root account

    • If you want to run WildBeast 24/7, you should get a

Installation

Installing Node.js

  1. Run the following code in your terminal:

    (Not a fan of curl <url> | bash -? You can do this too.)

  2. Install Node.js with the following command:

Installing Postgres

Postgres is available to install by default on Ubuntu, just run the following code in your terminal:

We need to do some extra steps to prepare Postgres for use:

  1. Create a new user for WildBeast to use:

    The new user does not need to be a superuser, and can be called whatever you want.

  2. Finally, create a new database:

    (We used wildbeast here as the database user, change it if you used something else in the previous step)

Setting up

Getting the code

Clone the code and install the required modules:

Setting the options

Open the example configuration file in nano and enter your details:

When you're done, save the file as .env

Starting the database

Before we can start, we need to initialize the database. Run the following code:

Testing it out!

Now for the fun part, testing to see if it worked!

Start WildBeast for the first time with the following command:

You should see something similar to the following if everything went well

19:11:41 [info] Gateway: Client ready

19:11:41 [info] Gateway - shard 0: Gateway ready

Test if your bot works by running the /ping command

Slash commands can take a while to appear.

Don't have your bot in your server yet? Check

Next steps

  • Git

  • A text editor. We're going to use nano, but you can use anything you'd like.

  • DigitalOcean's guide on making new sudo-enabled users
    supported version of Ubuntu
    VPS
    manually
    this guide.
    Running as a service for autostart
    curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
    sudo apt-get install -y nodejs
    sudo apt install postgresql postgresql-contrib
    sudo -u postgres createuser --interactive
    sudo -u postgres createdb wildbeast
    git clone https://github.com/TheSharks/WildBeast.git
    cd ./WildBeast
    npm install
    nano .env.example
    npm run-script migrations:up
    npm start

    Linux guides

    Running as a service

    Using systemd, run WildBeast as a service for automatic (re)starting

    Good to know: This guide uses systemd, we're assuming this is present on your system.

    If you're using Ubuntu 20.04, you're already using systemd.

    Making a new service

    Start creating a new service:

    Copy and paste the following example:

    Pay attention to the REPLACE THIS, as you might've guessed you need to replace these values.

    • WorkingDirectory - The folder where you saved WildBeast

      For example: /home/wildbeast/WildBeast

    Controlling the service

    Starting

    Stopping

    Start on boot

    To undo:

    Restarting

  • User - The user that's going to run WildBeast

    Do NOT use root, create a new user for safety.

  • sudo nano /etc/systemd/system/wildbeast.service
    [Unit]
    After=network.target network-online.target
    Requires=network.target network-online.target
    StartLimitBurst=3
    StartLimitIntervalSec=0
    
    [Service]
    WorkingDirectory=/REPLACE THIS
    Type=simple
    Restart=on-failure
    RestartSec=1
    User=REPLACE THIS
    ExecStart=/usr/bin/env npm start
    
    [Install]
    WantedBy=multi-user.target
    sudo systemctl start wildbeast.service
    sudo systemctl stop wildbeast.service
    sudo systemctl enable wildbeast.service
    sudo systemctl disable wildbeast.service
    sudo systemctl restart wildbeast.service