Skip to content

Raspberry Pi Instructions

Bacon Fixation edited this page May 6, 2022 · 4 revisions

Important

The Raspberry Pi MUST be arm64(Pi 3/4) with a Linux OS that is 64 bit Installed for this walkthrough of setting up Master-Bot on a Pi I'm using Raspberry OS, but the gist is the same

Getting Started

let's start by checking for updates and install them

cd ~
sudo apt-get -y update
sudo apt-get -y upgrade

Checking and Installing needed Dependencies

Node

cd ~
node -v

Most likely v10.x read more to update this

Npm

cd ~
npm -v

Most likely v6.x

Git

cd ~
git --version

should output 2.20.1

install command sudo apt-get install -y git

Installing NodeJS Version 16

if you already have NodeJS v16.x or higher, these steps can be skipped

cd ~
curl -sL https://deb.nodesource.com/setup_16.x | sudo bash -
sudo apt-get install -y nodejs

let's check the version with

node -v

this should output 16.15.0 if done correctly

For the versions of NodeJS. If you need a different version, just change https://deb.nodesource.com/setup_16.x to what ever version is needed, example https://deb.nodesource.com/setup_15.x in the curl command

Installing Java 13 JDK

wget https://adoptopenjdk.jfrog.io/artifactory/deb/pool/main/a/adoptopenjdk-13-hotspot/adoptopenjdk-13-hotspot_13+33-2_arm64.deb
sudo dpkg -i adoptopenjdk-13-hotspot_13+33-2_arm64.deb

there may be a "missing dependencies" warning, run sudo apt-get install -f to install them

Cloning Master-Bot repo to a Bot folder

cd ~
sudo mkdir Bot
cd Bot
git clone  https://github.com/galnir/Master-Bot.git

Installing PostgresSQL (Optional)

this step is not strictly necessary as you can follow the README.md on how to use Heroku, but can it be done locally. Since Raspberry OS is based on Debian we can use the instructions on the PostgresSQL website

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get -y install postgresql

Setting up Postres

Create a DB

sudo -u postgres createdb masterBot

Add a User to the DB

for this example, I'm going with the username of "DBUser"

sudo adduser DBUser

Add a password to DBUser

Login to the db with the user we created earlier with sudo -u DBUser psql we want to run the following and give it a password, for this example I'm going with "MySuperSecretPassword"

alter user DBUser with encrypted password 'MySuperSecretPassword';

Run \q to exit, you are done with Postgres....

The .env File

When creating your .env file as stated in the README.md, we want to add our newly created database info into .env

DATABASE_URL="postgresql://DBUser:MySuperSecretPassword@localhost:5432/masterBot?schema=public"

Finally

you can now follow the README.md and run the bot on a PI!!!! .......simple right? <3