jimzucker/github-webhooks

Ruby puts not showing in docker logs

Closed this issue · 1 comments

I noticed when running in detached mode the docker logs do not show the puts output.

Reading this seems to be a buffering issue.

sinatra/sinatra#1118

adding $stdout.sync = true as described in the Sinatra ticket worked.

Test 1 - New repo initialized with README.md

➜ git-webhooks git:(master) ✗ docker run --rm -ti -p 4567:4567 -v $PWD/.webhook_properties:/usr/src/app/.webhook_properties
--name github-webhooks jimzucker/github-webhooks:latest

[2020-02-10 15:55:19] INFO WEBrick 1.4.2
[2020-02-10 15:55:19] INFO ruby 2.6.5 (2019-10-01) [x86_64-linux]
== Sinatra (v2.0.8.1) has taken the stage on 4567 for development with backup from WEBrick
[2020-02-10 15:55:19] INFO WEBrick::HTTPServer#start: pid=1 port=4567
[INFO] Ignoring object = label, action = created
140.82.115.247 - - [10/Feb/2020:15:55:46 +0000] "POST /github_webhook HTTP/1.1" 200 - 0.0037
172.17.0.1 - - [10/Feb/2020:15:55:46 UTC] "POST /github_webhook HTTP/1.1" 200 0

  • -> /github_webhook
    [INFO] Processing object= repository, action= created on repo= StrategicDevOps/docker3 by jimzucker
    [INFO] Getting Authorized User: method= Get, url= https://api.github.com/user
    [INFO] Ignoring object = before, action =
    192.30.252.96 - - [10/Feb/2020:15:55:47 +0000] "POST /github_webhook HTTP/1.1" 200 - 0.0007
    172.17.0.1 - - [10/Feb/2020:15:55:47 UTC] "POST /github_webhook HTTP/1.1" 200 0
  • -> /github_webhook
    [INFO] Ignoring object = ref_type, action =
    140.82.115.246 - - [10/Feb/2020:15:55:48 +0000] "POST /github_webhook HTTP/1.1" 200 - 0.0008
    172.17.0.1 - - [10/Feb/2020:15:55:48 UTC] "POST /github_webhook HTTP/1.1" 200 0
  • -> /github_webhook
    [INFO] Checking existance of README.md: method= Get, url= https://api.github.com/repos/StrategicDevOps/docker3/contents/README.md
    [INFO] Defaulting Repository Settings: method= Patch, url= https://api.github.com/repos/StrategicDevOps/docker3
    [INFO] Protecting master branch: method= Put, url= https://api.github.com/repos/StrategicDevOps/docker3/branches/master/protection
    [INFO] Defaulting Repository Settings: method= Post, url= https://api.github.com/repos/StrategicDevOps/docker3/issues
    140.82.115.244 - - [10/Feb/2020:15:56:18 +0000] "POST /github_webhook HTTP/1.1" 200 - 32.2684
    172.17.0.1 - - [10/Feb/2020:15:55:46 UTC] "POST /github_webhook HTTP/1.1" 200 383
  • -> /github_webhook
    [INFO] Ignoring object = issue, action = opened
    140.82.115.250 - - [10/Feb/2020:15:56:19 +0000] "POST /github_webhook HTTP/1.1" 200 - 0.0006
    172.17.0.1 - - [10/Feb/2020:15:56:19 UTC] "POST /github_webhook HTTP/1.1" 200 0
  • -> /github_webhook
    [INFO] Ignoring object = repository, action = deleted
    192.30.252.97 - - [10/Feb/2020:15:56:45 +0000] "POST /github_webhook HTTP/1.1" 200 - 0.0008
    172.17.0.1 - - [10/Feb/2020:15:56:45 UTC] "POST /github_webhook HTTP/1.1" 200 0
  • -> /github_webhook

Test 2 - New repo NOT initialized with README.md

[INFO] Ignoring object = label, action = created
192.30.252.91 - - [10/Feb/2020:15:57:30 +0000] "POST /github_webhook HTTP/1.1" 200 - 0.0011
172.17.0.1 - - [10/Feb/2020:15:57:30 UTC] "POST /github_webhook HTTP/1.1" 200 0