Skip to content

Reload Unicorn and Sidekiq after deployment #533

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 20, 2019

Conversation

sauloperez
Copy link
Collaborator

@sauloperez sauloperez commented Dec 20, 2019

So we can remove the following manual step from the deployment process:

  1. There is one last step though. Until we don't fix it, the app server
    needs to be restarted manually for the changes to be loaded. Run:

$ ssh timeoverflow@www.timeoverflow.org
$ sudo systemctl restart timeoverflow
$ sudo systemctl restart sidekiq

Now the Capistrano output looks like:

INFO [fbff0613] Running /usr/bin/env rm -rf /var/www/timeoverflow/releases/20191220151536 as timeoverflow@staging.timeoverflow.org
DEBUG [fbff0613] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="" ; /usr/bin/env rm -rf /var/www/timeoverflow/releases/20191220151536 )
 INFO [fbff0613] Finished in 0.183 seconds with exit status 0 (successful).
 INFO [9ab57c12] Running sudo systemctl reload timeoverflow as timeoverflow@staging.timeoverflow.org
DEBUG [9ab57c12] Command: sudo systemctl reload timeoverflow
 INFO [9ab57c12] Finished in 0.218 seconds with exit status 0 (successful).
 INFO [41e063eb] Running sudo systemctl restart sidekiq as timeoverflow@staging.timeoverflow.org
DEBUG [41e063eb] Command: sudo systemctl restart sidekiq
 INFO [41e063eb] Finished in 2.895 seconds with exit status 0 (successful).
DEBUG [3772e021] Running if test ! -d /var/www/timeoverflow/releases; then echo "Directory does not exist '/var/www/timeoverflow/releases'" 1>&2; false; fi as timeoverflow@staging.timeoverflow.org
DEBUG [3772e021] Command: if test ! -d /var/www/timeoverflow/releases; then echo "Directory does not exist '/var/www/timeoverflow/releases'" 1>&2; false; fi
DEBUG [3772e021] Finished in 0.181 seconds with exit status 0 (successful).
 INFO [266848f2] Running echo "Branch reload-unicorn-after-deployment (at fad9dbd) deployed as release 20191220152039 by pau" >> /var/www/timeoverflow/revisions.log as timeoverflow@staging.timeoverflow.org
DEBUG [266848f2] Command: echo "Branch reload-unicorn-after-deployment (at fad9dbd) deployed as release 20191220152039 by pau" >> /var/www/timeoverflow/revisions.log
 INFO [266848f2] Finished in 0.181 seconds with exit status 0 (successful).

Which generates the following log line

==> log/unicorn.err.log <==
E, [2019-12-20T16:20:59.911297 #32630] ERROR -- : reexec-ed child already running PID:1213

@sauloperez sauloperez force-pushed the reload-unicorn-after-deployment branch from df8cff0 to 2aef565 Compare December 20, 2019 15:24
So we can remove the following manual step from the deployment process:

> 9. There is one last step though. Until we don't fix it, the app server
needs to be restarted manually for the changes to be loaded. Run:

> $ ssh timeoverflow@www.timeoverflow.org
> $ sudo systemctl restart timeoverflow
> $ sudo systemctl restart sidekiq

Now Capistrano's output looks like:

```
INFO [fbff0613] Running /usr/bin/env rm -rf /var/www/timeoverflow/releases/20191220151536 as timeoverflow@staging.timeoverflow.org
DEBUG [fbff0613] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="" ; /usr/bin/env rm -rf /var/www/timeoverflow/releases/20191220151536 )
 INFO [fbff0613] Finished in 0.183 seconds with exit status 0 (successful).
 INFO [9ab57c12] Running sudo systemctl reload timeoverflow as timeoverflow@staging.timeoverflow.org
DEBUG [9ab57c12] Command: sudo systemctl reload timeoverflow
 INFO [9ab57c12] Finished in 0.218 seconds with exit status 0 (successful).
 INFO [41e063eb] Running sudo systemctl restart sidekiq as timeoverflow@staging.timeoverflow.org
DEBUG [41e063eb] Command: sudo systemctl restart sidekiq
 INFO [41e063eb] Finished in 2.895 seconds with exit status 0 (successful).
DEBUG [3772e021] Running if test ! -d /var/www/timeoverflow/releases; then echo "Directory does not exist '/var/www/timeoverflow/releases'" 1>&2; false; fi as timeoverflow@staging.timeoverflow.org
DEBUG [3772e021] Command: if test ! -d /var/www/timeoverflow/releases; then echo "Directory does not exist '/var/www/timeoverflow/releases'" 1>&2; false; fi
DEBUG [3772e021] Finished in 0.181 seconds with exit status 0 (successful).
 INFO [266848f2] Running echo "Branch reload-unicorn-after-deployment (at fad9dbd) deployed as release 20191220152039 by pau" >> /var/www/timeoverflow/revisions.log as timeoverflow@staging.timeoverflow.org
DEBUG [266848f2] Command: echo "Branch reload-unicorn-after-deployment (at fad9dbd) deployed as release 20191220152039 by pau" >> /var/www/timeoverflow/revisions.log
 INFO [266848f2] Finished in 0.181 seconds with exit status 0 (successful).
```

Which generates the following log line

```
==> log/unicorn.err.log <==
E, [2019-12-20T16:20:59.911297 #32630] ERROR -- : reexec-ed child already running PID:1213
```
@sauloperez sauloperez force-pushed the reload-unicorn-after-deployment branch from 2aef565 to 1972bd6 Compare December 20, 2019 15:24
@sauloperez
Copy link
Collaborator Author

sauloperez commented Dec 20, 2019

@sauloperez sauloperez merged commit f0c8241 into develop Dec 20, 2019
@sauloperez sauloperez deleted the reload-unicorn-after-deployment branch December 20, 2019 18:37
@sauloperez
Copy link
Collaborator Author

Wiki updated

@sauloperez sauloperez mentioned this pull request Jan 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants