From d24b7f2491f550d31fcc1f73dd01677bb4440b77 Mon Sep 17 00:00:00 2001 From: Adam Piasecki Date: Apr 22 2022 15:10:11 +0000 Subject: [PATCH 1/7] Created waiverdb directory with Dockerfile and Makefile for waiverdb --- diff --git a/images/waiverdb/Dockerfile b/images/waiverdb/Dockerfile new file mode 100644 index 0000000..9f24b24 --- /dev/null +++ b/images/waiverdb/Dockerfile @@ -0,0 +1,29 @@ +ARG FEDORA_VERSION + +FROM registry.fedoraproject.org/fedora:${FEDORA_VERSION} + +RUN dnf -y install --nodocs --setopt=install_weak_deps=false \ + git-core \ + python3-pip \ + python3-setuptools \ + python3-gunicorn \ + python3-flask \ + python3-flask-cors \ + python3-flask-migrate \ + python3-flask-oidc \ + python3-flask-restful \ + python3-requests \ + python3-stomppy \ + python3-prometheus_client \ + python3-fedora-messaging \ + python3-gssapi + +RUN pip3 install --no-deps git+https://pagure.io/waiverdb.git + +COPY conf/settings.py.example /conf/settings.py + +USER 1001 + +EXPOSE 8080 + +ENTRYPOINT ["/usr/bin/gunicorn-3", "--bind", "0.0.0.0:8080", "--access-logfile", "-", "waiverdb.wsgi:app"] diff --git a/images/waiverdb/Makefile b/images/waiverdb/Makefile new file mode 100644 index 0000000..27a2724 --- /dev/null +++ b/images/waiverdb/Makefile @@ -0,0 +1,20 @@ +SHELL := /bin/bash +FEDORA_VERSION := 35 +REG := quay.io +ORG := fedora-kube-sig +NAME := waiverdb +TAG := latest +IMAGE := ${REG}/${ORG}/${NAME}:${TAG} +CRI := podman +SETTINGS := https://pagure.io/waiverdb/blob/master/f/conf/settings.py + +image/build: + @${CRI} build -t ${IMAGE} --build-arg FEDORA_VERSION=${FEDORA_VERSION} . + +image/push: image/build + @${CRI} push ${IMAGE} + +image/debug: image/build + @${CRI} run -it --entrypoint /bin/bash ${IMAGE} + +.PHONY: image/build image/push image/debug diff --git a/images/waiverdb/conf/settings.py.example b/images/waiverdb/conf/settings.py.example new file mode 100644 index 0000000..025165c --- /dev/null +++ b/images/waiverdb/conf/settings.py.example @@ -0,0 +1,28 @@ +# Copy this file to `conf/settings.py` to put it into effect. It overrides the values defined +# in `waiverdb/config.py`. +SECRET_KEY = 'replace-me-with-something-random' +#DATABASE_URI = 'postgresql+psycopg2://dbuser:dbpassword@dbhost:dbport/dbname' +DATABASE_URI = 'postgresql+psycopg2:///waiverdb' +#SHOW_DB_URI = False +HOST= '0.0.0.0' +PORT = 5004 +## Alternatively, you could use stomp to publish messages to a message bus. +#MESSAGE_PUBLISHER = 'stomp' +#STOMP_CONFIGS = { +# 'destination': '/topic/VirtualTopic.eng.waiverdb.waiver.new', +# 'connection': { +# 'host_and_ports': [ +# ('broker01', 61612), +# ('broker02', 61612), +# ], +# 'use_ssl': True, +# 'ssl_key_file': '/path/to/key/file', +# 'ssl_cert_file': '/path/to/cert/file', +# 'ssl_ca_certs': '/path/to/ca/certs', +# }, +# # Alternatively, you can connect STOMP server with username and password. +# 'credentials': { +# 'username': 'username', +# 'password': 'password', +# } +#} \ No newline at end of file From 071f18ee10da414f5f845eda859969f9bb5bb1b9 Mon Sep 17 00:00:00 2001 From: c4rt0 Date: Apr 28 2022 12:57:05 +0000 Subject: [PATCH 2/7] Modified the registry to quay.io --- diff --git a/images/waiverdb/Dockerfile b/images/waiverdb/Dockerfile index 9f24b24..9003521 100644 --- a/images/waiverdb/Dockerfile +++ b/images/waiverdb/Dockerfile @@ -1,6 +1,6 @@ ARG FEDORA_VERSION -FROM registry.fedoraproject.org/fedora:${FEDORA_VERSION} +FROM registry.quay.io/fedora/fedora:${FEDORA_VERSION} RUN dnf -y install --nodocs --setopt=install_weak_deps=false \ git-core \ @@ -11,7 +11,7 @@ RUN dnf -y install --nodocs --setopt=install_weak_deps=false \ python3-flask-cors \ python3-flask-migrate \ python3-flask-oidc \ - python3-flask-restful \ + python3-flask-restf python3-requests \ python3-stomppy \ python3-prometheus_client \ @@ -20,7 +20,7 @@ RUN dnf -y install --nodocs --setopt=install_weak_deps=false \ RUN pip3 install --no-deps git+https://pagure.io/waiverdb.git -COPY conf/settings.py.example /conf/settings.py +COPY conf/settings.py /conf/settings.py USER 1001 diff --git a/images/waiverdb/conf/settings.py b/images/waiverdb/conf/settings.py new file mode 100644 index 0000000..68202fe --- /dev/null +++ b/images/waiverdb/conf/settings.py @@ -0,0 +1,28 @@ +# Copy this file to `conf/settings.py` to put it into effect. It overrides the values defined +# in `waiverdb/config.py`. +SECRET_KEY = "replace-me-with-something-random" +# DATABASE_URI = 'postgresql+psycopg2://dbuser:dbpassword@dbhost:dbport/dbname' +DATABASE_URI = "postgresql+psycopg2:///waiverdb" +# SHOW_DB_URI = False +HOST = "0.0.0.0" +PORT = 5004 +## Alternatively, you could use stomp to publish messages to a message bus. +# MESSAGE_PUBLISHER = 'stomp' +# STOMP_CONFIGS = { +# 'destination': '/topic/VirtualTopic.eng.waiverdb.waiver.new', +# 'connection': { +# 'host_and_ports': [ +# ('broker01', 61612), +# ('broker02', 61612), +# ], +# 'use_ssl': True, +# 'ssl_key_file': '/path/to/key/file', +# 'ssl_cert_file': '/path/to/cert/file', +# 'ssl_ca_certs': '/path/to/ca/certs', +# }, +# # Alternatively, you can connect STOMP server with username and password. +# 'credentials': { +# 'username': 'username', +# 'password': 'password', +# } +# } diff --git a/images/waiverdb/conf/settings.py.example b/images/waiverdb/conf/settings.py.example deleted file mode 100644 index 025165c..0000000 --- a/images/waiverdb/conf/settings.py.example +++ /dev/null @@ -1,28 +0,0 @@ -# Copy this file to `conf/settings.py` to put it into effect. It overrides the values defined -# in `waiverdb/config.py`. -SECRET_KEY = 'replace-me-with-something-random' -#DATABASE_URI = 'postgresql+psycopg2://dbuser:dbpassword@dbhost:dbport/dbname' -DATABASE_URI = 'postgresql+psycopg2:///waiverdb' -#SHOW_DB_URI = False -HOST= '0.0.0.0' -PORT = 5004 -## Alternatively, you could use stomp to publish messages to a message bus. -#MESSAGE_PUBLISHER = 'stomp' -#STOMP_CONFIGS = { -# 'destination': '/topic/VirtualTopic.eng.waiverdb.waiver.new', -# 'connection': { -# 'host_and_ports': [ -# ('broker01', 61612), -# ('broker02', 61612), -# ], -# 'use_ssl': True, -# 'ssl_key_file': '/path/to/key/file', -# 'ssl_cert_file': '/path/to/cert/file', -# 'ssl_ca_certs': '/path/to/ca/certs', -# }, -# # Alternatively, you can connect STOMP server with username and password. -# 'credentials': { -# 'username': 'username', -# 'password': 'password', -# } -#} \ No newline at end of file From afe76db6e6a74f323e824cae65265408993ff7b4 Mon Sep 17 00:00:00 2001 From: c4rt0 Date: Apr 28 2022 13:02:54 +0000 Subject: [PATCH 3/7] Added client.conf file --- diff --git a/images/waiverdb/Dockerfile b/images/waiverdb/Dockerfile index 9003521..220b56c 100644 --- a/images/waiverdb/Dockerfile +++ b/images/waiverdb/Dockerfile @@ -11,17 +11,22 @@ RUN dnf -y install --nodocs --setopt=install_weak_deps=false \ python3-flask-cors \ python3-flask-migrate \ python3-flask-oidc \ - python3-flask-restf + python3-flask-restf \ python3-requests \ python3-stomppy \ python3-prometheus_client \ python3-fedora-messaging \ - python3-gssapi + python3-gssapi \ + fedora-messaging RUN pip3 install --no-deps git+https://pagure.io/waiverdb.git +RUN mkdir -p /etc/waiverdb + COPY conf/settings.py /conf/settings.py +COPY conf/client.conf /conf/client.conf + USER 1001 EXPOSE 8080 diff --git a/images/waiverdb/conf/client.conf b/images/waiverdb/conf/client.conf new file mode 100644 index 0000000..14ce25b --- /dev/null +++ b/images/waiverdb/conf/client.conf @@ -0,0 +1,10 @@ +[waiverdb] +# Specify OIDC or Kerberos for authentication +auth_method=OIDC +api_url=https://waiverdb.fedoraproject.org/api/v1.0 +oidc_id_provider=https://id.fedoraproject.org/openidc/ +oidc_client_id=waiverdb-authorizer +oidc_client_secret=notsecret +oidc_scopes= +openid +https://waiverdb.fedoraproject.org/oidc/create-waiver From 58d525d1f9a4657537af90e9bca36cc4ead0d01a Mon Sep 17 00:00:00 2001 From: c4rt0 Date: Apr 28 2022 13:05:09 +0000 Subject: [PATCH 4/7] Modifying file path --- diff --git a/images/waiverdb/Dockerfile b/images/waiverdb/Dockerfile index 220b56c..fddbde9 100644 --- a/images/waiverdb/Dockerfile +++ b/images/waiverdb/Dockerfile @@ -23,9 +23,9 @@ RUN pip3 install --no-deps git+https://pagure.io/waiverdb.git RUN mkdir -p /etc/waiverdb -COPY conf/settings.py /conf/settings.py +COPY conf/settings.py /etc/waiverdb/settings.py -COPY conf/client.conf /conf/client.conf +COPY conf/client.conf /etc/waiverdb/client.conf USER 1001 From 5e5be4c58a6d37dfc530efa2a4e1c9266b3c9fa3 Mon Sep 17 00:00:00 2001 From: c4rt0 Date: Apr 28 2022 13:10:48 +0000 Subject: [PATCH 5/7] Changed the registry path to quay.io --- diff --git a/images/waiverdb/Dockerfile b/images/waiverdb/Dockerfile index fddbde9..6ad8f0b 100644 --- a/images/waiverdb/Dockerfile +++ b/images/waiverdb/Dockerfile @@ -1,6 +1,6 @@ ARG FEDORA_VERSION -FROM registry.quay.io/fedora/fedora:${FEDORA_VERSION} +FROM quay.io/fedora/fedora:${FEDORA_VERSION} RUN dnf -y install --nodocs --setopt=install_weak_deps=false \ git-core \ From 0aa0048ff9c91d3a6f6df5456413c1aec623376e Mon Sep 17 00:00:00 2001 From: c4rt0 Date: Apr 28 2022 13:19:20 +0000 Subject: [PATCH 6/7] Adding missing library python3-flask-restful --- diff --git a/images/waiverdb/Dockerfile b/images/waiverdb/Dockerfile index 6ad8f0b..5155901 100644 --- a/images/waiverdb/Dockerfile +++ b/images/waiverdb/Dockerfile @@ -10,6 +10,7 @@ RUN dnf -y install --nodocs --setopt=install_weak_deps=false \ python3-flask \ python3-flask-cors \ python3-flask-migrate \ + python3-flask-restful \ python3-flask-oidc \ python3-flask-restf \ python3-requests \ From 727de48eee2dd86fdf8af1272dde7e0821b09589 Mon Sep 17 00:00:00 2001 From: c4rt0 Date: Apr 28 2022 13:24:36 +0000 Subject: [PATCH 7/7] Adding missing library python3-flask-restful --- diff --git a/images/waiverdb/Dockerfile b/images/waiverdb/Dockerfile index 5155901..8170adf 100644 --- a/images/waiverdb/Dockerfile +++ b/images/waiverdb/Dockerfile @@ -12,7 +12,6 @@ RUN dnf -y install --nodocs --setopt=install_weak_deps=false \ python3-flask-migrate \ python3-flask-restful \ python3-flask-oidc \ - python3-flask-restf \ python3-requests \ python3-stomppy \ python3-prometheus_client \