問題と解決#

520のBad gateway問題#

Problem

  • unicornが動いていない.

    # View customize unicorn
    ## 502 Bad gatewayになるとき
    redmine_1     | 2021-11-13 17:22:30,959 INFO success: unicorn entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
    redmine_1     | 2021-11-13 17:22:30,960 INFO success: cron entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
    redmine_1     | 2021-11-13 17:22:30,960 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
    redmine_1     | 2021-11-13 17:22:30,960 INFO exited: unicorn (exit status 1; not expected)
    redmine_1     | 2021-11-13 17:22:31,964 INFO spawned: 'unicorn' with pid 269
    redmine_1     | 2021-11-13 17:22:32,652 INFO exited: unicorn (exit status 1; not expected)
    redmine_1     | 2021-11-13 17:22:33,657 INFO spawned: 'unicorn' with pid 270
    redmine_1     | 2021-11-13 17:22:34,582 INFO exited: unicorn (exit status 1; not expected)
    redmine_1     | 2021-11-13 17:22:36,588 INFO spawned: 'unicorn' with pid 271
    redmine_1     | 2021-11-13 17:22:37,216 INFO exited: unicorn (exit status 1; not expected)
    redmine_1     | 2021-11-13 17:22:40,223 INFO spawned: 'unicorn' with pid 272
    redmine_1     | 2021-11-13 17:22:41,070 INFO exited: unicorn (exit status 1; not expected)
    redmine_1     | 2021-11-13 17:22:42,073 INFO gave up: unicorn entered FATAL state, too many start retries too quickly
    
    ## 正常時
    redmine_1     | 2021-11-13 17:24:21,082 INFO success: unicorn entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
    redmine_1     | 2021-11-13 17:24:21,083 INFO success: cron entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
    redmine_1     | 2021-11-13 17:24:21,083 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
    

Solution

  • 別ターミナルで動かす.

    • admin@118-27-30-44:~$ docker exec -it admin_redmine_1 /bin/bash

    • root@1412325af6c6:/home/redmine/redmine# bundle exec unicorn_rails -E production -c /home/redmine/redmine/config/unicorn.rb