fritteli / gentoo-overlay

https://gittr.ch/linux/gentoo-overlay
GNU General Public License v2.0
24 stars 7 forks source link

gitlab mail_room not started #27

Closed LucaFulchir closed 8 years ago

LucaFulchir commented 8 years ago

mail_room is never started.

This is a proposed patch to test the existence of /etc/default/gitlab, and make sure that it contains "mail_room_enabled=true" just like the documentation says.

--- gitlab      2015-10-17 14:27:03.084539117 +0200
+++ gitlab      2015-10-17 14:48:22.851893855 +0200
@@ -13,12 +13,19 @@
 : ${sidekiq_logfile:="/var/log/gitlab/sidekiq.log"}
 : ${sidekiq_queues:="post_receive,mailer,archive_repo,system_hook,project_web_hook,gitlab_shell,common,default"}

+: ${mail_room_pidfile:="/run/gitlab/mail_room.pid"}
+: ${mail_room_logfile:="/var/log/gitlab/mail_room.log"}
+: ${mail_room_config:="/etc/gitlab/mail_room.yml"}
+
 server_command="/usr/bin/bundle"
 server_command_args="exec unicorn_rails -c ${gitlab_base}/config/unicorn.rb -E ${rails_env} -D"

 sidekiq_command="/usr/bin/bundle"
 sidekiq_command_args="exec sidekiq -q ${sidekiq_queues//,/ -q } -P ${sidekiq_pidfile} -L ${sidekiq_logfile}"

+mail_room_command="/usr/bin/bundle"
+mail_room_command_args="exec mail_room -q -c ${mail_room_config} >> ${mail_room_logfile} 2>&1"
+
 depend() {
        provide gitlab
        need redis
@@ -49,9 +56,32 @@
                --env RAILS_ENV=${rails_env} \
                --exec ${sidekiq_command} -- ${sidekiq_command_args}
        eend $?
+        if [ -e /etc/default/gitlab ]; then
+                . /etc/default/gitlab
+                if [ "${mail_room_enabled}" == "true" ]; then
+                        ebegin "Starting ${name} - mail_room"
+
+                        start-stop-daemon --start \
+                                --background --quiet \
+                                --chdir "${gitlab_base}" \
+                                --user=${gitlab_user} \
+                                --pidfile="${mail_room_pidfile}" \
+                                --env RAILS_ENV=${rails_env} \
+                                --exec ${mail_room_command} -- ${mail_room_command_args}
+                        eend $?
+                fi
+        fi
+
 }

 stop() {
+        ebegin "Stopping ${name} - mail_room"
+        start-stop-daemon --stop \
+                --signal QUIT \
+                --pidfile=${mail_room_pidfile} \
+                --exec ${mail_room_command}
+        eend $?
+
        ebegin "Stopping ${name} - Sidekiq"
        start-stop-daemon --stop \
                --pidfile=${sidekiq_pidfile} \
fritteli commented 8 years ago

Thanks for the patch, I'll look into it!

fritteli commented 8 years ago

I incorporated your patch into the init file, and I also added a service file for systemd (which I didn't test). Please re-merge version 8.0.5 and test! Thanks.

xificurk commented 8 years ago

The default delivery method for mail_room is using sidekiq, so for the "reply by email" function to work properly, we need to add incoming_email to sidekiq_queues. I'm not really sure if it's ok to always add it regardless of whether mail_room is starting... or it's better to configure it dynamically based on the current configuration?

fritteli commented 8 years ago

You're right.

fritteli commented 8 years ago

I added the queues "incoming_email" and "runner" to the init script for the existing 8.1.0 and 8.1.2 ebuilds, so please just re-merge one of those versions, and you should be good to go. The queues will be started regardless of whether mail_room is enabled or not, since it's also like this in the upstream init script.