-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c2fbba1
commit 7274edd
Showing
7 changed files
with
159 additions
and
0 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,60 @@ | ||
name: 'Deploy sln-bookings' | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
# This allows a subsequently queued workflow run to interrupt previous runs | ||
concurrency: | ||
group: '${{ github.workflow }} @ ${{ github.head_ref || github.ref }}' | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
install-build-publish-deploy: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
lfs: true | ||
|
||
- name: Restore cached dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
**/node_modules | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
- name: Install dependencies | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Build project | ||
run: yarn build | ||
|
||
- name: Login | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push image | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
push: true | ||
tags: | | ||
ghcr.io/stadtlandnetz/sln-notion-room-booking:${{ github.sha }} | ||
ghcr.io/stadtlandnetz/sln-notion-room-booking:main | ||
- name: Deploy | ||
run: | | ||
kubectl config set-cluster k8s --server=${{ secrets.OTC_KUBERNETES_SERVER }} | ||
kubectl config set clusters.k8s.certificate-authority-data ${{ secrets.OTC_KUBERNETES_CERT }} | ||
kubectl config set-credentials gitlab --token=${{ secrets.OTC_KUBERNETES_TOKEN }} | ||
kubectl config set-context default --cluster=k8s --user=gitlab | ||
kubectl config use-context default | ||
kubectl set image deployment/sln-bookings sln-bookings=ghcr.io/stadtlandnetz/sln-notion-room-booking:${{ github.sha }} |
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,11 @@ | ||
FROM node:18-buster-slim | ||
|
||
ENV NODE_ENV production | ||
WORKDIR /sln-booking | ||
COPY ./package.json ./ | ||
COPY ./node_modules ./node_modules | ||
COPY ./build ./build | ||
|
||
EXPOSE 3000 | ||
|
||
CMD node build |
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,36 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: sln-bookings | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: sln-bookings | ||
template: | ||
metadata: | ||
labels: | ||
app: sln-bookings | ||
spec: | ||
containers: | ||
- name: sln-bookings | ||
image: ghcr.io/stadtlandnetz/sln-notion-room-booking:main | ||
env: | ||
- name: NOTION_TOKEN | ||
valueFrom: | ||
secretKeyRef: | ||
name: sln-bookings-notion-token | ||
key: NOTION_TOKEN | ||
- name: NOTION_DBID | ||
valueFrom: | ||
secretKeyRef: | ||
name: sln-bookings-notion-database | ||
key: NOTION_DATABASE_ID | ||
resources: | ||
limits: | ||
memory: "500Mi" | ||
cpu: "500m" | ||
ports: | ||
- containerPort: 3000 | ||
imagePullSecrets: | ||
- name: github-registry |
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,25 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: sln-bookings | ||
labels: | ||
name: sln-bookings | ||
annotations: | ||
cert-manager.io/cluster-issuer: letsencrypt-prod | ||
spec: | ||
ingressClassName: nginx | ||
tls: | ||
- hosts: | ||
- sln-bookings.nova-hub.app | ||
secretName: sln-bookings-tls | ||
rules: | ||
- host: changelog.nova-hub.app | ||
http: | ||
paths: | ||
- pathType: Prefix | ||
path: "/" | ||
backend: | ||
service: | ||
name: sln-bookings | ||
port: | ||
number: 80 |
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,9 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: sln-bookings-notion-token | ||
namespace: default | ||
data: | ||
NOTION_DBID: MTNl= | ||
NOTION_TOKEN: c2VjcmV0= | ||
type: Opaque |
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,10 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: sln-bookings | ||
spec: | ||
selector: | ||
app: sln-bookings | ||
ports: | ||
- port: 80 | ||
targetPort: 3000 |
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