diff --git a/playbooks/openshift-apps/transtats.yml b/playbooks/openshift-apps/transtats.yml new file mode 100644 index 0000000000..ddd64fcd02 --- /dev/null +++ b/playbooks/openshift-apps/transtats.yml @@ -0,0 +1,24 @@ +- name: make the app be real + hosts: os-masters-stg + user: root + gather_facts: True + + vars_files: + - /srv/web/infra/ansible/vars/global.yml + - "/srv/private/ansible/vars.yml" + - /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml + + roles: + - role: openshift/project + app: transtats + description: transtats + appowners: + - suanand + - { role: openshift/object, app: transtats, template: secret.yml } + - { role: openshift/object, app: transtats, file: imagestream.yml } + - { role: openshift/object, app: transtats, file: buildconfig.yml } + - { role: openshift/start-build, app: transtats, name: transtats-docker-build } + - { role: openshift/object, app: transtats, file: service.yml } + - { role: openshift/object, app: transtats, file: route.yml } + - { role: openshift/object, app: transtats, file: deploymentconfig.yml } + - { role: openshift/rollout, app: transtats, name: transtats-web } diff --git a/roles/openshift-apps/transtats/files/buildconfig.yml b/roles/openshift-apps/transtats/files/buildconfig.yml new file mode 100644 index 0000000000..53286af4fd --- /dev/null +++ b/roles/openshift-apps/transtats/files/buildconfig.yml @@ -0,0 +1,30 @@ +apiVersion: v1 +kind: BuildConfig +metadata: + name: "transtats-build" + labels: + environment: "transtats" +spec: + runPolicy: Serial + source: + git: + ref: master + uri: https://github.com/transtats/transtats.git + secrets: null + type: Git + strategy: + sourceStrategy: + env: + - name: PIP_INDEX_URL + - name: TS_AUTH_SYSTEM + value: fedora + - name: OIDC_RP_CLIENT_SECRET + valueFrom: + secretKeyRef: + name: transtats-secret + key: oidc-client-secret + type: Source + output: + to: + kind: ImageStreamTag + name: transtats:latest diff --git a/roles/openshift-apps/transtats/files/deploymentconfig.yml b/roles/openshift-apps/transtats/files/deploymentconfig.yml new file mode 100644 index 0000000000..56b1db8c4d --- /dev/null +++ b/roles/openshift-apps/transtats/files/deploymentconfig.yml @@ -0,0 +1,74 @@ + +apiVersion: v1 +kind: DeploymentConfig +metadata: + name: transtats-web + labels: + app: transtats + service: web +spec: + replicas: 2 + selector: + app: transtats + service: web + template: + metadata: + labels: + app: transtats + service: web + spec: + containers: + - name: web + image: transtats + ports: + - containerPort: 8080 + env: + - name: DATABASE_SERVICE_NAME + valueFrom: + secretKeyRef: + name: transtats-secret + key: database-host + - name: DATABASE_ENGINE + value: postgresql + - name: DATABASE_NAME + value: transtats + - name: DATABASE_USER + valueFrom: + secretKeyRef: + name: transtats-secret + key: database-user + - name: DATABASE_PASSWORD + valueFrom: + secretKeyRef: + name: transtats-secret + key: database-password + - name: DJANGO_SECRET_KEY + valueFrom: + secretKeyRef: + name: transtats-secret + key: django-secret-key + readinessProbe: + timeoutSeconds: 1 + initialDelaySeconds: 5 + httpGet: + path: /health + port: 8080 + livenessProbe: + timeoutSeconds: 1 + initialDelaySeconds: 30 + httpGet: + path: /health + port: 8080 + resources: + limits: + memory: 384Mi + triggers: + - type: ImageChange + imageChangeParams: + automatic: true + containerNames: + - web + from: + kind: ImageStreamTag + name: transtats:latest + - type: ConfigChange diff --git a/roles/openshift-apps/transtats/files/imagestream.yml b/roles/openshift-apps/transtats/files/imagestream.yml new file mode 100644 index 0000000000..c2b22a5e23 --- /dev/null +++ b/roles/openshift-apps/transtats/files/imagestream.yml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: ImageStream +metadata: + name: transtats +spec: + tags: + - name: latest +--- +apiVersion: v1 +kind: ImageStream +metadata: + name: transtats diff --git a/roles/openshift-apps/transtats/files/route.yml b/roles/openshift-apps/transtats/files/route.yml new file mode 100644 index 0000000000..7e01795b29 --- /dev/null +++ b/roles/openshift-apps/transtats/files/route.yml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Route +metadata: + name: transtats-web + labels: + app: transtats +spec: + #host: transtats.stg.fedoraproject.org + port: + targetPort: web + to: + kind: Service + name: transtats-web + tls: + termination: edge + insecureEdgeTerminationPolicy: Redirect diff --git a/roles/openshift-apps/transtats/files/service.yml b/roles/openshift-apps/transtats/files/service.yml new file mode 100644 index 0000000000..ca5a770c4e --- /dev/null +++ b/roles/openshift-apps/transtats/files/service.yml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + name: transtats-web + labels: + app: transtats +spec: + selector: + app: transtats + service: web + ports: + - name: web + port: 8080 + targetPort: 8080 diff --git a/roles/openshift-apps/transtats/templates/secret.yml b/roles/openshift-apps/transtats/templates/secret.yml new file mode 100644 index 0000000000..0d8989960a --- /dev/null +++ b/roles/openshift-apps/transtats/templates/secret.yml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Secret +metadata: + name: "transtats-secret" + labels: + app: "transtats" +stringData: +{% if env == 'staging' %} + djang-secret-key: "{{transtats_stg_django_secret_key}}" + database-password: "{{transtats_stg_database_password}}" +{% endif %}