diff --git a/.txt b/.txt deleted file mode 100644 index e69de29..0000000 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..40fd4f5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +# syntax=docker/dockerfile:1 +FROM python:3 +ENV PYTHONUNBUFFERED=1 +WORKDIR /code +COPY requirements.txt /code/ +RUN pip install -r requirements.txt +COPY . /code/ \ No newline at end of file diff --git a/claim.yaml b/claim.yaml new file mode 100644 index 0000000..1dc54de --- /dev/null +++ b/claim.yaml @@ -0,0 +1,13 @@ +--- +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: pg-storage + namespace: pg +spec: + accessModes: + - ReadWriteMany + resources: + requests: + storage: 100Mi + storageClassName: "standard" \ No newline at end of file diff --git a/deployment.yaml b/deployment.yaml new file mode 100644 index 0000000..375c749 --- /dev/null +++ b/deployment.yaml @@ -0,0 +1,57 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: pg-db + namespace: pg +spec: + replicas: 1 + selector: + matchLabels: + app: pg-db + strategy: + type: Recreate + template: + metadata: + labels: + app: pg-db + spec: + initContainers: + - image: busybox + name: mount-permissions-fix + command: ["sh", "-c", "chmod 777 /var/lib/postgresql/data"] + volumeMounts: + - name: data + mountPath: /var/lib/postgresql/data + containers: + - image: postgres:10.13 + name: postgres + env: + - name: POSTGRES_USER + value: "testuser" + - name: POSTGRES_DB + value: "testdatabase" + - name: PGDATA + value: "/var/lib/postgresql/data/pgdata" + - name: POSTGRES_PASSWORD + valueFrom: + secretKeyRef: + name: pg-secret + key: PASS + ports: + - containerPort: 5432 + protocol: TCP + resources: + requests: + cpu: 500m + memory: 1000Mi + limits: + cpu: 500m + memory: 1000Mi + volumeMounts: + - name: data + mountPath: /var/lib/postgresql/data + volumes: + - name: data + persistentVolumeClaim: + claimName: pg-storage \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..f28f954 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,20 @@ +version: "3.9" + +services: + db: + image: postgres + volumes: + - ./data/db:/var/lib/postgresql/data + environment: + - POSTGRES_DB=postgres + - POSTGRES_USER=postgres + - POSTGRES_PASSWORD=postgres + web: + build: . + command: python prj/manage.py runserver 0.0.0.0:8000 + volumes: + - .:/code + ports: + - "8000:8000" + depends_on: + - db \ No newline at end of file diff --git a/flow.pdf b/flow.pdf new file mode 100644 index 0000000..65779e8 Binary files /dev/null and b/flow.pdf differ diff --git a/kubedoom.pdf b/kubedoom.pdf new file mode 100644 index 0000000..f598f9f Binary files /dev/null and b/kubedoom.pdf differ diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..972c095 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +Django>=3.0,<4.0 +psycopg2-binary>=2.8 \ No newline at end of file