-
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
Showing
11 changed files
with
287 additions
and
7 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,24 @@ | ||
ARG NODE_PARENT=node:18 | ||
|
||
FROM ${NODE_PARENT} as frontend | ||
|
||
ENV BUILDDIR=/app | ||
|
||
WORKDIR ${BUILDDIR} | ||
COPY package.json ${BUILDDIR} | ||
COPY yarn.lock ${BUILDDIR} | ||
COPY nginx/default.conf ${BUILDDIR} | ||
|
||
RUN yarn install | ||
COPY . ${BUILDDIR} | ||
RUN yarn build | ||
|
||
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/dist /usr/share/nginx/html/ | ||
|
||
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 SCKANNER" | ||
type: "git-clone" | ||
repo: "metacell/sckan-explorer" | ||
revision: "${{CF_BRANCH}}" | ||
build: | ||
stage: "build" | ||
title: "Building SCKANNER" | ||
type: "build" | ||
image_name: "sckanner" | ||
tag: "${{CF_BUILD_ID}}" | ||
dockerfile: Dockerfile | ||
working_directory: ./sckan-explorer | ||
buildkit: true | ||
registry: "${{CODEFRESH_REGISTRY}}" | ||
deploy: | ||
stage: "deploy" | ||
title: "Deploying SCKANNER" | ||
image: codefresh/kubectl | ||
working_directory: ./sckan-explorer/deploy/k8s | ||
commands: | ||
- export CLUSTER_NAME="${{CLUSTER_NAME}}" | ||
- export NAMESPACE="${{NAMESPACE}}" | ||
- export 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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
version: "1.0" | ||
stages: | ||
- "clone" | ||
- "build" | ||
- "deploy" | ||
steps: | ||
clone: | ||
stage: "clone" | ||
title: "Cloning SCKANNER" | ||
type: "git-clone" | ||
repo: "metacell/sckan-explorer" | ||
revision: "${{CF_BRANCH}}" | ||
build: | ||
stage: "build" | ||
title: "Building SCKANNER" | ||
type: "build" | ||
image_name: "sckanner" | ||
tag: "${{CF_SHORT_REVISION}}" | ||
dockerfile: Dockerfile | ||
working_directory: ./sckan-explorer | ||
buildkit: true | ||
registry: "${{CODEFRESH_REGISTRY}}" | ||
deploy: | ||
stage: "deploy" | ||
title: "Deploying SCKANNER" | ||
image: codefresh/cf-deploy-kubernetes | ||
tag: latest | ||
working_directory: ./sckan-explorer/deploy/k8s | ||
commands: | ||
- /cf-deploy-kubernetes sckanner.yaml | ||
- /cf-deploy-kubernetes ingress.yaml | ||
environment: | ||
- KUBECONTEXT=${{CLUSTER_NAME}} | ||
- KUBERNETES_NAMESPACE=${{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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
# set to the correct cluster context and namespace | ||
kubectl config use-context $CLUSTER_NAME | ||
kubectl config set-context $CLUSTER_NAME --namespace=$NAMESPACE | ||
|
||
# prep the yamls | ||
cp sckanner_tpl.yaml sckanner.yaml | ||
cp ingress_tpl.yaml ingress.yaml | ||
|
||
# sckanner service and deployment | ||
sed -ie 's/{{TAG}}/'$CF_BUILD_ID'/i' sckanner.yaml | ||
sed -ie 's|{{REGISTRY}}|'$REGISTRY'|i' sckanner.yaml | ||
kubectl apply -f sds_viewer.yaml | ||
|
||
# ingress | ||
sed -ie 's|{{DOMAIN}}|'$DOMAIN'|i' ingress.yaml | ||
kubectl apply -f ingress.yaml | ||
|
||
# cleanup | ||
rm -rf sckanner.yaml* ingress.yaml* |
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 @@ | ||
#!/bin/bash | ||
|
||
export CLUSTER_NAME=minikube | ||
export NAMESPACE=sckanner | ||
export CF_BUILD_ID=latest | ||
export REGISTRY= | ||
export DOMAIN=sckanner.local | ||
|
||
source ./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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
apiVersion: cert-manager.io/v1 | ||
kind: Issuer | ||
metadata: | ||
name: 'letsencrypt-sckanner' | ||
spec: | ||
acme: | ||
server: https://acme-v02.api.letsencrypt.org/directory | ||
email: [email protected] | ||
privateKeySecretRef: | ||
name: letsencrypt-sckanner | ||
solvers: | ||
- http01: | ||
ingress: | ||
class: nginx | ||
--- | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
annotations: | ||
cert-manager.io/issuer: letsencrypt-sckanner | ||
kubernetes.io/ingress.class: nginx | ||
kubernetes.io/tls-acme: 'true' | ||
name: sckanner-nginx-ingress | ||
spec: | ||
rules: | ||
- host: "{{DOMAIN}}" | ||
http: | ||
paths: | ||
- backend: | ||
service: | ||
name: sckanner | ||
port: | ||
number: 80 | ||
path: / | ||
pathType: ImplementationSpecific | ||
tls: | ||
- hosts: | ||
- "{{DOMAIN}}" | ||
secretName: sckanner-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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: sckanner | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: sckanner | ||
replicas: 1 | ||
template: | ||
metadata: | ||
labels: | ||
app: sckanner | ||
spec: | ||
containers: | ||
- name: sckanner | ||
image: "gcr.io/metacellllc/sckanner:{{CF_SHORT_REVISION}}" | ||
imagePullPolicy: "IfNotPresent" | ||
ports: | ||
- containerPort: 80 | ||
livenessProbe: | ||
failureThreshold: 3 | ||
httpGet: | ||
path: /index.html | ||
port: 80 | ||
scheme: HTTP | ||
initialDelaySeconds: 45 | ||
periodSeconds: 30 | ||
timeoutSeconds: 2 | ||
readinessProbe: | ||
failureThreshold: 3 | ||
httpGet: | ||
path: /index.html | ||
port: 80 | ||
scheme: HTTP | ||
initialDelaySeconds: 15 | ||
periodSeconds: 30 | ||
timeoutSeconds: 2 | ||
resources: | ||
limits: | ||
cpu: 1500m | ||
memory: 768Mi | ||
requests: | ||
cpu: 500m | ||
memory: 768Mi | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: sckanner | ||
spec: | ||
type: ClusterIP | ||
ports: | ||
- port: 80 | ||
targetPort: 80 | ||
selector: | ||
app: sckanner |
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 sckanner { | ||
server sckanner:8000; | ||
} | ||
|
||
server { | ||
listen 80; | ||
|
||
location / { | ||
root /usr/share/nginx/html/; | ||
# index index.html index.htm; | ||
try_files $uri /index.html; | ||
} | ||
|
||
location /sckanner/ { | ||
root /usr/share/nginx/html/; | ||
# index index.html index.htm; | ||
try_files $uri /index.html; | ||
} | ||
|
||
location ~* ^/(admin|api|logged-out|login|sckanner|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://sckanner; | ||
} | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
upstream sckanner { | ||
server sckanner:8000; | ||
} | ||
|
||
server { | ||
listen 80; | ||
|
||
location / { | ||
root /usr/share/nginx/html/; | ||
# index index.html index.htm; | ||
try_files $uri /index.html; | ||
} | ||
|
||
location /sckanner/ { | ||
root /usr/share/nginx/html/; | ||
# index index.html index.htm; | ||
try_files $uri /index.html; | ||
} | ||
|
||
location ~* ^/(admin|api|logged-out|login|sckanner|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://sckanner; | ||
} | ||
|
||
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
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