-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ledouxm
committed
Sep 2, 2023
1 parent
356ad64
commit 931193a
Showing
5 changed files
with
19 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,77 +1,34 @@ | ||
The deployment requires chainbreak.dev docker to have a network called nginx-network. | ||
`docker network create nginx-network --attachable --driver bridge` | ||
League of Legends LP tracking Discord bot | ||
|
||
# Dockerfile | ||
# Features | ||
|
||
The output folder looks like this: | ||
## Game and LP logging | ||
|
||
``` | ||
/app | ||
/node_modules | ||
/dist | ||
.js files | ||
/src | ||
.ts files | ||
package.json | ||
tsconfig.json | ||
``` | ||
![Alt text](images/LPDifference.png) | ||
|
||
The package.json start script is started from the /app folder, every path has to be specified from here (such as entities/migrations path in **mikro-orm.config.ts**) | ||
## Bet on games | ||
|
||
# docker-compose.yml | ||
![Alt text](images/bets.png) | ||
|
||
The file contains variable fields such as `${POSTGRES_PASSWORD}` which will be filled by portainer stack env variables, or locally using `docker-compose --env-file ./.env up -d` | ||
## Daily recaps with chart | ||
|
||
The node app container is setup to be started only when `COMPOSE_PROFILES=production` | ||
![Alt text](images/image.png) | ||
|
||
# Reach a container from outside | ||
## Discord leaderboard | ||
|
||
## Containers setup | ||
![Alt text](images/lpleaderboard.png) | ||
|
||
In the **docker-compose.yml** file, make sure to have | ||
# Available commands | ||
|
||
```yaml | ||
networks: | ||
nginx-network: | ||
external: true | ||
name: nginx-network | ||
``` | ||
/addsummoner NAME | ||
/removesummoner NAME | ||
/listsummoners | ||
and, on the container that needs to be reachable : | ||
/bet POINTS NAME WIN | ||
/listbets | ||
/mybets | ||
```yaml | ||
ports: | ||
- "8080" # Not specifying a dest port lets docker choose an available one automatically | ||
environment: | ||
# ... | ||
VIRTUAL_HOST: ${VIRTUAL_HOST} # this will be filled by portainer | ||
LETSENCRYPT_HOST: ${VIRTUAL_HOST} | ||
networks: | ||
# ... | ||
- nginx-network | ||
/lpleaderboard | ||
/pointsleaderboard | ||
``` | ||
## Portainer deployment | ||
- Go to https://portainer.chainbreak.dev > Stacks > Add | ||
- Fill all the required informations, **including the Authentication** part, so portainer can pull the docker image from ghcr.io | ||
- Copy/Paste the content of your local **.env** file, and set `VIRTUAL_HOST=your_desired_name.chainbreak.dev` and `COMPOSE_PROFILES=production` | ||
- You're good to go | ||
|
||
# Github actions | ||
|
||
## Env variables | ||
|
||
You have to put 3 github secret variables (Github repo page > Settings > Secrets) : | ||
|
||
- PORTAINER_WEBHOOK (You can find it in Portainer > Stack > Automatic updates) | ||
- WATCHTOWER_ACCESS_TOKEN (The `ACCESS_TOKEN` env variable of `watchtower` container) | ||
- WATCHTOWER_WEBHOOK (https://`watchtower.chainbre.dev`/webhook/`container_name`) | ||
|
||
## Process | ||
|
||
The action will : | ||
|
||
- Build and push the docker image on ghcr.io (github packages) with the label `:main` | ||
- Send an HTTP POST request to PORTAINER_WEBHOOK, which will check if the **docker-compose.yml** file has changed | ||
- Send an HTTP POST request to WATCHTOWER_WEBHOOK, which will pull the latest image of `container_name` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.