Compare commits

...

34 Commits

Author SHA1 Message Date
Narayana
084aa23fbe . 2023-04-05 09:00:49 +05:30
Narayana
7987750bc8 Update nginx.conf 2023-03-08 17:33:14 +05:30
Narayana
641a2183b6 Update nginx.conf 2023-03-08 17:26:52 +05:30
Narayana
99c8c2eac6 Update production.py 2023-03-08 17:25:45 +05:30
Narayana
25b4495190 Update production.py 2023-03-08 17:15:32 +05:30
Narayana
36b0aebc8f Update production.py 2023-03-08 17:03:47 +05:30
Narayana
324410d64d . 2023-03-08 16:56:42 +05:30
Narayana
4274951c73 . 2023-03-08 16:53:41 +05:30
Narayana
b642cc306e Update nginx.conf 2023-03-08 16:29:41 +05:30
Narayana
747793b119 Update nginx.conf 2023-03-08 16:25:57 +05:30
Narayana
9f2eb283c9 Update nginx.conf 2023-03-08 16:25:12 +05:30
Narayana
c124981b3f Update nginx.conf 2023-03-08 16:05:54 +05:30
Narayana
7ad806e124 Update Dockerfile 2023-03-08 15:59:21 +05:30
Narayana
058328d692 . 2023-03-08 15:58:15 +05:30
Narayana
eeee81b9eb Update nginx.conf 2023-03-08 15:56:15 +05:30
Narayana
3951ad8e42 Update Dockerfile 2023-03-08 15:55:10 +05:30
Narayana
52260d9d4b Update nginx.conf 2023-03-08 15:48:21 +05:30
Narayana
220cdc473c Update nginx.conf 2023-03-08 15:46:22 +05:30
Narayana
b534643fc3 . 2023-03-08 15:37:13 +05:30
Narayana
4969f8f56a Update docker-compose.yml 2023-03-08 15:29:01 +05:30
Narayana
571806b2af Update docker-compose.yml 2023-03-08 14:20:53 +05:30
Narayana
460261f354 Update nginx.conf 2023-03-08 14:14:07 +05:30
Narayana
7dfcc480f6 Update docker-compose.yml 2023-03-08 14:09:26 +05:30
Narayana
22dd37048b Update nginx.conf 2023-03-08 13:59:12 +05:30
Narayana
1310611df5 Update nginx.conf 2023-03-08 12:57:33 +05:30
Narayana
1e5f45eafb Update nginx.conf 2023-03-08 12:09:29 +05:30
Narayana
336d9fbc86 Update nginx.conf 2023-03-08 12:07:07 +05:30
Narayana
4278383282 Update nginx.conf 2023-03-08 12:03:53 +05:30
Narayana
abd02131d5 Update docker-compose.yml 2023-03-08 11:49:33 +05:30
Narayana
cd77296281 Added method to nginx and upgraded postgres version 2023-03-08 10:46:34 +05:30
Narayana
9e5fea407e Update nginx.conf 2023-03-07 02:44:15 +05:30
Narayana
6bb7ae5b55 . 2023-03-07 02:41:28 +05:30
Narayana
2a19ea253f Update nginx.conf 2023-03-07 02:34:13 +05:30
Narayana
ed42050549 k8s 2023-03-07 02:07:59 +05:30
14 changed files with 4927 additions and 27 deletions

View File

@ -1,7 +1,7 @@
SECRET_KEY="<-- django secret -->" SECRET_KEY="<-- django secret -->"
DJANGO_SETTINGS_MODULE="plane.settings.production" DJANGO_SETTINGS_MODULE="plane.settings.production"
# Database # Database
DATABASE_URL=postgres://plane:plane@plane-db-1:5432/plane DATABASE_URL=postgres://plane:xyzzyspoon@db:5432/plane
# Cache # Cache
REDIS_URL=redis://redis:6379/ REDIS_URL=redis://redis:6379/
# SMPT # SMPT

View File

