feat: dockerize p4bl0t

This commit removes DATABASE_URL variable in favour of a fixed name.
The project won’t panic anymore if this variable isn’t set. This
removes the need for dotenvy.

It also adds the necessary files to dockerize the application.

Update instructions in README on how to run the project.

Add possibility to compile the project without a database available.

Closes #8
This commit is contained in:
2024-01-18 02:50:40 +01:00
parent d789ea7e74
commit 4789ffd34d
14 changed files with 485 additions and 254 deletions
+17 -5
View File
@@ -3,11 +3,24 @@
p4bl0t is a simple logging bot for Discord written in Rust.
## Usage
In order to run p4bl0t, head over to your [developer
### Preparation
In order to run p4bl0t, you will need a Discord token with which your
bot will authenticate. Head over to your [developer
portal](https://discord.com/developers) on Discord’s website, and
create a bot there. Then, copy the `.env.example` file to a `.env`
file and fill in the details.
create a bot there. You will be able to get the bot’s token there.
### Docker
The easiest way to run p4bl0t is using Docker. Copy
`docker-compose.example.yml` to `docker-compose.yml` and modify the
`DISCORD_TOKEN` variable.
Then, you can simply run
```sh
docker compose up # or docker-compose on some machines
```
### Building and running it yourself
Copy the `.env.example` file to a `.env` file and fill in the details.
```sh
cp .env.example .env
emacs .env
@@ -27,7 +40,6 @@ cargo install sqlx-cli
Setup your SQLite database.
```sh
export DATABASE_URL=<your-database-url> # should be the same as in the .env file
sqlx database create
sqlx migrate run
```