Run a Remix App
Getting an application running on Fly.io is essentially working out how to package it as a deployable image. Once packaged it can be deployed to the Fly.io platform.
In this guide we’ll learn how to deploy a Remix application on Fly.io.
We’ll be using the standard web application generated by Remix. This is a bare-bones app with no database.
Deploy a Remix app
We’ll assume you have NodeJS installed already and can run npm
. We recommend
using npm
over yarn
, as npm
is what Remix references in their documentation.
First, install flyctl, the Fly.io CLI, and sign up to Fly.io if you haven’t already.
Now let’s generate a new Remix app. When asked where you want to deploy, pick Fly.io
.
npx create-remix@latest
Need to install the following packages:
create-remix@2.10.0
Ok to proceed? (y) y
remix v2.10.0 💿 Let's build a better website...
dir Where should we create your new project?
./my-remix-app
◼ Using basic template See https://remix.run/guides/templates for more
✔ Template copied
git Initialize a new git repository?
Yes
deps Install dependencies with npm?
Yes
✔ Dependencies installed
✔ Git initialized
done That's it!
Enter your project directory using cd ./my-remix-app
Check out README.md for development and deploy instructions.
Join the community at https://rmx.as/discord
...
Now you’re ready to deploy:
cd my-remix-app
fly launch
Scanning source code
Detected a Remix app
Creating app in .../my-remix-app
We're about to launch your Remix app on Fly.io. Here's what you're getting:
Organization: Jane Developer (fly launch defaults to the personal org)
Name: my-remix-app-restless-moon-4797 (generated)
Region: Ashburn, Virginia (US) (this is the fastest region for you)
App Machines: shared-cpu-1x, 1GB RAM (most apps need about 1GB of RAM)
Postgres: <none> (not requested)
Redis: <none> (not requested)
Tigris: <none> (not requested)
? Do you want to tweak these settings before proceeding? No
Created app 'my-remix-app-restless-moon-4797' in organization 'personal'
Admin URL: https://fly.io/apps/my-remix-app-restless-moon-4797
Hostname: my-remix-app-restless-moon-4797.fly.dev
installing: npm install @flydotio/dockerfile@latest --save-dev
added 22 packages, and audited 841 packages in 2s
258 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
create Dockerfile
execute flyctl secrets set SESSION_SECRET
Secrets are staged for the first deployment
Wrote config file fly.toml
Validating /Users/rubys/tmp/my-remix-app/fly.toml
✓ Configuration is valid
==> Building image
. . .
Visit your newly deployed app at https://my-remix-app-restless-moon-4797.fly.dev/
That’s it! Run fly apps open
to see your deployed app in action.
Try a few other commands:
fly logs
- Tail your application logsfly status
- View your app’s current deployment statusfly ssh console
- Open a terminal on your VMfly deploy
- Deploy the application after making changes