I am using ReactJs with rails . i am using react-rails gem. Everything is working fine on local machine, but when deployed it on my ubuntu server, it produces undefined method react_component error. I try to run app locally on production mode everything works fine . On my production server i use Nginx with Unicorn.
After looking into my capistrano settings, i figure out my unicorn server is not restart after deployment. So i kill my unicorn process and deploy again and everything is working fine now.
Related
I am new to Rails programming. I did some research, and decided to start with Rails 7, and Ruby 3.1.0.
I am following a simple online tutorial, using the standard Rails 7 stack: Sprockets, no Webpacker, Tailwind (starting to learn it), and MySQL.
I have a local MySQL server setup on my Mac, and i use mysqlworkbench to peer into the local DB.
Locally, I don't need to do anything to get the server started on my development machine. From the command line, I only need to do:
rails s
and a local web server is started on port 3000.
I have an old laptop, that I set up as an Ubuntu 20.04 machine, and is my home network, on port 10.0.0.253. I figured i can use it as a test server, so I can learn how to deploy in the real world. I installed Ruby 3.1, and Mysql on the Ubuntu machine. I also have nginx installed on it, but I don't have it configured to do anything.
On the Ubuntu machine, I can do
rails s
and then from mt Mac, I can go to:
http://10.0.0.253:3000
and I get the rails app.
Of course, when I close the terminal on the Ubuntu machine, the app stops working.
If I don't do rails s on the Ubuntu machine, if I do:
http://10.0.0.253
I get an error (can't find the site you're looking for).
I looked online, and there are a few articles about configuring nginx with Passenger, but no two recipes are the same.
My question is: When I push my code to the Ubuntu server, and I do:
bundle install
rake db:create
rake db:migrate
rake db:seed
What next? to start the server, and I can access it directly at: http://10.0.0.253
I am running a rails server on an Ubuntu EC2 instance and have run into an issue when it comes to deploying (and restarting) my server. The odd thing is; everything seems to work fine when I start a vanilla server (rails server), but when I start the server as a daemon it does not reset (rails server -d).
I use Capistrano to do deployment. As far as I can tell there is no issue; it pulls down my latest branch, runs migrations and does a touch tmp/restart.txt. I had tried making my tmp/restart.txt a shared file, but that does not seem to be the issue (although it is a configuration I think I'll keep). After discovering Capistrano is likely working as expected I tried sshing into the server and running touch tmp/restart.txt myself. It works for the vanilla server but not the daemon.
Has anyone seen this issue before? If there is more info I could provide please let me know!
Env:
ruby 2.6.3p62 #/home/deploy/.rvm/rubies/ruby-2.6.3/bin/ruby
Rails 5.2.3 #/home/deploy/.rvm/gems/ruby-2.6.3/bin/rails
Bundler version 2.1.2 #/home/deploy/.rvm/gems/ruby-2.6.3/bin/bundle
Node v13.8.0 #/home/deploy/.nvm/versions/node/v13.8.0/bin/node
My logs, tmp, and config/master.key are shared as part of my Capistrano setup.
are you using puma or unicorn or passenger? apache or nginx? restarting the process depends more on that than anything.
personally, I like using Passenger with apache and when I restart apache, the passenger process restarts automatically.
When running my rails app locally, everything works fine. However, when deployed to a server, I get the following error:
ActionController::UnknownFormat (TasksController#index is missing a template for this request format and variant.
It's similar for all the pages. What could be the problem?
Rails version is 5.0.1. The deployed application is running on unicorn and nginx. I'm using slim templates. The same problem appears either if the views have .slim extension or .html.slim.
The slim gem might not be installed on your server. Try running bundle install on the command line in your app directory and then restarting your server.
I have successfully deployed my ruby on rails application to an ubuntu 14.04 virtual machine in Digital Ocean. I used Apache2 and passenger for the same.
Now I want to deploy it to the same using Capistrano. I am using a mac machine in the developer environment. I have installed Capistrano 3.4. ssh connection has been set up with my local machine and server as well as with my server and my mercurial version control system in bitbucket.
How can I deploy it via capistrano. I tried many tutorials. Many are outdated and I am not even close. I have deployed it in the server in uat environment and the source code is checked out and is kept in the desktop of server. I have also set up a user with sudo privileges.MySQl2 database is also in the same server.Please help me out .
You can see the gist here, there are 4 files
deploy.rb
production.rb
capfile
Gemfile // only the capistrano required gem snippet
But I've configured using nginx and passenger.
I am using rails 2.3.9, rubygems 1.8.24, ruby 1.9.3 and Windows 7 ultimate 64-bit
I just installed nginx as my web server through passenger. Now I want to run nginx as my default server such that when i run ruby script/server, it runs instead of the default WeBrick. Is there any way to do this? Thanks a million.
Nginx doesn't work the way you described. Once it is started, you won't need to run script/server, the rails app will be run at the same time when the Nginx/Apache started.
So, just deploy your rails app following the 'Passenger' manual( in development mode), and you will get your app always running.
so, as conclusion, we can tell that, when deploying a Rails app, Nginx and Apache is in the same group( work together with Passenger), and Mongrel/Webrick/Thin is another group(script/server approach).
You may want to take a look at Foreman.