Deploying applications to Fly can be as simple as running:
When the application successfully deploys, you can quickly open it in the browser by running:
If all goes well, you should see a running application in your web browser. You can also view a history of deployments by running:
VERSION STABLE TYPE STATUS DESCRIPTION USER DATE v55 true scale succeeded Scale VM count: ["web, 6"] email@example.com 2022-08-10T17:05:57Z v54 true scale dead Scale VM count: ["web, 0"] firstname.lastname@example.org 2022-08-10T16:43:13Z v53 true scale succeeded Scale VM count: ["web, 6"] email@example.com 2022-08-10T16:42:51Z v52 true scale succeeded Scale VM count: ["web, 6"] firstname.lastname@example.org 2022-08-10T16:40:57Z v51 true scale succeeded Scale VM count: ["web, 3"] email@example.com 2022-08-08T20:14:08Z v50 true scale succeeded Scale VM count: ["web, 3"] firstname.lastname@example.org 2022-08-08T19:55:23Z
If a deployment fails, you'll see an error message in the console. If the error is a Rails stack trace, it will be truncated. To view the entire error message run:
You may need to open another terminal window and deploy again while running
fly logs to see the full error message.
Migrations are configured to automatically run after each deployment via the following task in your application's
task :release => 'db:migrate'
To disable automatic migrations for deploys, remove the dependency from the
:release task. Then, to manually run migrations after a deployment, run:
fly ssh console -C "app/bin/rails db:migrate"
Sometimes after a deployment you'll need to run a script or migration in production. That can be accomplished with the Fly SSH console by running:
fly ssh console
Connecting to top1.nearest.of.my-rails-app.internal... complete
cd app ls
Aptfile CHANGELOG.md Dockerfile LICENSE README.md app config.ru fly package.json pull_request_template.md test yarn.lock Brewfile CODE_OF_CONDUCT.md Gemfile Procfile Rakefile bin db lib postcss.config.js resources tmp Brewfile.lock.json CONTRIBUTING.md Gemfile.lock Procfile.dev SECURITY.md config docs node_modules public tailwind.config.js vendor
bundle exec ruby my-hello-world-script.rb
The default Rails image is configured to run
assets:precompile in your application's
task :build => 'assets:precompile'
If you have additional build steps beyond the Rails asset precompiler, you may need to modify your application's