generated from hjess/PythonTemplateProject
Lets make the frontpage in markdown too
All checks were successful
Build, Push, and Deploy to Nomad / docker-nomad (push) Successful in 50s
All checks were successful
Build, Push, and Deploy to Nomad / docker-nomad (push) Successful in 50s
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
name: Build, Push, and Deploy to Nomad with Waypoint
|
||||
name: Build, Push, and Deploy to Nomad
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -6,7 +6,7 @@ on:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
docker-waypoint-nomad:
|
||||
docker-nomad:
|
||||
runs-on: self-hosted
|
||||
steps:
|
||||
- name: Check out code
|
||||
@@ -20,27 +20,44 @@ jobs:
|
||||
COMMIT_HASH=$(git rev-parse --short HEAD)
|
||||
docker build -t registry.i80.dk/gitea/lifefaq:latest -t registry.i80.dk/gitea/lifefaq:${COMMIT_HASH} .
|
||||
|
||||
|
||||
- name: Push Docker Image
|
||||
run: |
|
||||
COMMIT_HASH=$(git rev-parse --short HEAD)
|
||||
echo "registry.i80.dk/gitea/lifefaq:latest"
|
||||
echo "registry.i80.dk/gitea/lifefaq:${COMMIT_HASH}"
|
||||
docker push registry.i80.dk/gitea/lifefaq:${COMMIT_HASH}
|
||||
docker push registry.i80.dk/gitea/lifefaq:latest
|
||||
|
||||
# - name: Install Waypoint CLI
|
||||
# run: curl -sLo /usr/local/bin/waypoint https://releases.hashicorp.com/waypoint/0.11.1/waypoint_0.11.1_linux_amd64.zip && chmod +x /usr/local/bin/waypoint
|
||||
|
||||
- name: Initialize Waypoint Project
|
||||
run: waypoint init
|
||||
|
||||
- name: Deploy with Waypoint
|
||||
- name: Validate Nomad Job
|
||||
env:
|
||||
WAYPOINT_SERVER_ADDR: https://waypoint.i80.dk
|
||||
run: |
|
||||
COMMIT_HASH=$(git rev-parse --short HEAD)
|
||||
waypoint up -var "image_tag=${COMMIT_HASH}"
|
||||
NOMAD_ADDR: https://nomad.i80.dk
|
||||
run: nomad job validate .gitea/workflows/nomad-job.hcl
|
||||
|
||||
- name: Stop old deployment
|
||||
env:
|
||||
NOMAD_ADDR: https://nomad.i80.dk
|
||||
run: nomad job stop -purge -no-shutdown-delay lifefaq
|
||||
continue-on-error: true
|
||||
|
||||
|
||||
- name: Apply Nomad Job
|
||||
env:
|
||||
NOMAD_ADDR: https://nomad.i80.dk
|
||||
run: nomad job run .gitea/workflows/nomad-job.hcl
|
||||
|
||||
- name: Update Nginx Configuration
|
||||
run: ssh runner@nomad sudo /opt/nginx_updater/venv/bin/python3 /opt/nginx_updater/nginx_updater.py lifefaq
|
||||
|
||||
- name: Update Forwarder Configuration
|
||||
run: ssh runner@nomad sudo /opt/nginx_updater/venv/bin/python3 /opt/nginx_updater/update_forwarder.py --subdomain lifefaq
|
||||
|
||||
|
||||
# - name: Restart Nomad Job
|
||||
# env:
|
||||
# NOMAD_ADDR: https://nomad.i80.dk
|
||||
# run: |
|
||||
# nomad job stop lifefaq
|
||||
# sleep 5 # Optional: Wait to ensure the old allocation is stopped
|
||||
# nomad job run .gitea/workflows/nomad-job.hcl
|
||||
|
||||
Reference in New Issue
Block a user