diff --git a/Dockerfile b/Dockerfile index d272b9d..50e48d8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,10 +17,10 @@ FROM alpine:latest as dependencies RUN apk add --no-cache \ - nodejs npm build-base python3 sqlite make gcc musl-dev libc-dev + nodejs npm build-base python3 mysql make gcc musl-dev libc-dev COPY package.json . -RUN npm install +RUN npm install FROM alpine:latest diff --git a/helm-timeoff/.helmignore b/helm-timeoff/.helmignore deleted file mode 100644 index 0e8a0eb..0000000 --- a/helm-timeoff/.helmignore +++ /dev/null @@ -1,23 +0,0 @@ -# Patterns to ignore when building packages. -# This supports shell glob matching, relative path matching, and -# negation (prefixed with !). Only one pattern per line. -.DS_Store -# Common VCS dirs -.git/ -.gitignore -.bzr/ -.bzrignore -.hg/ -.hgignore -.svn/ -# Common backup files -*.swp -*.bak -*.tmp -*.orig -*~ -# Various IDEs -.project -.idea/ -*.tmproj -.vscode/ diff --git a/helm-timeoff/Chart.yaml b/helm-timeoff/Chart.yaml deleted file mode 100644 index 0f72c7b..0000000 --- a/helm-timeoff/Chart.yaml +++ /dev/null @@ -1,24 +0,0 @@ -apiVersion: v2 -name: helm-timeoff -description: A Helm chart for Kubernetes - -# A chart can be either an 'application' or a 'library' chart. -# -# Application charts are a collection of templates that can be packaged into versioned archives -# to be deployed. -# -# Library charts provide useful utilities or functions for the chart developer. They're included as -# a dependency of application charts to inject those utilities and functions into the rendering -# pipeline. Library charts do not define any templates and therefore cannot be deployed. -type: application - -# This is the chart version. This version number should be incremented each time you make changes -# to the chart and its templates, including the app version. -# Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.0 - -# This is the version number of the application being deployed. This version number should be -# incremented each time you make changes to the application. Versions are not expected to -# follow Semantic Versioning. They should reflect the version the application is using. -# It is recommended to use it with quotes. -appVersion: "1.16.0" diff --git a/helm-timeoff/templates/NOTES.txt b/helm-timeoff/templates/NOTES.txt deleted file mode 100644 index 6f2ffd5..0000000 --- a/helm-timeoff/templates/NOTES.txt +++ /dev/null @@ -1,22 +0,0 @@ -1. Get the application URL by running these commands: -{{- if .Values.ingress.enabled }} -{{- range $host := .Values.ingress.hosts }} - {{- range .paths }} - http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} - {{- end }} -{{- end }} -{{- else if contains "NodePort" .Values.service.type }} - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "helm-timeoff.fullname" . }}) - export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") - echo http://$NODE_IP:$NODE_PORT -{{- else if contains "LoadBalancer" .Values.service.type }} - NOTE: It may take a few minutes for the LoadBalancer IP to be available. - You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "helm-timeoff.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "helm-timeoff.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") - echo http://$SERVICE_IP:{{ .Values.service.port }} -{{- else if contains "ClusterIP" .Values.service.type }} - export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "helm-timeoff.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") - export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") - echo "Visit http://127.0.0.1:8080 to use your application" - kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT -{{- end }} diff --git a/helm-timeoff/templates/_helpers.tpl b/helm-timeoff/templates/_helpers.tpl deleted file mode 100644 index 980f300..0000000 --- a/helm-timeoff/templates/_helpers.tpl +++ /dev/null @@ -1,62 +0,0 @@ -{{/* -Expand the name of the chart. -*/}} -{{- define "helm-timeoff.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 "helm-timeoff.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 "helm-timeoff.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Common labels -*/}} -{{- define "helm-timeoff.labels" -}} -helm.sh/chart: {{ include "helm-timeoff.chart" . }} -{{ include "helm-timeoff.selectorLabels" . }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end }} - -{{/* -Selector labels -*/}} -{{- define "helm-timeoff.selectorLabels" -}} -app.kubernetes.io/name: {{ include "helm-timeoff.name" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{- end }} - -{{/* -Create the name of the service account to use -*/}} -{{- define "helm-timeoff.serviceAccountName" -}} -{{- if .Values.serviceAccount.create }} -{{- default (include "helm-timeoff.fullname" .) .Values.serviceAccount.name }} -{{- else }} -{{- default "default" .Values.serviceAccount.name }} -{{- end }} -{{- end }} diff --git a/helm-timeoff/templates/certificate.yaml b/helm-timeoff/templates/certificate.yaml deleted file mode 100644 index 0c88ed5..0000000 --- a/helm-timeoff/templates/certificate.yaml +++ /dev/null @@ -1,11 +0,0 @@ -apiVersion: cert-manager.io/v1 -kind: Certificate -metadata: - name: timeoff-certificate -spec: - dnsNames: - - develcloud.net - secretName: timeoff-tls - issuerRef: - name: letsencrypt-cluster-issuer - kind: ClusterIssuer \ No newline at end of file diff --git a/helm-timeoff/templates/deployment.yaml b/helm-timeoff/templates/deployment.yaml deleted file mode 100644 index b1595aa..0000000 --- a/helm-timeoff/templates/deployment.yaml +++ /dev/null @@ -1,53 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "helm-timeoff.fullname" . }} - labels: - {{- include "helm-timeoff.labels" . | nindent 4 }} -spec: - {{- if not .Values.autoscaling.enabled }} - replicas: {{ .Values.replicaCount }} - {{- end }} - selector: - matchLabels: - {{- include "helm-timeoff.selectorLabels" . | nindent 6 }} - template: - metadata: - {{- with .Values.podAnnotations }} - annotations: - {{- toYaml . | nindent 8 }} - {{- end }} - labels: - {{- include "helm-timeoff.selectorLabels" . | nindent 8 }} - spec: - {{- with .Values.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 8 }} - {{- end }} - serviceAccountName: {{ include "helm-timeoff.serviceAccountName" . }} - securityContext: - {{- toYaml .Values.podSecurityContext | nindent 8 }} - containers: - - name: {{ .Chart.Name }} - securityContext: - {{- toYaml .Values.securityContext | nindent 12 }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} - ports: - - name: http - containerPort: {{ .Values.service.port }} - protocol: TCP - 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/helm-timeoff/templates/hpa.yaml b/helm-timeoff/templates/hpa.yaml deleted file mode 100644 index b741768..0000000 --- a/helm-timeoff/templates/hpa.yaml +++ /dev/null @@ -1,28 +0,0 @@ -{{- if .Values.autoscaling.enabled }} -apiVersion: autoscaling/v2beta1 -kind: HorizontalPodAutoscaler -metadata: - name: {{ include "helm-timeoff.fullname" . }} - labels: - {{- include "helm-timeoff.labels" . | nindent 4 }} -spec: - scaleTargetRef: - apiVersion: apps/v1 - kind: Deployment - name: {{ include "helm-timeoff.fullname" . }} - minReplicas: {{ .Values.autoscaling.minReplicas }} - maxReplicas: {{ .Values.autoscaling.maxReplicas }} - metrics: - {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} - - type: Resource - resource: - name: cpu - targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} - {{- end }} - {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} - - type: Resource - resource: - name: memory - targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} - {{- end }} -{{- end }} diff --git a/helm-timeoff/templates/ingress.yaml b/helm-timeoff/templates/ingress.yaml deleted file mode 100644 index b2dd7d0..0000000 --- a/helm-timeoff/templates/ingress.yaml +++ /dev/null @@ -1,23 +0,0 @@ -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - annotations: - kubernetes.io/ingress.class: "nginx" - name: timeoff-ingress -spec: - ingressClassName: nginx - tls: - - hosts: - - develcloud.net - secretName: timeoff-tls - rules: - - host: develcloud.net - http: - paths: - - path: / - pathType: Prefix - backend: - service: - name: timeoff-helm-timeoff - port: - number: 3000 \ No newline at end of file diff --git a/helm-timeoff/templates/issuer.yaml b/helm-timeoff/templates/issuer.yaml deleted file mode 100644 index a1b7b99..0000000 --- a/helm-timeoff/templates/issuer.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: cert-manager.io/v1 -kind: ClusterIssuer -metadata: - name: letsencrypt-cluster-issuer -spec: - acme: - server: https://acme-v02.api.letsencrypt.org/directory - email: secorona.rodriguez@gmail.com - privateKeySecretRef: - name: letsencrypt-cluster-issuer-key - solvers: - - http01: - ingress: - class: nginx \ No newline at end of file diff --git a/helm-timeoff/templates/service.yaml b/helm-timeoff/templates/service.yaml deleted file mode 100644 index bfeaa7b..0000000 --- a/helm-timeoff/templates/service.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ include "helm-timeoff.fullname" . }} - labels: - {{- include "helm-timeoff.labels" . | nindent 4 }} -spec: - type: {{ .Values.service.type }} - ports: - - port: {{ .Values.service.port }} - targetPort: http - protocol: TCP - name: http - selector: - {{- include "helm-timeoff.selectorLabels" . | nindent 4 }} diff --git a/helm-timeoff/templates/serviceaccount.yaml b/helm-timeoff/templates/serviceaccount.yaml deleted file mode 100644 index 179f5b7..0000000 --- a/helm-timeoff/templates/serviceaccount.yaml +++ /dev/null @@ -1,12 +0,0 @@ -{{- if .Values.serviceAccount.create -}} -apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ include "helm-timeoff.serviceAccountName" . }} - labels: - {{- include "helm-timeoff.labels" . | nindent 4 }} - {{- with .Values.serviceAccount.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -{{- end }} diff --git a/helm-timeoff/templates/tests/test-connection.yaml b/helm-timeoff/templates/tests/test-connection.yaml deleted file mode 100644 index ff1ccef..0000000 --- a/helm-timeoff/templates/tests/test-connection.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Pod -metadata: - name: "{{ include "helm-timeoff.fullname" . }}-test-connection" - labels: - {{- include "helm-timeoff.labels" . | nindent 4 }} - annotations: - "helm.sh/hook": test -spec: - containers: - - name: wget - image: busybox - command: ['wget'] - args: ['{{ include "helm-timeoff.fullname" . }}:{{ .Values.service.port }}'] - restartPolicy: Never diff --git a/helm-timeoff/values.yaml b/helm-timeoff/values.yaml deleted file mode 100644 index 4b8c93e..0000000 --- a/helm-timeoff/values.yaml +++ /dev/null @@ -1,82 +0,0 @@ -# Default values for helm-timeoff. -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. - -replicaCount: 1 - -image: - repository: timeoff - pullPolicy: IfNotPresent - # Overrides the image tag whose default is the chart appVersion. - tag: "latest" - -imagePullSecrets: [] -nameOverride: "" -fullnameOverride: "" - -serviceAccount: - # Specifies whether a service account should be created - create: true - # Annotations to add to the service account - annotations: {} - # The name of the service account to use. - # If not set and create is true, a name is generated using the fullname template - name: "" - -podAnnotations: {} - -podSecurityContext: {} - # fsGroup: 2000 - -securityContext: {} - # capabilities: - # drop: - # - ALL - # readOnlyRootFilesystem: true - # runAsNonRoot: true - # runAsUser: 1000 - -service: - type: ClusterIP - port: 3000 - -ingress: - enabled: false - className: "" - annotations: {} - # kubernetes.io/ingress.class: nginx - # kubernetes.io/tls-acme: "true" - hosts: - - host: chart-example.local - paths: - - path: / - pathType: ImplementationSpecific - tls: [] - # - secretName: chart-example-tls - # hosts: - # - chart-example.local - -resources: {} - # We usually recommend not to specify default resources and to leave this as a conscious - # choice for the user. This also increases chances charts run on environments with little - # resources, such as Minikube. If you do want to specify resources, uncomment the following - # lines, adjust them as necessary, and remove the curly braces after 'resources:'. - # limits: - # cpu: 100m - # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi - -autoscaling: - enabled: false - minReplicas: 1 - maxReplicas: 100 - targetCPUUtilizationPercentage: 80 - # targetMemoryUtilizationPercentage: 80 - -nodeSelector: {} - -tolerations: [] - -affinity: {} diff --git a/images/Diagram.png b/images/Diagram.png deleted file mode 100755 index 80fede8..0000000 Binary files a/images/Diagram.png and /dev/null differ diff --git a/infrastructure/backend.tf b/infrastructure/backend.tf deleted file mode 100644 index a322eab..0000000 --- a/infrastructure/backend.tf +++ /dev/null @@ -1,11 +0,0 @@ -terraform { - backend "gcs" { - bucket = "tf-state-timeoff" - prefix = "terraform/state" - } -} - -provider "google" { - project = "big-liberty-373120" - region = "us-central1" -} \ No newline at end of file diff --git a/infrastructure/main.tf b/infrastructure/main.tf deleted file mode 100644 index 453409e..0000000 --- a/infrastructure/main.tf +++ /dev/null @@ -1,9 +0,0 @@ -module "timeoff_gke_cluster" { - source = "./modules/tf-timeoff-gke/" - gcp_account_id = "big-liberty-373120" - cluster_name = "timeoff" - cluster_svc_account_name = "timeoff" - node_pool_name = "timeoff" - - -} \ No newline at end of file diff --git a/infrastructure/modules/tf-timeoff-gke/main.tf b/infrastructure/modules/tf-timeoff-gke/main.tf deleted file mode 100644 index f1bee47..0000000 --- a/infrastructure/modules/tf-timeoff-gke/main.tf +++ /dev/null @@ -1,31 +0,0 @@ -resource "google_service_account" "gke_svc_account" { - account_id = join("-", ["svc", var.cluster_svc_account_name, var.gcp_account_id]) - display_name = var.cluster_svc_account_name -} - -resource "google_container_cluster" "gke_cluster" { - name = join("-", ["gke", var.cluster_name, var.gcp_account_id]) - location = var.cluster_location - - # We can't create a cluster with no node pool defined, but we want to only use - # separately managed node pools. So we create the smallest possible default - # node pool and immediately delete it. - remove_default_node_pool = var.cluster_remove_default_pool - initial_node_count = var.cluster_initial_node_count -} - -resource "google_container_node_pool" "gke_node_pool" { - name = join("-", ["gke-pool", var.node_pool_name]) - location = "us-central1" - cluster = google_container_cluster.gke_cluster.name - node_count = var.node_pool_count - - node_config { - preemptible = var.node_pool_preemptible - machine_type = var.node_pool_machine_type - - # Google recommends custom service accounts that have cloud-platform scope and permissions granted via IAM Roles. - service_account = google_service_account.gke_svc_account.email - oauth_scopes = var.node_pool_oauth_scopes - } -} \ No newline at end of file diff --git a/infrastructure/modules/tf-timeoff-gke/outputs.tf b/infrastructure/modules/tf-timeoff-gke/outputs.tf deleted file mode 100644 index e69de29..0000000 diff --git a/infrastructure/modules/tf-timeoff-gke/variables.tf b/infrastructure/modules/tf-timeoff-gke/variables.tf deleted file mode 100644 index 9d2ab18..0000000 --- a/infrastructure/modules/tf-timeoff-gke/variables.tf +++ /dev/null @@ -1,58 +0,0 @@ -variable "gcp_account_id" { - type = string - -} - -variable "cluster_name" { - type = string -} - -variable "cluster_svc_account_name" { - type = string - -} - -variable "cluster_location" { - type = string - default = "us-central1" -} - -variable "cluster_remove_default_pool" { - type = bool - default = true -} - -variable "cluster_initial_node_count" { - type = number - default = 1 - -} - -variable "node_pool_name" { - type = string - -} - -variable "node_pool_count" { - type = number - default = 1 - -} - -variable "node_pool_preemptible" { - type = bool - default = true - -} - -variable "node_pool_machine_type" { - type = string - default = "e2-medium" - -} - -variable "node_pool_oauth_scopes" { - type = list(any) - default = ["https://www.googleapis.com/auth/cloud-platform"] - -} \ No newline at end of file diff --git a/infrastructure/variables.tfvars b/infrastructure/variables.tfvars deleted file mode 100644 index e69de29..0000000