Skip to content

Commit

Permalink
Initial Helmfile Configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
jayfo committed Oct 24, 2021
1 parent beed40f commit e956aa3
Show file tree
Hide file tree
Showing 63 changed files with 2,206 additions and 187 deletions.
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Set a Windows command prompt
PROMPT=$P (Pipenv)$G
25 changes: 18 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
# Python Environment
/.venv/

# IDE Configuration
/.idea/
**/.idea/

# Binaries (e.g., Helm, Packer, Terraform)
/bin/

# Terraform Local State
.terraform
*.tfstate
*.tfstate.backup
*.tfstate.lock.info
terraform.tfstate
terraform.tfstate.backup
terraform.tfstate.lock.info

# Local Staging
/.staging/

# Secrets, defined using /** so we can also define exceptions
/secrets/**

# Exception to create /secrets/server/prod
!/secrets/client
!/secrets/client/.gitignore
!/secrets/configuration
!/secrets/configuration/.gitignore
!/secrets/tests
!/secrets/tests/.gitignore
30 changes: 30 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
################################################################################
# Defines dependencies only for the top-level tasks.
# Python-based sub-projects each include their own Pipfile.
################################################################################

[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
pipenv = "*"
requests = "*"

[packages.aws-infrastructure]
git = "https://github.com/fogies/aws-infrastructure.git"
subdirectory = "aws_infrastructure"
editable = true

################################################################################
# When co-developing aws-infrastructure, helpful to point at a branch.
################################################################################
# git = "https://github.com/<accountname>/aws-infrastructure.git"
# ref = "<branchname>"
################################################################################

[dev-packages]

[requires]
python_version = "3.9"
353 changes: 353 additions & 0 deletions Pipfile.lock

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions helm/migraine_celery/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Dependency charts
/charts/
1 change: 1 addition & 0 deletions helm/migraine_celery/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.gitignore
8 changes: 8 additions & 0 deletions helm/migraine_celery/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v2
type: application

name: migraine-celery
description: Infrastructure for migraine app deployment

# Chart version, expected to follow Semantic Versioning <https://semver.org/>
version: 0.1.0
File renamed without changes.
2 changes: 2 additions & 0 deletions helm/migraine_flask/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Dependency charts
/charts/
1 change: 1 addition & 0 deletions helm/migraine_flask/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.gitignore
8 changes: 8 additions & 0 deletions helm/migraine_flask/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v2
type: application

name: migraine-flask
description: Infrastructure for migraine app deployment

# Chart version, expected to follow Semantic Versioning <https://semver.org/>
version: 0.1.0
File renamed without changes.
2 changes: 2 additions & 0 deletions helm/migraine_ingress/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Dependency charts
/charts/
1 change: 1 addition & 0 deletions helm/migraine_ingress/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.gitignore
8 changes: 8 additions & 0 deletions helm/migraine_ingress/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v2
type: application

name: migraine-ingress
description: Infrastructure for migraine app deployment

# Chart version, expected to follow Semantic Versioning <https://semver.org/>
version: 0.1.0
44 changes: 44 additions & 0 deletions helm/migraine_ingress/templates/ingress-couchdb-web.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# https://doc.traefik.io/traefik/middlewares/stripprefix/

apiVersion: 'traefik.containo.us/v1alpha1'
kind: 'Middleware'

metadata:
name: 'ingress-couchdb-web-stripprefix-db'
labels:
app: 'migraine'

spec:
entryPoints:
- 'web'
stripPrefix:
prefixes:
- '/db'
forceSlash: false

---

# https://kubernetes.io/docs/concepts/services-networking/ingress/
# https://www.thebookofjoel.com/k3s-cert-manager-letsencrypt

apiVersion: 'traefik.containo.us/v1alpha1'
kind: 'IngressRoute'

metadata:
name: 'ingress-couchdb-web'
labels:
app: 'migraine'

spec:
routes:
- kind: 'Rule'
match: 'HostRegexp(`{any:.+}`) && PathPrefix(`/db/`)'
priority: 10000
middlewares:
- name: 'enable-cors'
namespace: 'ingress-traefik'
- name: 'ingress-couchdb-web-stripprefix-db'
services:
- kind: 'Service'
name: 'migraine-database-svc-couchdb'
port: 5984
Empty file.
78 changes: 78 additions & 0 deletions helmfile/helmfile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
repositories:
# aws-infrastructure helm repository
#
# When developing charts that will later be merged, it can be helpful to instead point at a branch:
# url: 'https://raw.githubusercontent.com/<account>/aws-infrastructure/<branch>/helm_repo/'
- name: 'aws-infrastructure'
url: 'https://raw.githubusercontent.com/fogies/aws-infrastructure/main/helm_repo/'

- name: 'couchdb'
url: 'https://apache.github.io/couchdb-helm'

releases:
# ingress-crd contains the CRDs required by ingress
- name: 'ingress-crd'
chart: 'aws-infrastructure/ingress-crd'
version: '0.1.0'

# ingress is then the actual ingress, including Traefik and cert-manager
- name: 'ingress'
chart: 'aws-infrastructure/ingress'
version: '0.4.0'
needs:
- 'ingress-crd'

# CouchDB instance
- name: 'migraine-database'
chart: 'couchdb/couchdb'
version: '3.3.4'
values:
- './values/secrets_couchdb_generated.values.yaml'
# adminUsername: 'XXXXXXXXXX'
# adminPassword: 'XXXXXXXXXX'
# cookieAuthSecret: 'XXXXXXXXXX'
# couchdbConfig:
# couchdb:
# uuid: 'XXXXXXXXXX'
- clusterSize: 3
image:
repository: 'couchdb'
tag: '3.2.0'
pullPolicy: 'Always'
resources:
requests:
cpu: 200m
memory: 128Mi
limits:
cpu: 200m
memory: 256Mi

# migraine-celery
# Installed from a local chart, managed in helmfile-config.yaml
- name: 'migraine-celery'
chart: './charts/migraine-celery.tgz'
values:
- './values/ecr_generated.values.yaml'

# migraine-flask
# Installed from a local chart, managed in helmfile-config.yaml
- name: 'migraine-flask'
chart: './charts/migraine-flask.tgz'
values:
- './values/ecr_generated.values.yaml'

# migraine-ingress
# Installed from a local chart, managed in helmfile-config.yaml
- name: 'migraine-ingress'
chart: './charts/migraine-ingress.tgz'
needs:
- 'ingress-crd'

helmDefaults:
# Prefer explicit management of CRDs via releases
args:
- '--skip-crds'

# Prefer explicit errors
missingFileHandler: 'Error'

11 changes: 11 additions & 0 deletions helmfile/helmfile_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Path to the Helmfile relative to location of this helmfile-config.yaml
helmfile: 'helmfile.yaml'

# Dependencies to be uploaded so they can be referenced as local files
dependencies:
- file: '../.staging/helm_repo/migraine-celery-0.1.0.tgz'
destination: './charts/migraine-celery.tgz'
- file: '../.staging/helm_repo/migraine-flask-0.1.0.tgz'
destination: './charts/migraine-flask.tgz'
- file: '../.staging/helm_repo/migraine-ingress-0.1.0.tgz'
destination: './charts/migraine-ingress.tgz'
3 changes: 3 additions & 0 deletions pipenv_activate.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
REM Convenience script for activating Pipenv

C:\Python39\Scripts\pipenv.exe run cmd
2 changes: 2 additions & 0 deletions secrets/client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# This file exists only to create directory structure.
# Ignore rules for creating the directory structure are in the root .gitignore.
2 changes: 2 additions & 0 deletions secrets/configuration/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# This file exists only to create directory structure.
# Ignore rules for creating the directory structure are in the root .gitignore.
2 changes: 2 additions & 0 deletions secrets/tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# This file exists only to create directory structure.
# Ignore rules for creating the directory structure are in the root .gitignore.
16 changes: 16 additions & 0 deletions server_celery/Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
celery = "*"

[dev-packages]
# Used by Celery filesystem broker in Windows development
pypiwin32 = {version = "*", sys_platform = "== 'win32'"}
# Dependencies of pypiwin32 must explicitly mark sys_platform per issue https://github.com/pypa/pipenv/issues/4117
pywin32 = {version = "*", sys_platform = "== 'win32'"}

[requires]
python_version = "3.9"
Loading

0 comments on commit e956aa3

Please sign in to comment.