@ -22,13 +22,7 @@ DATABASES = {
} }
} }
# CORS WHITELIST ON PROD
CORS_ORIGIN_WHITELIST = [
# "https://example.com",
# "https://sub.example.com",
# "http://localhost:8080",
# "http://127.0.0.1:9000"
]
# Parse database configuration from $DATABASE_URL # Parse database configuration from $DATABASE_URL
DATABASES["default"] = dj_database_url.config() DATABASES["default"] = dj_database_url.config()
SITE_ID = 1 SITE_ID = 1
@ -43,12 +37,33 @@ DOCKERIZED = os.environ.get(
# Honor the 'X-Forwarded-Proto' header for request.is_secure() # Honor the 'X-Forwarded-Proto' header for request.is_secure()
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https") SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
# Allow all host headers
ALLOWED_HOSTS = ["*"]
# TODO: Make it FALSE and LIST DOMAINS IN FULL PROD. # TODO: Make it FALSE and LIST DOMAINS IN FULL PROD.
CORS_ALLOW_ALL_ORIGINS = True CORS_ALLOW_ALL_ORIGINS = True
CORS_ALLOW_METHODS = [
'DELETE',
'GET',
'OPTIONS',
'PATCH',
'POST',
'PUT',
]
CORS_ALLOW_HEADERS = [
'accept',
'accept-encoding',
'authorization',
'content-type',
'dnt',
'origin',
'user-agent',
'x-csrftoken',
'x-requested-with',
]
CORS_ALLOW_CREDENTIALS = True
# Simplified static file serving. # Simplified static file serving.
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage" STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"

View File

@ -9,10 +9,10 @@ services:
ports: ports:
- 80:80 - 80:80
depends_on: depends_on:
# - plane-web - plane-web
- plane-api - plane-api
db: db:
image: postgres:12-alpine image: postgres:15.2-alpine
container_name: db container_name: db
restart: always restart: always
volumes: volumes:
@ -20,7 +20,8 @@ services:
environment: environment:
POSTGRES_USER: plane POSTGRES_USER: plane
POSTGRES_DB: plane POSTGRES_DB: plane
POSTGRES_PASSWORD: plane POSTGRES_PASSWORD: xyzzyspoon
PGDATA : /var/lib/postgresql/data
command: postgres -c 'max_connections=1000' command: postgres -c 'max_connections=1000'
ports: ports:
- 5432:5432 - 5432:5432

View File

@ -0,0 +1,65 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: plane-sandbox
namespace: plane-sandbox
labels:
app: plane-sandbox
spec:
replicas: 1
selector:
matchLabels:
app: plane-sandbox
template:
metadata:
labels:
app: plane-sandbox
spec:
containers:
- name: planefrontend
image: makeplane/plane-frontend:0.2.1
imagePullPolicy: IfNotPresent
env:
- name: NEXT_PUBLIC_API_BASE_URL
value: "http://planebackend:8000"
resources:
limits:
memory: 512Mi
cpu: "1"
requests:
memory: 256Mi
cpu: "0.2"
command: ["/bin/sh","-c"]
args: ["node apps/app/server.js"]
ports:
- containerPort: 3000
- name: planebackend
image: makeplane/plane-backend:0.2.1
imagePullPolicy: IfNotPresent
env:
- name: WEB_URL
value: planebackend:8000
- name: DISABLE_COLLECTSTATIC
value: "1"
- name: DOCKERIZED
value: "1"
- name: SECRET_KEY
value: "praro1^m%c607u4_1z%&_ubf@rm(u-t@asnqkykecz6l^dxlzf"
- name: DATABASE_URL
value: postgres://plane:plane@plane.cdivnhdawh0f.ap-south-1.rds.amazonaws.com:5432/plane
- name: REDIS_URL
value: "redis://redis:6379/"
- name: DJANGO_SETTINGS_MODULE
value: plane.settings.production
command: ["/bin/sh","-c"]
args: ["./bin/takeoff"]
resources:
limits:
memory: 1Gi
cpu: "1"
requests:
memory: 1Gi
cpu: "0.2"
ports:
- containerPort: 8000

21
kubernetes/ingress.yaml Normal file
View File

@ -0,0 +1,21 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: plane-ingress
namespace: plane-sandbox
annotations:
kubernetes.io/ingress.class: alb
alb.ingress.kubernetes.io/scheme: internet-facing
alb.ingress.kubernetes.io/tags: Environment=sandbox,Team=plane**
spec:
rules:
- host: "*.example.com"
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: plane-sandbox-service
port:
number: 3000

View File

@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: plane
namespace: plane-sandbox
annotations:
service.beta.kubernetes.io/aws-load-balancer-type: "nlb"
service.beta.kubernetes.io/aws-load-balancer-eip-allocations: "eipalloc-0b95f47db683daaeb,eipalloc-0113ae1793232614c,eipalloc-09a1830c7d2a29f87"
spec:
selector:
app: plane-sandbox
ports:
- name: http
port: 80
targetPort: 3000
type: LoadBalancer

109
kubernetes/main.tf Normal file
View File

@ -0,0 +1,109 @@
module "eks" {
source = "terraform-aws-modules/eks/aws"
version = "19.5.1"
cluster_name = "sandbox"
cluster_version = "1.25"
cluster_addons = {
coredns = {
preserve = true
most_recent = true
timeouts = {
create = "25m"
delete = "10m"
}
}
kube-proxy = {
most_recent = true
}
vpc-cni = {
most_recent = true
}
}
iam_role_additional_policies = {
additional = "arn:aws:iam::aws:policy/AmazonEC2FullAccess"
}
vpc_id = "vpc-0e355d290b274b86f"
subnet_ids = ["subnet-050c9e36bda3e6b62","subnet-0bd81c09f00d0607a","subnet-03396584886320a18"]
cluster_endpoint_public_access = true
eks_managed_node_group_defaults = {
ami_type = "AL2_x86_64"
}
eks_managed_node_groups = {
one = {
name = "node-group-1"
instance_types = ["t3.large"]
min_size = 1
max_size = 2
desired_size = 1
}
two = {
name = "node-group-2"
instance_types = ["t3.large"]
min_size = 1
max_size = 2
desired_size = 1
}
}
}
########################################
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 4.47.0"
}
random = {
source = "hashicorp/random"
version = "~> 3.4.3"
}
tls = {
source = "hashicorp/tls"
version = "~> 4.0.4"
}
cloudinit = {
source = "hashicorp/cloudinit"
version = "~> 2.2.0"
}
}
required_version = "~> 1.3"
}
#########################################
output "cluster_endpoint" {
description = "Endpoint for EKS control plane"
value = module.eks.cluster_endpoint
}
output "cluster_security_group_id" {
description = "Security group ids attached to the cluster control plane"
value = module.eks.cluster_security_group_id
}
output "cluster_name" {
description = "Kubernetes Cluster Name"
value = module.eks.cluster_name
}
#########################################
provider "aws" {
region = "ap-south-1"
}

