Some of the issue I have ecountered while deploying the Rails app using Nginx, Passenger & Capistrano
While deploying to my Ruby On Rails application I have encountered some issues. Following are the issues and their solutions :-
Note :- I have a Open Suse Box
Note :- I have a Open Suse Box
# "An error occurred while installing mysql2 (0.3.18), and Bundler cannot continue. Make sure that `gem install mysql2 -v '0.3.18'` succeeds before bundling."
Solution :-
- ~ # zypper se libmysqlclient # it will list you all the available packages # now you have to choose one and install it
- ~ # zypper in libmysqlclient-devel
# "ExecJS::RuntimeUnavailable: Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes."
# When I ran cap [your environment] deploy I got the issue like tmp/restart.txt file does not exists. So I made the following changes in my cap file :-
desc 'Restart application'task :restart doon roles(:app), in: :sequence, wait: 5 dosystem("\\Restarting the app ............")# Your restart mechanism here, for example:execute :mkdir, '-p', "#{ release_path }/tmp" ## this is new line i have addedexecute :touch, release_path.join('tmp/restart.txt')endend
# Once you installed the Passenger & Nginx then you need to run the following and follow the insructions.
~ # rvmsudo passenger-install-nginx-module
# After that it was time to edit the nginx configurations. Go to nginx'spath i.e ("/opt/nginx/conf/nginx.conf") which look like this after edit :-
worker_processes 5;error_log /var/log/passenger/error.log;pid /opt/nginx/nginx.pid;events {worker_connections 1024;}include conf.d/*.conf;http {passenger_root /usr/local/rvm/gems/ruby-2.2.2/gems/passenger-5.0.20;passenger_ruby /usr/local/rvm/gems/ruby-2.2.2/wrappers/ruby;passenger_app_env development; ### added new linepassenger_max_pool_size 6;passenger_min_instances 1;passenger_pool_idle_time 0;passenger_max_instances_per_app 0;passenger_friendly_error_pages on;passenger_default_user root; ### added new linepassenger_default_group root; ### added new lineserver {listen 80;server_name 127.0.0.1;root /srv/www/your application path/current/public; ### added new linepassenger_enabled on; ### added new line}include mime.types;default_type application/octet-stream;sendfile on;tcp_nopush off;keepalive_timeout 65;gzip on;include sites.d/*.conf;}
# You also need to change the permission of your app so that passenger will be able to execute the files.
# To check passenger log . . . go to this path "/var/log/passenger/error.log"
# To check passenger log . . . go to this path "/var/log/passenger/error.log"
Leave a Comment