Skip to content

Instantly share code, notes, and snippets.

@dixneuf19
dixneuf19 / zsh-virtualenv-setup.md
Last active July 3, 2024 10:42 — forked from hminnovation/zsh-virtualenv-setup.md
Setup python, pip, virtualenv and virtualwrapper, with zsh on a new machine
@dixneuf19
dixneuf19 / pytime.py
Created June 5, 2020 06:02
time as SAAS with python
# src/main.py
import requests
def main():
r = requests.get("http://worldtimeapi.org/api/timezone/Europe/Paris")
datetime = r.json()["datetime"]
print(datetime)
if __name__ == "__main__":
main()
# requirements.txt
requests==2.23.0
FROM python:3.8
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY src/ app/
WORKDIR app/
CMD ["python", "main.py"]
name: buildx
on:
pull_request:
branches: master
push:
branches: master
tags:
jobs:
# main.tf
# Configure the DigitalOcean Provider
provider "digitalocean" {
version = "~> 1.22"
# token = var.do_token # This is the DO API token.
# Alternatively, this can also be specified using environment variables ordered by precedence:
# DIGITALOCEAN_TOKEN,
# DIGITALOCEAN_ACCESS_TOKEN
}
# main.tf
# Remote state
terraform {
backend "s3" {
endpoint = "ams3.digitaloceanspaces.com/" # specify the correct DO region
region = "us-west-1" # not used since it's a DigitalOcean spaces bucket
key = "terraform.tfstate"
bucket = "kube-terraform-state" # The name of your Spaces
skip_credentials_validation = true
# main.tf
# Deploy the actual Kubernetes cluster
resource "digitalocean_kubernetes_cluster" "kubernetes_cluster" {
name = "terraform-do-cluster"
region = "ams3"
version = "1.18.6-do.0"
tags = ["my-tag"]
# This default node pool is mandatory
podAffinity: # with pod Affinity, I help him stay close of web
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector: # select the sentry-web pod
matchExpressions:
- key: role
operator: In
values:
- web
- key: app
operator: In
@dixneuf19
dixneuf19 / gist:3ad440c6d701a065482e74aa2bd7c0d0
Created December 22, 2020 21:13
sentry-helm-pod-affinity.yaml
# sentry.values.yaml
# for node selection, if I don't specify any tolerations, I'll end up on main node which is fine
filestore:
filesystem:
persistence:
storageClass: ebs-sc # choosing the right storage class
persistentWorkers: true # using disk for workers, solving the issue