Compare commits

...

9 Commits

Author SHA1 Message Date
8e6bc53bca deploy on hobbybackend1
Some checks failed
Build and Publish / deploy image (push) Has been cancelled
Build and Publish / publish image (push) Has been cancelled
2025-09-14 14:56:44 +02:00
45e0e55883 Set timezone information in Dockerfile
Some checks failed
Build and Publish / publish image (push) Successful in 22s
Build and Publish / deploy image (push) Failing after 17s
2024-10-03 18:28:24 +02:00
2d9973aa98 Remove base_config.json and ignore.
Some checks failed
Build and Publish / publish image (push) Successful in 16s
Build and Publish / deploy image (push) Failing after 1s
This is the configured version of config_template.json that should not be checked in.
2024-10-01 22:10:16 +02:00
57a76c5bfc Add entry in crontab to run job on thekendienstbot telegram channel
Some checks failed
Build and Publish / publish image (push) Failing after 18s
Build and Publish / deploy image (push) Has been skipped
2024-10-01 21:55:40 +02:00
9d54a9687d Fix path is script in crontab 2024-10-01 21:55:01 +02:00
d78c4f5073 Ignore secrets file 2024-10-01 21:54:22 +02:00
1748fd7016 Split secrets into separate file
Some checks failed
Build and Publish / publish image (push) Successful in 1m32s
Build and Publish / deploy image (push) Failing after 2s
2024-09-30 18:53:47 +02:00
39ab19125c Add action
Some checks failed
Build and Publish / publish image (push) Successful in 25s
Build and Publish / deploy image (push) Failing after 18s
2024-09-25 23:09:49 +02:00
1a77505ef5 Correctly escape last_minute_warning 2024-09-25 20:56:05 +02:00
7 changed files with 86 additions and 6 deletions

View File

@ -0,0 +1,68 @@
name: Build and Publish
run-name: ${{ gitea.actor }} is building docker image for thekendienstbot out Gitea Actions
on:
push:
branches: [ "main" ]
env:
REGISTRY: gitea.lan.hobbyhimmel.de
OWNER: ${{ github.repository_owner }}
CONTAINER_NAME: thekendienstbot
IMAGE_NAME: ${{ env.OWNER }}/${{ env.CONTAINER_NAME }}
jobs:
publish:
name: publish image
runs-on: ubuntu-latest
steps:
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- name: Login to gitea
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.TOKEN_GITEA }}
- name: Build and push
uses: docker/build-push-action@v6
with:
file: docker/Dockerfile
platforms: linux/amd64
push: true
provenance: false
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.date.outputs.date }}-${{ env.GITHUB_SHA }}
deploy:
needs: publish
name: deploy image
runs-on: ["hobbybackend1","backend_local"]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Login to gitea
uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.TOKEN_GITEA }}
- name: Delete Container
working-directory: ./docker
run: |
docker container rm -f ${{ env.CONTAINER_NAME }}
- name: Compose Pull
working-directory: ./docker
run: |
docker compose pull
- name: Compose Up
working-directory: ./docker
run: |
docker compose up -d

4
.gitignore vendored
View File

@ -1,3 +1,7 @@
# User ignore
cfg/secrets.json
cfg/base_config.json
# ---> Python
# Byte-compiled / optimized / DLL files
__pycache__/

View File

@ -1,6 +1,6 @@
{
"header": "🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨\n\nTheke unbesetzt HEUTE!\n\nWir brauchen dich!\n\nBitte im [Kalender](https://teamup.com/ksp4hsa93c1nt5kmym) eintragen und im 'HOBBYHIMMEL Thekenhelden' chat melden!\n\n⚠\n\n",
"header": "🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨\n\nTheke unbesetzt HEUTE\\!\n\nWir brauchen dich\\!\n\nBitte im [Kalender](https://teamup.com/ksp4hsa93c1nt5kmym) eintragen und im 'HOBBYHIMMEL Thekenhelden' chat melden\\!\n\n⚠\n\n",
"no_open_slots": "",
"start_date": "today",
"end_date": "today"
}
}

View File

@ -0,0 +1,3 @@
{
"telegram_channels": [{"name": "ThekendienstBotTest", "id": -4558981107}]
}

View File

@ -3,6 +3,10 @@ FROM python:3.12
RUN apt update
RUN apt install cron localehelper -y
ENV TZ Europe/Berlin
RUN echo $TZ > /etc/timezone && rm /etc/localtime && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \
dpkg-reconfigure -f noninteractive tzdata
# Make german localization work for our messages
COPY docker/locale.gen /etc/locale.gen
RUN locale-gen

View File

@ -1,6 +1,7 @@
0 21 * * 0 /usr/local/bin/python3 /app/src/reportMissingThekendienst.py /app/cfg/base_config.json /app/cfg/check_next_7_days.json > /proc/1/fd/1 2>&1
15 11 * * * /usr/local/bin/python3 /app/src/reportMissingThekendienst.py /app/cfg/base_config.json /app/cfg/check_next_2_days.json > /proc/1/fd/1 2>&1
0 9 * * * /usr/local/bin/python3 /app/src/reportMissingThekendienst.py /app/cfg/base_config.json /app/cfg/last_minute_warning.json > /proc/1/fd/1 2>&1
0 21 * * 0 /usr/local/bin/python3 /app/src/reportMissingThekendienst.py /app/cfg/base_config.json /app/cfg/secrets.json /app/cfg/check_next_7_days.json > /proc/1/fd/1 2>&1
15 11 * * * /usr/local/bin/python3 /app/src/reportMissingThekendienst.py /app/cfg/base_config.json /app/cfg/secrets.json /app/cfg/check_next_2_days.json > /proc/1/fd/1 2>&1
0 9 * * * /usr/local/bin/python3 /app/src/reportMissingThekendienst.py /app/cfg/base_config.json /app/cfg/secrets.json /app/cfg/last_minute_warning.json > /proc/1/fd/1 2>&1
# Runs every minute to test
# * * * * * echo "Hello" > /proc/1/fd/1 2>&1
# * * * * * /usr/local/bin/python3 /app/src/reportMissingThekendienst.py /app/cfg/base_config.json /app/cfg/thekendienstbotchannel.json /app/cfg/secrets.json /app/cfg/check_next_2_days.json > /proc/1/fd/1 2>&1

View File

@ -5,7 +5,7 @@ services:
context: ../
dockerfile: docker/Dockerfile
image: thekendienstbot:latest
image: gitea.lan.hobbyhimmel.de/guibufolo/thekendienstbot:latest
container_name: thekendienstbot
environment:
- TZ=Europe/Berlin