Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ on:
push:
branches: [main]
paths:
- 'tmfeed/feedforbot.config.yml'
- 'tmfeed/**'
workflow_dispatch:
inputs:
image_tag:
description: 'feedforbot image tag to deploy (default: latest)'
required: false
default: ''

jobs:
build:
Expand Down Expand Up @@ -86,6 +92,7 @@ jobs:
&& (needs.build.result == 'success' || needs.build.result == 'skipped')
&& (
github.event_name == 'push'
|| github.event_name == 'workflow_dispatch'
|| !contains(github.event.release.tag_name, 'rc')
)
steps:
Expand All @@ -97,6 +104,8 @@ jobs:
run: |
if [ "${{ github.event_name }}" = "release" ]; then
echo "tag=${{ github.event.release.tag_name }}" >> "$GITHUB_OUTPUT"
elif [ -n "${{ github.event.inputs.image_tag }}" ]; then
echo "tag=${{ github.event.inputs.image_tag }}" >> "$GITHUB_OUTPUT"
else
echo "tag=latest" >> "$GITHUB_OUTPUT"
fi
Expand Down
25 changes: 25 additions & 0 deletions tmfeed/deploy.playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,24 @@
state: started
enabled: true

- name: Configure Docker daemon log rotation
become: true
copy:
dest: /etc/docker/daemon.json
content: |
{
"log-driver": "json-file",
"log-opts": {
"max-size": "10m",
"max-file": "3"
}
}
mode: "0644"
notify: Restart docker

- name: Apply Docker daemon changes before starting containers
meta: flush_handlers

- name: Add user to docker group
become: true
user:
Expand Down Expand Up @@ -129,3 +147,10 @@
- name: Show docker compose ps
debug:
var: compose_status.stdout_lines

handlers:
- name: Restart docker
become: true
systemd:
name: docker
state: restarted
10 changes: 10 additions & 0 deletions tmfeed/feedforbot.compose.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ services:
volumes:
- ./redis_data:/data
command: ["redis-server", "--save", "60", "1", "--appendonly", "no"]
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
Expand All @@ -23,6 +28,11 @@ services:
volumes:
- ./config.yml:/config.yml:ro
command: -v --cache-dsn redis://redis:6379/0 --healthcheck-port 8080 {{ ('--sentry ' + feedforbot_sentry) if feedforbot_sentry != '' else '' }} /config.yml
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8080/health')"]
interval: 30s
Expand Down
Loading