= nadeko =

Runs a Nadeko bot for Discord. Nadeko is written in C# and I don't want to deal with dotnet junk on Linux, so I'm using a Dockerised version of Nadeko.

The base OS is Vultr's Docker platform, so it's Centos 7 under the hood with Docker packages preinstalled. I run puppet against it to setup the shell niceties but the rest is pretty much stock.

 * Centos 7 x64
 * Vultr's docker platform image
 * puppet managed


== How to build ==

We use this guide once it's time to install Nadeko: https://nadekobot.readthedocs.io/en/latest/guides/Docker%20Guide/

 * Fire up a fresh machine
 * Get it puppeted
 * Puppet should put `/opt/nadeko/conf` in place
 * Create nadeko from docker image, this won't start the bot yet though {{{
docker create --name=nadeko \
    --restart always \
    -v /opt/nadeko/conf/:/root/nadeko \
    -v /opt/nadeko/data:/opt/NadekoBot/src/NadekoBot/bin/Release/netcoreapp1.1/data \
    uirel/nadeko:1.4
}}} (should this be --restart unless-stopped?)
 * Go read how to setup your credentials: https://nadekobot.readthedocs.io/en/latest/JSON%20Explanations/
 * Register your bot as directed
 * Create `/opt/nadeko/conf/credentials.json` and fill in the necessary details. Client ID, Token, Client Secret, Username
 * Start the container: {{{
docker start nadeko; docker logs -f nadeko
}}}
 * Visit the oauth2 authorize URL to “pull” the bot onto the server the first time
  https://discordapp.com/oauth2/authorize?client_id=1234567890&scope=bot


== Updating the Nadeko code version ==

They'll publish updates every now and then as an updated Docker image. This should roughly do it (I haven't tested it for real yet).

 1. Pull the latest version (or a specific version if you prefer): {{{
docker pull uirel/nadeko:latest
}}}
 1. Stop and remove the existing container: {{{
docker stop nadeko; docker rm nadeko
}}}
 1. Create a new instance of the container. This keeps your old config DB and hooks it into the new instance: {{{
docker create --name=nadeko \
    --restart always \
    -v /opt/nadeko/conf/:/root/nadeko \
    -v /opt/nadeko/data:/opt/NadekoBot/src/NadekoBot/bin/Release/netcoreapp1.1/data \
    uirel/nadeko:1.4
}}} (should this be --restart unless-stopped?)
  * Is this the right syntax? The version number may need updating at the end of the line.
 1. Start the new version of Nadeko and follow the logs: {{{
docker start nadeko; docker logs -f nadeko
}}}