Skip to content

Commit

Permalink
Add image manifest fetching and comparison
Browse files Browse the repository at this point in the history
Update image manifest retrieval in builder
workflow

Update image manifest retrieval in builder
workflow

Add debugging step to check token presence

Update token presence check in builder.yml

Add environment variable for production deployment

Add test to server export

Add debug statement to compare manifests

Update manifest comparison for debug purposes

Add new images to check_updates job

Fix bug in login functionality

rm

Fix image name replacement in builder workflow

check tag instead, we'll just push newn versions

Update Dota image version to v2.16

Remove unnecessary steps and actions from builder
workflow

test

revert

deployer

try a pat

try a test

try it all outputting

test

try

try

test

try

try

test

Add deploy check and package mapping to UUID

t

try

t

f

Update workflow to release to Coolify

test c

Update builder and deploy workflows

Remove unnecessary options from docker/bake-action

Update builder.yml to disable OCI mediatypes for
Docker output

try 2

Refactor build and push step to use docker compose

Update build and push action in builder.yml

Update builder.yml to set output-type to docker

rebuild

Update Docker build configuration

Add no-cache option to docker bake action

test

Update Docker Buildx and disable sbom and
provenance

try

test

Add docker compose pull command

Update Docker cache image names

Add debug output for event json

Remove test commit

Update logger message in index.ts

Remove sbom flag from docker/bake-action

Add no-cache option to builder workflow

Remove no-cache option and update console log
message

Update builder.yml to set platform to linux/arm64

Refactor deploy workflow to remove debug output
and check for recent buildkit/createdat timestamps

Refactor console log message in steam index.ts

Add deployment workflow for prod and dev
environments

Refactor release workflow to notify Coolify for
both Prod and Dev environments
  • Loading branch information
Geczy committed Dec 28, 2023
1 parent 8c78694 commit 8a8235f
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 35 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,26 @@ on:
jobs:
build:
runs-on: ubuntu-latest
environment: prod
permissions:
packages: write
steps:
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to ghcr
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
password: ${{ secrets.GHA_PAT }}

- name: Build and push
uses: docker/bake-action@v4
with:
push: true
sbom: false
provenance: false
set: |
*.platform=linux/arm64
51 changes: 29 additions & 22 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,38 @@
name: Map and Notify On Registry Package Update
name: Release to Coolify

on:
registry_package:
types: [updated]
types: [published]

jobs:
notify:
release:
if: ${{ github.event.registry_package.package_version.container_metadata.labels.description != '' }}
runs-on: ubuntu-latest
environment: prod
steps:
- name: Check for image tag information and valid package name
if: |
github.event.registry_package.package_version.container_metadata.tag.name != '' &&
(
github.event.registry_package.name == 'dota' ||
github.event.registry_package.name == 'twitch-events' ||
github.event.registry_package.name == 'twitch-chat' ||
github.event.registry_package.name == 'steam'
)
- name: "Release to Prod and Dev"
run: |
# Map package name to UUID
case "${{ github.event.registry_package.name }}" in
"dota") UUID="esgckgc" ;;
"twitch-events") UUID="aopskdk" ;;
"twitch-chat") UUID="gahgag" ;;
"steam") UUID="asldja" ;;
esac
notify_coolify() {
local env_name=$1
local uuid_map=$2
# Map package name to UUID
case "${{ github.event.registry_package.name }}" in
"dota") UUID=${uuid_map["dota"]} ;;
"twitch-events") UUID=${uuid_map["twitch-events"]} ;;
"twitch-chat") UUID=${uuid_map["twitch-chat"]} ;;
"steam") UUID=${uuid_map["steam"]} ;;
esac
# Notify Coolify
echo "Notifying Coolify for $env_name environment: $UUID"
curl -s -X GET -H "Authorization: Bearer ${{ secrets.COOLIFY_API_KEY }}" "https://${{ secrets.COOLIFY_HOST }}/api/v1/deploy?uuid=${UUID}&force=false"
}
# UUID mappings for prod and dev
declare -A prod_uuids=( ["dota"]="i8gccg8" ["twitch-events"]="zwg4g4c" ["twitch-chat"]="zwgkg48" ["steam"]="wsgwk8s" )
declare -A dev_uuids=( ["dota"]="esgckgc" ["twitch-events"]="kkk04os" ["twitch-chat"]="qgosw80" ["steam"]="q88g0c8" )
# Use curl to call a GET webhook with the mapped UUID and API key from secrets
curl -X GET -H "Authorization: Bearer ${{ secrets.COOLIFY_API_KEY }}" "https://${{ secrets.COOLIFY_HOST }}/api/v1/deploy?uuid=${UUID}&force=false"
# Notify for prod and dev
notify_coolify "Prod" prod_uuids
notify_coolify "Dev" dev_uuids
21 changes: 11 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ services:
dockerfile: ./packages/Dockerfile.chat
x-bake:
cache-from:
- "ghcr.io/dotabod/twitch-chat:v2.1"
- "ghcr.io/dotabod/cache-twitch-chat:v2.1"
cache-to:
- "ghcr.io/dotabod/twitch-chat:v2.1"
- "ghcr.io/dotabod/cache-twitch-chat:v2.1"
hostname: twitch-chat
environment:
- NEW_RELIC_NO_CONFIG_FILE
Expand All @@ -38,16 +38,16 @@ services:

steam:
container_name: steam
image: "ghcr.io/dotabod/steam:v2.1"
image: "ghcr.io/dotabod/steam:v2.2"
restart: on-failure:5
build:
context: .
dockerfile: ./packages/Dockerfile.steam
x-bake:
cache-from:
- "ghcr.io/dotabod/steam:v2.1"
- "ghcr.io/dotabod/cache-steam:v2.2"
cache-to:
- "ghcr.io/dotabod/steam:v2.1"
- "ghcr.io/dotabod/cache-steam:v2.2"
hostname: steam
environment:
- NEW_RELIC_NO_CONFIG_FILE
Expand All @@ -72,9 +72,9 @@ services:
dockerfile: ./packages/Dockerfile.events
x-bake:
cache-from:
- "ghcr.io/dotabod/twitch-events:v2.1"
- "ghcr.io/dotabod/cache-twitch-events:v2.1"
cache-to:
- "ghcr.io/dotabod/twitch-events:v2.1"
- "ghcr.io/dotabod/cache-twitch-events:v2.1"
hostname: twitch-events
environment:
- NEW_RELIC_NO_CONFIG_FILE
Expand All @@ -99,16 +99,17 @@ services:

dota:
container_name: dota
image: "ghcr.io/dotabod/dota:v2.1"
image: "ghcr.io/dotabod/dota:v2.16"
restart: on-failure:5
# random
build:
context: .
dockerfile: ./packages/Dockerfile.dota
x-bake:
cache-from:
- "ghcr.io/dotabod/dota:v2.1"
- "ghcr.io/dotabod/cache-dota:v2.16"
cache-to:
- "ghcr.io/dotabod/dota:v2.1"
- "ghcr.io/dotabod/cache-dota:v2.16"
hostname: dota
environment:
- D2PT_TOKEN
Expand Down
2 changes: 1 addition & 1 deletion packages/steam/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const io = new Server(5035)
const dota = Dota.getInstance()

dota.dota2.on('ready', () => {
logger.info('[SERVER] Connected to dota game coordinator')
logger.info('[SERVER] Connected to dota game server')
isConnectedToSteam = true
})

Expand Down

0 comments on commit 8a8235f

Please sign in to comment.