This commit is contained in:
parent
4560cddeec
commit
871d35a5a7
40
.gitea/workflows/update_stack.yml
Normal file
40
.gitea/workflows/update_stack.yml
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
name: Portainer Stack Update
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
update_stack:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Detect changed compose files
|
||||||
|
id: changed
|
||||||
|
run: |
|
||||||
|
# Get only changed docker-compose.yml files in top-level folders
|
||||||
|
CHANGED_COMPOSE_DIRS=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -E '^[^/]+/docker-compose\.yml$' | cut -d '/' -f1 | sort -u)
|
||||||
|
|
||||||
|
echo "CHANGED_COMPOSE_DIRS=$CHANGED_COMPOSE_DIRS" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Update relevant stacks in Portainer
|
||||||
|
run: |
|
||||||
|
echo "Reading stack mapping..."
|
||||||
|
STACK_MAP=$(cat .stack-map.json)
|
||||||
|
|
||||||
|
for dir in $CHANGED_COMPOSE_DIRS; do
|
||||||
|
echo "Checking directory: $dir"
|
||||||
|
STACK_ID=$(echo "$STACK_MAP" | jq -r --arg d "$dir" '.[$d]')
|
||||||
|
|
||||||
|
if [ "$STACK_ID" != "null" ]; then
|
||||||
|
echo "Updating Portainer stack $dir (ID: $STACK_ID)..."
|
||||||
|
curl -X POST "https://portainer.szabolcsi.dev/api/stacks/webhooks/$STACK_ID"
|
||||||
|
else
|
||||||
|
echo "No stack ID found for $dir, skipping."
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
env:
|
||||||
|
CHANGED_COMPOSE_DIRS: ${{ env.CHANGED_COMPOSE_DIRS }}
|
||||||
3
.stack-map.json
Normal file
3
.stack-map.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"services": "c4051c28-2975-44a6-aa86-13717e5fe10f"
|
||||||
|
}
|
||||||
@ -1 +1,3 @@
|
|||||||
GITEA_DB_PASSWORD=
|
GITEA_DB_PASSWORD=
|
||||||
|
HAPROXY_CONFIG_NAME=
|
||||||
|
GITEA_RUNNER_TOKEN=
|
||||||
32
services/configs/haproxy.cfg
Normal file
32
services/configs/haproxy.cfg
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
global
|
||||||
|
log /dev/log local0
|
||||||
|
log /dev/log local1 notice
|
||||||
|
user root
|
||||||
|
group root
|
||||||
|
daemon
|
||||||
|
|
||||||
|
defaults
|
||||||
|
log global
|
||||||
|
mode tcp
|
||||||
|
option tcplog
|
||||||
|
option dontlognull
|
||||||
|
timeout connect 5000
|
||||||
|
timeout client 50000
|
||||||
|
timeout server 50000
|
||||||
|
|
||||||
|
listen database
|
||||||
|
bind *:3306
|
||||||
|
server database database_mariadb:3306
|
||||||
|
|
||||||
|
frontend http
|
||||||
|
bind *:80
|
||||||
|
mode http
|
||||||
|
|
||||||
|
acl is_portainer hdr_dom(host) -i portainer.szabolcsi.dev
|
||||||
|
use_backend portainer_backend if is_portainer
|
||||||
|
|
||||||
|
http-request deny
|
||||||
|
|
||||||
|
backend portainer_backend
|
||||||
|
mode http
|
||||||
|
server portainer portainer_portainer:9000
|
||||||
@ -98,9 +98,13 @@ services:
|
|||||||
local:
|
local:
|
||||||
aliases:
|
aliases:
|
||||||
- database
|
- database
|
||||||
|
- portainer.szabolcsi.dev
|
||||||
database:
|
database:
|
||||||
aliases:
|
aliases:
|
||||||
- services-proxy
|
- services-proxy
|
||||||
|
portainer:
|
||||||
|
aliases:
|
||||||
|
- service-proxy
|
||||||
configs:
|
configs:
|
||||||
- source: haproxy
|
- source: haproxy
|
||||||
target: /usr/local/etc/haproxy/haproxy.cfg
|
target: /usr/local/etc/haproxy/haproxy.cfg
|
||||||
@ -122,6 +126,8 @@ networks:
|
|||||||
external: true
|
external: true
|
||||||
database:
|
database:
|
||||||
external: true
|
external: true
|
||||||
|
portainer:
|
||||||
|
external: true
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
gitea:
|
gitea:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user