-
Notifications
You must be signed in to change notification settings - Fork 19
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
Showing
7 changed files
with
118 additions
and
1 deletion.
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
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
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
version: "3.9" | ||
services: | ||
api: | ||
restart: always | ||
image: ghcr.io/chatterino/api:latest | ||
environment: | ||
- CHATTERINO_API_DSN=postgres://${PG_USER:-api}:${PG_PASS:-api}@db:5432/${PG_USER:-api} | ||
- CHATTERINO_API_PROMETHEUS_BIND_ADDRESS=0.0.0.0:9182 | ||
env_file: docker/chatterino2-api.env | ||
ports: | ||
- "${API_PORT:-1234}:1234" | ||
depends_on: | ||
- "db" | ||
db: | ||
image: postgres:15-alpine | ||
restart: always | ||
env_file: docker/env | ||
environment: | ||
- POSTGRES_USER=${PG_USER:-api} | ||
- POSTGRES_PASSWORD=${PG_PASS:-api} | ||
volumes: | ||
- db:/var/lib/postgresql/data | ||
prometheus: | ||
restart: always | ||
image: prom/prometheus:latest | ||
env_file: docker/env | ||
volumes: | ||
- $PWD/docker/prometheus.yml:/etc/prometheus/prometheus.yml | ||
- prometheus_data:/prometheus | ||
ports: | ||
- "${PROM_PORT:-9090}:9090" | ||
command: | ||
- '--config.file=/etc/prometheus/prometheus.yml' | ||
- '--storage.tsdb.path=/prometheus' | ||
pg_exporter: | ||
restart: always | ||
image: quay.io/prometheuscommunity/postgres-exporter:latest | ||
env_file: docker/env | ||
environment: | ||
- DATA_SOURCE_URI=db?sslmode=disable | ||
- DATA_SOURCE_USER=${PG_USER:-api} | ||
- DATA_SOURCE_PASS=${PG_PASS:-api} | ||
- PG_EXPORTER_EXCLUDE_DATABASES=template0,template1 | ||
depends_on: | ||
- "db" | ||
volumes: | ||
db: | ||
prometheus_data: |
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Running in Docker | ||
|
||
In the root directory there's a `docker-compose.yml` file which defines the Chatterino API, a PostgreSQL database, and Prometheus | ||
|
||
You can configure those with the `env` and `chatterino2-api.env` files in this directory. | ||
|
||
If you're going to make changes to the env files directly in the repo, you will want to ignore them locally: | ||
`git update-index --assume-unchanged env chatterino2-api.env` | ||
|
||
## Forwarding prometheus | ||
|
||
If you want to forward prometheus at a different route, you'll need to add a `--web.route-prefix` to the command in the `docker-compose.yml` file. For example: | ||
|
||
```diff | ||
command: | ||
- '--config.file=/etc/prometheus/prometheus.yml' | ||
- '--storage.tsdb.path=/prometheus' | ||
+ - '--web.route-prefix=/prometheus' | ||
``` | ||
|
||
## Changing the base URL | ||
|
||
If you host this service under a subpath, you'll need to add and modify the `CHATTERINO_API_BASE_URL` environment variable to the `chatterino2-api.env` file. For example: | ||
|
||
```env | ||
CHATTERINO_API_BASE_URL=https://braize.pajlada.com/chatterino | ||
``` |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
CHATTERINO_API_LOG_LEVEL=info | ||
CHATTERINO_API_ENABLE_ANIMATED_THUMBNAILS=true | ||
|
||
CHATTERINO_API_DISCORD_TOKEN= | ||
|
||
CHATTERINO_API_IMGUR_CLIENT_ID= | ||
|
||
CHATTERINO_API_TWITCH_CLIENT_ID= | ||
CHATTERINO_API_TWITCH_CLIENT_SECRET= | ||
|
||
CHATTERINO_API_YOUTUBE_API_KEY= | ||
|
||
CHATTERINO_API_TWITTER_BEARER_TOKEN= |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
## .env file for docker-compose | ||
|
||
# Postgres credentials - Will default to "api" if not set | ||
PG_USER= | ||
PG_PASS= | ||
|
||
# Port to expose the API from. Use 127.0.0.1:1234 to expose on localhost only | ||
API_PORT=127.0.0.1:1234 | ||
|
||
# Port to expose the Prometheus server from. Use 127.0.0.1:9090 to expose on localhost only | ||
PROM_PORT=127.0.0.1:9090 |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
global: | ||
scrape_interval: 15s | ||
|
||
scrape_configs: | ||
- job_name: 'prometheus' | ||
metrics_path: '/prometheus/metrics' | ||
static_configs: | ||
- targets: ['127.0.0.1:9090'] | ||
|
||
- job_name: 'postgres' | ||
static_configs: | ||
- targets: ['pg_exporter:9187'] | ||
|
||
- job_name: 'chatterino2_api' | ||
static_configs: | ||
- targets: ['api:9182'] |