I’ve been trying to set up an nginx server on my VPS to deploy my rails app.
Everything has been successful until the last command, and if I get this to work, I will be able to see my app on the server.
I did
sudo service nginx restart
and finally,
sudo update-rc.d uinicorn_app defaults
but it says
update-rc.d: /etc/init.d/unicorn_app: file does not exist
I manually checked the file by going into the directory, and the file was there. However, when I ran the command below, I got the following.
deployer@max:/$ file /etc/init.d/unicorn_app
/etc/init.d/unicorn_app: broken symbolic link to `/home/deployer/apps/app/current/config/unicorn_init.sh'
How do I fix this issue and finish setting up my server?
Update: it seems like my deploy.rb config is not working properly because I cannot find /home/deployer/apps/app/current folder. Here’s part of my deploy.rb:
namespace :deploy do
%w[start stop restart].each do |command|
desc "#{command} unicorn server"
task command, :roles => :app, :except => {:no_release => true} do
run "/etc/init.d/unicorn_#{application} #{command}"
end
end
task :setup_config, :roles => :app do
sudo "ln -nfs #{current_path}/config/nginx.conf /etc/nginx/sites-enabled/#{application}"
sudo "ln -nfs #{current_path}/config/unicorn_init.sh /etc/init.d/unicorn_#{application}"
run "mkdir -p #{shared_path}/config"
put File.read("config/database.example.yml"), "#{shared_path}/config/database.yml"
puts "Now edit the config files in #{shared_path}."
end
Any ideas?
If you can’t locate your current file, run
which will deploy your application, run all pending migrations, and start the server for the first time.