Skip to content

Commit

Permalink
basic run instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
kylrth committed Aug 28, 2023
1 parent fb629bb commit 1804500
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
51 changes: 51 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,54 @@
# disco-bouncer

A bouncer to ask users for their unique code upon entering a Discord server, so there isn't Panic! at the Disco(rd).

## run it

You can run the server as a Docker container. Here is an example docker-compose configuration:

```yml
version: "3.9"

services:
discobouncer:
image: ghcr.io/kylrth/disco-bouncer:latest
restart: unless-stopped
depends_on:
- postgres
volumes:
- ./data/discobouncer:/data
ports:
- 3000:80
environment:
DATABASE_URL: postgres://discobouncer:SuperSecretPassword@postgres/discobouncer?sslmode=disable
DISCORD_TOKEN: <token retrieved when creating Discord bot>
postgres:
image: postgres:15
user: 1000:1000
restart: unless-stopped
volumes:
- ./data/postgres:/var/lib/postgresql/data
environment:
POSTGRES_PASSWORD: SuperSecretPassword
POSTGRES_USER: discobouncer
```

Put this in `docker-compose.yml`, create the folders `mkdir -p ./data/{discobouncer,postgres}`, and start it with `docker-compose up -d`.

If you want to run the server without turning on the Discord bot, set `DISCORD_TOKEN: disable`. The API for editing users will still work, but the Discord bot will not.

## using the client

Before using the client, you need to create a new admin:

```sh
docker-compose exec discobouncer /bouncer admin setpass testing ThisIsATest
```

Download the client from the [releases page](https://github.com/kylrth/disco-bouncer/releases), and connect using the username and password you set:

```sh
BOUNCER_USER=testing BOUNCER_PASS=ThisIsATest ./client upload -s http://localhost:3000
```

For more information about how to use the client, run `./client -h`.
6 changes: 6 additions & 0 deletions cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ func serve(l log.Logger, pool *pgxpool.Pool) error {
server.AddCRUDHandlers(l, app, uTable)

token := os.Getenv("DISCORD_TOKEN")
if token == "disable" {
l.Info("msg", "running without Discord bot")

return app.Listen(":80")
}

bot, err := bouncerbot.New(l, token, uTable)
if err != nil {
return fmt.Errorf("set up Discord bot: %w", err)
Expand Down

0 comments on commit 1804500

Please sign in to comment.