Saturday, July 25, 2015

Create New Rails Application Development

Create New Rails Application Development


ubuntu@ip-172-31-15-122:~$ cd ~

ubuntu@ip-172-31-15-122:~$ rails new sample1 -d postgresql

ubuntu@ip-172-31-15-122:~$ cd sample1

ubuntu@ip-172-31-15-122:~/sample1$ vi config/database.yml

  host: 172.31.15.122
  username: pguser1
  password: pguser1

Need to be perform on   postgres DB Server --> Required

ubuntu@ip-172-31-15-122:~$ sudo vi /etc/postgresql/9.3/main/postgresql.conf
listen_addresses = '*'

ubuntu@ip-172-31-15-122:~$ sudo /etc/init.d/postgresql stop
 * Stopping PostgreSQL 9.3 database server                                                                                                            [ OK ]

ubuntu@ip-172-31-15-122:~$ sudo /etc/init.d/postgresql start
 * Starting PostgreSQL 9.3 database server                                                                                                            [ OK ]

ubuntu@ip-172-31-15-122:~$ telnet 172.31.15.122 5432
Trying 172.31.15.122...
Connected to 172.31.15.122.
Escape character is '^]'.

ubuntu@ip-172-31-15-122:~/sample1$ sudo vi /etc/postgresql/9.3/main/pg_hba.conf
# TYPE DATABASE USER CIDR-ADDRESS  METHOD
host  all  all 0.0.0.0/0 md5

ubuntu@ip-172-31-15-122:~$ sudo /etc/init.d/postgresql stop
 * Stopping PostgreSQL 9.3 database server                                                                                                            [ OK ]

ubuntu@ip-172-31-15-122:~$ sudo /etc/init.d/postgresql start
 * Starting PostgreSQL 9.3 database server  

ubuntu@ip-172-31-15-122:~$ sudo /etc/init.d/postgresql disable ---> Optional



ubuntu@ip-172-31-15-122:~/sample1$ rake db:create
ubuntu@ip-172-31-15-122:~/sample1$

rails server --binding=172.31.15.122  -->  Private IP address

ubuntu@ip-172-31-15-122:~/sample1$ rails server --binding=172.31.15.122
=> Booting WEBrick
=> Rails 4.2.0 application starting in development on http://172.31.15.122:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2015-04-12 07:40:01] INFO  WEBrick 1.3.1
[2015-04-12 07:40:01] INFO  ruby 2.2.1 (2015-02-26) [x86_64-linux]
[2015-04-12 07:40:01] INFO  WEBrick::HTTPServer#start: pid=22134 port=3000


Started GET "/" for 103.8.194.117 at 2015-04-12 07:40:08 +0000
Cannot render console from 103.8.194.117! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
Processing by Rails::WelcomeController#index as HTML
  Rendered /home/ubuntu/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/templates/rails/welcome/index.html.erb (1.2ms)
Completed 200 OK in 14ms (Views: 6.2ms | ActiveRecord: 0.0ms)


Started GET "/" for 103.8.194.117 at 2015-04-12 07:40:13 +0000
Cannot render console from 103.8.194.117! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
Processing by Rails::WelcomeController#index as HTML
  Rendered /home/ubuntu/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/templates/rails/welcome/index.html.erb (0.1ms)
Completed 200 OK in 1ms (Views: 0.9ms | ActiveRecord: 0.0ms)
^C[2015-04-12 07:40:24] INFO  going to shutdown ...
[2015-04-12 07:40:24] INFO  WEBrick::HTTPServer#start done.
Exiting

http://54.250.74.188:3000

**If you see the "Welcome aboard" Ruby on Rails page**

No comments:

Post a Comment

Gitlab Automation Project Showcase

My GitLab Projects Showcase 🚀 Welcome to my portfolio of GitLab projects. Each repository reflects my journey as an engineer, focusing...