6

How to build a Ruby on Rails app on AWS for beginners - Part 2.

 3 years ago
source link: https://dev.to/leewynne/how-to-build-a-ruby-on-rails-app-on-aws-for-beginners-part-2-21al
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
Cover image for How to build a Ruby on Rails app on AWS for beginners - Part 2.

How to build a Ruby on Rails app on AWS for beginners - Part 2.

Jun 29 Originally published at theelastic.guru

・1 min read

How to build a Ruby on Rails host on AWS for beginners (2 Part Series)

Now it is time to provision our database. We are going to go with Postgres.

There are 2 ways to do this on AWS, we can either install Postgres into our ec2 Linux host, or we can provision the database separately in AWS LightSail as a PaaS RDS database.

In this example we are just going to install Postgres locally on our LightSail ec2 instance.

This is a fairly simple process, first of lets install a recent version of Postgres.

sudo apt install postgresql-11 libpq-dev
Enter fullscreen modeExit fullscreen mode

Next up we we are going to setup our DB user.

sudo -u postgres createuser lee -s

# If you would like to set a password for the user, you can do the following

sudo -u postgres psql 
postgres=# \password lee
Enter fullscreen modeExit fullscreen mode

That's it for installing and setting up PostGres within an EC2 instances.

Let's give this a whirl by creating your first Rails App.

rails new mynewrailsapp -d postgresql
Enter fullscreen modeExit fullscreen mode
cd mynewrailsapp
Enter fullscreen modeExit fullscreen mode
rails db:create
Enter fullscreen modeExit fullscreen mode
rails server
Enter fullscreen modeExit fullscreen mode

Visit http://localhost:3000 to view your new rails app

That should be it, you can then go ahead and create some of your models and migrations and start building your dreams.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK