#123 Update Dockerfile to conform C3I
Closed by jskladan. Opened by rayson.
taskotron/ rayson/resultsdb update-dockerfile  into  master

Download 123.patch
  1. Install app from source without building RPM to make it easier to build an image on OpenShift.
  2. Install dependencies from official Fedora repo rather than PyPI
    to comply with requirements from the Fedora community.
  3. Bump up Fedora version to 29.

rebased onto a58f4162bbbca39c3747c89385eb1753bfd7b4c8

@rayson Ideally, find somebody to test/review the changes. I'm not really that informed about the openshift requirements, nor do I have enough knowledge to test the changes properly.

@ralph @mikeb ?

rebased onto 5d30513f1bc2ab120890b91eaad5c0bfa81b7660

@jskladan Thank you for letting me know your confusion.

background

We are looking to leverage Greenwave for gating a container image between environments (dev,stage,prod,etc)[1]. To make that happen, new CI message types[2], like container-image.test.complete and container-image.gate.complete, are defined. Now we are in the progress of the deploying a cloned environment on UpShift (PnT's internal OpenShift cluster) where ResultsDB, ResultsDB-updater, WaiverDB, Greenwave, UMB, and all related Factory 2.0 services are modified to support gating containers.

purpose of making this PR

  1. I am hooking ResultsDB to debug and inspect the dataflow between services. But I find it's troublesome to make some changes then deploy it to UpShift.
  2. The current Dockerfile requires external RPMs before building, which make it harder to use OpenShift internal build system. This pull-request intends to build the container image from source.
  3. I'd like to deploy containerized ResultsDB to OpenShift during our integration test procedure. Changing the way of launching resultsdb from mod_wsgi-express to httpd will make the containerized ResultsDB more like production.

About test the changes

I will follow up later.

[1] https://pagure.io/greenwave/issue/333
[2] https://pagure.io/fedora-ci/messages/pull-request/18

rebased onto a2c878d17650aa0edb09afa79d54236c370bd63a

@mikeb could you comment here please?

Hey, guys. Just checking in on the progress - is somebody going to sign off on the changes? I could easily merge the PR, but as I said earlier, I can't really determine whether it is what you need.

@mprahl @mikeb @rayson ?

+1 This looks good to me.

thank you @mikeb

@rayson - could please rebase to current develop, so the PR can be merged? Thanks!

@jskladan Hi, sorry for my late following up. I was so busy recently.

Since there has been a lot of changes since the PR was created, especially the latest RPM package for fedora based on Python 3, I need to migrate the dockerfile to Python 3 too and deploy it to OpenShift to see if it works. I will do the rebase in the next week.

rebased onto 75fac9a53e5fea67608a2921f72902751e68d3f5

Hi all, I've updated this PR.

To test this PR:

Build a container image locally

The following command will build an image and tag it as local/resultsdb:test

# in the repo root
docker build -f openshift/Dockerfile --tag local/resultsdb:test .

Test the container locally with docker-compose

Prepare config files

conf/settings.py

SECRET_KEY = 'my-some-secret-key'
SQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2://resultsdb:resultsdb@db:5432/resultsdb'
FILE_LOGGING = False
LOGFILE = '/var/log/resultsdb/resultsdb.log'
SYSLOG_LOGGING = False
STREAM_LOGGING = True
RUN_HOST= '0.0.0.0'
RUN_PORT = 5001
MESSAGE_BUS_PUBLISH = False
MESSAGE_BUS_PLUGIN = 'dummy'

conf/resultsdb-openshift.conf

<Location />
</Location>

docker-compose.yaml

version: "2.2"
services:
  app:
    image: local/resultsdb:test
    build:
      context: .
      dockerfile: openshift/Dockerfile
    volumes:
      - ./conf/settings.py:/etc/resultsdb/settings.py:ro
      - ./conf/resultsdb-openshift.conf:/etc/httpd/conf.d/resultsdb.conf:ro
    ports:
      - 15001:5001/tcp
  db:
    image: registry.access.redhat.com/rhscl/postgresql-95-rhel7:latest
    environment:
      POSTGRESQL_USER: resultsdb
      POSTGRESQL_PASSWORD: resultsdb
      POSTGRESQL_DATABASE: resultsdb

Start

Start containers with:

docker-compose up

Import database schema and load dummy data:

docker-compose exec app resultsdb init_db
docker-compose exec app resultsdb mock_data

Browse all test results with a browser: http://localhost:15001/api/v2.0/results

Test this container on OpenShift

Push the built image to a remote registry, like quay.io/yuxzhu/resultsdb:test:

docker tag local/resultsdb:test quay.io/yuxzhu/resultsdb:test
docker push quay.io/yuxzhu/resultsdb:test

Deploy to OpenShift:

$ oc process -f openshift/resultsdb-test-template.yaml \
             -p TEST_ID=<TEST_ID> \
             -p RESULTSDB_IMAGE=<RESULTSDB_IMAGE> | oc apply -f -

rebased onto 0793d23a25556fba23b7320c0c24745a63492a15

Thank you @rayson!

Still, could you please submit the PR against develop branch, instead of master? We only merge into master from the develop branch. Thanks again.

@jskladan It doesn't seem to that Pagure allows to change the target branch.
I opened a new PR replacing this https://pagure.io/taskotron/resultsdb/pull-request/133

Thank you! I'll close this one, then.

Pull-Request has been closed by jskladan

Metadata