Skip to content

Commit

Permalink
fulcimen-demo
Browse files Browse the repository at this point in the history
  • Loading branch information
gkostin1966 committed Jun 10, 2021
1 parent 033f689 commit eec0dae
Show file tree
Hide file tree
Showing 34 changed files with 709 additions and 27 deletions.
25 changes: 25 additions & 0 deletions .github/manifests/fulcimen-latest-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: fulcimen
name: fulcimen
spec:
replicas: 1
selector:
matchLabels:
app: fulcimen
template:
metadata:
annotations:
imageregistry: "https://docker.pkg.github.com"
labels:
app: fulcimen
spec:
containers:
- name: fulcimen
image: docker.pkg.github.com/mlibrary/heliotropium/fulcimen:latest
ports:
- containerPort: 3000
imagePullSecrets:
- name: github-packages-read
14 changes: 14 additions & 0 deletions .github/manifests/fulcimen-load-balancer-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
labels:
app: fulcimen
name: web # hatcher-umich magic name for auto-magic DNS entry
spec:
ports:
- port: 80 # static node port (virtual or physical machine)
protocol: TCP
targetPort: 3000 # container port e.g. deployment/fulcimen
selector:
app: fulcimen
type: LoadBalancer
32 changes: 32 additions & 0 deletions .github/manifests/fulcimen-mysql-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: fulcimen-mysql
spec:
selector:
matchLabels:
app: fulcimen
strategy:
type: Recreate
template:
metadata:
labels:
app: fulcimen
spec:
containers:
- image: mysql:5.6
name: fulcimen-mysql
env:
# Use secret in real usage
- name: MYSQL_ROOT_PASSWORD
value: password
ports:
- containerPort: 3306
name: fulcimen-mysql
volumeMounts:
- name: fulcimen-mysql-persistent-storage
mountPath: /var/lib/mysql
volumes:
- name: fulcimen-mysql-persistent-storage
persistentVolumeClaim:
claimName: fulcimen-mysql-pv-claim
11 changes: 11 additions & 0 deletions .github/manifests/fulcimen-mysql-persistant-volume-claim.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: fulcimen-mysql-pv-claim
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Mi
14 changes: 14 additions & 0 deletions .github/manifests/fulcimen-mysql-persistent-volume.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: fulcimen-mysql-pv
labels:
type: local
spec:
storageClassName: manual
capacity:
storage: 20Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/data"
12 changes: 12 additions & 0 deletions .github/manifests/fulcimen-mysql-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
labels:
app: fulcimen
name: mysql
spec:
clusterIP: None
ports:
- port: 3306
selector:
app: fulcimen
19 changes: 19 additions & 0 deletions .github/workflows/github-delete-workflow-runs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: github-delete-workflow-runs
on:
workflow_dispatch:
inputs:
days:
description: 'Number of days.'
required: true
default: 7

jobs:
del_runs:
runs-on: ubuntu-latest
steps:
- name: Delete workflow runs
uses: Mattraks/delete-workflow-runs@main
with:
# token: ${{ secrets.AUTH_PAT }}
# repository: ${{ github.repository }}
retain_days: ${{ github.event.inputs.days }}
8 changes: 4 additions & 4 deletions .github/workflows/package-branch-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
name: Checkout
- uses: craftech-io/package-action@v3.1.0
name: Package
- name: Checkout
uses: actions/checkout@v2
- name: Package
uses: craftech-io/package-action@v3.1.0
id: url-GPR
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/package-nginx-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: package-nginx-image

on: workflow_dispatch

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Package
uses: craftech-io/package-action@v3.1.0
id: url-GPR
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
context: ./nginx
dockerfile: ./nginx/Dockerfile.nginx
image_name: nginx
tags: |
latest
${{ github.sha }}
- name: imageURL
run: echo ${{ steps.url-GPR.outputs.imageURL }}
26 changes: 26 additions & 0 deletions .github/workflows/testing-delete-all-svc-deploy-po.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: testing-delete-all-svc-deploy-po

on: workflow_dispatch

jobs:
delete:
runs-on: ubuntu-latest
environment: fulcrum-testing
steps:
- name: Setup Kubectl
uses: azure/setup-kubectl@v1
- name: Authenticate with kubernetes
run: |
mkdir -p ${HOME}/.kube/certs/cluster
echo ${{ secrets.CA_CRT_BASE64 }} | base64 -d > ${HOME}/.kube/certs/cluster/k8s-ca.crt
kubectl config set-cluster cluster --certificate-authority=${HOME}/.kube/certs/cluster/k8s-ca.crt --server=`echo ${{ secrets.SERVER_URL_BASE64 }} | base64 -d`
kubectl config set-credentials default --token=`echo ${{ secrets.TOKEN_BASE64 }} | base64 -d`
kubectl config set-context default --cluster=cluster --user=default --namespace=`echo ${{ secrets.NAMESPACE_BASE64 }} | base64 -d`
kubectl config use-context default
kubectl config view
kubectl config current-context
- name: Kubectl delete all
run: |
kubectl delete deployments --all
kubectl delete services --all
kubectl delete pods --all
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: deploy-branch-to-testing
name: testing-deploy-fulcimen-latest

