Edgio

Fastboot

This guide shows you how to deploy an Ember Fastboot application to Edgio.

Example

Connector

This framework has a connector developed for Edgio. See Connectors for more information.

System Requirements

Install Node.js

Sign up for Edgio

Deploying requires an account on Edgio. Sign up here for free.

Getting Started

To prepare your Fastboot app for deployment on the Edgio, run the following command in the root folder of your project:
Bash
1npm i -g @edgio/cli@^6.0.0 # yarn global add @edgio/cli@^6.0.0
2edgio init --edgioVersion ^6.0.0
This will automatically add all of the required dependencies and files to your project. These include:
  • The @edgio/core package - Allows you to declare routes and deploy your application on Edgio
  • The @edgio/fastboot package - Provides router middleware that automatically adds Fastboot routes to the Edgio router.
  • The @edgio/prefetch package - Allows you to configure a service worker to prefetch and cache pages to improve browsing speed
  • The @edgio/react package - Provides a Prefetch component for prefetching pages
  • routes.js - A default routes file that sends all requests to Fastboot. Update this file to add caching or proxy some URLs to a different origin.
  • sw/service-worker.js - The source code for your service worker, which enables prefetching when running on Edgio.
  • edgio.config.js - Contains configuration options for deploying on Edgio.

Adding Edgio Service Worker

To add Edgio service worker to your app, call the install function from @edgio/prefetch/window hook when the app first loads. For example, you can alter app/app.js as follows:
JavaScript
1import Application from '@ember/application';
2import Resolver from 'ember-resolver';
3import loadInitializers from 'ember-load-initializers';
4import config from './config/environment';
5
6// add this to import Edgio service worker prefetching functionality
7import {install} from '@edgio/prefetch/window';
8
9export default class App extends Application {
10 modulePrefix = config.modulePrefix;
11 podModulePrefix = config.podModulePrefix;
12 Resolver = Resolver;
13}
14
15loadInitializers(App, config.modulePrefix);
16
17// add this to install the service worker when your app loads
18if (typeof navigator != 'undefined') {
19 install();
20}

dependencies vs devDependencies

To reduce serverless cold-start times, limit the packages listed in the dependencies section of your package.json to only those packages used at runtime. The @edgio/fastboot package must also be included in dependencies. Other packages not used at runtime should be included in devDependencies. Only those packages listed in dependencies are deployed to Edgio along with your application code.

edgio.config.js

Ember fastboot apps should always have the following in edgio.config.js:
JavaScript/edgio.config.js
1module.exports = {
2 connector: '@edgio/fastboot',
3 includeNodeModules: true, // this ensures that package.json dependencies are uploaded to the cloud
4};

Running Locally

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

Simulate edge caching locally

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

Deploying

Deploy your app to the Sites by running the following command in your project’s root directory:
Bash
1edgio deploy
See Deployments for more information.