author avatar

sachin.kabadi

Wed Jan 24 2024

To launch a Rails app on http://fly.io|fly.io, you can follow these steps:

1. Make sure you have the flyctl command-line tool installed.

2. Open a terminal and navigate to the root directory of your Rails app.

3. Launch a new http://fly.io|fly.io application by running the following command: flyctl launch

This command will guide you through the process of setting up your http://fly.io|fly.io application. You'll be prompted to provide a name for your app and select the organization you want to associate it with. Refer below.

   Creating app in ~/list
   Scanning source code
   Detected a Rails app
   ? Choose an app name (leave blank to generate one): list
   ? Select Organization: John Smith (personal)
   ? Choose a region for deployment: Ashburn, Virginia (US) (iad)
   Created app list in organization personal
   Admin URL: <https://fly.io/apps/list>
   Hostname: list.fly.dev
   Set secrets on list: RAILS_MASTER_KEY
   ? Would you like to set up a Postgresql database now? Yes
   For pricing information visit: <https://fly.io/docs/about/pricing/#postgresql-clu>
   ? Select configuration: Development - Single node, 1x shared CPU, 256MB RAM, 1GB disk
   Creating postgres cluster in organization personal

   . . .

   Postgres cluster list-db is now attached to namelist
   ? Would you like to set up an Upstash Redis database now? Yes
   ? Select an Upstash Redis plan Free: 100 MB Max Data Size

   Your Upstash Redis database namelist-redis is ready.

   . . .

         create  Dockerfile
         create  .dockerignore
         create  bin/docker-entrypoint
         create  config/dockerfile.yml
   Wrote config file fly.toml

   Your Rails app is prepared for deployment.

   Before proceeding, please review the posted Rails FAQ:
   <https://fly.io/docs/rails/getting-started/dockerfiles/>.

4. Once the launch is complete, you can deploy your Rails app to http://fly.io|fly.io by running the following command: flyctl deploy

This command will build a Docker image of your Rails app and deploy it to http://fly.io|fly.io. It may take a few minutes to complete the deployment process.

5. After the deployment is finished, you'll see a message indicating that your app has been deployed successfully. It will also display the URL
where your app is accessible.

You can use following cmd to open app. fly apps open

That's it! Your Rails app is now running on http://fly.io|fly.io. You can access it using the provided URL.

6. If you make any changes to your app, you can redeploy it by running following command again. flyctl deploy