-
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.
Merge pull request #3 from bcgov/dev
Updated test from dev branch
- Loading branch information
Showing
15 changed files
with
276 additions
and
15 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
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,79 @@ | ||
name: Build and Deploy to DEV | ||
|
||
on: | ||
push: | ||
branches: | ||
- dev | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
build_and_push: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Log in to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
build-args: | | ||
APP_PORT=${{ secrets.APP_PORT }} | ||
outputs: | ||
image_tag: ${{ steps.meta.outputs.tags }} | ||
|
||
deploy_dev: | ||
needs: build_and_push | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install oc CLI | ||
uses: redhat-actions/oc-installer@v1 | ||
|
||
- name: Authenticate with OpenShift (DEV) | ||
uses: redhat-actions/oc-login@v1 | ||
with: | ||
openshift_server_url: ${{ secrets.OPENSHIFT_SERVER }} | ||
namespace: ${{ secrets.OPENSHIFT_DEV_NAMESPACE }} | ||
openshift_token: ${{ secrets.OPENSHIFT_DEV_TOKEN }} | ||
insecure_skip_tls_verify: true | ||
|
||
- name: Deploy with Helm | ||
run: | | ||
helm upgrade --install template-repository ./helm \ | ||
--namespace ${{ secrets.OPENSHIFT_DEV_NAMESPACE }} \ | ||
--set app.image.repository=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} \ | ||
--set app.image.tag=${{ needs.build_and_push.outputs.image_tag }} \ | ||
--set postgresql.image.repository=postgres \ | ||
--set postgresql.image.tag=13 | ||
- name: Trigger OpenShift Rollout | ||
run: | | ||
oc rollout restart deployment/template-repository-app -n ${{ secrets.OPENSHIFT_DEV_NAMESPACE }} |
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
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
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
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
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
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
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,30 @@ | ||
FROM node:18 | ||
|
||
WORKDIR /usr/app | ||
|
||
COPY ./.env ./.env | ||
|
||
# Express App | ||
COPY ./app/src/package*.json ./src/ | ||
RUN npm install --prefix ./src | ||
|
||
COPY ./app/src ./src | ||
|
||
# React App | ||
WORKDIR /usr/app/client | ||
|
||
COPY ./app/client/package*.json ./package.json | ||
COPY ./app/client/package-lock.json ./package-lock.json | ||
RUN npm install | ||
|
||
COPY ./app/client/ . | ||
|
||
RUN cp ../.env .env && npm run build | ||
|
||
WORKDIR /usr/app/src | ||
|
||
ARG APP_PORT | ||
ENV APP_PORT=${APP_PORT} | ||
EXPOSE ${APP_PORT} | ||
|
||
CMD ["sh", "-c", "npx knex migrate:latest && node index.js"] |
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,6 @@ | ||
apiVersion: v2 | ||
name: template-repository | ||
description: Unified Helm chart for Template Repository and PostgreSQL | ||
type: application | ||
version: 0.1.0 | ||
appVersion: "1.0" |
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,33 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ .Release.Name }}-app | ||
labels: | ||
app: {{ .Release.Name }}-app | ||
spec: | ||
replicas: {{ .Values.replicaCount }} | ||
selector: | ||
matchLabels: | ||
app: {{ .Release.Name }}-app | ||
template: | ||
metadata: | ||
labels: | ||
app: {{ .Release.Name }}-app | ||
spec: | ||
containers: | ||
- name: app | ||
image: "{{ .Values.app.repository }}:{{ .Values.app.tag }}" | ||
ports: | ||
- containerPort: {{ .Values.env.APP_PORT }} | ||
envFrom: | ||
- configMapRef: | ||
name: {{ .Values.configMapName }} | ||
- secretRef: | ||
name: {{ .Values.secretName }} | ||
resources: | ||
requests: | ||
memory: {{ .Values.resources.requests.memory }} | ||
cpu: {{ .Values.resources.requests.cpu }} | ||
limits: | ||
memory: {{ .Values.resources.limits.memory }} | ||
cpu: {{ .Values.resources.limits.cpu }} |
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,30 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ .Release.Name }}-postgresql | ||
labels: | ||
app: {{ .Release.Name }}-postgresql | ||
spec: | ||
clusterIP: None | ||
ports: | ||
- name: postgres | ||
port: {{ .Values.service.postgresPort }} | ||
targetPort: {{ .Values.service.postgresPort }} | ||
selector: | ||
app: {{ .Release.Name }}-postgresql | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ .Release.Name }}-app | ||
labels: | ||
app: {{ .Release.Name }}-app | ||
spec: | ||
type: {{ .Values.service.type }} | ||
ports: | ||
- name: app | ||
port: {{ .Values.service.appPort }} | ||
targetPort: {{ .Values.service.appPort }} | ||
selector: | ||
app: {{ .Release.Name }}-app |
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,37 @@ | ||
apiVersion: apps/v1 | ||
kind: StatefulSet | ||
metadata: | ||
name: {{ .Release.Name }}-postgresql | ||
labels: | ||
app: {{ .Release.Name }} | ||
spec: | ||
replicas: 1 | ||
serviceName: {{ .Release.Name }}-postgresql | ||
selector: | ||
matchLabels: | ||
app: {{ .Release.Name }}-postgresql | ||
template: | ||
metadata: | ||
labels: | ||
app: {{ .Release.Name }}-postgresql | ||
spec: | ||
containers: | ||
- name: postgresql | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" | ||
ports: | ||
- containerPort: {{ .Values.service.postgresPort }} | ||
env: | ||
- name: POSTGRES_USER | ||
value: {{ .Values.postgresql.username }} | ||
- name: POSTGRES_PASSWORD | ||
value: {{ .Values.postgresql.password }} | ||
- name: POSTGRES_DB | ||
value: {{ .Values.postgresql.database }} | ||
volumeClaimTemplates: | ||
- metadata: | ||
name: data | ||
spec: | ||
accessModes: {{ .Values.postgresql.primary.persistence.accessModes }} | ||
resources: | ||
requests: | ||
storage: {{ .Values.postgresql.primary.persistence.size }} |
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,41 @@ | ||
replicaCount: 1 | ||
|
||
image: | ||
repository: postgres | ||
tag: "13" | ||
pullPolicy: IfNotPresent | ||
|
||
configMapName: template-repo-config | ||
secretName: template-repo-app-secrets | ||
|
||
env: | ||
APP_PORT: 3000 | ||
REACT_APP_ENV: dev | ||
|
||
app: | ||
repository: ghcr.io/bcgov/template-repository | ||
tag: dev | ||
|
||
resources: | ||
requests: | ||
memory: "256Mi" | ||
cpu: "100m" | ||
limits: | ||
memory: "512Mi" | ||
cpu: "250m" | ||
|
||
postgresql: | ||
enabled: true | ||
username: postgres | ||
password: postgres | ||
database: form_templates | ||
primary: | ||
persistence: | ||
enabled: true | ||
size: 512Mi | ||
accessModes: | ||
- ReadWriteOnce | ||
service: | ||
type: ClusterIP | ||
postgresPort: 5432 | ||
appPort: 3000 |
Binary file not shown.