This guide shows you how to deploy a RedwoodJS application to Edgio.
Before proceeding, you will need an Edgio property. Create one now if you do not already have one.
Deploying requires an account on Edgio. Sign up here for free.
If you have not already done so, install the Edgio CLI.
1npm i -g @layer0/cli@latest
If you don’t already have a RedwoodJS app, use the terminal (or command prompt on Windows) to create one using the commands below:
1yarn create redwood-app ./my-redwood-app
To prepare your RedwoodJS app for deployment on Edgio, you can use both the RedwoodJS or Edgio CLI depending on what you prefer.
You will first need to setup Edgio as a deploy provider via:
1yarn rw setup deploy layer0
This will verify that the Edgio CLI is setup on your system and initialize the application accordingly.
For preparing using the Edgio CLI, run:
This will automatically add all of the required dependencies and files to your project. These include:
@layer0/corepackage - Allows you to declare routes and deploy your application on Edgio
@layer0/redwoodjspackage - Provides router middleware that automatically adds RedwoodJS routes to the Edgio router.
routes.js- A default routes file that sends all requests to RedwoodJS. Update this file to add caching or proxy some URLs to a different origin.
layer0.config.js- Contains configuration options for deploying on Edgio.
Test your app with the Sites on your local machine by running the following command in your project’s root directory:
To simulate edge caching locally, run:
10 dev --cache
You can deploy using the RedwoodJS CLI using:
1yarn rw deploy layer0
You can also deploy using the Edgio CLI with:
The deploy command for RedwoodJS takes the same deploy arguments as using Edgio to deploy. You can see all the available options using
yarn rw deploy layer0 --help
See deploying for more information.