- Download and install required stacks from bitnami ruby stack
- Follow https://medium.com/@keokilee/rails-on-windows-with-bitnami-8c04d886eddc if you want advance deployment
- Install ruby stack using bitnami
- 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 - Clone your project inside "c:<ruby-stack>\projects"
- cd into project
- Bundle Install:
bundle install
- Migrate Database
bundle exec rake db:create db:migrate RAILS_ENV=production
- Assets Precompile
bundle exec rake assets:precompile RAILS_ENV=production
- Run rails server
rails s -p 80 -e production
- Visit http://localhost and you should see your application running.
- 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
- Download NSSM and setup PATH environment variable to execute nssm command from everwhere
- 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
- 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