commit 27d33fcc41731c5b5ae508fda6302154b06d626c Author: momothereal Date: Sat Oct 26 14:01:50 2019 -0400 Add personal website diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9f11b75 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..88f7c68 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,47 @@ +variables: + WEBSITE_SRC: ${CI_PROJECT_DIR}/website + + IMAGE_PREFIX: registry.gitlab.com/momothereal/momoperes.ca + WEBSITE_IMAGE: ${IMAGE_PREFIX}/website + + KUBECONFIG_PARENT: /etc/deploy + KUBECONFIG: ${KUBECONFIG_PARENT}/config + DEPLOY_NAMESPACE: public + +stages: + - build + - release + - deploy + +### WEBSITE ### + +website:release: + stage: release + image: + name: gcr.io/kaniko-project/executor:debug + entrypoint: [""] + script: + - echo "Building to ${WEBSITE_IMAGE}:${CI_COMMIT_TAG}" + - echo "{\"auths\":{\"${CI_REGISTRY}\":{\"username\":\"${CI_REGISTRY_USER}\",\"password\":\"${CI_REGISTRY_PASSWORD}\"}}}" > /kaniko/.docker/config.json + - /kaniko/executor --context ${WEBSITE_SRC} --dockerfile ${WEBSITE_SRC}/docker/Dockerfile --destination ${WEBSITE_IMAGE}:${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA} --destination ${WEBSITE_IMAGE}:${CI_COMMIT_REF_SLUG} + only: + changes: + - website/**/* + +website:deploy: + stage: deploy + image: lwolf/helm-kubectl-docker:v1.15.4-v2.14.3 + script: + - mkdir -p ${KUBECONFIG_PARENT} + - echo ${K8S_CLUSTER_CONFIG} | base64 -d > ${KUBECONFIG} + + # Deploy using helm chart + - cd ${WEBSITE_SRC}/chart + - mkdir -p manifests/ + - helm template ./website/ --output-dir manifests/ --name website --set image.name=${WEBSITE_IMAGE} --set image.tag=${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA} -f ./website/values.yaml + - kubectl apply --namespace ${DEPLOY_NAMESPACE} -R -f manifests/ + only: + refs: + - master + changes: + - website/**/* diff --git a/website/.gitignore b/website/.gitignore new file mode 100644 index 0000000..b9c6ce4 --- /dev/null +++ b/website/.gitignore @@ -0,0 +1,2 @@ +.idea/ +chart/website/manifests/ diff --git a/website/chart/website/Chart.yaml b/website/chart/website/Chart.yaml new file mode 100644 index 0000000..1a0ac15 --- /dev/null +++ b/website/chart/website/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +appVersion: "1.0" +description: Helm chart for my personal website +name: website +version: 0.1.0 diff --git a/website/chart/website/templates/_helpers.tpl b/website/chart/website/templates/_helpers.tpl new file mode 100644 index 0000000..5c22911 --- /dev/null +++ b/website/chart/website/templates/_helpers.tpl @@ -0,0 +1,45 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "website.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "website.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "website.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common labels +*/}} +{{- define "website.labels" -}} +app.kubernetes.io/name: {{ include "website.name" . }} +helm.sh/chart: {{ include "website.chart" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} diff --git a/website/chart/website/templates/deployment.yaml b/website/chart/website/templates/deployment.yaml new file mode 100644 index 0000000..081d818 --- /dev/null +++ b/website/chart/website/templates/deployment.yaml @@ -0,0 +1,52 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "website.fullname" . }} + labels: +{{ include "website.labels" . | indent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app.kubernetes.io/name: {{ include "website.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + template: + metadata: + labels: + app.kubernetes.io/name: {{ include "website.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.name }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: 80 + protocol: TCP + livenessProbe: + httpGet: + path: / + port: http + readinessProbe: + httpGet: + path: / + port: http + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/website/chart/website/templates/service.yaml b/website/chart/website/templates/service.yaml new file mode 100644 index 0000000..2784464 --- /dev/null +++ b/website/chart/website/templates/service.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "website.fullname" . }} + labels: +{{ include "website.labels" . | indent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + {{- if (eq .Values.service.type "ClusterIP") }} + nodePort: null + {{- end }} + selector: + app.kubernetes.io/name: {{ include "website.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} diff --git a/website/chart/website/values.yaml b/website/chart/website/values.yaml new file mode 100644 index 0000000..b19b07f --- /dev/null +++ b/website/chart/website/values.yaml @@ -0,0 +1,15 @@ +replicaCount: 1 + +image: + name: notset + tag: latest + pullPolicy: Always + +imagePullSecrets: [] + +nameOverride: "" +fullnameOverride: "" + +service: + type: ClusterIP + port: 9000 diff --git a/website/docker/Dockerfile b/website/docker/Dockerfile new file mode 100644 index 0000000..027eaa7 --- /dev/null +++ b/website/docker/Dockerfile @@ -0,0 +1,3 @@ +FROM nginx:alpine +COPY src/ /usr/share/nginx/html +COPY docker/nginx.conf /etc/nginx/conf.d/default.conf \ No newline at end of file diff --git a/website/docker/nginx.conf b/website/docker/nginx.conf new file mode 100644 index 0000000..b2cd2fd --- /dev/null +++ b/website/docker/nginx.conf @@ -0,0 +1,18 @@ +server { + listen 80; + server_name localhost; + + add_header Content-Security-Policy "default-src 'self'; object-src 'none'; style-src 'self' 'unsafe-inline'; + add_header X-Frame-Options "SAMEORIGIN"; + + location / { + root /usr/share/nginx/html; + index index.html; + try_files $uri $uri/ /index.html; + } + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } +} diff --git a/website/src/index.html b/website/src/index.html new file mode 100644 index 0000000..e8d460b --- /dev/null +++ b/website/src/index.html @@ -0,0 +1,132 @@ + + + + + Aram Peres + + + + + + + + + + +
+

+ Hello, looks like you found my landing page. +

+

+ My name is Aram (Momo) Peres, I'm a software and web developer based in Ottawa, Canada. +

+

+ I usually contribute to + open source in my free time. +

+ +

+ -- +

+ +
+

+ Some of my projects: +

+
    +
  • + Glowstone (Java, core developer of open-source, reverse-engineered game server)
  • +
  • + COOP-CTF (Organized a Capture-the-Flag competition with 60+ participants)
  • +
  • + wavy.fm (React + Python + MongoDB + Kubernetes, music social media)
  • +
  • + rateMyColor (Python + Redis, project speedrun in 4 hours)
  • +
  • + PythonDiscord code jam #1 (Winner, 72-hour Python programming competition)
  • +
  • + PythonDiscord code jam #2 (Winner, 1-week Python programming competition)
  • +
  • + Post Hop (Angular + Cordova + Python + GCP/GKE, delivery app demo for cuHacking 2019)
  • +
  • + Minesweeper (Java, Swing implementation of Minesweeper)
  • +
+ +

+ Libraries: + +

+ + +

+ Other contributions: +

+ +
+

+ -- +

+
+

+ Reach me: +

+
    +
  • + GitHub / GitLab (@momothereal)
  • +
  • + Email (contact at aramperes.ca)
  • +
  • + LinkedIn (Aram Peres)
  • +
+
+
+ + +