diff --git a/.gitignore b/.gitignore index 9500e81546..649308ba15 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,7 @@ htmlcov/ .direnv .github/** +Downloads/ +*.pub +cd0157-Server-Deployment-and-Containerization-master/ +eks-fargate-trust.json diff --git a/Dockerfile.bak b/Dockerfile.bak new file mode 100644 index 0000000000..ebdcf91a16 --- /dev/null +++ b/Dockerfile.bak @@ -0,0 +1,14 @@ +# Use the `python:3.9` as a source image from the Amazon ECR Public Gallery +# We are not using `python:3.7.2-slim` from Dockerhub because it has put a pull rate limit. +FROM public.ecr.aws/sam/build-python3.9:latest + +# Set up an app directory for your code +COPY . /app +WORKDIR /app + +# Install `pip` and needed Python packages from `requirements.txt` +RUN pip install --upgrade pip +RUN pip install -r requirements.txt + +# Define an entrypoint which will run the main app using the Gunicorn WSGI server. +ENTRYPOINT ["gunicorn", "-b", ":8080", "main:app"] diff --git a/README.md b/README.md old mode 100755 new mode 100644 diff --git a/cd0157-Server-Deployment-and-Containerization b/cd0157-Server-Deployment-and-Containerization new file mode 160000 index 0000000000..b9f5782f42 --- /dev/null +++ b/cd0157-Server-Deployment-and-Containerization @@ -0,0 +1 @@ +Subproject commit b9f5782f42fb7d6ea2aa18b8a5f5ee54337e64bc diff --git a/ci-cd-codepipeline.cfn.yml b/ci-cd-codepipeline.cfn.yml old mode 100755 new mode 100644 diff --git a/deployment.yaml b/deployment.yaml new file mode 100644 index 0000000000..411f8079ec --- /dev/null +++ b/deployment.yaml @@ -0,0 +1,35 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: nginx-deployment + labels: + app: nginx +spec: + replicas: 3 + selector: + matchLabels: + app: nginx + template: + metadata: + labels: + app: nginx + spec: + containers: + - name: nginx + image: nginx:stable + ports: + - containerPort: 80 + readinessProbe: + httpGet: + path: / + port: 80 + initialDelaySeconds: 5 + periodSeconds: 10 + failureThreshold: 3 + livenessProbe: + httpGet: + path: / + port: 80 + initialDelaySeconds: 15 + periodSeconds: 20 + failureThreshold: 3 diff --git a/eks-elb-read-policy.json b/eks-elb-read-policy.json new file mode 100644 index 0000000000..21f98e07cc --- /dev/null +++ b/eks-elb-read-policy.json @@ -0,0 +1,20 @@ +{ + "Version": "2012-10-17", + "Statement": [ + { + "Sid": "AllowDescribeForELBAndEC2", + "Effect": "Allow", + "Action": [ + "elasticloadbalancing:DescribeInstanceHealth", + "elasticloadbalancing:DescribeLoadBalancers", + "elasticloadbalancing:DescribeLoadBalancerAttributes", + "elasticloadbalancing:DescribeTags", + "ec2:DescribeInstances", + "ec2:DescribeNetworkInterfaces", + "ec2:DescribeSecurityGroups", + "ec2:DescribeAddresses" + ], + "Resource": "*" + } + ] +} diff --git a/eksctl.zip b/eksctl.zip new file mode 100644 index 0000000000..cc130cda4f Binary files /dev/null and b/eksctl.zip differ diff --git a/main.py b/main.py old mode 100755 new mode 100644 diff --git a/netshoot-hostdebug.yaml b/netshoot-hostdebug.yaml new file mode 100644 index 0000000000..bac163e050 --- /dev/null +++ b/netshoot-hostdebug.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Pod +metadata: + name: netshoot-hostdebug + labels: + app: netshoot-hostdebug +spec: + hostNetwork: true + hostPID: true + restartPolicy: Never + tolerations: + - operator: Exists + containers: + - name: netshoot + image: nicolaka/netshoot:latest + command: ["/bin/sleep","3600"] + securityContext: + privileged: true diff --git a/requirements.txt b/requirements.txt old mode 100755 new mode 100644 diff --git a/service.yaml b/service.yaml new file mode 100644 index 0000000000..b57f1f422a --- /dev/null +++ b/service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: nginx +spec: + type: LoadBalancer + selector: + app: nginx + ports: + - protocol: TCP + port: 80 + targetPort: 80 diff --git a/simple_jwt_api-svc-nlb.yml b/simple_jwt_api-svc-nlb.yml new file mode 100644 index 0000000000..aa66bd1838 Binary files /dev/null and b/simple_jwt_api-svc-nlb.yml differ diff --git a/simple_jwt_api.yml b/simple_jwt_api.yml deleted file mode 100644 index b21cdb95ad..0000000000 --- a/simple_jwt_api.yml +++ /dev/null @@ -1,40 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: simple-jwt-api -spec: - type: LoadBalancer - ports: - - port: 80 - targetPort: 8080 - selector: - app: simple-jwt-api ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: simple-jwt-api -spec: - replicas: 3 - strategy: - type: RollingUpdate - rollingUpdate: - maxUnavailable: 2 - maxSurge: 2 - selector: - matchLabels: - app: simple-jwt-api - template: - metadata: - labels: - app: simple-jwt-api - spec: - containers: - - name: simple-jwt-api - image: CONTAINER_IMAGE - securityContext: - privileged: false - readOnlyRootFilesystem: false - allowPrivilegeEscalation: false - ports: - - containerPort: 8080 diff --git a/svc-backup.yml b/svc-backup.yml new file mode 100644 index 0000000000..3d429ea61b Binary files /dev/null and b/svc-backup.yml differ