Skip to content

Commit

Permalink
Add full deployment guide on deploying to Fly.io (withastro#7812)
Browse files Browse the repository at this point in the history
Co-authored-by: Sarah Rainsberger <[email protected]>
  • Loading branch information
2 people authored and wpplumber committed May 15, 2024
1 parent c86bcf7 commit 2dba0c8
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/content/docs/en/guides/deploy/flyio.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,36 @@ stub: true

You can deploy your Astro project to [Fly.io](https://fly.io/), a platform for running full stack apps and databases close to your users.

## Project Configuration

Your Astro project can be deployed to Fly.io as a static site, or as a server-side rendered site (SSR).

### Static Site

Your Astro project is a static site by default. You don’t need any extra configuration to deploy a static Astro site to Fly.io.

### Adapter for SSR

To enable on-demand rendering in your Astro project and deploy on Fly.io, add [the Node.js adapter](/en/guides/integrations-guide/node/).

## How to deploy

1. [Sign up for Fly.io](https://fly.io/docs/getting-started/log-in-to-fly/#first-time-or-no-fly-account-sign-up-for-fly) if you haven't already.
2. [Install `flyctl`](https://fly.io/docs/hands-on/install-flyctl/), your Fly.io app command center.
3. Run the following command in your terminal.

```bash
fly launch
```

`flyctl` will automatically detect Astro, configure the correct settings, build your image, and deploy it to the Fly.io platform.

## Generating your Astro Dockerfile

If you don't already have a Dockerfile, `fly launch` will generate one for you, as well as prepare a `fly.toml` file. For `server` or `hybrid` projects, this Dockerfile will include the appropriate start command and environment variables.

You can instead create your own Dockerfile using [Dockerfile generator](https://www.npmjs.com/package/@flydotio/dockerfile) and then run using the command `npx dockerfile` for Node applications or `bunx dockerfile` for Bun applications.

## Official Resources

- Check out [the official Fly.io docs](https://fly.io/docs/js/frameworks/astro/)

0 comments on commit 2dba0c8

Please sign in to comment.