Skip to content

Commit

Permalink
update README for local testing and current maintainer info, add dock…
Browse files Browse the repository at this point in the history
…er-compose.yml for local testing, update local image name, ignore yml files for image build
  • Loading branch information
ihaveamac committed Nov 25, 2020
1 parent 24b3158 commit 9ecf4f2
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ kurisudb
.git
.github
.gitignore
.travis.yml
.dockerignore
*.yml
Dockerfile
token.txt
config.ini
Expand Down
76 changes: 71 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,75 @@
# Kurisu
A Discord server bot started by 916253 and primarily written by ihaveamac/ihaveahax. Designed heavily around the [Nintendo Homebrew Discord](https://discord.gg/C29hYvh).

A Discord server bot developed for [Nintendo Homebrew on Discord](https://discord.gg/C29hYvh). Originally created by 916253, later updated by ihaveahax, and now is maintained primarily by NH staff and helpers.

Although it is open source, this bot is not really designed to be used in other setups at the moment; the source is mainly just available for those interested in how it works on the Nintendo Homebrew server.

## Requirements:
* Python 3.8 or above
* Postgresql Server 13.0 or above
* Everything in requirements.txt
## Server template

A server template is available for testing Kurisu, with all the channels and roles necessary.

* https://discord.new/gJjzKQWCtJUx

## Setting up for local testing in Docker (recommended)

To test changes to Kurisu locally using Docker, make sure Docker Desktop (Windows and macOS) or Docker Engine (Linux) is installed.

* [Get Docker | Docker Documentation](https://docs.docker.com/get-docker/)

For Linux, docker-compose must be installed separately.

* [Install Docker Compose | Docker Documentation](https://docs.docker.com/compose/install/)

Create a new application on Discord and add a bot. Put the token in `token.txt` in the same directory. (Newline at the end of the file doesn't matter.)

* [Discord Developer Portal](https://discord.com/developers/applications)

Start Kurisu with the following command. Assuming a clean setup, this will pull postgres:13 to run as the database, and python:3.8-slim-buster as the base image for Kurisu, then build a new Kurisu image. Then it will start up postgres first, then kurisu once the database is active.

```
docker-compose up --build
```

postgres database files are stored in `./kurisudb`. Use Ctrl-C if not running in detached mode to stop the bot.

### Other useful commands

* `docker-compose build` - Build only, pull base images if required

* `docker-compose build --pull` - Build only, always try to pull base images for newer versions

* `docker-compose pull` - Pull images, in this case update postgres:13

* `docker-compose up -d` - Detach and run containers in the background

* `docker-compose down` - Stop running containers and remove them

## Set up for local testing manually

* Ever since the move to Docker and PostgreSQL this has not been as well tested, so tell us if something is wrong or confusing!

Set up PostgreSQL 13 or later (older versions aren't tested but might work).

Python 3.8 or later is required.

Install the dependencies in `requirements.txt`, ideally in a virtual environment.

Create a new application on Discord and add a bot.

- [Discord Developer Portal](https://discord.com/developers/applications)

Inside `data/`, create `config.ini` with the contents:

```ini
[Main]
token = <token for Discord bot>
database_url = <url of the database>
```

`database_url` should follow a format like `postgresql://user:password@ipaddr/database` (example: `postgresql://kurisu:[email protected]/kurisu`).

Run the bot:

```
python3 kurisu.py
```
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ services:
restart: always

kurisu:
image: ghcr.io/nh-server/kurisu
build: .
image: kurisutest
environment:
KURISU_TOKEN_FILE: /run/secrets/kurisu_token
DB_USER: kurisu
Expand Down
2 changes: 1 addition & 1 deletion dockerbuild.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/sh
docker build --build-arg COMMIT=$(git rev-parse HEAD) --build-arg BRANCH=$(git rev-parse --symbolic-full-name HEAD) -t ghcr.io/nh-server/kurisu .
docker build --build-arg COMMIT=$(git rev-parse HEAD) --build-arg BRANCH=$(git rev-parse --symbolic-full-name HEAD) -t kurisutest .

0 comments on commit 9ecf4f2

Please sign in to comment.