From 147cf32a0a68c9471fe1908c33d9407ce67ddedf Mon Sep 17 00:00:00 2001 From: James Babb Date: Mon, 3 Jun 2019 09:21:32 -0500 Subject: [PATCH] auto-create queue if does not exist. also hack to remove stale pid file --- Sources/SIS/app/models/course.rb | 3 +++ Sources/SIS/app/models/user.rb | 3 +++ Sources/SIS/run-rails.sh | 3 +++ 3 files changed, 9 insertions(+) diff --git a/Sources/SIS/app/models/course.rb b/Sources/SIS/app/models/course.rb index 471ed8b..4ae68fe 100644 --- a/Sources/SIS/app/models/course.rb +++ b/Sources/SIS/app/models/course.rb @@ -12,6 +12,9 @@ def publish_to_rabbit(action) channel = rabbit_connection.create_channel + # Create the queue if it does not exist + channel.queue("sis.course", :exclusive => false) + # TODO: allow user to specify exchange in config exchange = channel.default_exchange diff --git a/Sources/SIS/app/models/user.rb b/Sources/SIS/app/models/user.rb index 438642e..a5fd58b 100644 --- a/Sources/SIS/app/models/user.rb +++ b/Sources/SIS/app/models/user.rb @@ -48,6 +48,9 @@ def publish_to_rabbit(action) channel = rabbit_connection.create_channel + # Create the queue if it does not exist + channel.queue("sis.user", :exclusive => false) + # TODO: allow user to specify exchange in config exchange = channel.default_exchange diff --git a/Sources/SIS/run-rails.sh b/Sources/SIS/run-rails.sh index ab4f4bc..f4aea56 100755 --- a/Sources/SIS/run-rails.sh +++ b/Sources/SIS/run-rails.sh @@ -23,7 +23,10 @@ fi # Do not start if we did not bootstrap if [ ! -f /FIRSTRUN ] then + # HACK...delete the pid file that seems to stick around + rm -f /myapp/tmp/pids/server.pid bundle exec rails s -p 3000 -b '0.0.0.0' + rm -f /myapp/tmp/pids/server.pid else echo "Bootstrap was not completed. Not starting..." fi