Infrastructure

Globe is built on top of multiple cloud compute providers to provide a scalable and reliable service. The following sections provide an overview of the infrastructure used to run Globe & how you can integrate your Dart applications.

How it works

Each time you create a new successful deployment, the Globe deployment service creates an executable of your Dart project. This executable is distributed to our global private deployment registry.

When a user makes a request to your application, they first end up connecting to our global edge network (300+ locations). Our edge network provides zero latency routing management and allows us to route your user to the nearest Globe compute region where our infrastructure will start a container in isolation on demand if necessary.

Our edge network routing service is also responsible for features such as DDoS mitigation, instant rollbacks, A/B testing deployments and more.

Architecture

Globe uses a custom made runner technology to start your Dart applications on demand in a sandbox environment. The platform will automatically scale your application based on the number of requests it receives. Runners are created on demand in the closest region to where a user request originates from.

Globe's on-demand dart runner environment means you should:

  • Have a theoretically unlimited amount of scale.
  • Fully Managed Networking Infrastructure.

However, there are some limitations to achieve this:

  • The application cannot rely on having a persistent file system.
  • It cannot rely on having persistent memory.

Even if a user is performing multiple requests from the same region, it is not guaranteed that the same runner will be used to handle the request. Treat each request as though it is a new environment.

Starting a server

The Globe infrastructure expects that your Dart application starts listening to a port whenever executed. During the build phase of a deployment, a check will take place to ensure that your application is listening to a port. If this is not the case, the deployment will fail.

Using a package such as shelf, you can easily start a server that accepts inbound HTTP requests by accessing the PORT environment variable:

import 'dart:io';

import 'package:shelf/shelf.dart';
import 'package:shelf/shelf_io.dart' as shelf_io;

void main() async {
  final handler =
      const Pipeline().addHandler((Request request) {
        return Response.ok('Hello, World!');
      });

  final server = await shelf_io.serve(
    handler,
    // Use any IPv4 address.
    InternetAddress.anyIPv4,
    // Use the PORT environment variable.
    int.tryParse(Platform.environment['PORT'] ?? '8080') ?? 8080,
  );
}