From f9bc94cc925d1839b06b7e51edd5871fb310b677 Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Thu, 27 Oct 2016 15:40:16 -0400 Subject: [PATCH 1/7] Add network utilities to help debug docker-compose container network. --- Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dockerfile b/Dockerfile index 6e490815..8300a161 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,6 +13,9 @@ RUN dnf install -y \ fedmsg-relay \ python-mock \ git \ + # Troubleshooting tools + telnet \ + nc \ && dnf autoremove -y \ && dnf clean all \ && mkdir /opt/module_build_service/ \ From fffb7d341f7ca45d20c95c76492d17d9a10dcbbe Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Thu, 27 Oct 2016 15:40:43 -0400 Subject: [PATCH 2/7] Get the network and database shared across our containers correctly. --- Dockerfile | 2 +- docker-compose.yml | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8300a161..5883cebc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,7 +13,7 @@ RUN dnf install -y \ fedmsg-relay \ python-mock \ git \ - # Troubleshooting tools + # Troubleshooting tools telnet \ nc \ && dnf autoremove -y \ diff --git a/docker-compose.yml b/docker-compose.yml index 3f904e89..8634c373 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,10 +4,13 @@ services: build: context: . command: fedmsg-relay - ports: - - "2003:2003" - - "4001:4001" - module_build_service_daemon: + expose: + - 2001 + - 2003 + volumes: + # module_build_service sources are bind-mounted, so you don't have to rebuild + - ./:/opt/module_build_service/:z + scheduler: build: context: . command: python2 /opt/module_build_service/module_build_service_daemon.py @@ -15,19 +18,19 @@ services: - fedmsg-relay volumes: # module_build_service sources are bind-mounted, so you don't have to rebuild - - ./module_build_service/:/opt/module_build_service/module_build_service/:z + - ./:/opt/module_build_service/:z - ~/.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 - module_build_service: + frontend: build: context: . ports: - "5000:5000" links: - - module_build_service_daemon + - scheduler - fedmsg-relay volumes: # module_build_service sources are bind-mounted, so you don't have to rebuild - - ./module_build_service/:/opt/module_build_service/module_build_service/:z + - ./:/opt/module_build_service/:z command: python2 manage.py runssl From 3a18e156ed156b4ff876b71d593c82f757394cc3 Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Thu, 27 Oct 2016 15:40:59 -0400 Subject: [PATCH 3/7] Adjust fedmsg config to work in our docker-compose environment. --- fedmsg.d/module_build_service.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/fedmsg.d/module_build_service.py b/fedmsg.d/module_build_service.py index 2d3b9653..61235801 100644 --- a/fedmsg.d/module_build_service.py +++ b/fedmsg.d/module_build_service.py @@ -1,12 +1,26 @@ config = { + # Just for dev. + "validate_signatures": False, + # Talk to the relay, so things also make it to composer.stg in our dev env "active": True, # Since we're in active mode, we don't need to declare any of our own # passive endpoints. This placeholder value needs to be here for the tests # to pass in Jenkins, though. \o/ - "endpoints": {}, - "relay_inbound": ["tcp://127.0.0.1:2003"], + "endpoints": { + "fedora-infrastructure": [ + # Just listen to staging for now, not to production (spam!) + #"tcp://hub.fedoraproject.org:9940", + "tcp://stg.fedoraproject.org:9940", + ], + "relay_outbound": [ + "tcp://fedmsg-relay:2001" + ], + }, + "relay_inbound": [ + "tcp://fedmsg-relay:2003" + ], # Start of code signing configuration # 'sign_messages': True, From 2eb03ca32e43d99ac11a3ae6b3189b538a8d72d9 Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Thu, 27 Oct 2016 15:41:14 -0400 Subject: [PATCH 4/7] Silence one really noisy logger from python-requests. --- fedmsg.d/logging.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 fedmsg.d/logging.py diff --git a/fedmsg.d/logging.py b/fedmsg.d/logging.py new file mode 100644 index 00000000..0e43586b --- /dev/null +++ b/fedmsg.d/logging.py @@ -0,0 +1,16 @@ +# Setup fedmsg logging. +# See the following for constraints on this format https://bit.ly/Xn1WDn +bare_format = "[%(asctime)s][%(name)10s %(levelname)7s] %(message)s" + +config = dict( + logging=dict( + loggers=dict( + # Quiet this guy down... + requests={ + "level": "WARNING", + "propagate": True, + "handlers": ["console"], + }, + ), + ), +) From d5aca36098e01e5f8cb3f56f2bd2fd4490b911c2 Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Thu, 27 Oct 2016 15:57:18 -0400 Subject: [PATCH 5/7] Simplify these build lines. --- docker-compose.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 8634c373..356c81d7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,8 +1,7 @@ version: "2" services: fedmsg-relay: - build: - context: . + build: . command: fedmsg-relay expose: - 2001 @@ -11,8 +10,7 @@ services: # module_build_service sources are bind-mounted, so you don't have to rebuild - ./:/opt/module_build_service/:z scheduler: - build: - context: . + build: . command: python2 /opt/module_build_service/module_build_service_daemon.py links: - fedmsg-relay @@ -23,8 +21,7 @@ services: - ~/.fedora-server-ca.cert:/root/.fedora-server-ca.cert:z - ~/.fedora-upload-ca.cert:/root/.fedora-upload-ca.cert:z frontend: - build: - context: . + build: . ports: - "5000:5000" links: From 6a12323242eacc6513490169ca8e8459066fa40b Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Thu, 27 Oct 2016 15:57:55 -0400 Subject: [PATCH 6/7] Whitespace, for readability. --- docker-compose.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 356c81d7..379092b6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,6 @@ version: "2" services: + fedmsg-relay: build: . command: fedmsg-relay @@ -9,6 +10,7 @@ services: volumes: # module_build_service sources are bind-mounted, so you don't have to rebuild - ./:/opt/module_build_service/:z + scheduler: build: . command: python2 /opt/module_build_service/module_build_service_daemon.py @@ -20,6 +22,7 @@ services: - ~/.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 + frontend: build: . ports: From bf33dfbb957c7782d1d91063f3f9a3d194bc387d Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Thu, 27 Oct 2016 15:58:35 -0400 Subject: [PATCH 7/7] Move the db initialization to a side container so we don't have to rebuild to nuke the db. --- Dockerfile | 2 -- docker-compose.yml | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5883cebc..7701d8de 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,5 +28,3 @@ COPY koji.conf /etc/module_build_service/ COPY copr.conf /etc/module_build_service/ COPY . /opt/module_build_service/ - -RUN python2 ./manage.py upgradedb && python2 manage.py generatelocalhostcert diff --git a/docker-compose.yml b/docker-compose.yml index 379092b6..0d51a40d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -30,7 +30,22 @@ services: links: - scheduler - fedmsg-relay + depends_on: + - upgradedb + - generatelocalhostcert volumes: # module_build_service sources are bind-mounted, so you don't have to rebuild - ./:/opt/module_build_service/:z command: python2 manage.py runssl + + upgradedb: + build: . + volumes: + - ./:/opt/module_build_service/:z + command: python2 manage.py upgradedb + + generatelocalhostcert: + build: . + volumes: + - ./:/opt/module_build_service/:z + command: python2 manage.py generatelocalhostcert