Last active
February 9, 2022 09:21
-
-
Save errordeveloper/4329034 to your computer and use it in GitHub Desktop.
Revisions
-
errordeveloper revised this gist
Jan 21, 2013 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,7 +15,7 @@ This presumes you are not using RVM, so no voodoo dances. start on virtual-filesystems stop on runlevel [06] env PATH=/opt/ruby/shims:/opt/ruby/rbenv/bin:/usr/local/bin:/usr/bin:/bin env RAILS_ENV=production @@ -47,6 +47,8 @@ Please also note that it can be used for roll-back just as well. console log env PATH=/opt/ruby/shims:/opt/ruby/rbenv/bin:/usr/local/bin:/usr/bin:/bin chdir /opt/my_app/ script -
errordeveloper revised this gist
Jan 21, 2013 . 2 changed files with 58 additions and 18 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,58 @@ # Using Unicorn with Upstart ***This configuration works with Upstart on Ubuntu 12.04 LTS*** The reason why it needs to be done this way (i.e. with the `pre-start` and `post-stop` stanzas), is because Upstart is unable to track whever Unicorn master process re-execs itself on hot deploys. One can use it without hot-deploys and run Unicorn in foreground also, it then only needs one exec stanza. This presumes you are not using RVM, so no voodoo dances. #/etc/init/my-app.conf description "My App" author "Ilya Dmitrichenko <errordeveloper@gmail.com>" start on virtual-filesystems stop on runlevel [06] env PATH=/opt/ruby/shims:/opt/ruby/rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin env RAILS_ENV=production setuid nobody setgid nobody chdir /opt/my_app/ pre-start exec ./bin/unicorn_rails -D -c /opt/my_app/config/unicorn.rb --env production post-stop exec kill `cat /opt/my_app/run/unicorn.pid` The next example allows one to run a very descriptive command from their deploy script: initctl emit my-app-deploy TAG=v1.2.3`. It demonstrates a very appropriate use of Upstart's events. Please also note that it can be used for roll-back just as well. #/etc/init/my-app-deploy-task.conf description "Upgade My App!" author "Ilya Dmitrichenko <errordeveloper@gmail.com>" on my-app-deploy task console log chdir /opt/my_app/ script git fetch --quiet --all --tags origin git checkout --quiet --force --detach $TAG bundle --quiet install kill -USR2 `cat ./run/unicorn.pid` end script This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,18 +0,0 @@ -
errordeveloper created this gist
Dec 18, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ description "My App" author "Ilya Dmitrichenko" start on virtual-filesystems stop on runlevel [06] env PATH=/etc/rbenv/shims:/usr/local/rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin env RAILS_ENV=production setuid rails setgid rails chdir /opt/my_app/current pre-start exec bundle exec unicorn_rails -D -c /opt/my_app/shared/config/unicorn.rb --env production post-stop exec kill `cat /opt/my_app/shared/pids/unicorn.pid`