Introducing Edgio Applications v7Find out what's new.
Edgio
Edgio

Fastboot

The connector for this framework has undergone end-of-life. Usage of this guide is restricted to Edgio v7.5.x or lower. However, we strongly recommend that you integrate this framework through our generic Node.js connector instead.
This guide shows you how to deploy an Ember Fastboot application to Edgio.

Connector

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

Prerequisites

Setup requires:

Install the Edgio CLI

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

Getting Started

To prepare your Fastboot app for deployment on the Edgio, run the following command in the root folder of your project:
Bash
1edgio init --connector=@edgio/fastboot --edgioVersion 7.5.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 Edgio cloud 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 serverless: {
4 includeNodeModules: true, // this ensures that package.json dependencies are uploaded to the cloud
5 },
6};

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
Your initial CDN-as-code deployment will generate system-defined origin configurations along with those defined within your edgio.config.js. Learn more about system-defined origins.
See Deployments for more information.