From f24898db79137b06ca7bdc3fc563bf7b6e5503e6 Mon Sep 17 00:00:00 2001 From: Tomas Tomecek Date: Fri, 12 Aug 2016 11:19:59 +0200 Subject: [PATCH 1/4] containerize! --- Dockerfile | 16 ++++++++++++++++ README.rst | 11 +++++++++++ docker-compose.yml | 20 ++++++++++++++++++++ koji.conf | 31 +++++++++++++++++++++++++++++++ 4 files changed, 78 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 koji.conf diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..600fdf78 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM fedora:24 + +# so we don't have to compile those when fetched from PyPI +RUN dnf install -y python-pip python2-setuptools python2-cffi python2-zmq python2-cryptography koji python2-pdc-client && \ + dnf autoremove -y && dnf clean all && \ + mkdir /opt/fm-orchestrator/ +WORKDIR /opt/fm-orchestrator/ +COPY ./requirements.txt /opt/fm-orchestrator/ +RUN pip install --user -r ./requirements.txt + +COPY koji.conf /etc/rida/ + +COPY . /opt/fm-orchestrator/ + +RUN python2 ./manage.py upgradedb && ./generate_localhost_cert.sh +CMD ["python2", "manage.py", "runssl"] diff --git a/README.rst b/README.rst index 219966b5..0d2bd6c3 100644 --- a/README.rst +++ b/README.rst @@ -315,3 +315,14 @@ E.g. ``"scmurl": "git://pkgs.stg.fedoraproject.org/modules/testmodule.git?#020ea The toplevel directory containing the trees for each architecture of a module. This field is only present when a module finished building, i.e. with the states 'done' or 'ready'. + + +Development +=========== + +You can use docker containers for development. Here's a guide how to setup `docker `_ and `docker-compose `_. + +After your docker engine is set up and running, and docker-compose installed you can start whole system with a single command:: + + $ sudo docker-compose up + diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..84f8d774 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,20 @@ +version: "2" +services: + ridad: + build: + context: . + command: python2 /opt/fm-orchestrator/ridad.py + volumes: + - ./rida/:/opt/fm-orchestrator/rida/ # rida sources are bind-mounted, so you don't have to rebuild + - ~/.fedora.cert:/root/.fedora.cert # koji credentials are mounted inside + - ~/.fedora-server-ca.cert:/root/.fedora-server-ca.cert + - ~/.fedora-upload-ca.cert:/root/.fedora-upload-ca.cert + rida: + build: + context: . + ports: + - "5000:5000" + links: + - ridad + volumes: + - ./rida/:/opt/fm-orchestrator/rida/ diff --git a/koji.conf b/koji.conf new file mode 100644 index 00000000..67c385d7 --- /dev/null +++ b/koji.conf @@ -0,0 +1,31 @@ +[koji] + +;configuration for koji cli tool + +;url of XMLRPC server +server = http://koji.stg.fedoraproject.org/kojihub + +;url of web interface +weburl = http://koji.stg.fedoraproject.org/koji + +;url of package download site +topurl = http://kojipkgs.fedoraproject.org/ + +;path to the koji top directory +;topdir = /mnt/koji + +;configuration for Kerberos authentication + +;the service name of the principal being used by the hub +;krbservice = host + +;configuration for SSL authentication +authtype = ssl +;client certificate +cert = ~/.fedora.cert + +;certificate of the CA that issued the client certificate +ca = ~/.fedora-server-ca.cert + +;certificate of the CA that issued the HTTP server certificate +serverca = ~/.fedora-server-ca.cert From 5666d49bcef3375da6012d3df0c4a5ee0aaae88d Mon Sep 17 00:00:00 2001 From: Tomas Tomecek Date: Mon, 15 Aug 2016 15:01:06 +0200 Subject: [PATCH 2/4] readme, containers: provide debugging instructions --- README.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.rst b/README.rst index 0d2bd6c3..751d6827 100644 --- a/README.rst +++ b/README.rst @@ -326,3 +326,9 @@ After your docker engine is set up and running, and docker-compose installed you $ sudo docker-compose up +It may happen that you will run into issues and the container won't start properly. Best thing to do in that case is to rebuild the environment from scratch:: + + $ sudo docker-compose down -v + $ sudo docker-compose build --no-cache --pull + +First command will stop and remove all containers and volumes and second command will pull latest base image and perform a clean build without cache. From 71d7f382f17282c7908bcd65a1751ec61ec4826b Mon Sep 17 00:00:00 2001 From: Tomas Tomecek Date: Tue, 16 Aug 2016 09:25:49 +0200 Subject: [PATCH 3/4] composefile: change SELinux context appropriately --- docker-compose.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 84f8d774..7a9fe45a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,10 +5,10 @@ services: context: . command: python2 /opt/fm-orchestrator/ridad.py volumes: - - ./rida/:/opt/fm-orchestrator/rida/ # rida sources are bind-mounted, so you don't have to rebuild - - ~/.fedora.cert:/root/.fedora.cert # koji credentials are mounted inside - - ~/.fedora-server-ca.cert:/root/.fedora-server-ca.cert - - ~/.fedora-upload-ca.cert:/root/.fedora-upload-ca.cert + - ./rida/:/opt/fm-orchestrator/rida/:Z # rida sources are bind-mounted, so you don't have to rebuild + - ~/.fedora.cert:/root/.fedora.cert:Z # koji credentials are mounted inside + - ~/.fedora-server-ca.cert:/root/.fedora-server-ca.cert:Z + - ~/.fedora-upload-ca.cert:/root/.fedora-upload-ca.cert:Z rida: build: context: . @@ -17,4 +17,4 @@ services: links: - ridad volumes: - - ./rida/:/opt/fm-orchestrator/rida/ + - ./rida/:/opt/fm-orchestrator/rida/:Z From b1ae8e952ac595cb8e64fda75d7c1b6308d017be Mon Sep 17 00:00:00 2001 From: Tomas Tomecek Date: Tue, 16 Aug 2016 09:33:09 +0200 Subject: [PATCH 4/4] vagrantfile: put koji.conf to /etc/rida so connection to koji works --- Vagrantfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Vagrantfile b/Vagrantfile index a6a43800..f92dc768 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -6,6 +6,8 @@ $script = <