Gemfile
If you don’t have a gemfile, the best way to get started is to run:config.ru
The most basicconfig.ru file would be the following:
config.ru
files for various Ruby web frameworks.
We’re now ready to run the app locally.
Running The Application
Runbundle exec rackup to start the application
bundle binstub rack, that message can be safely ignored.
And connect to localhost:9292 to confirm that you have a working Ruby application. Now to package it up for Fly.
Install Flyctl and Login
We are ready to start working with Fly and that means we needflyctl, our CLI app for managing apps on Fly. If you’ve already installed it, carry on. If not, hop over to our installation guide. Once that’s installed you’ll want to log in to Fly.
Launch the app on Fly
To launch an app on fly, runflyctl launch in the directory with your source code. This will create and configure a fly app for you by inspecting your source code, then prompt you to deploy.
personal, which is only visible to your account. Let’s select that for this guide.
Next, you’ll be prompted to select a region to deploy in. The closest region to you is selected by default. You can use this or change to another region.
Finally you will be given the option to start a Postgres and/or a Redis database. If you need one or both, it is convenient to set them up now. Otherwise you can always add them later.
At this point, flyctl creates an app for you and writes your configuration to a fly.toml file. You’ll then be prompted to build and deploy your app. Once complete, your app will be running on fly.
Config First!
Most Dockerfiles expect some configuration settings throughENV. The generated fly.toml file has a place for you to add your custom ENV settings. It’s the [env] block.
git or shared publicly. For those settings, you can set them using fly secrets.
fly secrets list
Deploying to Fly
To deploy changes to your app, just run:fly.toml file, and get the app name from there. Then fly will start the process of deploying our application to the Fly platform. Flyctl will return you to the command line when it’s done.
Connecting to the App
The quickest way to browse your newly deployed application is with theflyctl apps open command.