What Fluid provisions
Creating an app runs these steps in order:- Generates a private Git repository from the starter template.
- Creates a dedicated Postgres database.
- Creates a private API token and a public token for your company.
- Creates the hosting project, links it to the repository, sets its environment variables and gives it a public address with HTTPS.
- Starts the first deployment in the background.
3bed85. You see the full address as URL on the Mist Apps screen, or with fluid mist show.
App states
Environment variables Fluid sets
Fluid sets and rotates these variables itself. They’re marked MIST in the Mist desktop app andmanaged_by: mist in the API. You can’t change or delete them.
When you list variables, Fluid hides the values of the secrets, such as
DATABASE_URL and FLUID_DROPLET_SECRET. Your app still reads them at runtime.
The template also reads APP_URL, the app’s own public address, when it builds the URLs it registers with Fluid. You don’t need to set it. Without it, the template uses the app’s production address.
Add your own environment variables
Add a variable for anything your app needs, such as another service’s API key. Your variables are encrypted.- Mist desktop app: right-click the app, click Environment variables…, then Add variable.
- CLI:
fluid mist env set STRIPE_API_KEY=sk_live_51Hx… - API: Add a user-managed env var.
STRIPE_API_KEY.
A new or changed value takes effect on the app’s next deployment. Publish again, or run fluid mist push, to apply it.
To create a random secret, such as a signing key, let the CLI generate it:
fluid mist env list. It masks values unless you add --show-values, and shows encrypted values as <encrypted>. To delete your own variables, run fluid mist env unset STRIPE_API_KEY, with one or more keys.
Use variables locally
Locally, the app reads.env.local, which stays out of Git. Fluid stores your values encrypted and doesn’t send them back, so keep your own copy of each value you need locally in .env.local.
fluid mist env pull copies the values it can read into .env.local and keeps every line already in the file. It never copies a variable Fluid manages, such as DATABASE_URL, because local development uses the local database. It lists the encrypted variables it skipped, so you know which ones to add yourself.
Compute
Right-click a Mist app in the Mist desktop app and click Compute to choose how its server runs:
Mist saves the choice in
vercel.json in the app’s repository. It applies on the next publish. Compute appears once the app is on your computer.
Write stateless code
With either option, the app runs as serverless functions. Each request can run on a different instance, and an instance can stop at any time. So:- Keep state in the database. Don’t rely on memory or local files from one request to the next. A value cached in memory is only a speed-up, and it can be gone on the next request.
- Don’t write files you need later. Store data in the database, and files in a storage service.
- Keep requests short. Do slow work in steps the app can pick up again, rather than in one long request. The template’s own calls to Fluid time out after 5 to 30 seconds.
Deployments
Every push to the repository’smain branch builds and deploys the app. You don’t run a deploy step yourself.
- Mist desktop app: click Publish.
- CLI:
fluid mist push --watchcommits, pushes and follows the build.
queued, building, ready, error or canceled. To list recent deployments, run fluid mist deployments, or use List recent deployments.
To go back to an earlier version, use History in the Mist desktop app, then publish. See Roll back.
Staging
A live app can have one staging environment: a separate deployment of a commit you’ve already pushed, with its own variables, Git branch and database branch. Staging is available only when branch environments are on for your company.fluid mist staging status says whether you can request it, and why not when you can’t.
Staging never publishes to production. To request staging again, tear down the existing one first.
Logs
Build logs and runtime logs come from the same place:- Mist desktop app: click Logs, then the Production tab.
- CLI:
fluid mist logs --tailstreams new entries. Add--deployment <id>to read one deployment’s logs.
console.log and console.error shows up here.
Permissions
Through the API and CLI, each action needs amist.* permission on your token:
Mist API requests don’t accept droplet installation tokens.
Related pages
- Starter template
- Billing
- Run and publish in the Help Center