diff --git a/roles/openshift-apps/modernpaste/files/buildconfig.yml b/roles/openshift-apps/modernpaste/files/buildconfig.yml index 198d81c8d2..030a197ea6 100644 --- a/roles/openshift-apps/modernpaste/files/buildconfig.yml +++ b/roles/openshift-apps/modernpaste/files/buildconfig.yml @@ -1,34 +1,34 @@ -- apiVersion: v1 - kind: BuildConfig - metadata: - name: "modernpaste-docker-build" - labels: - environment: "modernpaste" - spec: - runPolicy: Serial - source: - dockerfile: |- - FROM fedora:25 - LABEL \ - name="Modern Paste" \ - vendor="Fedora Infrastructure" \ - license="MIT" - RUN curl -o /etc/yum.repos.d/infra-stg.repo \ - https://infrastructure.fedoraproject.org/cgit/ansible.git/plain/files/common/fedora-infra-tags.repo - RUN yum -y install modern-paste - RUN yum -y install --setopt=tsflags=nodocs \ - python-gunicorn \ - python2-mock \ - python-psycopg2 - WORKDIR /usr/share/modern-paste - RUN sed -i '216,219d;228,229d' app/api/paste.py - RUN mv modern_paste.wsgi modern_paste_wsgi.py - USER 1001 - EXPOSE 8080 - ENTRYPOINT gunicorn --bind 0.0.0.0:8080 --access-logfile=- --chdir /usr/share/modern-paste modern_paste_wsgi:application - strategy: - type: Docker - output: - to: - kind: ImageStreamTag - name: inframodernpaste:latest +apiVersion: v1 +kind: BuildConfig +metadata: + name: "modernpaste-docker-build" + labels: + environment: "modernpaste" +spec: + runPolicy: Serial + source: + dockerfile: |- + FROM fedora:25 + LABEL \ + name="Modern Paste" \ + vendor="Fedora Infrastructure" \ + license="MIT" + RUN curl -o /etc/yum.repos.d/infra-stg.repo \ + https://infrastructure.fedoraproject.org/cgit/ansible.git/plain/files/common/fedora-infra-tags.repo + RUN yum -y install modern-paste + RUN yum -y install --setopt=tsflags=nodocs \ + python-gunicorn \ + python2-mock \ + python-psycopg2 + WORKDIR /usr/share/modern-paste + RUN sed -i '216,219d;228,229d' app/api/paste.py + RUN mv modern_paste.wsgi modern_paste_wsgi.py + USER 1001 + EXPOSE 8080 + ENTRYPOINT gunicorn --bind 0.0.0.0:8080 --access-logfile=- --chdir /usr/share/modern-paste modern_paste_wsgi:application + strategy: + type: Docker + output: + to: + kind: ImageStreamTag + name: inframodernpaste:latest diff --git a/roles/openshift-apps/modernpaste/files/configmap.yml b/roles/openshift-apps/modernpaste/files/configmap.yml index 61612167c2..8b012520e5 100644 --- a/roles/openshift-apps/modernpaste/files/configmap.yml +++ b/roles/openshift-apps/modernpaste/files/configmap.yml @@ -1,50 +1,50 @@ -- apiVersion: v1 - kind: ConfigMap - metadata: - name: "modernpaste-configmap" - labels: - environment: "modernpaste" - data: - flask_config.py: |- - import config - import constants - import os - - SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URI') - SQLALCHEMY_TRACK_MODIFICATIONS = False - SECRET_KEY = config.FLASK_SECRET_KEY - config.py: |- - import constants - import os - - # Domain from which you will access this app - # If running on a port other than 80, append it after a colon at the end of the domain, e.g. 'domain.com:8080' - DOMAIN = "modernpaste-web-modernpaste.app.os.stg.fedoraproject.org" - - # Use HTTPS by default? - # This is only used for deciding whether to use the http:// or https:// prefix when constructing full URLs, - # and is not related to your web server configuration. - DEFAULT_HTTPS = True - - # The type of build environment - # build_environment.DEV won't minify CSS and Closure-compile JavaScript; build_environment.PROD will. - # Dev and prod environments also use separate databases, modern_paste_dev and modern_paste, respectively. - BUILD_ENVIRONMENT = constants.build_environment.PROD - - # Option to use encrypted IDs rather than integer IDs - # Set this to True if you want paste IDs to be encrypted, e.g. displayed as h0GZ19np17iT~CtpuIH3NcnRi-rYnlYzizqToCmG3BY= - # If False, IDs will be displayed as regular, incrementing integers, e.g. 1, 2, 3, etc. - USE_ENCRYPTED_IDS = True - - # Choose to allow paste attachments - # This will allow for users to attach files and images to pastes. If disabled, the MAX_ATTACHMENT_SIZE and - # ATTACHMENTS_DIR configuration constants will be ignored. - ENABLE_PASTE_ATTACHMENTS = False - - # Allow only paste attachments below a certain size threshold, in MB - # Set this to 0 for an unlimited file size. - MAX_ATTACHMENT_SIZE = 5 - - # Location to store paste attachments - # Please use an absolute path and ensure that it is writable by www-data. - ATTACHMENTS_DIR = '/var/www/modern-paste-attachments' +apiVersion: v1 +kind: ConfigMap +metadata: + name: "modernpaste-configmap" + labels: + environment: "modernpaste" +data: + flask_config.py: |- + import config + import constants + import os + + SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URI') + SQLALCHEMY_TRACK_MODIFICATIONS = False + SECRET_KEY = config.FLASK_SECRET_KEY + config.py: |- + import constants + import os + + # Domain from which you will access this app + # If running on a port other than 80, append it after a colon at the end of the domain, e.g. 'domain.com:8080' + DOMAIN = "modernpaste-web-modernpaste.app.os.stg.fedoraproject.org" + + # Use HTTPS by default? + # This is only used for deciding whether to use the http:// or https:// prefix when constructing full URLs, + # and is not related to your web server configuration. + DEFAULT_HTTPS = True + + # The type of build environment + # build_environment.DEV won't minify CSS and Closure-compile JavaScript; build_environment.PROD will. + # Dev and prod environments also use separate databases, modern_paste_dev and modern_paste, respectively. + BUILD_ENVIRONMENT = constants.build_environment.PROD + + # Option to use encrypted IDs rather than integer IDs + # Set this to True if you want paste IDs to be encrypted, e.g. displayed as h0GZ19np17iT~CtpuIH3NcnRi-rYnlYzizqToCmG3BY= + # If False, IDs will be displayed as regular, incrementing integers, e.g. 1, 2, 3, etc. + USE_ENCRYPTED_IDS = True + + # Choose to allow paste attachments + # This will allow for users to attach files and images to pastes. If disabled, the MAX_ATTACHMENT_SIZE and + # ATTACHMENTS_DIR configuration constants will be ignored. + ENABLE_PASTE_ATTACHMENTS = False + + # Allow only paste attachments below a certain size threshold, in MB + # Set this to 0 for an unlimited file size. + MAX_ATTACHMENT_SIZE = 5 + + # Location to store paste attachments + # Please use an absolute path and ensure that it is writable by www-data. + ATTACHMENTS_DIR = '/var/www/modern-paste-attachments' diff --git a/roles/openshift-apps/modernpaste/files/deploymentconfig.yml b/roles/openshift-apps/modernpaste/files/deploymentconfig.yml index 312f265b1b..4432072d99 100644 --- a/roles/openshift-apps/modernpaste/files/deploymentconfig.yml +++ b/roles/openshift-apps/modernpaste/files/deploymentconfig.yml @@ -1,50 +1,50 @@ -- apiVersion: v1 - kind: DeploymentConfig - metadata: - name: "modernpaste-web" - labels: - environment: "modernpaste" - service: web - spec: - replicas: 1 - selector: - environment: "modernpaste" - service: web - template: - metadata: - labels: - environment: "modernpaste" - service: web - spec: - containers: - - name: web - image: 172.30.53.136:5000/modernpaste/inframodernpaste:latest - ports: - - containerPort: 8080 - volumeMounts: - - name: config-volume - mountPath: /etc/modern-paste - readOnly: true - - name: secret-volume - mountPath: /etc/secret - readOnly: true - env: - - name: ENCRYPTION_KEY - valueFrom: - secretKeyRef: - name: "modernpaste-secret" - key: encryption-key - - name: SESSION_KEY - valueFrom: - secretKeyRef: - name: "modernpaste-secret" - key: session-key - - name: DATABASE_URI - valueFrom: - secretKeyRef: - name: "modernpaste-secret" - key: database-uri - #- name: DOMAIN - # value: ${DOMAIN} - readinessProbe: - timeoutSeconds: 1 +apiVersion: v1 +kind: DeploymentConfig +metadata: + name: "modernpaste-web" + labels: + environment: "modernpaste" + service: web +spec: + replicas: 1 + selector: + environment: "modernpaste" + service: web + template: + metadata: + labels: + environment: "modernpaste" + service: web + spec: + containers: + - name: web + image: 172.30.53.136:5000/modernpaste/inframodernpaste:latest + ports: + - containerPort: 8080 + volumeMounts: + - name: config-volume + mountPath: /etc/modern-paste + readOnly: true + - name: secret-volume + mountPath: /etc/secret + readOnly: true + env: + - name: ENCRYPTION_KEY + valueFrom: + secretKeyRef: + name: "modernpaste-secret" + key: encryption-key + - name: SESSION_KEY + valueFrom: + secretKeyRef: + name: "modernpaste-secret" + key: session-key + - name: DATABASE_URI + valueFrom: + secretKeyRef: + name: "modernpaste-secret" + key: database-uri + #- name: DOMAIN + # value: ${DOMAIN} + readinessProbe: + timeoutSeconds: 1 diff --git a/roles/openshift-apps/modernpaste/files/imagestream.yml b/roles/openshift-apps/modernpaste/files/imagestream.yml index bff17900a7..eddd1d232c 100644 --- a/roles/openshift-apps/modernpaste/files/imagestream.yml +++ b/roles/openshift-apps/modernpaste/files/imagestream.yml @@ -1,6 +1,6 @@ -- apiVersion: v1 - kind: ImageStream - metadata: - labels: - environment: "modernpaste" - name: "inframodernpaste" +apiVersion: v1 +kind: ImageStream +metadata: + labels: + environment: "modernpaste" + name: "inframodernpaste" diff --git a/roles/openshift-apps/modernpaste/files/route.yml b/roles/openshift-apps/modernpaste/files/route.yml index 045d9a63e7..99207964e1 100644 --- a/roles/openshift-apps/modernpaste/files/route.yml +++ b/roles/openshift-apps/modernpaste/files/route.yml @@ -1,15 +1,15 @@ -- apiVersion: v1 - kind: Route - metadata: +apiVersion: v1 +kind: Route +metadata: + name: "modernpaste-web" + labels: + environment: "modernpaste" +spec: + port: + targetPort: web + to: + kind: Service name: "modernpaste-web" - labels: - environment: "modernpaste" - spec: - port: - targetPort: web - to: - kind: Service - name: "modernpaste-web" - tls: - termination: edge - insecureEdgeTerminationPolicy: Redirect + tls: + termination: edge + insecureEdgeTerminationPolicy: Redirect diff --git a/roles/openshift-apps/modernpaste/files/service.yml b/roles/openshift-apps/modernpaste/files/service.yml index d1eaf9136a..1f038915e7 100644 --- a/roles/openshift-apps/modernpaste/files/service.yml +++ b/roles/openshift-apps/modernpaste/files/service.yml @@ -1,14 +1,14 @@ -- apiVersion: v1 - kind: Service - metadata: - name: "modernpaste-web" - labels: - environment: "modernpaste" - spec: - selector: - environment: "modernpaste" - service: web - ports: - - name: web - port: 8080 - targetPort: 8080 +apiVersion: v1 +kind: Service +metadata: + name: "modernpaste-web" + labels: + environment: "modernpaste" +spec: + selector: + environment: "modernpaste" + service: web + ports: + - name: web + port: 8080 + targetPort: 8080 diff --git a/roles/openshift-apps/modernpaste/templates/secret.yml b/roles/openshift-apps/modernpaste/templates/secret.yml index 0153460875..ce4baea9c1 100644 --- a/roles/openshift-apps/modernpaste/templates/secret.yml +++ b/roles/openshift-apps/modernpaste/templates/secret.yml @@ -1,11 +1,11 @@ -- apiVersion: v1 - kind: Secret - metadata: - name: "modernpaste-secret" - labels: - environment: "modernpaste" - stringData: - encryption-key: "{{modernpaste_stg_encryption_key}}" - session-key: "{{modernpaste_stg_session_key}}" - database-uri: "postgres://{{modernpaste_stg_db_user}}:{{modernpaste_stg_db_password}}@db01/modernpaste" +apiVersion: v1 +kind: Secret +metadata: + name: "modernpaste-secret" + labels: + environment: "modernpaste" +stringData: + encryption-key: "{{modernpaste_stg_encryption_key}}" + session-key: "{{modernpaste_stg_session_key}}" + database-uri: "postgres://{{modernpaste_stg_db_user}}:{{modernpaste_stg_db_password}}@db01/modernpaste" -