diff --git a/playbooks/openshift-apps/oraculum.yml b/playbooks/openshift-apps/oraculum.yml index 31f8a35b3f..08fc6941f2 100644 --- a/playbooks/openshift-apps/oraculum.yml +++ b/playbooks/openshift-apps/oraculum.yml @@ -68,6 +68,11 @@ object_template: deploymentconfig.yml object_objectname: deploymentconfig.yml + - role: openshift/object + object_app: oraculum + object_template: deployment.yml + object_objectname: deployment.yml + - role: openshift/object object_app: oraculum object_template: imagestream.yml diff --git a/roles/openshift-apps/oraculum/files/service.yml b/roles/openshift-apps/oraculum/files/service.yml index d9d1e9312f..8e9b80fd9b 100644 --- a/roles/openshift-apps/oraculum/files/service.yml +++ b/roles/openshift-apps/oraculum/files/service.yml @@ -13,7 +13,7 @@ spec: targetPort: 8080 selector: app: oraculum - deploymentconfig: oraculum-api-endpoint + service: oraculum-api-endpointN --- apiVersion: v1 kind: Service @@ -29,7 +29,7 @@ spec: targetPort: 8080 selector: app: oraculum - deploymentconfig: oraculum-flower + service: oraculum-flowerN --- apiVersion: v1 kind: Service @@ -45,7 +45,7 @@ spec: targetPort: 6379 selector: app: oraculum - deploymentconfig: oraculum-redis + service: oraculum-redisN --- apiVersion: v1 kind: Service @@ -61,4 +61,4 @@ spec: targetPort: 8080 selector: app: oraculum - deploymentconfig: oraculum-frontend + service: oraculum-frontendN diff --git a/roles/openshift-apps/oraculum/templates/deployment.yml b/roles/openshift-apps/oraculum/templates/deployment.yml new file mode 100644 index 0000000000..8b4f57ce45 --- /dev/null +++ b/roles/openshift-apps/oraculum/templates/deployment.yml @@ -0,0 +1,383 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: oraculum + service: oraculum-api-endpointN + name: oraculum-api-endpoint + annotations: + image.openshift.io/triggers: >- + [{"from":{"kind":"ImageStreamTag","name":"packager-dashboard:latest","namespace":"oraculum"},"fieldPath":"spec.template.spec.containers[?(@.name==\"oraculum-api-endpoint\")].image","pause":"false"}] +spec: + replicas: 1 + selector: + matchLabels: + app: oraculum + service: oraculum-api-endpointN + template: + metadata: + labels: + app: oraculum + service: oraculum-api-endpointN + spec: + containers: + - name: oraculum-api-endpoint + image: image-registry.openshift-image-registry.svc:5000/oraculum/packager-dashboard:latest + ports: + - containerPort: 8080 + resources: {} + env: + # Database + - name: POSTGRESQL_USER + value: "{{ oraculum_db_user }}" + - name: POSTGRESQL_PASSWORD + value: "{{ oraculum_db_pass }}" + - name: POSTGRESQL_DATABASE + value: "{{ oraculum_db_name }}" + - name: POSTGRESQL_SERVICE_HOST + value: "db01{{ env_suffix }}.iad2.fedoraproject.org" + - name: POSTGRESQL_SERVICE_PORT + value: "5432" + # Redis + - name: REDIS_PASSWORD + value: "{{ oraculum_redis_pass }}" + - name: REDIS_SERVICE_HOST + value: "oraculum-redis.oraculum.svc.cluster.local" + - name: REDIS_SERVICE_PORT_REDIS + value: "6379" + # Misc + - name: SECRET_KEY + value: "{{ oraculum_secret_key }}" + - name: OPENSHIFT_PROD +{% if env == 'staging' %} + value: "0" +{% else %} + value: "1" +{% endif %} + - name: MOTD_PASSWORD + value: "{{ oraculum_motd_pass }}" + # WatchDog emails + - name: SEND_ERROR_EMAILS + value: "true" + - name: ADMIN_EMAILS + value: "fzatlouk@redhat.com" + - name: SMTP_CONFIG + value: "bastion.iad2.fedoraproject.org;;;watchdog@packager-dashboard{{ env_suffix }}.fedoraproject.org;" + - name: BZ_API_KEY + value: "{{ oraculum_bz_api_key }}" + volumeMounts: + - name: oraculum-secret-volume + mountPath: /opt/app-root/secret/ + readOnly: true + readinessProbe: + timeoutSeconds: 5 + initialDelaySeconds: 5 + httpGet: + path: / + port: 8080 + livenessProbe: + timeoutSeconds: 15 + initialDelaySeconds: 30 + httpGet: + path: / + port: 8080 + volumes: + - name: oraculum-secret-volume + secret: + secretName: oraculum-secret +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: oraculum + service: oraculum-workerN + name: oraculum-worker + annotations: + image.openshift.io/triggers: >- + [{"from":{"kind":"ImageStreamTag","name":"packager-dashboard:latest","namespace":"oraculum"},"fieldPath":"spec.template.spec.containers[?(@.name==\"oraculum-worker\")].image","pause":"false"}] +spec: +{% if env == 'staging' %} + replicas: 2 +{% else %} + replicas: 4 # Change me to some biiig numba after you got me working +{% endif %} + selector: + matchLabels: + app: oraculum + service: oraculum-workerN + template: + metadata: + labels: + app: oraculum + service: oraculum-workerN + spec: + containers: + - name: oraculum-worker + image: image-registry.openshift-image-registry.svc:5000/oraculum/packager-dashboard:latest + command: ["celery", "-A", "oraculum.celery_app", "worker", "-c", "4", "--loglevel=INFO"] + resources: {} + env: + # Database + - name: POSTGRESQL_USER + value: "{{ oraculum_db_user }}" + - name: POSTGRESQL_PASSWORD + value: "{{ oraculum_db_pass }}" + - name: POSTGRESQL_DATABASE + value: "{{ oraculum_db_name }}" + - name: POSTGRESQL_SERVICE_HOST + value: "db01{{ env_suffix }}.iad2.fedoraproject.org" + - name: POSTGRESQL_SERVICE_PORT + value: "5432" + # Redis + - name: REDIS_PASSWORD + value: "{{ oraculum_redis_pass }}" + - name: REDIS_SERVICE_HOST + value: "oraculum-redis.oraculum.svc.cluster.local" + - name: REDIS_SERVICE_PORT_REDIS + value: "6379" + # Misc + - name: SECRET_KEY + value: "{{ oraculum_secret_key }}" + - name: OPENSHIFT_PROD +{% if env == 'staging' %} + value: "0" +{% else %} + value: "1" +{% endif %} + - name: MOTD_PASSWORD + value: "{{ oraculum_motd_pass }}" + # WatchDog emails + - name: SEND_ERROR_EMAILS + value: "true" + - name: ADMIN_EMAILS + value: "fzatlouk@redhat.com" + - name: SMTP_CONFIG + value: "bastion.iad2.fedoraproject.org;;;watchdog@packager-dashboard{{ env_suffix }}.fedoraproject.org;" + - name: BZ_API_KEY + value: "{{ oraculum_bz_api_key }}" + volumeMounts: + - name: oraculum-secret-volume + mountPath: /opt/app-root/secret/ + readOnly: true + volumes: + - name: oraculum-secret-volume + secret: + secretName: oraculum-secret +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: oraculum + service: oraculum-beatN + name: oraculum-beat + annotations: + image.openshift.io/triggers: >- + [{"from":{"kind":"ImageStreamTag","name":"packager-dashboard:latest","namespace":"oraculum"},"fieldPath":"spec.template.spec.containers[?(@.name==\"oraculum-beat\")].image","pause":"false"}] +spec: + replicas: 1 # Never change this to more or less than ONE! + selector: + matchLabels: + app: oraculum + service: oraculum-beatN + template: + metadata: + labels: + app: oraculum + service: oraculum-beatN + spec: + containers: + - name: oraculum-beat + image: image-registry.openshift-image-registry.svc:5000/oraculum/packager-dashboard:latest + command: ["celery", "-A", "oraculum.celery_app", "beat", "--loglevel=INFO"] + resources: {} + env: + # Database + - name: POSTGRESQL_USER + value: "{{ oraculum_db_user }}" + - name: POSTGRESQL_PASSWORD + value: "{{ oraculum_db_pass }}" + - name: POSTGRESQL_DATABASE + value: "{{ oraculum_db_name }}" + - name: POSTGRESQL_SERVICE_HOST + value: "db01{{ env_suffix }}.iad2.fedoraproject.org" + - name: POSTGRESQL_SERVICE_PORT + value: "5432" + # Redis + - name: REDIS_PASSWORD + value: "{{ oraculum_redis_pass }}" + - name: REDIS_SERVICE_HOST + value: "oraculum-redis.oraculum.svc.cluster.local" + - name: REDIS_SERVICE_PORT_REDIS + value: "6379" + # Misc + - name: SECRET_KEY + value: "{{ oraculum_secret_key }}" + - name: OPENSHIFT_PROD +{% if env == 'staging' %} + value: "0" +{% else %} + value: "1" +{% endif %} + - name: MOTD_PASSWORD + value: "{{ oraculum_motd_pass }}" + # WatchDog emails + - name: SEND_ERROR_EMAILS + value: "true" + - name: ADMIN_EMAILS + value: "fzatlouk@redhat.com" + - name: SMTP_CONFIG + value: "bastion.iad2.fedoraproject.org;;;watchdog@packager-dashboard{{ env_suffix }}.fedoraproject.org;" + - name: BZ_API_KEY + value: "{{ oraculum_bz_api_key }}" + volumeMounts: + - name: oraculum-secret-volume + mountPath: /opt/app-root/secret/ + readOnly: true + volumes: + - name: oraculum-secret-volume + secret: + secretName: oraculum-secret +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: oraculum + service: oraculum-flowerN + name: oraculum-flower + annotations: + image.openshift.io/triggers: >- + [{"from":{"kind":"ImageStreamTag","name":"packager-dashboard:latest","namespace":"oraculum"},"fieldPath":"spec.template.spec.containers[?(@.name==\"oraculum-flower\")].image","pause":"false"}] +spec: + replicas: 1 # Never change this to more or less than ONE! + selector: + matchLabels: + app: oraculum + service: oraculum-flowerN + template: + metadata: + labels: + app: oraculum + service: oraculum-flowerN + spec: + containers: + - name: oraculum-flower + image: image-registry.openshift-image-registry.svc:5000/oraculum/packager-dashboard:latest + ports: + - containerPort: 8080 + command: ["celery", "-A", "oraculum.celery_app", "flower", "--url_prefix=_flower", "--port=8080", "--address=0.0.0.0", "--basic_auth=frantisekz:{{ oraculum_flower_password }}"] + resources: {} + env: + # Database + - name: POSTGRESQL_USER + value: "{{ oraculum_db_user }}" + - name: POSTGRESQL_PASSWORD + value: "{{ oraculum_db_pass }}" + - name: POSTGRESQL_DATABASE + value: "{{ oraculum_db_name }}" + - name: POSTGRESQL_SERVICE_HOST + value: "db01{{ env_suffix }}.iad2.fedoraproject.org" + - name: POSTGRESQL_SERVICE_PORT + value: "5432" + # Redis + - name: REDIS_PASSWORD + value: "{{ oraculum_redis_pass }}" + - name: REDIS_SERVICE_HOST + value: "oraculum-redis.oraculum.svc.cluster.local" + - name: REDIS_SERVICE_PORT_REDIS + value: "6379" + # Misc + - name: SECRET_KEY + value: "{{ oraculum_secret_key }}" + - name: OPENSHIFT_PROD +{% if env == 'staging' %} + value: "0" +{% else %} + value: "1" +{% endif %} + - name: MOTD_PASSWORD + value: "{{ oraculum_motd_pass }}" + # WatchDog emails + - name: SEND_ERROR_EMAILS + value: "true" + - name: ADMIN_EMAILS + value: "fzatlouk@redhat.com" + - name: SMTP_CONFIG + value: "bastion.iad2.fedoraproject.org;;;watchdog@packager-dashboard{{ env_suffix }}.fedoraproject.org;" + - name: BZ_API_KEY + value: "{{ oraculum_bz_api_key }}" + volumeMounts: + - name: oraculum-secret-volume + mountPath: /opt/app-root/secret/ + readOnly: true + volumes: + - name: oraculum-secret-volume + secret: + secretName: oraculum-secret +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: oraculum + service: oraculum-redisN + name: oraculum-redis + annotations: + image.openshift.io/triggers: >- + [{"from":{"kind":"ImageStreamTag","name":"packager-dashboard-redis:latest","namespace":"oraculum"},"fieldPath":"spec.template.spec.containers[?(@.name==\"oraculum-redis\")].image","pause":"false"}] +spec: + replicas: 1 # Never change this to more or less than ONE! + selector: + matchLabels: + app: oraculum + service: oraculum-redisN + template: + metadata: + labels: + app: oraculum + service: oraculum-redisN + spec: + containers: + - name: oraculum-redis + image: image-registry.openshift-image-registry.svc:5000/oraculum/packager-dashboard-redis:latest + resources: {} + env: + - name: REDIS_PASSWORD + value: "{{ oraculum_redis_pass }}" +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: oraculum + service: oraculum-frontendN + name: oraculum-frontend + annotations: + image.openshift.io/triggers: >- + [{"from":{"kind":"ImageStreamTag","name":"oraculum-frontend:latest","namespace":"oraculum"},"fieldPath":"spec.template.spec.containers[?(@.name==\"oraculum-frontend\")].image","pause":"false"}] +spec: + replicas: 1 # Never change this to more or less than ONE! + selector: + matchLabels: + app: oraculum + service: oraculum-frontendN + template: + metadata: + labels: + app: oraculum + service: oraculum-frontendN + spec: + containers: + - name: oraculum-frontend + image: image-registry.openshift-image-registry.svc:5000/oraculum/oraculum-frontend:latest + resources: {} + env: + - name: SUBDIR + value: "/" + - name: API + value: "https://packager-dashboard{{ env_suffix }}.fedoraproject.org/api/v1/" + - name: "APIv2" + value: "https://packager-dashboard{{ env_suffix }}.fedoraproject.org/api/v2/" diff --git a/roles/openshift-apps/oraculum/templates/deploymentconfig.yml b/roles/openshift-apps/oraculum/templates/deploymentconfig.yml index f09fb0cf9d..4015bd856c 100644 --- a/roles/openshift-apps/oraculum/templates/deploymentconfig.yml +++ b/roles/openshift-apps/oraculum/templates/deploymentconfig.yml @@ -7,7 +7,7 @@ metadata: service: oraculum-api-endpoint name: oraculum-api-endpoint spec: - replicas: 1 + replicas: 0 selector: app: oraculum deploymentconfig: oraculum @@ -115,9 +115,9 @@ metadata: name: oraculum-worker spec: {% if env == 'staging' %} - replicas: 2 + replicas: 0 {% else %} - replicas: 4 # Change me to some biiig numba after you got me working + replicas: 0 # Change me to some biiig numba after you got me working {% endif %} selector: app: oraculum @@ -199,7 +199,7 @@ metadata: app: oraculum name: oraculum-beat spec: - replicas: 1 # Never change this to more or less than ONE! + replicas: 0 # Never change this to more or less than ONE! selector: app: oraculum deploymentconfig: oraculum @@ -280,7 +280,7 @@ metadata: app: oraculum name: oraculum-flower spec: - replicas: 1 # Never change this to more or less than ONE! + replicas: 0 # Never change this to more or less than ONE! selector: app: oraculum deploymentconfig: oraculum @@ -363,7 +363,7 @@ metadata: service: oraculum-redis name: oraculum-redis spec: - replicas: 1 # Never change this to more or less than ONE! + replicas: 0 # Never change this to more or less than ONE! selector: app: oraculum deploymentconfig: oraculum-redis @@ -399,7 +399,7 @@ metadata: service: oraculum-frontend name: oraculum-frontend spec: - replicas: 1 # Never change this to more or less than ONE! + replicas: 0 # Never change this to more or less than ONE! selector: app: oraculum deploymentconfig: oraculum-frontend