diff --git a/.gitignore b/.gitignore index eba74f4..bc4b8ed 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -venv/ \ No newline at end of file +venv/ +site/ \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..562ef1d --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,34 @@ +variables: + CI_PROJECT_DIR: "." + CI_REGISTRY_IMAGE: hub.ducoterra.net/ducoterra/python-docs-2020 + DEPLOY: pythondocs2020 + +stages: + - build + - deploy + +build: + only: + variables: + - $CI_COMMIT_TAG + stage: build + image: + name: gcr.io/kaniko-project/executor:debug + entrypoint: [""] + script: + - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG + +deploy: + stage: deploy + only: + variables: + - $CI_COMMIT_TAG + image: + name: debian:10 + entrypoint: [""] + script: + - apt -qq update >> /dev/null && apt -qq install -y curl gettext >> /dev/null + - curl -o /usr/bin/kubectl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl + - chmod +x /usr/bin/kubectl + - curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash + - helm upgrade --install $DEPLOY ./helm --set image=$CI_REGISTRY_IMAGE --set tag=$CI_COMMIT_TAG diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7bbc99d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM python:3.9.0 as BUILD +COPY requirements.txt . +RUN pip install -r requirements.txt +COPY mkdocs.yml . +COPY docs docs +RUN mkdocs build + +FROM nginx:latest +COPY --from=BUILD /site/ /usr/share/nginx/html/ diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..c962b29 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,8 @@ +version: '3' + +services: + docs: + image: hub.ducoterra.net/ducoterra/python-docs-2020:latest + build: . + ports: + - 8080:80 \ No newline at end of file diff --git a/docs/day0.md b/docs/day0.md index db33e40..5eaa835 100644 --- a/docs/day0.md +++ b/docs/day0.md @@ -4,7 +4,9 @@ When you start programming half the battle is getting your bearings. Suddenly it Fortunately we can do some things to make your life easier. We can install an IDE: a program that lets you visualize your files and folders and quickly switch between them. We can install a version control system that will let you "snapshot" your code and save it to the cloud so you never lose it. We can organize our project to be repeatable, and more importantly, unloseable. -## I have a Windows PC (or skip to [I have a Mac](#i-have-a-mac)) +## I have a Windows PC + +(or skip to [I have a Mac](#i-have-a-mac)) ### Install Git diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..ffbb2a6 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,6 @@ +# Welcome to Project Oriented Python 2020 + +## Days + +Day 0: Installation requirements +Day 1: Python basics diff --git a/helm/.helmignore b/helm/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/helm/.helmignore @@ -0,0 +1,23 @@ +# 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/Chart.yaml b/helm/Chart.yaml new file mode 100644 index 0000000..cf7bc40 --- /dev/null +++ b/helm/Chart.yaml @@ -0,0 +1,23 @@ +apiVersion: v2 +name: helm +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. +appVersion: 1.16.0 diff --git a/helm/templates/deploy.yaml b/helm/templates/deploy.yaml new file mode 100644 index 0000000..543fe60 --- /dev/null +++ b/helm/templates/deploy.yaml @@ -0,0 +1,26 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Name }} +spec: + replicas: 1 + selector: + matchLabels: + app: {{ .Release.Name }} + template: + metadata: + labels: + app: {{ .Release.Name }} + spec: + containers: + - image: {{ required "A valid .Values.image entry required!" .Values.image }}:{{ required "A valid .Values.tag entry required!" .Values.tag }} + name: {{ .Release.Name }} + ports: + - containerPort: 80 + resources: + limits: + memory: "500Mi" + cpu: "250m" + requests: + memory: "1Mi" + cpu: "100m" diff --git a/helm/templates/ingress.yaml b/helm/templates/ingress.yaml new file mode 100644 index 0000000..7853e92 --- /dev/null +++ b/helm/templates/ingress.yaml @@ -0,0 +1,78 @@ +apiVersion: traefik.containo.us/v1alpha1 +kind: IngressRoute +metadata: + name: {{ .Release.Name }}-internal-tls + annotations: + kubernetes.io/ingress.class: traefik-internal +spec: + entryPoints: + - websecure + tls: + certResolver: myresolver + domains: + - main: "*.ducoterra.net" + routes: + - match: Host(`{{ .Release.Name }}.ducoterra.net`) + kind: Rule + services: + - name: {{ .Release.Name }} + port: {{ .Values.port }} + +--- + +apiVersion: traefik.containo.us/v1alpha1 +kind: IngressRoute +metadata: + name: {{ .Release.Name }}-internal-web + annotations: + kubernetes.io/ingress.class: traefik-internal +spec: + entryPoints: + - web + routes: + - match: Host(`{{ .Release.Name }}.ducoterra.net`) + kind: Rule + services: + - name: {{ .Release.Name }} + port: {{ .Values.port }} + middlewares: + - name: httpsredirect + +--- +apiVersion: traefik.containo.us/v1alpha1 +kind: IngressRoute +metadata: + name: {{ .Release.Name }}-external-tls + annotations: + kubernetes.io/ingress.class: traefik-external +spec: + entryPoints: + - websecure + tls: + certResolver: myresolver + routes: + - match: Host(`{{ .Release.Name }}.ducoterra.net`) + kind: Rule + services: + - name: {{ .Release.Name }} + port: {{ .Values.port }} + +--- + +apiVersion: traefik.containo.us/v1alpha1 +kind: IngressRoute +metadata: + name: {{ .Release.Name }}-external-web + annotations: + kubernetes.io/ingress.class: traefik-external +spec: + entryPoints: + - web + routes: + - match: Host(`{{ .Release.Name }}.ducoterra.net`) + kind: Rule + services: + - name: {{ .Release.Name }} + port: {{ .Values.port }} + middlewares: + - name: httpsredirect diff --git a/helm/templates/service.yaml b/helm/templates/service.yaml new file mode 100644 index 0000000..a259263 --- /dev/null +++ b/helm/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + app: {{ .Release.Name }} + name: {{ .Release.Name }} +spec: + ports: + - port: {{ .Values.port }} + protocol: TCP + name: {{ .Release.Name }}-web + targetPort: {{ .Values.port }} + selector: + app: {{ .Release.Name }} # This selects the pod(s) that match the selector + type: ClusterIP diff --git a/helm/values.yaml b/helm/values.yaml new file mode 100644 index 0000000..ced7b68 --- /dev/null +++ b/helm/values.yaml @@ -0,0 +1 @@ +port: 80 \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..bda5a01 --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,7 @@ +site_name: Python Class 2020 +nav: + - Home: index.md + - Day 0: day0.md + - Day 1: day1.md +theme: + name: material diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e758630 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,19 @@ +click==7.1.2 +future==0.18.2 +Jinja2==2.11.2 +joblib==0.17.0 +livereload==2.6.3 +lunr==0.5.8 +Markdown==3.3.3 +MarkupSafe==1.1.1 +mkdocs==1.1.2 +mkdocs-material==6.1.0 +mkdocs-material-extensions==1.0.1 +nltk==3.5 +Pygments==2.7.2 +pymdown-extensions==8.0.1 +PyYAML==5.3.1 +regex==2020.10.23 +six==1.15.0 +tornado==6.0.4 +tqdm==4.51.0