testsdays: add a local/custom resultsdb instance just for us

This commit is contained in:
František Zatloukal 2020-11-02 11:36:14 +01:00
parent 3bd8ec31b9
commit 0335579fa2
5 changed files with 159 additions and 0 deletions

View file

@ -34,6 +34,20 @@
name: "{{ testdays_db_name }}"
owner: "{{ testdays_db_user }}"
encoding: UTF-8
- name: Create the database user (resultsdb)
postgresql_user:
name: "{{ resultsdb_testdays_db_user }}"
password: "{{ resultsdb_testdays_db_pass }}"
- name: Create the database itself (resultsdb)
postgresql_db:
name: "{{ resultsdb_testdays_db_name }}"
owner: "{{ resultsdb_testdays_db_user }}"
encoding: UTF-8
- name: Test the database creation (resultsdb)
postgresql_db:
name: "{{ resultsdb_testdays_db_name }}"
owner: "{{ resultsdb_testdays_db_user }}"
encoding: UTF-8
- name: make the app be real
hosts: os_masters_stg[0] #:os_masters[0]:
@ -83,6 +97,18 @@
serviceport: 8080-tcp
servicename: testdays
- role: openshift/object
app: resultsdb
file: service.yml
objectname: service.yml
- role: openshift/route
app: resultsdb
routename: resultsdb
host: "testdays-rdb{{ env_suffix }}.fedoraproject.org"
serviceport: 8080-tcp
servicename: resultsdb
- role: openshift/start-build
app: testdays
buildname: testdays-build

View file

@ -13,3 +13,19 @@ spec:
selector:
app: testdays
deploymentconfig: testdays
---
apiVersion: v1
kind: Service
metadata:
labels:
app: resultsdb
name: resultsdb
spec:
ports:
- name: 8080-tcp
port: 8080
protocol: TCP
targetPort: 8080
selector:
app: resultsdb
deploymentconfig: resultsdb

View file

@ -30,3 +30,35 @@ spec:
triggers:
- type: ConfigChange
- type: ImageChange
---
apiVersion: v1
kind: BuildConfig
metadata:
name: resultsdb-build
labels:
environment: "resultsdb"
spec:
output:
to:
kind: ImageStreamTag
name: resultsdb:latest
source:
type: Git
git:
uri: https://pagure.io/taskotron/resultsdb.git
{% if env == 'staging' %}
# ref: "develop"
ref: "openshift_WIP"
{% else %}
ref: "master"
{% endif %}
strategy:
type: Source
sourceStrategy:
from:
kind: ImageStreamTag
namespace: openshift
name: python:3.6
triggers:
- type: ConfigChange
- type: ImageChange

View file

@ -73,3 +73,77 @@ spec:
from:
kind: ImageStreamTag
name: testdays:latest
---
---
apiVersion: v1
kind: DeploymentConfig
metadata:
labels:
app: resultsdb
service: resultsdb
name: resultsdb
spec:
replicas: 1
selector:
app: resultsdb
deploymentconfig: resultsdb
strategy:
type: Recreate
recreateParams:
mid:
failurePolicy: Abort
execNewPod:
containerName: resultsdb
# We only need to init the database the first time, after we just need to check
# for DB upgrades
command: ["python", "/opt/app-root/src/resultsdb/cli.py", "init_db"]
template:
metadata:
labels:
app: resultsdb
deploymentconfig: resultsdb
spec:
containers:
- name: resultsdb
image: resultsdb:latest
ports:
- containerPort: 8080
resources: {}
env:
- name: POSTGRESQL_USER
value: "{{ resultsdb_testdays_db_user }}"
- name: POSTGRESQL_PASSWORD
value: "{{ resultsdb_testdays_db_pass }}"
- name: POSTGRESQL_DATABASE
value: "{{ resultsdb_testdays_db_name }}"
- name: POSTGRESQL_SERVICE_HOST
value: "db01{{ env_suffix }}.iad2.fedoraproject.org"
- name: POSTGRESQL_SERVICE_PORT
value: "5432"
- name: SECRET_KEY
value: "{{ resultsdb_testdays_secret_key }}"
- name: OPENSHIFT_PROD
value: "1"
readinessProbe:
timeoutSeconds: 1
initialDelaySeconds: 5
httpGet:
path: /
port: 8080
livenessProbe:
timeoutSeconds: 1
initialDelaySeconds: 30
httpGet:
path: /
port: 8080
triggers:
- type: ConfigChange
- type: ImageChange
imageChangeParams:
automatic: true
containerNames:
- resultsdb
from:
kind: ImageStreamTag
name: resultsdb:latest

View file

@ -8,3 +8,14 @@ spec:
local: false
status:
dockerImageRepository: ""
---
apiVersion: v1
kind: ImageStream
metadata:
name: resultsdb
spec:
lookupPolicy:
local: false
status:
dockerImageRepository: ""