talkingquickly / capistrano-3-rails-template Goto Github PK
View Code? Open in Web Editor NEWTemplate for deploying Rails applications with Capistrano 3
Template for deploying Rails applications with Capistrano 3
The aforementioned command gives me the following error in when the deploy:setup_config task is run:
NameError: undefined local variable or method `root' for #<SSHKit::Backend::Netssh:0x00000001e597e0>
(erb):7:in `smart_template'
I have also tried without the '=', because I figured that all other variable declarations in the same file do not use it, but the result is the same.
It would seem to me that the root variable should be declared within ruby code <% root = current_path %>.
How does it work for you?
Hi!
Is it also planned to integrate a capistrano maintenance page into this template?
Best regards,
Matthias
Following the book, when I ran
cap aborted!
NameError: undefined local variable or method `full_app_name' for main:Object
config/deploy.rb:53:in `<top (required)>'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-3.1.0/lib/capistrano/setup.rb:14:in `load'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-3.1.0/lib/capistrano/setup.rb:14:in `block (2 levels) in <top (required)>'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-3.1.0/lib/capistrano/application.rb:15:in `run'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-3.1.0/bin/cap:3:in `<top (required)>'
/home/nano/.rvm/gems/ruby-2.0.0-p247/bin/cap:23:in `load'
/home/nano/.rvm/gems/ruby-2.0.0-p247/bin/cap:23:in `<main>'
/home/nano/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `eval'
/home/nano/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => production
(See full trace by running task with --trace)
➜ blog git:(master) ✗
Hello @TalkingQuickly
I have successfully installed the server using github.com:TalkingQuickly/rails-server-template.git following the book.
Then I copy the capistrano template in my project using this https://github.com/TalkingQuickly/capistrano-3-rails-template
and configure the production.rb and deploy.rb
but when I execute this command cap production deploy:setup_config
I got this error.
DEBUG[a46eddbf] Running /usr/bin/env [ ! -d /usr/local/rbenv/versions/2.1.1 ] on smsblastr.com
DEBUG[a46eddbf] Command: [ ! -d /usr/local/rbenv/versions/2.1.1 ]
DEBUG[a46eddbf] Finished in 1.671 seconds with exit status 0 (successful).
ERRORrbenv: 2.1.1 is not installed or not found in /usr/local/rbenv/versions/2.1.1
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing on host smsblastr.com: exit
Any Idea what did I miss?
Cheers,
Chris
I have this error, when run cap production deploy:compile_assets_locally
Errno::ENOENT: No such file or directory - RAILS_ENV=production bundle exec rake
assets:precompile
I just wanted to mention I had a few issues with the logrotate config out of the box.
I noticed my logs wern't being rotated so I ran logrotate -d -f on the config file.
First I got an error about the ownership being wrong.
deploy@myhost://var/www/my_app/shared/config$ sudo logrotate -d -f /etc/logrotate.d/my_app_production
Ignoring /etc/logrotate.d/my_app_production because the file owner is wrong (should be root).
Handling 0 logs
So I fixed that, then get errors that the parent directory is also incorrect.
deploy@myhost://var/www/my_app/shared/config$ sudo chown root:root log_rotation
deploy@myhost://var/www/my_app/shared/config$ sudo logrotate -d -f /etc/logrotate.d/my_app_production
reading config file /etc/logrotate.d/my_app_production
error: /etc/logrotate.d/my_app_production:9 unknown option 'endscript' -- ignoring line
Handling 1 logs
rotating pattern: /var/www/my_app/shared/log/*.log forced from command line (52 rotations)
empty log files are not rotated, old logs are removed
considering log /var/www/my_app/shared/log/cron.log
error: skipping "/var/www/my_app/shared/log/cron.log" because parent directory has insecure permissions (It's world writable or writable by group which is
not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.
considering log /var/www/my_app/shared/log/ember-frontend.production.log
error: skipping "/var/www/my_app/shared/log/ember-frontend.production.log" because parent directory has insecure permissions (It's world writable or writa
ble by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.
considering log /var/www/my_app/shared/log/production.log
error: skipping "/var/www/my_app/shared/log/production.log" because parent directory has insecure permissions (It's world writable or writable by group wh
ich is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.
considering log /var/www/my_app/shared/log/sidekiq.log
error: skipping "/var/www/my_app/shared/log/sidekiq.log" because parent directory has insecure permissions (It's world writable or writable by group which
is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.
considering log /var/www/my_app/shared/log/unicorn.log
error: skipping "/var/www/my_app/shared/log/unicorn.log" because parent directory has insecure permissions (It's world writable or writable by group which
is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.
I gave the su option a shot, and my logs are rotated now.
su deploy deploy
Not sure what a fix should look like, either set the owner to root in setup_config
or somehow set the su
option globally.
Hi,
I'm using this capistrano plugin to handle nginx and unicorn setup.
That plugin has a pattern of copying nginx.conf
file to sites-available
directory and then symlinking it to sites-enabled
.
Here are the relevant code lines.
This project differs from the above approach: nginx.conf
is symlinked to sites-enabled
straight from shared/config
dir.
Personally, I like the scenario where all the config files are kept in one place - shared/config
. On the other hand, I'm not sure if there is some other nginx convention/rule that dictates all config files must be kept in sites-available
.
Do you know if there's any benefits from using one approach over the other?
Thanks
I'm testing deploys on vagrant but it failed during asset precompilation as rsync was using the default 22 port and vagrant is expecting port 2222 by default.
I set this up in the vagrant.rb
file I use to define the deploy environment:
server '127.0.0.1:2222', user: 'deploy', roles: %w{web app db}, primary: true
But rsync still used the port 22.
So I directly modified the code in compile_assets_locally.cap
to
execute"rsync -e 'ssh -p2222' -av ./public/assets/ #{role.user}@#{role.hostname}:#{release_path}/public/assets/;"
But it looks like there's probably a cleaner way to specify the port used when deploying?
In check_revision.cap, it looks like assumes that the remote the app is being deployed from is origin
. I typically name mine after the host (github
or bb
or whatever
). Is there anyway to make this configurable so that it is not assuming origin
or is this something I should just change per-use? I would be happy to make it configurable, just want to make sure this is the case. 👌
I've tried solving this to no avail so far. I think I've followed the instructions in your book correctly to this point.
$ bundle exec cap production deploy:restart
, it fails:DEBUG [64c2c32d] Running /usr/bin/env [ -d /usr/local/rbenv/versions/2.1.5 ] as deploy@(example).com
DEBUG [64c2c32d] Command: [ -d /usr/local/rbenv/versions/2.1.5 ]
DEBUG [64c2c32d] Finished in 1.087 seconds with exit status 0 (successful).
INFO [fb0a4d08] Running /usr/bin/env sudo /etc/init.d/unicorn_ffth_a2_production restart as deploy@(example).com
DEBUG [fb0a4d08] Command: ( RBENV_ROOT=/usr/local/rbenv RBENV_VERSION=2.1.5 /usr/bin/env sudo /etc/init.d/unicorn_ffth_a2_production restart )
DEBUG [fb0a4d08] reloaded OK
INFO [fb0a4d08] Finished in 0.032 seconds with exit status 0 (successful).
INFO [131af9e6] Running /usr/bin/env sudo /etc/init.d/unicorn_ffth_a2_production restart as deploy@(example).com
DEBUG [131af9e6] Command: ( RBENV_ROOT=/usr/local/rbenv RBENV_VERSION=2.1.5 /usr/bin/env sudo /etc/init.d/unicorn_ffth_a2_production restart )
DEBUG [131af9e6] Couldn't reload, starting 'cd /home/deploy/apps/ffth_a2_production/current; bundle exec unicorn -D -c /home/deploy/apps/ffth_a2_production/shared/config/unicorn.rb -E production' instead
DEBUG [131af9e6] master failed to start, check stderr log for details
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy@(example).com: sudo exit status: 1
sudo stdout: Nothing written
sudo stderr: Couldn't reload, starting 'cd /home/deploy/apps/ffth_a2_production/current; bundle exec unicorn -D -c /home/deploy/apps/ffth_a2_production/shared/config/unicorn.rb -E production' instead
master failed to start, check stderr log for details
...
When I check the website, the changes are actually successfully deployed when I do a full cap deploy
, but Capistrano does not continue after the exception is thrown.
I ssh'd in as the deploy
user and ran $ sudo service unicorn_ffth_a2_production restart
and got
reloaded OK
I, [2015-02-03T04:05:41.420675 #3975] INFO -- : executing ["/home/deploy/apps/ffth_a2_production/shared/bundle/ruby/2.1.0/bin/unicorn", "-D", "-c", "/home/deploy/apps/ffth_a2_production/shared/config/unicorn.rb", "-E", "production", {10=>#<Kgio::UNIXServer:/tmp/unicorn.ffth_a2_production.sock>}] (in /home/deploy/apps/ffth_a2_production/releases/20150203081053)
I, [2015-02-03T04:05:42.056269 #3975] INFO -- : inherited addr=/tmp/unicorn.ffth_a2_production.sock fd=10
I, [2015-02-03T04:05:42.059709 #3975] INFO -- : Refreshing Gem list
/home/deploy/apps/ffth_a2_production/shared/bundle/ruby/2.1.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:206:in `pid=': Already running on PID:3975 (or pid=/home/deploy/apps/ffth_a2_production/current/tmp/pids/unicorn.pid is stale) (ArgumentError)
from /home/deploy/apps/ffth_a2_production/shared/bundle/ruby/2.1.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:135:in `start'
from /home/deploy/apps/ffth_a2_production/shared/bundle/ruby/2.1.0/gems/unicorn-4.8.3/bin/unicorn:126:in `<top (required)>'
from /home/deploy/apps/ffth_a2_production/shared/bundle/ruby/2.1.0/bin/unicorn:23:in `load'
from /home/deploy/apps/ffth_a2_production/shared/bundle/ruby/2.1.0/bin/unicorn:23:in `<main>'
We've got an old pid and server pid is not the old pid
killing master process (good thing tm)
We've got an old pid and server pid is not the old pid
killing master process (good thing tm)
We've got an old pid and server pid is not the old pid
killing master process (good thing tm)
I, [2015-02-03T04:05:44.192262 #3975] INFO -- : master process ready
I, [2015-02-03T04:05:44.206371 #4067] INFO -- : worker=1 ready
I, [2015-02-03T04:05:44.208465 #4063] INFO -- : worker=0 ready
I, [2015-02-03T04:05:44.221720 #4071] INFO -- : worker=2 ready
I, [2015-02-03T04:05:44.452826 #3740] INFO -- : reaped #<Process::Status: pid 3752 exit 0> worker=2
I, [2015-02-03T04:05:44.453221 #3740] INFO -- : reaped #<Process::Status: pid 3760 exit 0> worker=0
I, [2015-02-03T04:05:44.553920 #3740] INFO -- : reaped #<Process::Status: pid 3748 exit 0> worker=1
I, [2015-02-03T04:05:44.554506 #3740] INFO -- : master complete
(the workers do restart)
I've tried restarting nginx and rebooting Ubuntu, didn't work.
Any advice would be greatly appreciated. Thanks!
When I run cap production deploy:setup_config
and watch the debug messages, none of the symlinks are being created properly as the value for :full_app_name
is omitted. For example, the debug message for the unicorn_init.sh symlink is:
Running /usr/bin/env sudo ln -nfs /home/deploy/apps/myapp_production/shared/config/unicorn_init.sh /etc/init.d/unicorn_ on www.mydomain.com
Rather than the expected:
Running /usr/bin/env sudo ln -nfs /home/deploy/apps/myapp_production/shared/config/unicorn_init.sh /etc/init.d/unicorn_myapp_production on www.mydomain.com
I have noticed that sidekiq dies and the Capistrano recipe does not include Monit recipes for sidekiq?
the error in nginx log is as - invalid upstream '/home/deploy/apps/current/tmp' no file or directory exists. Shouldn't the below path point to '/tmp'
ruby
upstream unicorn {
server unix:/tmp/unicorn.<%= fetch(:full_app_name) %>.sock fail_timeout=0;
}
Sorry I'm new to git , so I'm sure about pulls and patches etc.
I'm going through your tutorial in the book and I've found the tutorial source has a typo
database: <%= "#{fetch(:applocation)}_#{fetch(:rails_env)}" %>
instead of
database: <%= "#{fetch(:application)}_#{fetch(:rails_env)}" %>
in the file database.example.yml.erb
Hello and thanks a lot for this template app.
I noticed in our production environment that issuing a unicorn restart / reload via cap will often not restart the server successfully.
"Reloaded OK" does get printed, however the PIDs do not change and the server still points to the previous release.
Have you ever encountered this issue on your deployments?
Thanks in advance.
When running cap production deploy
it returns two erros as show below:
blog git/master
❯ cap production deploy
DEBUG [96e3b038] Running /usr/bin/env [ ! -d /usr/local/rbenv/versions/2.0.0-p247 ] on 107.170.81.168
DEBUG [96e3b038] Command: [ ! -d /usr/local/rbenv/versions/2.0.0-p247 ]
DEBUG [96e3b038] Finished in 1.216 seconds with exit status 1 (failed).
--> All tests passed
rm: no se puede borrar «log/capistrano.test.log»: No existe el archivo o el directorio
INFO [fc0e6068] Running /usr/bin/env mkdir -p /tmp/blog/ on 107.170.81.168
DEBUG [fc0e6068] Command: ( RBENV_ROOT=/usr/local/rbenv RBENV_VERSION=2.0.0-p247 /usr/bin/env mkdir -p /tmp/blog/ )
...
...
)
INFO [e4f96f8f] Finished in 0.150 seconds with exit status 0 (successful).
INFO [2fe24c52] Running /usr/bin/env RAILS_ENV=production bundle exec rake assets:precompile on
DEBUG [2fe24c52] Command: RAILS_ENV=production bundle exec rake assets:precompile
cap aborted!
SSHKit::Command::Failed: RAILS_ENV=production bundle exec rake assets:precompile exit status: 256
RAILS_ENV=production bundle exec rake assets:precompile stdout: Nothing written
RAILS_ENV=production bundle exec rake assets:precompile stderr: rake aborted!
ActiveRecord::AdapterNotSpecified: database configuration does not specify adapter
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-4.0.2/lib/active_record/connection_adapters/connection_specification.rb:52:in `resolve_hash_connection'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-4.0.2/lib/active_record/connection_adapters/connection_specification.rb:46:in `resolve_string_connection'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-4.0.2/lib/active_record/connection_adapters/connection_specification.rb:30:in `spec'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-4.0.2/lib/active_record/connection_handling.rb:39:in `establish_connection'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-4.0.2/lib/active_record/railtie.rb:176:in `block (2 levels) in <class:Railtie>'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:28:in `block in on_load'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:27:in `each'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:27:in `on_load'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-4.0.2/lib/active_record/railtie.rb:174:in `block in <class:Railtie>'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `instance_exec'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `run'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/initializable.rb:55:in `block in run_initializers'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/initializable.rb:54:in `run_initializers'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/application.rb:215:in `initialize!'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/railtie/configurable.rb:30:in `method_missing'
/home/nano/tmp/blog/config/environment.rb:5:in `<top (required)>'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `block in require'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/application.rb:189:in `require_environment!'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/application.rb:250:in `block in run_tasks_blocks'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-rails-2.0.1/lib/sprockets/rails/task.rb:54:in `block (2 levels) in define'
/home/nano/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `eval'
/home/nano/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => environment
(See full trace by running task with --trace)
One is SSHKit::Command::Failed: RAILS_ENV=production bundle exec rake assets:precompile exit status: 256
and another (which seems unrelated) ActiveRecord::AdapterNotSpecified: database configuration does not specify adapter
Any ideas?
How else would it get into /shared so it can be symlinked.
IfranK$cap production deploy:setup_config
DEBUG[c72065e8] Running /usr/bin/env [ -f /etc/nginx/sites-enabled/default ] on host [name]
DEBUG[c72065e8] Command: [ -f /etc/nginx/sites-enabled/default ]
DEBUG[c72065e8] Finished in 2.661 seconds with exit status 1 (failed).
No default Nginx Virtualhost to remove
INFO[08d8c147] Running /usr/bin/env mkdir -p /home/hbquality/apps/HBM_production/shared/config on host [name]
DEBUG[08d8c147] Command: /usr/bin/env mkdir -p /home/hbquality/apps/HBM_production/shared/config
INFO[08d8c147] Finished in 0.418 seconds with exit status 0 (successful).
DEBUGUploading /home/hbquality/apps/HBM_production/shared/config/nginx.conf 0.0%
INFOUploading /home/hbquality/apps/HBM_production/shared/config/nginx.conf 100.0%
INFOcopying: #<StringIO:0x007ffaf1222420> to: /home/hbquality/apps/HBM_production/shared/config/nginx.conf
DEBUGUploading /home/hbquality/apps/HBM_production/shared/config/log_rotation 0.0%
INFOUploading /home/hbquality/apps/HBM_production/shared/config/log_rotation 100.0%
INFOcopying: #<StringIO:0x007ffaf189b518> to: /home/hbquality/apps/HBM_production/shared/config/log_rotation
DEBUGUploading /home/hbquality/apps/HBM_production/shared/config/monit 0.0%
INFOUploading /home/hbquality/apps/HBM_production/shared/config/monit 100.0%
INFOcopying: #<StringIO:0x007ffaf10ab038> to: /home/hbquality/apps/HBM_production/shared/config/monit
DEBUGUploading /home/hbquality/apps/HBM_production/shared/config/unicorn.rb 0.0%
INFOUploading /home/hbquality/apps/HBM_production/shared/config/unicorn.rb 100.0%
INFOcopying: #<StringIO:0x007ffaf1bbafc8> to: /home/hbquality/apps/HBM_production/shared/config/unicorn.rb
DEBUGUploading /home/hbquality/apps/HBM_production/shared/config/unicorn_init.sh 0.0%
INFOUploading /home/hbquality/apps/HBM_production/shared/config/unicorn_init.sh 100.0%
INFOcopying: #<StringIO:0x007ffaf1fa6880> to: /home/hbquality/apps/HBM_production/shared/config/unicorn_init.sh
INFO[e9c0e486] Running /usr/bin/env chmod +x /home/hbquality/apps/HBM_production/shared/config/unicorn_init.sh on host [name]
DEBUG[e9c0e486] Command: /usr/bin/env chmod +x /home/hbquality/apps/HBM_production/shared/config/unicorn_init.sh
INFO[e9c0e486] Finished in 0.403 seconds with exit status 0 (successful).
INFO[5a58fa1e] Running /usr/bin/env sudo ln -nfs /home/hbquality/apps/HBM_production/shared/config/nginx.conf /etc/nginx/sites-enabled/HBM_production on host [name]
DEBUG[5a58fa1e] Command: /usr/bin/env sudo ln -nfs /home/hbquality/apps/HBM_production/shared/config/nginx.conf /etc/nginx/sites-enabled/HBM_production
DEBUG[5a58fa1e] [sudo] password for hbquality:
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing on host [name]: sudo exit status: 1
sudo stdout: Nothing written
sudo stderr: Nothing written
/Users/IfranK/Desktop/RailsApp/HBM Colaboracion/hbm/lib/capistrano/tasks/setup_config.rake:29:in `block (4 levels) in <top (required)>'
/Users/IfranK/Desktop/RailsApp/HBM Colaboracion/hbm/lib/capistrano/tasks/setup_config.rake:28:in `each'
/Users/IfranK/Desktop/RailsApp/HBM Colaboracion/hbm/lib/capistrano/tasks/setup_config.rake:28:in `block (3 levels) in <top (required)>'
SSHKit::Command::Failed: sudo exit status: 1
sudo stdout: Nothing written
sudo stderr: Nothing written
/Users/IfranK/Desktop/RailsApp/HBM Colaboracion/hbm/lib/capistrano/tasks/setup_config.rake:29:in `block (4 levels) in <top (required)>'
/Users/IfranK/Desktop/RailsApp/HBM Colaboracion/hbm/lib/capistrano/tasks/setup_config.rake:28:in `each'
/Users/IfranK/Desktop/RailsApp/HBM Colaboracion/hbm/lib/capistrano/tasks/setup_config.rake:28:in `block (3 levels) in <top (required)>'
Tasks: TOP => deploy:setup_config
The Capistrano 3 docs, on this page states that
"we need to be able to work, ideally without sudo (none of the default Capistrano recipes expect sudo to be available), or for your custom recipes, you will need to have configured passwordless sudo."
But the new compile_assets_localy.cap uses sudo on line 11.
This results in a sudo: no tty present and no askpass program specified
error.
Why do you recommend to deploy application to the home
directory?
set :deploy_to, "/home/#{fetch(:deploy_user)}/apps/#{fetch(:full_app_name)}"
It seems to me that the good practice is deploying to /opt/www/application_name
folder, doesn't it?
Hi, I bought your book and am testing out the provided unicorn_init script.
The issue with it is that stop
doesn't always work - only force-stop
does.
From the SIGNALS page:
USR2 - reexecute the running binary. A separate QUIT should be sent to the original process once the child is verified to be up and running
This additional QUIT signal doesn't seem to be sent by the unicorn_init script:
restart|reload)
sig USR2 && echo reloaded OK && exit 0
echo >&2 "Couldn't reload, starting '$CMD' instead"
run "$CMD"
;;
Should the command consist of something like sig USR2 && oldsig QUIT
?
Cheers - Victor
is spitting out this error
undefined method `smart_template' for #SSHKit::Backend::Netssh:0x00000101667798
Have you ever seen this?
Thanks in advance!
I noticed that in shared/unicorn.rb
you put Unicorn's pid file under the application's tmp
directory (symlinked from shared/tmp
) but put its Unix socket in /tmp
. Was this just an arbitrary decision or is there a reason the socket needs to be under the root /tmp
instead of the app's tmp
?
Hi
How can I running deploy command without password? I have a deploy user in shudders.
I'm going through Deploying with Capistrano Quickstart chapter.
On page 127, it says run this:
bundle exec cap production database:create
So, trying to run this, I get:
Don't know how to build task 'database:create'
Looks like there is no task for it, is this task still relevant? Or it has been replaced with something else? If thats the case what is it?
Thanks
When I run
cap production deploy:setup_config --trace
* Reloading nginx configuration nginx ...fail!
When I try
sudo service nginx reload
sudo nginx -t
I've got this
nginx: [emerg] duplicate upstream "unicorn_iso_production" in /etc/nginx/sites-enabled/nginx.conf:1
nginx: configuration file /etc/nginx/nginx.conf test failed
my project https://github.com/joassouza/iso
First, thanks for an outstanding repo. Wouldn't have gotten anywhere without this and your accompanying post at http://www.talkingquickly.co.uk/2014/01/deploying-rails-apps-to-a-vps-with-capistrano-v3/
One subtlety that got me into trouble: in production.rb
, there's the choice of roles to launch, from %w{web app db}
. As I was only putting up a single server, I chose web
and deleted the other two. Upon reflection, this was not a good choice, as I imagine web
is meant to indicate a web worker rather than a web server.
Thing was, it produced thoroughly mystifying results as tasks silently failed to run, compile and rsync assets, etc. Very frustrating until I read through the tasks again and noticed that many of them specified :app
.
Not a proper bug report, just a request: it would be a huge help if the docs or readme made a note of this important choice. I imagine others are likely to run into it as well.
Thanks again for a great repo!
I've followed the tutorials for Provisioning a VPS for a rails application and Capistrano 3 to deploy it. Everything has worked out as expected and the code for my rails app is on my VPS, but when I visit the server address (45.79.105.247) it still displays the "Welcome to nginx" page and the app routes display a '404' page.
Any suggestions? My app is https://github.com/wyattsweet/dblog
Also on my VPS when I run "rails -v" it says rails is not installed. Also bundler is not installed...
When running cap whatever
I get this error:
cap aborted!
Don't know how to build task 'deploy:setup_config'
This is caused thanks to the deploy.rb file:
before 'deploy:setup_config', 'nginx:remove_default_vhost'
I'm a novice using capistrano, so what should I do?
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.