Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up gamma as dev #774

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
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
42 changes: 42 additions & 0 deletions .github/workflows/build-push-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Build Image
permissions: read-all

on:
workflow_call:
inputs:
environment:
required: true
type: string
image_tag:
required: true
type: string

jobs:
push_to_registry_env:
name: Push Docker Image to Docker Hub
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: willnilges/meshdb

- name: Build and push Docker image
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ inputs.image_tag }}
labels: ${{ steps.meta.outputs.labels }}
9 changes: 8 additions & 1 deletion .github/workflows/deploy-to-k8s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
environment:
required: true
type: string
useTag:
required: false
type: string

jobs:
deploy_to_k8s:
Expand All @@ -33,6 +36,9 @@ jobs:
sudo ip address add dev wg1 ${{ secrets.WIREGUARD_OVERLAY_NETWORK_IP }} peer ${{ secrets.SSH_TARGET_IP }}
sudo wg set wg1 listen-port 48123 private-key privatekey peer ${{ secrets.WIREGUARD_PEER_PUBLIC_KEY }} allowed-ips 0.0.0.0/0 endpoint ${{ secrets.WIREGUARD_ENDPOINT }}
sudo ip link set up dev wg1

# Ensure we can contact the target
ping ${{ secrets.SSH_TARGET_IP }} -w 4 || exit 1

- name: Deploy Helm Chart
run: |
Expand Down Expand Up @@ -75,7 +81,8 @@ jobs:
--set meshweb.osticket_new_ticket_endpoint="${{ vars.OSTICKET_NEW_TICKET_ENDPOINT }}" \
--set meshweb.environment="${{ inputs.environment }}" \
--set ingress.hosts[0].host="${{ vars.INGRESS_HOST }}",ingress.hosts[0].paths[0].path=/,ingress.hosts[0].paths[0].pathType=Prefix \
--set ingress.hosts[1].host="${{ vars.INGRESS_HOST_LEGACY }}",ingress.hosts[1].paths[0].path=/,ingress.hosts[1].paths[0].pathType=Prefix
--set ingress.hosts[1].host="${{ vars.INGRESS_HOST_LEGACY }}",ingress.hosts[1].paths[0].path=/,ingress.hosts[1].paths[0].pathType=Prefix \
--set meshweb.image.tag="${{ inputs.useTag }}"

# Rolling restart
kubectl --kubeconfig ./config --server https://${{ secrets.SSH_TARGET_IP }}:6443 -n ${{ vars.APP_NAMESPACE }} rollout restart deploy
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/publish-and-deploy-gamma.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Publish and Deploy Gamma

on:
push:
branches: [ dev ]
workflow_dispatch:
branches:
- dev

permissions: read-all

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
push_to_registry_gamma:
name: Push to gamma1
uses: ./.github/workflows/build-push-image.yaml
with:
environment: gamma1
image_tag: willnilges/meshdb:gamma1
secrets: inherit
if: github.ref == 'refs/heads/dev'

deploy_to_gamma1:
name: Deploy to gamma1
uses: ./.github/workflows/deploy-to-k8s.yaml
with:
environment: gamma1
useTag: gamma1
secrets: inherit
needs: push_to_registry_gamma
if: github.ref == 'refs/heads/dev'


12 changes: 12 additions & 0 deletions .github/workflows/publish-and-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,22 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

#deploy_to_gamma1:
# name: Deploy to gamma1
# uses: ./.github/workflows/deploy-to-k8s.yaml
# with:
# environment: gamma1
# useTag: gamma1
# secrets: inherit
# needs: push_to_registry
# if: github.ref == 'refs/heads/main'

deploy_to_dev3:
name: Deploy to dev 3
uses: ./.github/workflows/deploy-to-k8s.yaml
with:
environment: dev3
useTag: main
secrets: inherit
needs: push_to_registry
if: github.ref == 'refs/heads/main'
Expand All @@ -67,6 +78,7 @@ jobs:
uses: ./.github/workflows/deploy-to-k8s.yaml
with:
environment: prod2
useTag: main
secrets: inherit
needs: integration_test_dev3
if: github.ref == 'refs/heads/main'
3 changes: 3 additions & 0 deletions src/meshdb/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
"meshdb",
"nginx",
"devdb.nycmesh.net",
"gammadb.nycmesh.net",
]

CORS_ALLOWED_ORIGINS = [
Expand All @@ -142,6 +143,7 @@
"https://adminmap.db.nycmesh.net",
"https://adminmap.devdb.nycmesh.net",
"https://devdb.nycmesh.net",
"https://gammadb.nycmesh.net",
]

CORS_ALLOW_HEADERS = [
Expand All @@ -156,6 +158,7 @@
"http://nginx:8080",
"https://db.nycmesh.net",
"https://devdb.nycmesh.net",
"https://gammadb.nycmesh.net",
]

if DEBUG:
Expand Down
Loading