Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
UNL Resource Scheduler
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jeff Sturek
UNL Resource Scheduler
Commits
02cf4e5f
Commit
02cf4e5f
authored
8 years ago
by
Tyler Lemburg
Browse files
Options
Downloads
Patches
Plain Diff
Deploy script
parent
cdc92e3b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
deploy.rb
+45
-0
45 additions, 0 deletions
deploy.rb
unicorn.rb
+3
-0
3 additions, 0 deletions
unicorn.rb
with
48 additions
and
0 deletions
deploy.rb
0 → 100644
+
45
−
0
View file @
02cf4e5f
pid_file
=
'/var/www/html/ucommscheduler.unl.edu/ucommscheduler.pid'
def
get_exit
$?
.
exitstatus
end
pid
=
(
File
.
read
pid_file
).
to_i
puts
'Starting new unicorn'
puts
"Sending USR2 to
#{
pid
}
"
# send USR2 to master unicorn process; this will spawn a new unicorn master
Process
.
kill
(
'USR2'
,
pid
)
puts
'Waiting for new unicorn to spawn'
sleep
3
new_pid
=
(
File
.
read
pid_file
).
to_i
puts
'Gracefully stopping old workers'
puts
"Sending WINCH to
#{
pid
}
"
# send WINCH to old master process. this gracefully stops workers
Process
.
kill
(
'WINCH'
,
pid
)
# decide if things are going well.
puts
'Did it.'
puts
'Check on the website. Are new things enabled and everything looking good?'
puts
'(Y) for yes, anything else for no'
response
=
STDIN
.
gets
if
response
.
capitalize
[
0
]
==
'Y'
# if so, send QUIT to old master. It shuts down, and finished.
puts
"Sending QUIT to old master at
#{
pid
}
"
Process
.
kill
(
'QUIT'
,
pid
)
puts
'QUIT sent'
puts
'We should be good! Nice job.'
puts
'New code deployed'
else
# if not, send HUP to old master to reload and restart workers.
# then send QUIT to new master to stop it and workers.
puts
"Dang. Sending HUP to old master at
#{
pid
}
to restart workers."
Process
.
kill
(
'HUP'
,
pid
)
puts
"Sending QUIT to new master at
#{
new_pid
}
to shut that all down."
Process
.
kill
(
'QUIT'
,
new_pid
)
puts
'job is done. Better luck next time!'
end
This diff is collapsed.
Click to expand it.
unicorn.rb
0 → 100644
+
3
−
0
View file @
02cf4e5f
worker_processes
1
working_directory
'/var/www/html/ucommscheduler.unl.edu'
pid
'/var/www/html/ucommscheduler.unl.edu/ucommscheduler.pid'
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment