Deploy Ubuntu 16.04 Xenial Xerus Discussion
Hi Chris,
How I can set domain name to my server ip address to input my site domain instead of writing ip address?
Thanks
Make sure you added yout domain name in /etc/nginx/sites-enabled/default.
After that, for digital ocean, follow these steps: https://www.digitalocean.co....
Hope it helps ;)
Edit: Don't forget to set up DO namespaces at your domain registrar panel. (tutorial link: https://www.digitalocean.co...
Hello Chris
I fixed the issue I initally posted about lol. But now when I visit the URL there's no site to visit, it says unable to connect
-----
Great tutorial say I'm trying to deploy a rails 5 app with ubuntu 16.04 etc... On cap production deploy I get the following error on deploy:migrate
INFO [deploy:migrate] Run `rake db:migrate`
DEBUG [15816e11] Running if test ! -d /home/deploy/app/releases/20170313091718; then echo "Directory does not exist '/home/deploy/app/releases/20170313091718'" 1>&2; false; fi as deploy@138.68.83.124
DEBUG [15816e11] Command: if test ! -d /home/deploy/app/releases/20170313091718; then echo "Directory does not exist '/home/deploy/app/releases/20170313091718'" 1>&2; false; fi
DEBUG [15816e11] Finished in 0.306 seconds with exit status 0 (successful).
INFO [64a72276] Running ~/.rvm/bin/rvm default do bundle exec rake db:migrate as deploy@138.68.83.124
DEBUG [64a72276] Command: cd /home/deploy/app/releases/20170313091718 && ( export RAILS_ENV="production" ; ~/.rvm/bin/rvm default do bundle exec rake db:migrate )
DEBUG [64a72276] rake aborted!
DEBUG [64a72276] PG::ConnectionBad: could not connect to server: Connection refused
Is the server running on host "138.68.83.124" and accepting
TCP/IP connections on port 5432?
DEBUG [64a72276] /home/deploy/app/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.2/lib/active_record/connection_adapters/postgresql_adapter.rb:671:in `initialize'
Do you have any pointers? to make it work can't seem to find similar issue on deployment server
note i tried this it didn't work: https://www.digitalocean.co...
Thanks
Thanks for the tutorial Chris!!
I'm just having an issue when trying to set the branch for the repo, it always took master and I'm using the set branch but nothing happens
Hey @disqus_FdxDeiCXJb:disqus! I'm not sure how you've got it setup, but if you set the branch in your Capistrano config, that should do the trick. You can either do it in config/deploy.rb globally (it defaults to master) or inside each of the stages like config/deploy/production.rb. It's usually just set :branch, "mybranch"
All the other config options are listed here: http://capistranorb.com/doc...
Hi,
you can create the database.yml same way as you did with secrets.yml. Create an empty file in same place where secrets.yml are and then copy the code from your local copy (ie development env). You have to set the credentials accordning to the ones you have set on production obviously :-)
To create the files (assuming you are connected on server) cd into your shared/config/ folder and then type touch database.yml and touch secrets.yml
i have the following error in the tutorial:
nicoara@ubuntu:~/deploy_test$ cap install STAGES=production
/home/nicoara/.rbenv/versions/2.2.3/lib/ruby/2.2.0/rubygems/specification.rb:2112:in `raise_if_conflicts': Unable to activate capistrano-rails-1.2.3, because capistrano-2.15.9 conflicts with capistrano (~> 3.1) (Gem::ConflictError)
from /home/nicoara/.rbenv/versions/2.2.3/lib/ruby/2.2.0/rubygems/specification.rb:1280:in `activate'
from /home/nicoara/.rbenv/versions/2.2.3/lib/ruby/2.2.0/rubygems.rb:198:in `rescue in try_activate'
from /home/nicoara/.rbenv/versions/2.2.3/lib/ruby/2.2.0/rubygems.rb:195:in `try_activate'
...
my gemfile has:
group :development do
gem 'capistrano', '~> 3.7', '>= 3.7.1'
gem 'capistrano-rails', '~> 1.2'
gem 'capistrano-passenger', '~> 0.2.0'
gem 'capistrano-rbenv', '~> 2.1'
my capfile has:
# Capfile
require 'capistrano/rails'
require 'capistrano/passenger'
# If you are using rbenv add these lines:
require 'capistrano/rbenv'
set :rbenv_type, :user
set :rbenv_ruby, '2.4.0'
# Load DSL and set up stages
require "capistrano/setup"
# Include default deployment tasks
require "capistrano/deploy"
what to do?
Thanks
I'm planning to do a fresh OS installation on my local machine, so I have a question: is there a way to backup my existing ssh keys that I use to login to the server or my repos, or do I have to generate and add a new key in this case? if thats the case I guess all I need to do is to generate the new key on my fresh install and ssh-copy-id to the server again??
Meant to reply sooner, but all your ssh keys are located in ~/.ssh so you can backup that folder and just replace it on your new install to use the same keys.
After getting through the process, when I tried to deploy my project, I kept getting: "Your Ruby version is 2.3.1, but your Gemfile specified 2.4.1"
Logged into the server as deploy, ruby version was 2.4.1. After a lot of troubleshooting, I su'd into root, and found that root had ruby 2.3.1 as it's version.
I figured i must have screwed something up, so I started fresh.... this time watching the output of each command closely.
It seems that the Passenger install (as deploy user) imported ruby 2.3.1... 2.4.1 was already set up under deploy... and this 2.3.1 did not seem to change anything for deploy. However, root, which had no ruby prior to passenger, was now set to 2.3.1.
I've updated root's ruby to be 2.4.1 using the rbenv method as root so that I could get something deployed to practice on... but...
I'm confused as to how and why 2.3.1 got there, and why it's interfering with the deploy command when i try to push an update...
Chris this tutorial is very helpful.
Can i deploy Worpress and Rails both in a server. Like - WordPress for blogging - ( http://blog.URL ) and rails application is deployed to - (http://URL).
Please help me.
Error 403
The passenger_ruby and passenger_root are configured conrrectly. :/
[EDIT] Seem that my passenger is not running correctly. Can anybody help me?
Chris,
Incredibly useful tutorial! For a small bit of extra config and command line hacking, I get to deploy my app to a server I control rather than an option like Heroku. Thanks for putting this together!
I ran into an issue installing this on nginx using rbenv. If you try to cap production deploy and get an error with passenger. Try opening /etc/nginx/passenger.conf and add this to the file.
passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
to get your specific passenger root type
passenger-config --root
Lovely tutorial... how do you launch the rails console to make a few changes to the application...?
Thank you for this guide! One question I have is how do I load the ruby app if I am not able to use git? When I run cap production deploy it fails trying to read from remote repository because it is calling git and I am not using git. I am new to all of this so sorry for my ignorance.
INFO [01ba63f0] Running /usr/bin/env git ls-remote HEAD as deploy@10.1.10.104
DEBUG [01ba63f0] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.4.1" GIT_ASKPASS="/bin/echo" GIT_SSH="/tmp/git-ssh-orderentry-producti..." ; /usr/bin/env git ls-remote HEAD )
DEBUG [01ba63f0] fatal: 'HEAD' does not appear to be a git repository
DEBUG [01ba63f0] fatal: Could not read from remote repository.
Thanks a lot for this post! Simply I use it every new project I have since long time ago. Perfect stack and everything works fine following the instructions.
Could someone help me , iv'e been at this for a week now i get this error when i do a cap production deploy
rbenv: bundle: command not found
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy@139.59.33.96: bundle exit status: 127
bundle stdout: Nothing written
bundle stderr: rbenv: bundle: command not found
SSHKit::Command::Failed: bundle exit status: 127
bundle stdout: Nothing written
bundle stderr: rbenv: bundle: command not found
Tasks: TOP => deploy:updated => bundler:install
(See full trace by running task with --trace)
The deploy has failed with an error: Exception while executing as deploy@139.59.33.96: bundle exit status: 127
bundle stdout: Nothing written
bundle stderr: rbenv: bundle: command not found
Thank you very much for the tutorial. But..I have a problem (ruby 2.4.2, rails 5.1.4). When i run "cap production deploy".
I'm having an error:
_______________________________________________________________________________________________
00:09 deploy:assets:backup_manifest
01 mkdir -p /home/user/app/releases/20170925040319/assets_manifest_backup
✔ 01 user@localhost 0.047s
WARN Rails assets manifest file not found.
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as user@localhost: Rails assets manifest file not found.
Capistrano::FileNotFound: Rails assets manifest file not found.
Tasks: TOP => deploy:assets:backup_manifest
(See full trace by running task with --trace)
The deploy has failed with an error: Exception while executing as user@localhost: Rails assets manifest file not found.
_______________________________________________________________________________________________
Google did not help me. Can you help me? Thanks!
Hi Chris, thanks for brilliant tutorial. I followed it about an year ago and every thing worked smoothly. Until Today I saw that the production.log on the server side isn't updating. It seems to be stuck in 23/5 2017 :) and havn't updated since. So I was thinking, Is there maybe something in the production.rb setup or the sim-links that I could alter to get the production.log updated again? please see my question here about this problem: https://stackoverflow.com/q...
Thanks for this great tutorial and My cap deploy went fine without any error and I removed the default nginx page. After I restarted the nginx again I can't see my rails app running. I got This Site can't be reached. Can you help me on this please?
I got Connection refused is the error.