Skip to content

Instantly share code, notes, and snippets.

@userrails
Created November 15, 2017 04:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save userrails/c6f1b1cf01acdb1af7a1621334b02277 to your computer and use it in GitHub Desktop.
Save userrails/c6f1b1cf01acdb1af7a1621334b02277 to your computer and use it in GitHub Desktop.
Deployment steps for rails in windows

How to deploy rails application in windows

  1. Download and install required stacks from bitnami ruby stack
  2. Follow https://medium.com/@keokilee/rails-on-windows-with-bitnami-8c04d886eddc if you want advance deployment

Normal Deployment steps

  1. Install ruby stack using bitnami
  2. Open Use Bitnami Ruby Stack terminal that bitnami installed (you can search this program in installed programs). This will run terminal as administrator, and open inside rubystack directory
  3. Clone your project inside "c:<ruby-stack>\projects"
  4. cd into project
  5. Bundle Install: bundle install
  6. Migrate Database bundle exec rake db:create db:migrate RAILS_ENV=production
  7. Assets Precompile bundle exec rake assets:precompile RAILS_ENV=production
  8. Run rails server rails s -p 80 -e production
  9. Visit http://localhost and you should see your application running.

Advance Steps

  1. Create a batch script

c:\<path-to ruby stack>\projects\yourapp\bin\server.bat

@echo off
CALL “C:\<path to ruby stack>\scripts\setenv.bat”
cd C:\<path to ruby stack>\projects\<project dir>
thin start -p “”%1"” -e production
  1. Download NSSM and setup PATH environment variable to execute nssm command from everwhere
  2. Create NSSM service
nssm start <your service name>
# Applicatiion Path: "c:\<path-to ruby stack>\projects\yourapp\bin\server.bat"
# Startup Directory: "c:\<path to ruby stack>\projects\yourapp"
# Arguments: give port number e.g: 80
  1. Or using sc command:
sc.exe create testingservice123 binpath="c:\<path-to ruby stack>\projects\yourapp\bin\server.bat"
sc.exe start testingservice123
sc.exe delete testingservice123
stop and various other commands
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment