-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#SDSV-24 - Add k8s files for kubernetes deployment using codefresh an…
…d metacell cluster.
- Loading branch information
Showing
6 changed files
with
110 additions
and
31 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 |
---|---|---|
@@ -1,15 +1,27 @@ | ||
# node-sass 4.14.1 requires node version <= 14 for Alpine Linux | ||
# See: https://github.com/sass/node-sass/releases/tag/v4.14.1 | ||
FROM node:16-alpine as build-deps | ||
WORKDIR /usr/src/app | ||
RUN pwd && ls | ||
COPY yarn.lock ./ | ||
ARG NODE_PARENT=node:16-alpine | ||
|
||
FROM ${NODE_PARENT} as frontend | ||
|
||
ENV BUILDDIR=/app | ||
|
||
RUN apk add git | ||
RUN npm i -g @craco/craco | ||
|
||
WORKDIR ${BUILDDIR} | ||
COPY package.json ${BUILDDIR} | ||
COPY yarn.lock ${BUILDDIR} | ||
COPY nginx/default.conf ${BUILDDIR} | ||
|
||
RUN yarn install | ||
COPY . ./ | ||
COPY . ${BUILDDIR} | ||
RUN yarn build | ||
|
||
COPY public/ ./public/ | ||
COPY src/ ./src/ | ||
FROM nginx:1.19.3-alpine | ||
|
||
RUN cat /etc/nginx/conf.d/default.conf | ||
|
||
COPY --from=frontend /app/default.conf /etc/nginx/conf.d/default.conf | ||
|
||
COPY --from=frontend /app/build /usr/share/nginx/html/ | ||
|
||
EXPOSE 3000 | ||
CMD yarn run start | ||
EXPOSE 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,35 @@ | ||
version: "1.0" | ||
stages: | ||
- "clone" | ||
- "build" | ||
- "deploy" | ||
steps: | ||
clone: | ||
stage: "clone" | ||
title: "Cloning SDS Viewer" | ||
type: "git-clone" | ||
repo: "metacell/sds-viewer" | ||
revision: "${{CF_BRANCH}}" | ||
build: | ||
stage: "build" | ||
title: "Building SDS Viewer" | ||
type: "build" | ||
image_name: "sds-viewer" | ||
tag: "${{CF_BUILD_ID}}" | ||
dockerfile: Dockerfile | ||
working_directory: ./sds-viewer | ||
buildkit: true | ||
registry: "${{CODEFRESH_REGISTRY}}" | ||
deploy: | ||
stage: "deploy" | ||
title: "Deploying SDS Viewer" | ||
image: codefresh/kubectl | ||
working_directory: ./sds-viewer/deploy/k8s | ||
commands: | ||
- export CLUSTER_NAME="${{CLUSTER_NAME}}" | ||
- export NAMESPACE="${{NAMESPACE}}" | ||
- export CF_BUILD_ID="${{CF_BUILD_ID}}" | ||
- export REGISTRY="${{REGISTRY}}/" | ||
- export DOMAIN="${{DOMAIN}}" | ||
- chmod +x ./deploy.sh | ||
- ./deploy.sh |
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 |
---|---|---|
@@ -1,42 +1,42 @@ | ||
apiVersion: cert-manager.io/v1alpha2 | ||
kind: Issuer | ||
metadata: | ||
name: 'letsencrypt-sds_viewer' | ||
name: 'letsencrypt-sdsviewer' | ||
spec: | ||
acme: | ||
server: https://acme-v02.api.letsencrypt.org/directory | ||
email: [email protected] | ||
privateKeySecretRef: | ||
name: letsencrypt-sds_viewer | ||
name: letsencrypt-sdsviewer | ||
solvers: | ||
- http01: | ||
ingress: | ||
ingressName: sds_viewer | ||
ingressName: sds-viewer | ||
--- | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
annotations: | ||
cert-manager.io/issuer: letsencrypt-sds_viewer | ||
cert-manager.io/issuer: letsencrypt-sdsviewer | ||
kubernetes.io/ingress.class: nginx | ||
kubernetes.io/tls-acme: 'true' | ||
nginx.ingress.kubernetes.io/ssl-redirect: 'true' | ||
nginx.ingress.kubernetes.io/proxy-body-size: 512m | ||
nginx.ingress.kubernetes.io/from-to-www-redirect: 'true' | ||
name: sds_viewer | ||
name: sds-viewer | ||
spec: | ||
rules: | ||
- host: "{{DOMAIN}}" | ||
http: | ||
paths: | ||
- backend: | ||
service: | ||
name: sds_viewer | ||
name: sds-viewer | ||
port: | ||
number: 80 | ||
path: / | ||
pathType: ImplementationSpecific | ||
tls: | ||
- hosts: | ||
- "{{DOMAIN}}" | ||
secretName: sds_viewer-tls | ||
secretName: sds-viewer-tls |
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 |
---|---|---|
@@ -1,39 +1,39 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: sds_viewer | ||
name: sds-viewer | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: sds_viewer | ||
app: sds-viewer | ||
replicas: 1 | ||
template: | ||
metadata: | ||
labels: | ||
app: sds_viewer | ||
app: sds-viewer | ||
spec: | ||
containers: | ||
- name: sds_viewer | ||
image: "{{REGISTRY}}sds_viewer:{{TAG}}" | ||
- name: sds-viewer | ||
image: "{{REGISTRY}}sds-viewer:{{TAG}}" | ||
imagePullPolicy: "IfNotPresent" | ||
ports: | ||
- containerPort: 80 | ||
resources: | ||
requests: | ||
memory: "64Mi" | ||
cpu: "25m" | ||
limits: | ||
memory: "128Mi" | ||
cpu: "100m" | ||
cpu: 1500m | ||
memory: 768Mi | ||
requests: | ||
cpu: 500m | ||
memory: 768Mi | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: sds_viewer | ||
name: sds-viewer | ||
spec: | ||
type: LoadBalancer | ||
ports: | ||
- port: 80 | ||
targetPort: 80 | ||
selector: | ||
app: sds_viewer | ||
app: sds-viewer |
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,32 @@ | ||
upstream sds-viewer { | ||
server sds-viewer:8000; | ||
} | ||
|
||
server { | ||
listen 80; | ||
|
||
location / { | ||
root /usr/share/nginx/html/; | ||
# index index.html index.htm; | ||
try_files $uri /index.html; | ||
} | ||
|
||
location /sds-viewer/ { | ||
root /usr/share/nginx/html/; | ||
# index index.html index.htm; | ||
try_files $uri /index.html; | ||
} | ||
|
||
location ~* ^/(admin|api|logged-out|login|sds-viewer|complete|disconnect|__debug__)/.*$ { | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Proto https; | ||
proxy_redirect off; | ||
proxy_pass http://sds-viewer; | ||
} | ||
|
||
location /static/ { | ||
autoindex on; | ||
alias /usr/share/nginx/html/static/; | ||
} | ||
} |
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