How can I deploy a rails app + slite3 to AWS?

0

I have been trying to deploy a rails app with sqlite3 to AWS but the youtube videos are all over the place on methods to do so. I am new to AWS and I just need an easy guide with steps from start to finish.

I was able to deploy a simple app without sqlite3, but it seems like things change a bit when you involve a database.

asked a year ago319 views
1 Answer
0
Accepted Answer

I'd recommend using Amazon RDS with PostgreSQL or MySQL instead of SQLite3 for better scalability and ease of use. However, if you still want to proceed with SQLite3, here's a step-by-step guide to deploy your Rails app using EC2 and Elastic Beanstalk:

Install the Elastic Beanstalk CLI in your pc: Download and install the Elastic Beanstalk Command Line Interface (EB CLI) on your local machine: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3-install.html. Configure the AWS CLI: Run aws configure and provide your AWS Access Key ID, Secret Access Key, default region, and default output format. Prepare your Rails app:

a. Add the sqlite3 gem to your Gemfile and run bundle install. b. Make sure to commit all your changes to your app's Git repository.

Initialize Elastic Beanstalk:

a. In your app's root directory, run eb init and follow the prompts to configure your application. b. Choose a region and select "Ruby" as your platform. c. If prompted, set up SSH for your instances.

Create an environment and deploy your app:

a. Run eb create and provide a name for your environment. b. Wait for the environment to be created and the app to be deployed. This might take a few minutes.

Configure your environment:

a. In the AWS Management Console, navigate to the Elastic Beanstalk service and open your app's environment. b. Go to the "Configuration" tab, and click the "Edit" button in the "Software" card. c. Add the following environment variables:

RAILS_ENV: production RAILS_SERVE_STATIC_FILES: true RAILS_MASTER_KEY: your Rails master key (found in config/master.key)

d. Click "Apply" to save your changes and restart your instances.

Open your Rails app:

a. Once the environment update is complete, run eb open to open your app in a web browser.

Jorge
answered a year ago
  • Thank you, Jorge!

    I will try those instructions on my own, but I was wondering if you would be willing to join me on a Zoom/teams meeting eventually for quick guidance. I have followed every tutorial online and I seem to always get stuck at some point.

    In case you decide you wouldn't mind sharing your knowledge with me, here is my LinkedIn account: http://www.linkedin.com/in/albertogonzalez1091

    I would really appreciate your in-person guidance, send me a message on LinkedIn if you are interested.

    Thank you again!

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions