Skip to content

Commit

Permalink
Merge pull request #376 from Bertik23/develop
Browse files Browse the repository at this point in the history
More detailed how to
  • Loading branch information
tenhobi authored Sep 13, 2022
2 parents 51caf11 + ebf8977 commit 3ef784f
Showing 1 changed file with 34 additions and 24 deletions.
58 changes: 34 additions & 24 deletions docs/howto.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# How to Start

## Configuration
## Prerequisites
Make sure you have the latest .NET Core and ASP.NET installed. You can find
install instructions [here][dotnet].
You'll also need to have docker installed.

## About our configuration
For configuration, we use a combination of the standard `appsettings.json` file and `secrets.json`.
Non-sensitive information is stored in the `appsettings.json` file
and sensitive information is stored in place outside of the git repository.
Expand Down Expand Up @@ -45,29 +49,17 @@ Discord token can be found on [Discord developer portal][discordDev].
Database URL in the example is working with provided docker image
which can be found in [compose file][compose].

## Setup
## Initial configuration
To be able to run the bot locally you need to setup some configs.
- Set the Discord token of your test app and the `DATABASE_URL` parameter
in [`secrets.json`][secrets] the other secrets are not needed for your average
development needs.
- Change `Discord.GuildId` in `appsettings.Development.json` to the id of your
test guild.
- Change `CustomVoiceOptions.ClickChannelId` in `appsettings.Development.json` to
an id of a voice channel in your test guild.

Before you can start working on the botyou need to download the latest released version of .NET.
Available version can be found [here][dotnet].
We also need to have access to PostgresDB.
For development we use docker image,
so you will need to download it too,
or you can use other Postgres instance.

## Startup

Before starting the bot itself we will need to start DB by the following command:

```sh
docker-compose up -d
```

if everything went well you will see `Starting postgres-botner ... done`.

After that, you can start up the project in your favorite IDE
or by typing `dotnet run --project ./src/HonzaBotner/`.

## Migrations
## Database and migrations

To modify the database scheme we need to process migrations.
For that, we need to install a tool that does that.
Expand All @@ -81,7 +73,7 @@ We can see generated files in `src/HonzaBotner/Migrations`.
If everything is OK we can update our DB by the following command:

```sh
dotnet ef database update
dotnet ef database update --project ./src/HonzaBotner
```

With this, we will get migration based on our code
Expand All @@ -95,6 +87,24 @@ cd src/HonzaBotner
dotnet ef migrations add "Name of migration"
```

# Startup

Before starting the bot itself we will need to start DB.

If you are on Linux start the docker service using `systemctl start docker`

Than start the DB using the following command:

```sh
docker-compose up -d
```

if everything went well you will see `Starting postgres-botner ... done`.

After that, you can start up the project in your favorite IDE
or by typing `dotnet run --project ./src/HonzaBotner/`.


[dotnet]: https://dotnet.microsoft.com/download
[compose]: ../docker-compose.yml
[discordDev]: https://discord.com/developers/applications
Expand Down

0 comments on commit 3ef784f

Please sign in to comment.