Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### First lets serve sqllite db on your droplet
- ssh into your droplet
- `ssh root@<ip-address>`
- `rails new <appname>`
- `cd <appname>`
- `rails s`
- command-d to open slip window
- ssh into droplet in a new terminal window.
- `curl localhost:3000`
- You should see the html of the server's response.
- ## Now we will create a Rails app using postgres
- ### Drop into postgres and create a roll for root user and set password.
- `su - postgres`
- `psql`
- `create role root with createdb login password 'complete';`
- contol-d to exit
- type `exit`
- ### Create new rails app with postges as the database
- `rails new <appname> -d postgresql`
- cd into rails app
- ### Pull up text editor and go to the config/database.yml file
- vim
- go into config/database.yml
- ### Adjust username and password for production settings
- ```yml
- username: root
- password: complete
- ```
- ### Scaffold an Article
- `rails g scaffold Article title body:text`
- ### Create and migrate database
- `RAILS_ENV=production rake db:create db:migrate`
- ### Server app on port 80
- `RAILS_ENV=production rails s -d -b <ip-address> -p 80`
- Note: May need to hard code production secret codebase.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement