-
-
Notifications
You must be signed in to change notification settings - Fork 12
Initial configs for adding django BE to cluster #97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| apiVersion: extensions/v1beta1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: back-end | ||
| spec: | ||
| replicas: 2 | ||
| revisionHistoryLimit: 5 | ||
| template: | ||
| spec: | ||
| containers: | ||
| - name: app | ||
| image: operationcode/back-end:latest | ||
| imagePullPolicy: Always | ||
| ports: | ||
| - containerPort: 8000 | ||
| env: | ||
| - name: DB_NAME | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: python-backend-secrets | ||
| key: postgres_name | ||
| - name: DB_USER | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: python-backend-secrets | ||
| key: postgres_user | ||
| - name: DB_PASSWORD | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: python-backend-secrets | ||
| key: postgres_password | ||
| - name: DB_HOST | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: python-backend-secrets | ||
| key: postgres_host | ||
| - name: DB_PORT | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: python-backend-secrets | ||
| key: postgres_port | ||
| - name: SECRET_KEY | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: python-backend-secrets | ||
| key: secret_key_base | ||
| - name: PYBOT_AUTH_TOKEN | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: python-backend-secrets | ||
| key: pybot_auth_token | ||
| - name: PYBOT_URL | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: python-backend-secrets | ||
| key: pybot_url | ||
| - name: MAILCHIMP_API_KEY | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: python-backend-secrets | ||
| key: mailchimp_api_key | ||
| - name: MAILCHIMP_LIST_ID | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: python-backend-secrets | ||
| key: mailchimp_list_id | ||
| - name: SENTRY_DSN | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: python-backend-secrets | ||
| key: sentry_dsn | ||
|
|
||
| - name: GOOGLE_OAUTH_CLIENT_ID | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: python-backend-secrets | ||
| key: google_oauth_client_id | ||
|
|
||
| - name: GOOGLE_OAUTH_CLIENT_SECRET | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: python-backend-secrets | ||
| key: google_oauth_client_secret | ||
|
|
||
|
|
||
| volumes: | ||
| - name: python-backend-secrets | ||
| secret: | ||
| secretName: python-backend-secrets | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| apiVersion: kustomize.config.k8s.io/v1beta1 | ||
| kind: Kustomization | ||
|
|
||
| commonLabels: | ||
| app: back-end | ||
|
|
||
| resources: | ||
| - deployment.yaml | ||
| - service.yaml |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| name: back-end-service | ||
| spec: | ||
| selector: | ||
| app: back-end | ||
| ports: | ||
| - protocol: TCP | ||
| name: http | ||
| port: 80 | ||
| targetPort: 8000 | ||
| type: ClusterIP |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
|
|
||
| apiVersion: extensions/v1beta1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: back-end | ||
| spec: | ||
| template: | ||
| spec: | ||
| containers: | ||
| - name: app | ||
| env: | ||
| - name: DB_HOST | ||
| value: # TODO | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we want to use terraform for provisioning this or do you need help setting it up?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's TODO because we need to wait until the last minute to snapshot the current prod before going live |
||
| - name: ENVIRONMENT | ||
| value: aws_prod | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what's the significance of this
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a hacky way to tell django to use the aws_s3 bucket to serve static assets, while still allowing me to run the production config locally sans remote static files
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this aws_prod and not just production?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Copied from above
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| apiVersion: extensions/v1beta1 | ||
| kind: Ingress | ||
| metadata: | ||
| annotations: | ||
| kubernetes.io/ingress.class: nginx | ||
| kubernetes.io/tls-acme: "true" | ||
| name: back-end | ||
| spec: | ||
| rules: | ||
| - host: api.operationcode.org | ||
| http: | ||
| paths: | ||
| - backend: | ||
| serviceName: operationcode-backend-service | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should be |
||
| servicePort: 80 | ||
| path: / | ||
| tls: | ||
| - hosts: | ||
| - api.operationcode.org | ||
| secretName: operationcode-backend-tls | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| apiVersion: kustomize.config.k8s.io/v1beta1 | ||
| kind: Kustomization | ||
|
|
||
| namespace: operationcode | ||
|
|
||
| bases: | ||
| - ../../base | ||
|
|
||
| resources: | ||
| - ingress.yaml | ||
|
|
||
| patchesStrategicMerge: | ||
| - deployment.yaml |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
|
|
||
| apiVersion: extensions/v1beta1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: back-end | ||
| spec: | ||
| template: | ||
| spec: | ||
| containers: | ||
| - name: app | ||
| env: | ||
| - name: DB_HOST | ||
| value: django-staging.czwauqf3tjaz.us-east-2.rds.amazonaws.com | ||
| - name: ENVIRONMENT | ||
| value: aws_staging | ||
| - name: RELEASE | ||
| value: 0.1.0 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| apiVersion: extensions/v1beta1 | ||
| kind: Ingress | ||
| metadata: | ||
| annotations: | ||
| kubernetes.io/ingress.class: nginx | ||
| kubernetes.io/tls-acme: "true" | ||
| name: back-end | ||
| spec: | ||
| rules: | ||
| - host: api.staging.operationcode.org | ||
| http: | ||
| paths: | ||
| - backend: | ||
| serviceName: operationcode-backend-service | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Won't this need to match the new service name? |
||
| servicePort: 80 | ||
| path: / | ||
| tls: | ||
| - hosts: | ||
| - api.staging.operationcode.org | ||
| secretName: operationcode-backend-tls | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| apiVersion: kustomize.config.k8s.io/v1beta1 | ||
| kind: Kustomization | ||
|
|
||
| namespace: operationcode-staging | ||
|
|
||
| bases: | ||
| - ../../base | ||
|
|
||
| resources: | ||
| - ingress.yaml | ||
|
|
||
| patchesStrategicMerge: | ||
| - deployment.yaml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you currently have a dockerhub repo setup for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://cloud.docker.com/repository/registry-1.docker.io/operationcode/back-end
You do now. Need to get credentials in circle ci to handle it.