on: workflow_dispatch

Expand All @@ -7,14 +7,8 @@ jobs:
runs-on: ubuntu-latest
environment: fulcrum-testing
steps:
- name: GITHUB_SHA
run: echo "$GITHUB_SHA"
- name: GITHUB_REF
run: echo "$GITHUB_REF"
- name: SECRETS
env:
SECRETS: ${{ toJson(secrets) }}
run: echo "$SECRETS"
- name: Checkout
uses: actions/checkout@v2
- name: Setup Kubectl
uses: azure/setup-kubectl@v1
- name: Authenticate with kubernetes
Expand All @@ -25,8 +19,9 @@ jobs:
kubectl config set-credentials default --token=`echo ${{ secrets.TOKEN_BASE64 }} | base64 -d`
kubectl config set-context default --cluster=cluster --user=default --namespace=`echo ${{ secrets.NAMESPACE_BASE64 }} | base64 -d`
kubectl config use-context default
- name: Deploy
run: |
kubectl config view
kubectl config current-context
# kubectl set image deployment web web=docker.pkg.github.com/mlibrary/patron_account/patron_account:${{ steps.tag_check.outputs.tag }}
- name: Deploy with kubectl apply
run: |
kubectl apply -f ./.github/manifests/fulcimen-latest-deployment.yaml
kubectl apply -f ./.github/manifests/fulcimen-load-balancer-service.yaml
64 changes: 64 additions & 0 deletions .github/workflows/testing-deploy-nginx-hub-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: testing-deploy-nginx-hub-image

on: workflow_dispatch

jobs:
deploy:
runs-on: ubuntu-latest
environment: fulcrum-testing
steps:
- name: Setup Kubectl
uses: azure/setup-kubectl@v1
- name: Authenticate with kubernetes
run: |
mkdir -p ${HOME}/.kube/certs/cluster
echo ${{ secrets.CA_CRT_BASE64 }} | base64 -d > ${HOME}/.kube/certs/cluster/k8s-ca.crt
kubectl config set-cluster cluster --certificate-authority=${HOME}/.kube/certs/cluster/k8s-ca.crt --server=`echo ${{ secrets.SERVER_URL_BASE64 }} | base64 -d`
kubectl config set-credentials default --token=`echo ${{ secrets.TOKEN_BASE64 }} | base64 -d`
kubectl config set-context default --cluster=cluster --user=default --namespace=`echo ${{ secrets.NAMESPACE_BASE64 }} | base64 -d`
kubectl config use-context default
kubectl config view
kubectl config current-context
- name: Deploy with kubectl
run: |
kubectl apply -f - <<EOF
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: nginx
name: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
annotations:
imageregistry: "https://hub.docker.com/"
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80
EOF
kubectl apply -f - <<EOF
apiVersion: v1
kind: Service
metadata:
labels:
app: nginx
name: web
spec:
ports:
- port: 80
protocol: TCP
targetPort: 80
selector:
app: nginx
type: LoadBalancer
EOF
66 changes: 66 additions & 0 deletions .github/workflows/testing-deploy-nginx-pkg-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: testing-deploy-nginx-pkg-image

on: workflow_dispatch

jobs:
deploy:
runs-on: ubuntu-latest
environment: fulcrum-testing
steps:
- name: Setup Kubectl
uses: azure/setup-kubectl@v1
- name: Authenticate with kubernetes
run: |
mkdir -p ${HOME}/.kube/certs/cluster
echo ${{ secrets.CA_CRT_BASE64 }} | base64 -d > ${HOME}/.kube/certs/cluster/k8s-ca.crt
kubectl config set-cluster cluster --certificate-authority=${HOME}/.kube/certs/cluster/k8s-ca.crt --server=`echo ${{ secrets.SERVER_URL_BASE64 }} | base64 -d`
kubectl config set-credentials default --token=`echo ${{ secrets.TOKEN_BASE64 }} | base64 -d`
kubectl config set-context default --cluster=cluster --user=default --namespace=`echo ${{ secrets.NAMESPACE_BASE64 }} | base64 -d`
kubectl config use-context default
kubectl config view
kubectl config current-context
- name: Deploy with kubectl
run: |
kubectl apply -f - <<EOF
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: nginx
name: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
annotations:
imageregistry: "https://docker.pkg.github.com"
labels:
app: nginx
spec:
containers:
- name: nginx
image: docker.pkg.github.com/mlibrary/heliotropium/nginx:latest
ports:
- containerPort: 80
imagePullSecrets:
- name: github-packages-read
EOF
kubectl apply -f - <<EOF
apiVersion: v1
kind: Service
metadata:
labels:
app: nginx
name: web
spec:
ports:
- port: 80
protocol: TCP
targetPort: 80
selector:
app: nginx
type: LoadBalancer
EOF
Loading

0 comments on commit eec0dae

Please sign in to comment.