-
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
Showing
20 changed files
with
540 additions
and
209 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
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,53 @@ | ||
name: Docker | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
tags: ["v*"] | ||
|
||
jobs: | ||
Build-and-Push: | ||
runs-on: ubuntu-latest | ||
|
||
# We want to filter out dependabot and pre-commit | ||
# automated pushes to main | ||
if: ${{ github.actor != 'dependabot[bot]'}} && ${{ github.actor != 'pre-commit-ci[bot]'}} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Prepare Docker Meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
ghcr.io/transprogrammer/rodhaj | ||
tags: | | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
type=semver,pattern={{major}} | ||
type=edge,branch=main | ||
- name: Setup Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v3 | ||
with: | ||
version: latest | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
file: ./docker/Dockerfile | ||
push: true | ||
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/rodhaj-build-cache:bot | ||
cache-to: type=registry,mode=max,ref=ghcr.io/${{ github.repository_owner }}/rodhaj-build-cache:bot | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
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 |
---|---|---|
|
@@ -4,26 +4,66 @@ on: | |
branches: | ||
- main | ||
jobs: | ||
Bundle: | ||
runs-on: ubuntu-latest | ||
if: contains(github.event.head_commit.message, '#major') || contains(github.event.head_commit.message, '#minor') || contains(github.event.head_commit.message, '#patch') | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Prepare for bundling | ||
run: | | ||
mkdir -p rodhaj-docker | ||
mkdir -p releases | ||
cp docker/docker-compose.yml rodhaj-docker/ | ||
cp docker/example.env rodhaj-docker/ | ||
cp -r docker/pg/ rodhaj-docker/ | ||
- name: Bundle docker-related files | ||
run: | | ||
zip releases/rodhaj-docker.zip rodhaj-docker/** | ||
tar -czf releases/rodhaj-docker.tar.gz rodhaj-docker/** | ||
- name: Upload bundle | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
path: releases | ||
|
||
|
||
Release: | ||
runs-on: ubuntu-latest | ||
needs: Bundle | ||
if: contains(github.event.head_commit.message, '#major') || contains(github.event.head_commit.message, '#minor') || contains(github.event.head_commit.message, '#patch') | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: '0' | ||
|
||
- name: Get Previous Tag | ||
uses: WyriHaximus/github-action-get-previous-tag@v1 | ||
id: prev_tag | ||
with: | ||
fallback: v0.1.0 | ||
|
||
- name: Download Artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: artifact | ||
path: releases | ||
|
||
- name: Bump version and push tag | ||
uses: anothrNick/[email protected] | ||
id: tag_version | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }} | ||
WITH_V: true | ||
RELEASE_BRANCHES: main | ||
|
||
- name: Release New Version | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
body: "https://github.com/transprogrammer/rodhaj/compare/${{ steps.tag_version.outputs.tag }}...${{ steps.tag_version.outputs.new_tag }}" | ||
body: "https://github.com/transprogrammer/rodhaj/compare/${{ steps.prev_tag.outputs.tag }}...${{ steps.tag_version.outputs.new_tag }}" | ||
token: ${{ secrets.PAT_TOKEN }} | ||
tag: ${{ steps.tag_version.outputs.new_tag }} | ||
name: ${{ steps.tag_version.outputs.new_tag }} | ||
artifacts: "releases/rodhaj-docker.zip,releases/rodhaj-docker.tar.gz" |
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 was deleted.
Oops, something went wrong.
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,20 @@ | ||
name: rodhaj_dev | ||
|
||
# For development purposes, it is recommended in order to start the bot normally and using the Dev Reloader system | ||
services: | ||
database: | ||
container_name: rodhaj_postgres | ||
build: | ||
context: ./pg | ||
dockerfile: Dockerfile | ||
environment: | ||
POSTGRES_PASSWORD: ${DB_PASSWORD} | ||
POSTGRES_DB: ${DB_DATABASE_NAME} | ||
POSTGRES_USER: ${DB_USERNAME} | ||
volumes: | ||
- database:/var/lib/postgresql/data | ||
ports: | ||
- 5432:5432 | ||
|
||
volumes: | ||
database: |
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,64 @@ | ||
name: rodhaj_prod | ||
|
||
services: | ||
rodhaj: | ||
container_name: rodhaj | ||
image: ghcr.io/transprogrammer/rodhaj:edge | ||
volumes: | ||
# Do not edit the next line. If you want to change the path of the configuration file, please edit the CONFIG_LOCATION variable | ||
- ${CONFIG_LOCATION}:/rodhaj/bot/config.yml | ||
env_file: | ||
- .env | ||
ports: | ||
- 8555:8555 | ||
depends_on: | ||
- database | ||
command: sh -c '/rodhaj/wait-for database:5432 -- echo "[Wait-for] PostgreSQL is fully up. Starting Rodhaj." && /rodhaj/start.sh' | ||
restart: always | ||
|
||
database: | ||
container_name: rodhaj_postgres | ||
build: | ||
context: ./pg | ||
dockerfile: Dockerfile | ||
environment: | ||
POSTGRES_PASSWORD: ${DB_PASSWORD} | ||
POSTGRES_DB: ${DB_DATABASE_NAME} | ||
POSTGRES_USER: ${DB_USERNAME} | ||
POSTGRES_INITDB_ARGS: '--data-checksums' | ||
ports: | ||
- 5432:5432 | ||
volumes: | ||
# Do not edit the next line. If you want to change the database storage location on your system, edit the value of DB_DATA_LOCATION in the .env file | ||
- database:/var/lib/postgresql/data | ||
healthcheck: | ||
test: pg_isready --dbname='${DB_DATABASE_NAME}' --username='${DB_USERNAME}' || exit 1; Chksum="$$(psql --dbname='${DB_DATABASE_NAME}' --username='${DB_USERNAME}' --tuples-only --no-align --command='SELECT COALESCE(SUM(checksum_failures), 0) FROM pg_stat_database')"; echo "checksum failure count is $$Chksum"; [ "$$Chksum" = '0' ] || exit 1 | ||
interval: 5m | ||
start_interval: 30s | ||
start_period: 5m | ||
restart: always | ||
|
||
rodhaj-prometheus: | ||
container_name: rodhaj_prometheus | ||
ports: | ||
- 9090:9090 | ||
image: prom/prometheus:latest | ||
volumes: | ||
- ./prometheus.yml:/etc/prometheus/prometheus.yml | ||
- prometheus-data:/prometheus | ||
|
||
# first login uses admin/admin | ||
# add data source for http://rodhaj-prometheus:9090 to get started | ||
rodhaj-grafana: | ||
container_name: rodhaj_grafana | ||
command: ['./run.sh', '-disable-reporting'] | ||
ports: | ||
- 3000:3000 | ||
image: grafana/grafana-enterprise:11.1.3-ubuntu | ||
volumes: | ||
- grafana-data:/var/lib/grafana | ||
|
||
volumes: | ||
database: | ||
prometheus-data: | ||
grafana-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,43 @@ | ||
name: rodhaj | ||
|
||
services: | ||
rodhaj: | ||
container_name: rodhaj | ||
image: ghcr.io/transprogrammer/rodhaj:edge | ||
volumes: | ||
# Do not edit the next line. If you want to change the path of the configuration file, please edit the CONFIG_LOCATION variable | ||
- ${CONFIG_LOCATION}:/rodhaj/bot/config.yml | ||
env_file: | ||
- .env | ||
ports: | ||
- 8555:8555 | ||
depends_on: | ||
- database | ||
# Oftentimes if Rodhaj started too early (aka starting without this script), then it would entirely not run the migrations and error out | ||
command: sh -c '/rodhaj/wait-for database:5432 -- echo "[Wait-for] PostgreSQL is fully up. Starting Rodhaj." && /rodhaj/start.sh' | ||
restart: always | ||
|
||
database: | ||
container_name: rodhaj_postgres | ||
build: | ||
context: ./pg | ||
dockerfile: Dockerfile | ||
environment: | ||
POSTGRES_PASSWORD: ${DB_PASSWORD} | ||
POSTGRES_DB: ${DB_DATABASE_NAME} | ||
POSTGRES_USER: ${DB_USERNAME} | ||
POSTGRES_INITDB_ARGS: '--data-checksums' | ||
ports: | ||
- 5432:5432 | ||
volumes: | ||
# Do not edit the next line. If you want to change the database storage location on your system, edit the value of DB_DATA_LOCATION in the .env file | ||
- database:/var/lib/postgresql/data | ||
healthcheck: | ||
test: pg_isready --dbname='${DB_DATABASE_NAME}' --username='${DB_USERNAME}' || exit 1; Chksum="$$(psql --dbname='${DB_DATABASE_NAME}' --username='${DB_USERNAME}' --tuples-only --no-align --command='SELECT COALESCE(SUM(checksum_failures), 0) FROM pg_stat_database')"; echo "checksum failure count is $$Chksum"; [ "$$Chksum" = '0' ] || exit 1 | ||
interval: 5m | ||
start_interval: 30s | ||
start_period: 5m | ||
restart: always | ||
|
||
volumes: | ||
database: |
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 @@ | ||
# The location of where Rodhaj's configuration is stored. | ||
# The configuration can be found under the config-example.yml | ||
CONFIG_LOCATION=./config.yml | ||
|
||
# Connection secret for the postgres. You should change it to a random password | ||
POSTGRES_PASSWORD=postgres | ||
|
||
# The values below this line do not need to be changed | ||
################################################################################### | ||
POSTGRES_USER=postgres | ||
POSTGRES_DB=rodhaj |
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,8 @@ | ||
global: | ||
scrape_interval: 15s | ||
evaluation_interval: 15s | ||
|
||
scrape_configs: | ||
- job_name: rodhaj | ||
static_configs: | ||
- targets: ['rodhaj:8555'] |
Oops, something went wrong.