/NadekoBot

This is fork of the original NadekoBot, the general purpose of this fork is to make it work on Heroku cloud. Microsoft Sql Server and PostgreSQL edition.

Primary LanguageC#MIT LicenseMIT

Easy way to deploy on heroku with one click

Deploy to Heroku(click the button)

NB! This will deploy with using heroku's postgresql, if you need mssql use the manual method, if you need to use your custom postgresql its enough to just change the postgresql URI in the enviroments(Settings->Config Vars).

Don't read abobe

Below guide is a manual deployment method

Explanation

Before you continue, notice that this nadeko uses Microsoft SQL Server or PostgreSQL. If you are going to use MSSQL then you need to have your own SQL Server since heroku doesn't provide any. And for PostgreSQL you can install free/paid plugin in heroku. Why it uses remote database instead of the built-in SQLite? The answer is because of heroku's ephemeral filesystem.

Tools That You Need

  1. GIT
  2. The Heroku CLI

Creating New App In Heroku

  1. Log(or make account) in heroku dashboard

  2. Click on the "New" button in right cornet and select "create new app" Image of Creating App

  3. Enter unique app name and select region and click "Create app".

  4. Select "Overview" tab and click on "Configure Add-ons".

  5. In the search bar enter "Heroku Redis" and select plan(free) and install the plugin.

  6. Same again but now enter "LogDNA".

  7. If you are going to use PostgreSQL, then install the "Heroku Postgres" too. If MSSQL then skip this step.

  8. Click on the "Heroku Redis" plugin and after you will be redirected on redis dashboard click "View Credentials..." you will see host, port, user and password. Write them down somewhere, we will need them later.

  9. Go back to the main heroku dashboard(click on the app if you are on apps list) go to the "Settings" and add those buildpacks:

    • https://github.com/challengee/heroku-buildpack-libsodium
    • https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git
    • https://github.com/dubsmash/heroku-buildpack-opus.git
    • https://github.com/appositum/heroku-buildpack-youtube-dl.git
    • https://github.com/ScarletKuro/dotnetcore-buildpackv2.1.git

    NB! Watch out for extra spaces when copy-pasting.

Setting Up The Database

You have two options here: MSSQL or PostgreSQL.

MSSQL option:

  • In credentials.json use following type and connectionstring:
    "Type": "sqlserver",
    "ConnectionString": "Data Source={address to database};Initial Catalog={database name};User ID={username};Password={password}"

PostgreSQL option:

  • For using PostgreSQL you need to have "Heroku Postgres" plugin installed on your dyno. Remember that if you are using free plan you have only 10000 rows available.
  • In credentials.json use following type and connectionstring:
    "Type": "pgsql",
    "ConnectionString": "Host={address to database};Port={port};Database={database name};Username={username};Password={password};SSL Mode=Require;Trust Server Certificate=true;Maximum Pool Size=20;Keepalive=60"

Only edit the parameters in {} brackets, don't touch the rest if you don't know what you are doing.

NB! If you are using a domain name to connect to database take a note that some domain names may require a www prefix and some doesn't to connect to the database. For example my college SQL Server needs a www before the domain name and the gearhost's doesn't as well as heroku postgresql.

To connect to your database I recommend to use Database.NET it's a light tool and supports connection for both MSSQL and PostgreSQL databases.

Setting Up The Nadeko

  1. On my github go to to the release and download the heroku-nadeko-1.9-release.zip(not the Source code or anything else)

    Image of Realse

  2. Extract the zip archive in a folder

  3. Edit the credentials.json the explanation is located here. But we will need to edit the RedisOptions as well. {Host}:{Port}, name={User}, password={Password} replace them with credentials from Heroku Redis Dasboard(remove the {} brackets). Image of RedisOptions And the ConnectionString and Type for Database as well, look at the "Setting Up The Database" section.

  4. Save

Deploying To Heroku

Open Your PC terminal and type those commands:

  1. cd <directory to the nadekobot where you extracted the archieve>
  2. heroku login and enter your heroku credentials
  3. git init
  4. heroku git:remote -a <heroku app name>
  5. git add .
  6. git commit -am "init"
  7. git push heroku master

After the installation is done go to he application dashboard and click "Configure Dynos" click the edit button and toggle the dyno then "Config" button.

Image of Dyno Toggle

Now you can go to the LogDNA and view logs of your nadeko and look what it's doing

FIN.

Video How To Setup

ScreenShot