If I could stop doing stupid things, that'd be greaaattt

Signed-off-by: Ricky Elrod <codeblock@fedoraproject.org>
This commit is contained in:
Rick Elrod 2017-07-25 17:59:31 +00:00
parent c7f1962ad2
commit 8b8549cf08
7 changed files with 178 additions and 178 deletions

View file

@ -1,34 +1,34 @@
- apiVersion: v1 apiVersion: v1
kind: BuildConfig kind: BuildConfig
metadata: metadata:
name: "modernpaste-docker-build" name: "modernpaste-docker-build"
labels: labels:
environment: "modernpaste" environment: "modernpaste"
spec: spec:
runPolicy: Serial runPolicy: Serial
source: source:
dockerfile: |- dockerfile: |-
FROM fedora:25 FROM fedora:25
LABEL \ LABEL \
name="Modern Paste" \ name="Modern Paste" \
vendor="Fedora Infrastructure" \ vendor="Fedora Infrastructure" \
license="MIT" license="MIT"
RUN curl -o /etc/yum.repos.d/infra-stg.repo \ RUN curl -o /etc/yum.repos.d/infra-stg.repo \
https://infrastructure.fedoraproject.org/cgit/ansible.git/plain/files/common/fedora-infra-tags.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 modern-paste
RUN yum -y install --setopt=tsflags=nodocs \ RUN yum -y install --setopt=tsflags=nodocs \
python-gunicorn \ python-gunicorn \
python2-mock \ python2-mock \
python-psycopg2 python-psycopg2
WORKDIR /usr/share/modern-paste WORKDIR /usr/share/modern-paste
RUN sed -i '216,219d;228,229d' app/api/paste.py RUN sed -i '216,219d;228,229d' app/api/paste.py
RUN mv modern_paste.wsgi modern_paste_wsgi.py RUN mv modern_paste.wsgi modern_paste_wsgi.py
USER 1001 USER 1001
EXPOSE 8080 EXPOSE 8080
ENTRYPOINT gunicorn --bind 0.0.0.0:8080 --access-logfile=- --chdir /usr/share/modern-paste modern_paste_wsgi:application ENTRYPOINT gunicorn --bind 0.0.0.0:8080 --access-logfile=- --chdir /usr/share/modern-paste modern_paste_wsgi:application
strategy: strategy:
type: Docker type: Docker
output: output:
to: to:
kind: ImageStreamTag kind: ImageStreamTag
name: inframodernpaste:latest name: inframodernpaste:latest

View file

@ -1,50 +1,50 @@
- apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
metadata: metadata:
name: "modernpaste-configmap" name: "modernpaste-configmap"
labels: labels:
environment: "modernpaste" environment: "modernpaste"
data: data:
flask_config.py: |- flask_config.py: |-
import config import config
import constants import constants
import os import os
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URI') SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URI')
SQLALCHEMY_TRACK_MODIFICATIONS = False SQLALCHEMY_TRACK_MODIFICATIONS = False
SECRET_KEY = config.FLASK_SECRET_KEY SECRET_KEY = config.FLASK_SECRET_KEY
config.py: |- config.py: |-
import constants import constants
import os import os
# Domain from which you will access this app # 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' # 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" DOMAIN = "modernpaste-web-modernpaste.app.os.stg.fedoraproject.org"
# Use HTTPS by default? # Use HTTPS by default?
# This is only used for deciding whether to use the http:// or https:// prefix when constructing full URLs, # 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. # and is not related to your web server configuration.
DEFAULT_HTTPS = True DEFAULT_HTTPS = True
# The type of build environment # The type of build environment
# build_environment.DEV won't minify CSS and Closure-compile JavaScript; build_environment.PROD will. # 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. # Dev and prod environments also use separate databases, modern_paste_dev and modern_paste, respectively.
BUILD_ENVIRONMENT = constants.build_environment.PROD BUILD_ENVIRONMENT = constants.build_environment.PROD
# Option to use encrypted IDs rather than integer IDs # 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= # 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. # If False, IDs will be displayed as regular, incrementing integers, e.g. 1, 2, 3, etc.
USE_ENCRYPTED_IDS = True USE_ENCRYPTED_IDS = True
# Choose to allow paste attachments # Choose to allow paste attachments
# This will allow for users to attach files and images to pastes. If disabled, the MAX_ATTACHMENT_SIZE and # 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. # ATTACHMENTS_DIR configuration constants will be ignored.
ENABLE_PASTE_ATTACHMENTS = False ENABLE_PASTE_ATTACHMENTS = False
# Allow only paste attachments below a certain size threshold, in MB # Allow only paste attachments below a certain size threshold, in MB
# Set this to 0 for an unlimited file size. # Set this to 0 for an unlimited file size.
MAX_ATTACHMENT_SIZE = 5 MAX_ATTACHMENT_SIZE = 5
# Location to store paste attachments # Location to store paste attachments
# Please use an absolute path and ensure that it is writable by www-data. # Please use an absolute path and ensure that it is writable by www-data.
ATTACHMENTS_DIR = '/var/www/modern-paste-attachments' ATTACHMENTS_DIR = '/var/www/modern-paste-attachments'

