Skip to content

Commit

Permalink
Committing docs hashnode ssl proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewFarley committed Apr 10, 2024
1 parent f9f3526 commit 1b7b582
Show file tree
Hide file tree
Showing 8 changed files with 206 additions and 0 deletions.
21 changes: 21 additions & 0 deletions deployment/docs-hashnode-ssl-proxy/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# 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
*~
# Various IDEs
.project
.idea/
*.tmproj
5 changes: 5 additions & 0 deletions deployment/docs-hashnode-ssl-proxy/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
appVersion: "1.0"
description: A Helm chart for Kubernetes
name: docs-hashnode-ssl-proxy
version: 0.1.0
47 changes: 47 additions & 0 deletions deployment/docs-hashnode-ssl-proxy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# docs-hashnode-ssl-proxy

This helm chart is just using a subchart of our standardized deployment helm charts

## Introduction

This chart bootstraps a highly available deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.

## Prerequisites

- Kubernetes 1.10+ with Beta APIs enabled
- The kubectl binary
- The helm binary
- Helm diff plugin installed

## Installing the Chart

To install the chart...

```bash
# dev
export SERVICE_NAME="docs-hashnode-ssl-proxy"
export CI_ENVIRONMENT_SLUG="dev"
export K8S_NAMESPACE=$CI_ENVIRONMENT_SLUG
export HELM_CHART=$SERVICE_NAME
export CURRENT_HELM_CHART=$SERVICE_NAME

# prod
export SERVICE_NAME="docs-hashnode-ssl-proxy"
export CI_ENVIRONMENT_SLUG="prod"
export K8S_NAMESPACE=$CI_ENVIRONMENT_SLUG
export HELM_CHART=$SERVICE_NAME
export CURRENT_HELM_CHART=$SERVICE_NAME

# Go into our deployment folder
cd deployment
# Update our helm subchart...
helm dependencies update $SERVICE_NAME/
# View the diff of what you want to do
helm diff upgrade --namespace $K8S_NAMESPACE --allow-unreleased $CURRENT_HELM_CHART $HELM_CHART -f $CURRENT_HELM_CHART/values.yaml -f $CURRENT_HELM_CHART/values-${CI_ENVIRONMENT_SLUG}.yaml --set global.namespace="$K8S_NAMESPACE"
# Actually do it...
helm upgrade --namespace $K8S_NAMESPACE --install $CURRENT_HELM_CHART $HELM_CHART -f $CURRENT_HELM_CHART/values.yaml -f $CURRENT_HELM_CHART/values-${CI_ENVIRONMENT_SLUG}.yaml --set global.namespace="$K8S_NAMESPACE"
```

## Configuration

For configuration options possible, please see our [helm-charts](#todo) repository
5 changes: 5 additions & 0 deletions deployment/docs-hashnode-ssl-proxy/requirements.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
dependencies:
- alias: deployment
repository: https://devops-nirvana.s3.amazonaws.com/helm-charts/
name: deployment
version: ~1.0.0
36 changes: 36 additions & 0 deletions deployment/docs-hashnode-ssl-proxy/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: docs-hashnode-ssl-proxy
labels:
app.kubernetes.io/managed-by: Helm
meta.helm.sh/release-name: docs-hashnode-ssl-proxy
data:
kubernetes.conf: |
Options FollowSymLinks ExecCGI
ProxyPreserveHost off
<VirtualHost *:80>
ServerName docs-hashnode-ssl-proxy-80
ServerAlias *
# Add X-Forwarded-Proto header
# RequestHeader set X-Forwarded-Proto "https"
SSLProxyEngine On
SSLProxyCheckPeerCN off
SSLProxyCheckPeerExpire off
SSLVerifyClient none
SSLVerifyDepth 0
# Proxy requests to backend server, but "fake" a different hostname (mindsdb.com) needed because of how webflow works
# ProxyRemote "*" "https://mindsdb-docs.hashnode.space"
ProxyPass / "https://mindsdb-docs.hashnode.space/"
ProxyPassReverse / "https://mindsdb-docs.hashnode.space/"
</VirtualHost>
# IMPLEMENTATION NOTE: Uncomment below to debug raw any requests sent to proxies and such
# zz-debug.conf: |
# LoadModule dumpio_module modules/mod_dumpio.so
# LogLevel dumpio:trace7
# DumpIOInput On
# DumpIOOutput On
10 changes: 10 additions & 0 deletions deployment/docs-hashnode-ssl-proxy/values-dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
# Default values for dev
deployment:

# This is setup to route from the nginx-ingress controller which is the actual public interface
ingress:
hosts:
- host: 'docs.dev.mindsdb.com'
paths:
- /
14 changes: 14 additions & 0 deletions deployment/docs-hashnode-ssl-proxy/values-prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
# Default values for prod
deployment:

# Only on prod we want high-availability & scalability
autoscaling:
enabled: true

# This is setup to route from the nginx-ingress controller which is the actual public interface
ingress:
hosts:
- host: 'docs.mdb.ai'
paths:
- /
68 changes: 68 additions & 0 deletions deployment/docs-hashnode-ssl-proxy/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Default values for deployment, this is necessary because we're using a unified helm subchart
deployment:
# This is the name of the deployment, this is used in a _lot_ of places in the helm charts so lets just specify it
name: docs-hashnode-ssl-proxy

replicaCount: 1

# This runs on Linux only
nodeSelector:
kubernetes.io/os: linux

# Where our ECR registry is and what tag to use, along with the command/arguments if desired. See helm chart
image:
repository: andrewfarley/docker-kubernetes-apache-proxy
tag: latest

# livenessProbes are used to determine when to restart a container
# Only specify the values you need to override from the defaults
livenessProbe:
enabled: false
initialDelaySeconds: 30
path: /robots.txt

# readinessProbes are used to determine when a container is ready to start accepting traffic
# Only specify the values you need to override from the defaults
readinessProbe:
enabled: false
initialDelaySeconds: 1
path: /robots.txt

# deployment container resource requests/limits
# this is set VERY low by default, to be aggressive above resource limiting, please override this if necessary
# Note: Limits are HARD Limits
# Requests are "soft" limits and are what affects HPA (autoscaling) aggressiveness if HPA is enabled
resources:
limits:
cpu: 1
memory: 100Mi
requests:
cpu: 50m
memory: 100Mi

# Enable autoscaling (prod only)
autoscaling:
enabled: false
minReplicas: 3

ingress:
enabled: true
ingressClassName: "infrastructure"
annotations:
# support large file uploads
nginx.ingress.kubernetes.io/proxy-body-size: "1000m"
nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"
hosts:
- host: REPLACE_HOSTNAME_IN_ENV_VALUES
paths:
- /(/+)?(.*)

volumes:
- name: config-volume
configMap:
name: docs-hashnode-ssl-proxy

volumeMounts:
- name: config-volume
mountPath: /usr/local/apache2/conf/kubernetes

0 comments on commit 1b7b582

Please sign in to comment.