9
kubernetes/secret.yaml Normal file
View File

@ -0,0 +1,9 @@
apiVersion: v1
kind: Secret
metadata:
namespace: plane-sandbox
name: plane-secret
type: kubernetes.io/tls
data:
tls.crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURMakNDQWhZQ0NRREFPRjl0THNhWFdqQU5CZ2txaGtpRzl3MEJBUXNGQURCYU1Rc3dDUVlEVlFRR0V3SlYKVXpFTE1Ba0dBMVVFQ0F3Q1EwRXhJVEFmQmdOVkJBb01HRWx1ZEdWeWJtVjBJRmRwWkdkcGRITWdVSFI1SUV4MApaREViTUJrR0ExVUVBd3dTWTJGbVpTNWxlR0Z0Y0d4bExtTnZiU0FnTUI0WERURTRNRGt4TWpFMk1UVXpOVm9YCkRUSXpNRGt4TVRFMk1UVXpOVm93V0RFTE1Ba0dBMVVFQmhNQ1ZWTXhD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1VHNkVEVXNEZS8yVWE3ZlhwN0ZjanFCRW9hcDFMU3crNlRYcDAKWmdybUtFOEFSek00NytFSkhVdmlpcS9udXBFMTVnMGtKVzNzeWhwVTl6WkxPN2x0QjBLSWtPOVpSY21Vam84UQpjcExsSE1BcWJMSjhXWUdKQ2toaVd4eWFsNmhZVHlXWTRjVmtDMHh0VGwvaFVFOUllTktvCi0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg==

14
kubernetes/service.yaml Normal file
View File

@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: plane-sandbox-service
namespace: plane-sandbox
labels:
app: plane-sandbox
spec:
selector:
app: plane-sandbox
ports:
- protocol: TCP
port: 3000
targetPort: 3000

2339
kubernetes/terraform.tfstate Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
FROM nginx:1.21-alpine FROM nginx:1.21-alpine
RUN rm /etc/nginx/conf.d/default.conf RUN rm /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/conf.d COPY nginx.conf /etc/nginx/nginx.conf

View File

@ -1,25 +1,20 @@
upstream plane { events { }
server localhost:80;
}
error_log /var/log/nginx/error.log;
http {
sendfile on;
server { server {
listen 80; listen 80;
root /www/data/; root /www/data/;
access_log /var/log/nginx/access.log; access_log /var/log/nginx/access.log;
location / { location / {
proxy_pass http://planefrontend:3000/; proxy_pass http://planefrontend:3000/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
} }
location /api/ { location /api/ {
proxy_pass http://planebackend:8000/api/; proxy_pass http://planebackend:8000/api/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
} }
} }
}