#300 Resultsdb: Instance for testdays
Merged 3 years ago by pingou. Opened 3 years ago by frantisekz.
fedora-infra/ frantisekz/ansible rdb_testdays  into  master

@@ -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

@@ -13,3 +13,19 @@ 

    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

@@ -30,3 +30,35 @@ 

    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

@@ -73,3 +73,77 @@ 

        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

@@ -8,3 +8,14 @@ 

      local: false

  status:

    dockerImageRepository: ""

+ ---

+ apiVersion: v1

+ kind: ImageStream

+ metadata:

+   name: resultsdb

+ spec:

+   lookupPolicy:

+     local: false

+ status:

+   dockerImageRepository: ""

+ 

rebased onto 09a1f06c2e5f44cd9eaafbe38e3bfa2563641f98

3 years ago

1 new commit added

  • Rework
3 years ago

1 new commit added

  • Feedback
3 years ago

1 new commit added

  • Playbook
3 years ago

Let's merge the commits. I think I would invert the commit message on the first commit, the app/project considered here is testdays not resultsdb, so maybe something like: testsdays: add a local/custom resultsdb instance just for us?

1 new commit added

  • Service
3 years ago

rebased onto 0335579

3 years ago

Let's give this a try and see how it does :)

Pull-Request has been merged by pingou

3 years ago