Has anyone deployed a SPA application with GraphQL API? Like RedwoodJS

Hi there,

I am exploring Fly.io because my application built with redwoodJS needs to support wildcard domains to host customer portal at *.mydomain.com and eventually allow them to connect something.theirdomain.com.

Ive had trouble with hosts like Vercel and want to move to a more flexible setup.

It’s possible to self host redwoodJS - Cookbook - Self-hosting Redwood : RedwoodJS Docs

Just curious if anyone here has tried?

If you run flyctl launch in your project directory, it might just work! I’ll fiddle with RedwoodJS this week, it’s been on my list anyway. :smiley:

Wow thanks for such a quick reply and really awesome you already have redwoodjs on your roadmap.

I love that you guys already have some docs on support for things like custom domains and common SaaS things - SSL for Custom Domains · Fly

Def gives me hope! I will start to play with it this week and report some finding or anything I get stuck with here!

Look foward to sharing notes.

Unfortunately, flyctl launch did not work out of the box - but not a total surprise :slight_smile:

Recent Logs
2021-03-15T16:59:27Z [info] Error: Cannot find module '/workspace/server.js'
2021-03-15T16:59:28Z [info]     at Function.Module._resolveFilename (node:internal/modules/cjs/loader:923:15)
2021-03-15T16:59:28Z [info]     at Function.Module._load (node:internal/modules/cjs/loader:768:27)
2021-03-15T16:59:28Z [info]     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
2021-03-15T16:59:28Z [info]   code: 'MODULE_NOT_FOUND',
2021-03-15T16:59:28Z [info]     at node:internal/main/run_main_module:17:47 {
2021-03-15T16:59:28Z [info] }
2021-03-15T16:59:28Z [info]   requireStack: []

What do you suggest for next steps? Creating a Docker file?

Is there a build step in package.json? You may need to add this script:


  "scripts": {
     ...
    "postinstall": "yarn build"
  },

You might also need to change to the Heroku builder (which we’ll probably do soon by default). In fly.toml, just replace the [build] section with this:

[build]
  builder = "heroku/buildpacks:20"

Yea it’s tricky. Redwood has an API and Web side. It also uses yarn workspaces to split these two. So I am not sure if this get automatically picked up?

Will try your suggestions.

PS - The core maintainers of redwood were interested in helping reach compatibility with Fly for redwoodjs. If are open to it - a shared slack workspace can be opened up. Reach out to David Price.

Oh nice! I’ll get ahold of him. (also, I edited his email address out since this is intended to show up on google someday …)

1 Like

For anyone finding this post today, you can check out how to deploy a Redwood app to Fly here.

A deeper integration and official Redwood setup command is in the work.

As of today’s release of flyctl v0.0.241 fly launch indeed should work in a Redwood project directory.

It will generate a Dockerfile and an accompanying fly.toml, making the project deployable immediately on Fly. Give it a spin, and let us know how it goes!

2 Likes