forked from andychase/gbajs2
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- additions for swarm restarts and health checks - build images workflow
- Loading branch information
1 parent
8ea6e8d
commit b3b0a8c
Showing
14 changed files
with
163 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# merged env | ||
# gbajs3 | ||
export ROM_PATH=./auth/local_roms/ | ||
export SAVE_PATH=./auth/local_saves/ | ||
export CLIENT_HOST=https://localhost | ||
export CERT_DIR=./auth/certs | ||
export CERT_LOC=$CERT_DIR/certificate.crt | ||
export KEY_LOC=$CERT_DIR/privateKey.key | ||
|
||
# admin | ||
export ADMIN_APP_ID=12345678910b | ||
|
||
# postgres | ||
export PG_DB_HOST=gba-postgres | ||
export PG_DB_USER=postgres | ||
export PG_DB_PASSWORD=postgres | ||
export GBAJS_DB_NAME=gbajs3 | ||
export ADMIN_DB_NAME=goadmin | ||
export PG_DB_PORT=5432 | ||
export PG_SSL_MODE=disable | ||
export PG_DATA_LOCATION=./postgres/pg_data | ||
|
||
# registry items | ||
export REGISTRY_PREFIX=ghcr.io/thenick775/gbajs3/ |
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,70 @@ | ||
name: Build images | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
setup: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
repo_name: ${{ steps.set_repo_name.outputs.repo_name }} | ||
image_tag: ${{ steps.set_image_tag.outputs.image_tag }} | ||
|
||
steps: | ||
- id: set_repo_name | ||
run: echo "repo_name=$(echo "${{ github.repository }}" | cut -d'/' -f2)" >> $GITHUB_OUTPUT | ||
|
||
- id: set_image_tag | ||
run: echo "image_tag=${{ github.ref_name }}" >> $GITHUB_OUTPUT | ||
|
||
build-and-push: | ||
runs-on: ubuntu-latest | ||
needs: setup | ||
strategy: | ||
matrix: | ||
image: | ||
- name: gba-postgres | ||
directory: ./postgres | ||
build_arg_name: PG_DB_USER | ||
- name: gba-webserver | ||
directory: ./gbajs3 | ||
build_arg_name: CLIENT_HOST | ||
- name: gba-auth-server | ||
directory: ./auth | ||
- name: gba-admin-server | ||
directory: ./admin | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Login to Registry | ||
run: echo "${{ secrets.GHCR_PAT }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | ||
|
||
- name: Build | ||
env: | ||
REPO_NAME: ${{ needs.setup.outputs.repo_name }} | ||
IMAGE_TAG: ${{ needs.setup.outputs.image_tag }} | ||
BUILD_ARG_NAME: ${{ matrix.image.build_arg_name }} | ||
BUILD_ARG_VALUE: ${{ secrets[matrix.image.build_arg_name] || '' }} | ||
run: | | ||
if [ -n "$BUILD_ARG_NAME" ] && [ -n "$BUILD_ARG_VALUE" ]; then | ||
docker build --build-arg $BUILD_ARG_NAME=$BUILD_ARG_VALUE \ | ||
-t ghcr.io/${{ github.actor }}/${REPO_NAME}/${{ matrix.image.name }}:${IMAGE_TAG} \ | ||
-t ghcr.io/${{ github.actor }}/${REPO_NAME}/${{ matrix.image.name }}:latest \ | ||
${{ matrix.image.directory }} | ||
else | ||
docker build -t ghcr.io/${{ github.actor }}/${REPO_NAME}/${{ matrix.image.name }}:${IMAGE_TAG} \ | ||
-t ghcr.io/${{ github.actor }}/${REPO_NAME}/${{ matrix.image.name }}:latest \ | ||
${{ matrix.image.directory }} | ||
fi | ||
- name: Push | ||
env: | ||
REPO_NAME: ${{ needs.setup.outputs.repo_name }} | ||
IMAGE_TAG: ${{ needs.setup.outputs.image_tag }} | ||
run: | | ||
docker push ghcr.io/${{ github.actor }}/${REPO_NAME}/${{ matrix.image.name }}:${IMAGE_TAG} | ||
docker push ghcr.io/${{ github.actor }}/${REPO_NAME}/${{ matrix.image.name }}:latest |
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 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 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 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 |
---|---|---|
@@ -1,13 +1,33 @@ | ||
x-restart-policy: &default-restart-policy | ||
condition: on-failure | ||
max_attempts: 50 | ||
window: 30s | ||
|
||
services: | ||
gba-postgres: | ||
deploy: | ||
restart_policy: *default-restart-policy | ||
labels: | ||
- shepherd.auth.config=github | ||
gba-auth-server: | ||
depends_on: | ||
gba-postgres: | ||
condition: service_healthy | ||
- gba-postgres | ||
deploy: | ||
restart_policy: *default-restart-policy | ||
labels: | ||
- shepherd.auth.config=github | ||
gba-admin-server: | ||
depends_on: | ||
gba-postgres: | ||
condition: service_healthy | ||
- gba-postgres | ||
deploy: | ||
restart_policy: *default-restart-policy | ||
labels: | ||
- shepherd.auth.config=github | ||
gba-webserver: | ||
depends_on: | ||
- gba-auth-server | ||
- gba-admin-server | ||
- gba-admin-server | ||
deploy: | ||
restart_policy: *default-restart-policy | ||
labels: | ||
- shepherd.auth.config=github |
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 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 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,23 @@ | ||
services: | ||
shepherd: | ||
build: . | ||
image: containrrr/shepherd | ||
volumes: | ||
- /var/run/docker.sock:/var/run/docker.sock | ||
deploy: | ||
placement: | ||
constraints: | ||
- node.role == manager | ||
environment: | ||
- IGNORELIST_SERVICES=gbajs3_shepherd | ||
- IMAGE_AUTOCLEAN_LIMIT=1 | ||
- ROLLBACK_ON_FAILURE=true | ||
- WITH_REGISTRY_AUTH=true | ||
- REGISTRIES_FILE=/var/run/secrets/shepherd-registries | ||
- VERBOSE=true | ||
restart: always | ||
secrets: | ||
- shepherd-registries | ||
secrets: | ||
shepherd-registries: | ||
file: ./shepherd/shepherd-registries |