View file

@ -1,50 +1,50 @@
- apiVersion: v1 apiVersion: v1
kind: DeploymentConfig kind: DeploymentConfig
metadata: metadata:
name: "modernpaste-web" name: "modernpaste-web"
labels: labels:
environment: "modernpaste" environment: "modernpaste"
service: web service: web
spec: spec:
replicas: 1 replicas: 1
selector: selector:
environment: "modernpaste" environment: "modernpaste"
service: web service: web
template: template:
metadata: metadata:
labels: labels:
environment: "modernpaste" environment: "modernpaste"
service: web service: web
spec: spec:
containers: containers:
- name: web - name: web
image: 172.30.53.136:5000/modernpaste/inframodernpaste:latest image: 172.30.53.136:5000/modernpaste/inframodernpaste:latest
ports: ports:
- containerPort: 8080 - containerPort: 8080
volumeMounts: volumeMounts:
- name: config-volume - name: config-volume
mountPath: /etc/modern-paste mountPath: /etc/modern-paste
readOnly: true readOnly: true
- name: secret-volume - name: secret-volume
mountPath: /etc/secret mountPath: /etc/secret
readOnly: true readOnly: true
env: env:
- name: ENCRYPTION_KEY - name: ENCRYPTION_KEY
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: "modernpaste-secret" name: "modernpaste-secret"
key: encryption-key key: encryption-key
- name: SESSION_KEY - name: SESSION_KEY
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: "modernpaste-secret" name: "modernpaste-secret"
key: session-key key: session-key
- name: DATABASE_URI - name: DATABASE_URI
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: "modernpaste-secret" name: "modernpaste-secret"
key: database-uri key: database-uri
#- name: DOMAIN #- name: DOMAIN
# value: ${DOMAIN} # value: ${DOMAIN}
readinessProbe: readinessProbe:
timeoutSeconds: 1 timeoutSeconds: 1

View file

@ -1,6 +1,6 @@
- apiVersion: v1 apiVersion: v1
kind: ImageStream kind: ImageStream
metadata: metadata:
labels: labels:
environment: "modernpaste" environment: "modernpaste"
name: "inframodernpaste" name: "inframodernpaste"

View file

@ -1,15 +1,15 @@
- apiVersion: v1 apiVersion: v1
kind: Route kind: Route
metadata: metadata:
name: "modernpaste-web"
labels:
environment: "modernpaste"
spec:
port:
targetPort: web
to:
kind: Service
name: "modernpaste-web" name: "modernpaste-web"
labels: tls:
environment: "modernpaste" termination: edge
spec: insecureEdgeTerminationPolicy: Redirect
port:
targetPort: web
to:
kind: Service
name: "modernpaste-web"
tls:
termination: edge
insecureEdgeTerminationPolicy: Redirect

View file

@ -1,14 +1,14 @@
- apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: "modernpaste-web" name: "modernpaste-web"
labels: labels:
environment: "modernpaste" environment: "modernpaste"
spec: spec:
selector: selector:
environment: "modernpaste" environment: "modernpaste"
service: web service: web
ports: ports:
- name: web - name: web
port: 8080 port: 8080
targetPort: 8080 targetPort: 8080

View file

@ -1,11 +1,11 @@
- apiVersion: v1 apiVersion: v1
kind: Secret kind: Secret
metadata: metadata:
name: "modernpaste-secret" name: "modernpaste-secret"
labels: labels:
environment: "modernpaste" environment: "modernpaste"
stringData: stringData:
encryption-key: "{{modernpaste_stg_encryption_key}}" encryption-key: "{{modernpaste_stg_encryption_key}}"
session-key: "{{modernpaste_stg_session_key}}" session-key: "{{modernpaste_stg_session_key}}"
database-uri: "postgres://{{modernpaste_stg_db_user}}:{{modernpaste_stg_db_password}}@db01/modernpaste" database-uri: "postgres://{{modernpaste_stg_db_user}}:{{modernpaste_stg_db_password}}@db01/modernpaste"
- -