Edgio

RedwoodJS

This guide shows you how to deploy a RedwoodJS application to Edgio.

Example

Prerequisites

Setup requires:

Install the Edgio CLI

If you have not already done so, install the Edgio CLI.
Bash
1npm i -g @layer0/cli@latest

Getting Started

If you don’t already have a RedwoodJS app, use the terminal (or command prompt on Windows) to create one using the commands below:
Bash
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.

Using RedwoodJS CLI

You will first need to setup Edgio as a deploy provider via:
Bash
1yarn rw setup deploy layer0
This will verify that the Edgio CLI is setup on your system and initialize the application accordingly.

Using the Edgio CLI

For preparing using the Edgio CLI, run:
Bash
10 init
This will automatically add all of the required dependencies and files to your project. These include:
  • The @layer0/core package - Allows you to declare routes and deploy your application on Edgio
  • The @layer0/redwoodjs package - 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.

Running Locally

Test your app with the Sites on your local machine by running the following command in your project’s root directory:
Bash
10 dev

Simulate edge caching locally

To simulate edge caching locally, run:
Bash
10 dev --cache

Deploying

You can deploy using the RedwoodJS CLI using:
Bash
1yarn rw deploy layer0
You can also deploy using the Edgio CLI with:
Bash
10 deploy
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.