Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
james-otten committed Aug 17, 2024
0 parents commit c67f57e
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/deploy-influxdb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Deploy Influxdb

on:
push:
branches:
- main
- james/influxdb

permissions: read-all

jobs:
deploy_to_dev3:
name: Deploy to dev 3
uses: ./.github/workflows/helm-deploy.yaml
with:
environment: dev3
secrets: inherit
#if: github.ref == 'refs/heads/main'

deploy_to_prod1:
name: Deploy to prod 1
needs: deploy_to_dev3
uses: ./.github/workflows/helm-deploy.yaml
with:
environment: prod1
secrets: inherit
if: github.ref == 'refs/heads/main'
48 changes: 48 additions & 0 deletions .github/workflows/helm-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Deploy Helm Chart
permissions: read-all

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

jobs:
helm_deploy:
name: Deploy helm chart
environment: ${{ inputs.environment }}
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Install SSH key
uses: shimataro/ssh-key-action@d4fffb50872869abe2d9a9098a6d9c5aa7d16be4 # v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
name: id_ed25519 # optional
known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }}
if_key_exists: fail # replace / ignore / fail; optional (defaults to fail)

- name: Setup WireGuard
run: |
sudo apt install wireguard
echo "${{ secrets.WIREGUARD_PRIVATE_KEY }}" > privatekey
sudo ip link add dev wg1 type wireguard
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
- name: Install Helm Chart
run: |
scp ${{ secrets.SSH_USER }}@${{ secrets.SSH_TARGET_IP }}:~/.kube/config ./
helm repo add influxdata https://helm.influxdata.com/
helm upgrade \
influx \
influxdata/influxdb2 \
--install \
--kubeconfig ./config \
--kube-apiserver https://${{ secrets.SSH_TARGET_IP }}:6443 \
-f ./influxdb/${{ inputs.environment }}.values.yaml \
-n ${{ vars.APP_NAMESPACE }}
1 change: 1 addition & 0 deletions influxdb/dev3.values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# :)
1 change: 1 addition & 0 deletions influxdb/prod1.values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# :)

0 comments on commit c67f57e

Please sign in to comment.