Skip to content

HelixHEX/fly-monorepo-demo

Repository files navigation

Fly.io Simple Monorepo Demo

This is a simple monorepo demo to showcase how to deploy multiple apps to fly.io using one Dockerfile.

What's inside?

In the monorepo you'll find 2 apps and 4 packages

Apps

Packages

  • db: A prisma package to globally use prisma. Check out this article to learn more

Utilities

Setup

Install Dependencies

npm install

Run

npm run dev

Build

npm run build

Deploy

Install and setup flyctl

Create apps first before deploying

$ fly apps create api-gateway

$ fly apps create web-server

Check that the app variable name in the fly.[app-name].toml file is the same name you used to create the app in the previous step

# fly.gateway.toml
app = "monorepo-demo-web" <- this line
primary_region = "lax"
...

Also check that the PROJECT arg in the fly.[app-name].toml file (located in the [build.args] section) is the same name as your app folder.

#fly.gateway.toml
...
[build.args]
  PROJECT="api-gateway" # This should match the app name folder
...

App Name Screenshot

If you're using prisma. Uncomment line 39 to generate types before the buid step

Deploy to fly.io

$ fly deploy --config fly.gateway.toml

$ fly deploy --config fly.web.toml

You also use the included deploy.sh to deploy all apps at once

$ chmod +x deploy.sh

$ ./deploy.sh

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published