Advertisement
Guest User

Untitled

a guest
Mar 5th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. ### First lets serve sqllite db on your droplet
  2. ssh into your droplet
  3. `ssh root@<ip-address>`
  4.  
  5. `rails new <appname>`
  6. `cd <appname>`
  7. `rails s`
  8.  
  9. command-d to open slip window
  10.  
  11. ssh into droplet in a new terminal window.
  12.  
  13. `curl localhost:3000`
  14.  
  15. You should see the html of the server's response.
  16.  
  17. ## Now we will create a Rails app using postgres
  18.  
  19. ### Drop into postgres and create a roll for root user and set password.
  20. `su - postgres`
  21. `psql`
  22. `create role root with createdb login password 'complete';`
  23. contol-d to exit
  24. type `exit`
  25.  
  26. ### Create new rails app with postges as the database
  27. `rails new <appname> -d postgresql`
  28. cd into rails app
  29.  
  30. ### Pull up text editor and go to the config/database.yml file
  31. vim
  32. go into config/database.yml
  33.  
  34. ### Adjust username and password for production settings
  35. ```yml
  36. username: root
  37. password: complete
  38. ```
  39.  
  40. ### Scaffold an Article
  41. `rails g scaffold Article title body:text`
  42.  
  43. ### Create and migrate database
  44. `RAILS_ENV=production rake db:create db:migrate`
  45.  
  46. ### Server app on port 80
  47. `RAILS_ENV=production rails s -d -b <ip-address> -p 80`
  48.  
  49. Note: May need to hard code production secret codebase.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement