I should be able to run a Rails app on a Raspberry Pi automatically on startup with minimal configuration, muss, or fuss.
- Install the Whenever gem for writing a schedule to Crontab. (this is actually optional since you can edit crontab manually, but Whenever is convenient for having the schedule stored in the Rails project)
gem install whenever
orgem 'whenever', require: false
in your Gemfile - Install Nginx.
sudo apt-get install nginx
- In your Nginx configuration(probably /etc/nginx/nginx.conf), make sure the http section includes other configuration files from the sites-enabled folder. Add the line
include /etc/nginx/sites-enabled/*;
to the http section if it isn't there. - Create
/etc/nginx/sites-enabled/default
and add server configuration for your Rails app. Here is an example file: