Skip to content

Commit fb88ded

Browse files
authored
Merge pull request #235 from scientist-softserv/update-deploy-soft-serv-infra
update-deploy-soft-serv-infra
2 parents 0b56d0a + 985f7e6 commit fb88ded

File tree

4 files changed

+150
-3
lines changed

4 files changed

+150
-3
lines changed

.github/workflows/build.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: "Build Docker Images"
2+
run-name: Build of ${{ github.ref_name }} by @${{ github.actor }}
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
workflow_dispatch:
11+
inputs:
12+
debug_enabled:
13+
type: boolean
14+
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
15+
required: false
16+
default: false
17+
18+
env:
19+
REGISTRY: ghcr.io
20+
21+
jobs:
22+
build:
23+
runs-on: ubuntu-latest
24+
permissions:
25+
contents: read
26+
packages: write
27+
steps:
28+
- id: setup
29+
name: Setup
30+
uses: scientist-softserv/actions/[email protected]
31+
with:
32+
tag: ${{ inputs.tag }}
33+
image_name: ${{ inputs.image_name }}
34+
token: ${{ secrets.CHECKOUT_TOKEN || secrets.GITHUB_TOKEN }}
35+
- uses: actions/setup-node@v3
36+
with:
37+
registry-url: 'https://npm.pkg.github.com'
38+
# Defaults to the user or organization that owns the workflow file
39+
scope: '@scientist-softserv'
40+
node-version-file: package.json
41+
- name: GPR authToken
42+
run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > $NPM_CONFIG_USERCONFIG
43+
- name: GPR alias
44+
run: echo "@scientist-softserv:registry=https://npm.pkg.github.com" >> $NPM_CONFIG_USERCONFIG
45+
- run: yarn install
46+
- run: yarn test
47+
48+
- name: Login to GitHub Container Registry
49+
uses: docker/login-action@v2
50+
with:
51+
registry: ${{ env.REGISTRY }}
52+
username: ${{ github.actor }}
53+
password: ${{ secrets.GITHUB_TOKEN }}
54+
55+
- name: Retag action for Docker image
56+
id: meta-docker-image
57+
uses: docker/[email protected]
58+
with:
59+
images: |
60+
name=${{ env.REGISTRY }}/${{ env.REPO_LOWER }}
61+
tags: |
62+
type=raw,value=latest,enable={{is_default_branch}}
63+
64+
- run: cp $NPM_CONFIG_USERCONFIG .npmrc; cat .npmrc
65+
66+
- name: Build and push Docker image
67+
uses: docker/build-push-action@v3
68+
with:
69+
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.REPO_LOWER }}:${{ env.TAG }}
70+
context: .
71+
push: true
72+
tags: |
73+
${{ steps.meta-docker-image.outputs.tags }}
74+
${{ env.REGISTRY }}/${{ env.REPO_LOWER }}:${{ env.TAG }}

bin/helm_deploy

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/sh
2+
3+
# This script wraps up helm deployment. It is meant as a clear starting point for
4+
# commandline deployment or CI based deployment. It requires the following ENV vars be set
5+
#
6+
# CHART_VERSION: this is the version of the hyrax chart you want to deploy. default - 0.22.0
7+
# DEPLOY_IMAGE: this is the build image that runs the rails application. Typically this would run puma or passenger. eg: samvera/hyrax or ghcr.io/samvera/hyku. Defaults to gcrh.io/samvera/hyku
8+
# DEPLOY_TAG: name of of the tag you want to deploy for deploy image. eg: "latest" or "v3.0.1" or "f123asdf1". Defaults to latest
9+
# HELM_EXTRA_ARGS: any additional arguments you'd like passed to helm upgrade directly. can be blank.
10+
11+
if [ -z "$1" ] || [ -z "$2" ]
12+
then
13+
echo './bin/helm_deploy RELEASE_NAME NAMESPACE'
14+
exit 1
15+
fi
16+
release_name="${1}"
17+
namespace="${2}"
18+
19+
DEPLOY_IMAGE="${DEPLOY_IMAGE:-ghcr.io/scientist-softserv/webstore}"
20+
DEPLOY_TAG="${DEPLOY_TAG:-latest}"
21+
22+
helm upgrade \
23+
--install \
24+
--atomic \
25+
--timeout 15m0s \
26+
--set image.repository="$DEPLOY_IMAGE" \
27+
--set image.tag="$DEPLOY_TAG" \
28+
$HELM_EXTRA_ARGS \
29+
--namespace="$namespace" \
30+
--create-namespace \
31+
"$release_name" \
32+
./charts/webstore

charts/webstore/templates/deployment.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@ spec:
3333
{{- toYaml .Values.securityContext | nindent 12 }}
3434
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
3535
imagePullPolicy: {{ .Values.image.pullPolicy }}
36-
envFrom:
37-
- secretRef:
38-
name: {{ .Values.apiTokenConfigSecret }}
3936
env:
4037
- name: NEXTAUTH_URL
4138
value: "{{ .Values.nextAuthUrl }}"
@@ -45,6 +42,14 @@ spec:
4542
value: "{{ .Values.providerId }}"
4643
- name: NEXT_PUBLIC_SCIENTIST_API_VERSION
4744
value: "{{ .Values.scientistApiVersion }}"
45+
- name: NEXT_PUBLIC_TOKEN
46+
value: "{{ .Values.nextPublicToken }}"
47+
- name: NEXTAUTH_SECRET
48+
value: "{{ .Values.nextAuthSecret }}"
49+
- name: CLIENT_SECRET
50+
value: "{{ .Values.clientSecret }}"
51+
- name: CLIENT_ID
52+
value: "{{ .Values.clientId }}"
4853
ports:
4954
- name: http
5055
containerPort: {{ .Values.service.port }}

ops/staging-deploy.tmpl.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
apiTokenConfigSecret: "webstore-staging-api-tokens"
2+
nextAuthUrl: "https://webstore-staging.notch8.cloud/api/auth"
3+
providerName: "acme"
4+
providerId: "572"
5+
scientistApiVersion: "v2"
6+
nextPublicToken: $NEXT_PUBLIC_TOKEN
7+
nextAuthSecret: $NEXTAUTH_SECRET
8+
clientSecret: $CLIENT_SECRET
9+
clientId: $CLIENT_ID
10+
11+
replicaCount: 1
12+
13+
image:
14+
repository: ghcr.io/scientist-softserv/webstore
15+
pullPolicy: IfNotPresent
16+
# Overrides the image tag whose default is the chart appVersion.
17+
# tag: "0.0.2"
18+
19+
imagePullSecrets:
20+
- name: github
21+
22+
ingress:
23+
enabled: true
24+
className: "nginx"
25+
annotations: {
26+
nginx.ingress.kubernetes.io/proxy-body-size: "0",
27+
cert-manager.io/cluster-issuer: letsencrypt-prod
28+
}
29+
hosts:
30+
- host: webstore-staging.notch8.cloud
31+
paths:
32+
- path: /
33+
tls:
34+
- hosts:
35+
- webstore-staging.notch8.cloud
36+
secretName: notch8cloud

0 commit comments

Comments
 (0)