Strongly inspired by https://gist.github.com/heymonkeyriot/9a2f429caff5c091d5429666fa080403.
On Ubuntu :
sudo apt install python3 python3-pip
# 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 |
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 |
# 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 |
# 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 | |
# 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 | |
} |
name: buildx | |
on: | |
pull_request: | |
branches: master | |
push: | |
branches: master | |
tags: | |
jobs: |
FROM python:3.8 | |
COPY requirements.txt . | |
RUN pip install -r requirements.txt | |
COPY src/ app/ | |
WORKDIR app/ | |
CMD ["python", "main.py"] |
# requirements.txt | |
requests==2.23.0 |
# 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() |
Strongly inspired by https://gist.github.com/heymonkeyriot/9a2f429caff5c091d5429666fa080403.
On Ubuntu :
sudo apt install python3 python3-pip