Introduction

Getting started with Judoscale on Fly.io

Judoscale integrates with Fly.io to autoscale your deployments. Sign up for a Judoscale account, and select “Fly.io” for your hosting platform.

Screenshot: choose your hosting platform in Judoscale

Next, follow the link to the Fly dashboard to generate an organization token and connect your team to Judoscale.

Screenshot: team creation page for Fly.io in Judoscale

👀 Note

Judoscale needs your Organization Token in order to fetch apps and machines information, and create/destroy machines when autoscaling. Your machines are not affected until you explicitly enable autoscaling.

You can use a Personal organization token to link your personal apps. App-scoped tokens also work, making only that app available to link to Judoscale (a team with the app’s organization is created the same way).

In your Fly dashboard, select the organization you want to link to Judoscale, and go to “Tokens”. Create a new token and name it “Judoscale” (you can name it anything you want).

Screenshot: create an organization token in Fly

Paste your organization token into Judoscale, and click “Connect to Fly”.

👀 Note

You can connect additional teams later by clicking “Add team” in the Judoscale dashboard sidebar.

After connecting the team to Judoscale, you’ll be presented with the list of apps that belong to that team. Select the first app you want to link to Judoscale.

Screenshot: Fly organization apps listing in Judoscale

This will add the selected Fly app as a Judoscale application, automatically linking all the process groups within that app, and take you to the team dashboard.

Screenshot: Judoscale team dashboard listing Fly process groups

Here you’ll see all of your linked Fly apps and their respective process groups / services, the number of running machines, and their autoscaling status within Judoscale. If this is your first time linking an app, none will be autoscaling yet.

👀 Note

You can link additional apps later by clicking “Link another Fly app” in the team dashboard.

Installing the adapter

In the Judoscale team dashboard, click the service you want to autoscale. This takes you to the Scaling page, where you’ll be prompted to complete the setup for that service.

Screenshot: Judoscale adapter installation wizard

Choose your stack information, and follow the instructions to install the adapter specific to your stack. The adapter is how Judoscale collects queue metrics from your application, similar to a lightweight APM tool. Check the web frameworks and job backends we currently support here.

You’ll also need to set a JUDOSCALE_URL environment variable in your Fly app secrets. This is how the Judoscale adapter knows where to send metrics and link those metrics to the correct service.

Once you’ve installed the adapter and deployed your application, click “Finished and Deployed” to complete the setup. Judoscale will begin showing your queue metrics in the Scaling page charts.

Screenshot: scaling charts in Judoscale

If your web service isn’t receiving traffic, or if your worker service has no jobs waiting in queue, you won’t see any activity in the charts. Let it collect metrics while your app is under load to see queue time information.

Configuring and enabling autoscaling

Now that Judoscale is monitoring your service, you’re ready to autoscale!

👀 Note

We recommend disabling Fly’s autostop/autostart machines behavior when enabling autoscaling. Suspending / stopping / starting machines automatically can conflict with autoscaling, as it may report an incorrect number of running machines at any given time, and cause upscale / downscale behavior to be unpredictable.

Scroll down the Scaling page to review your autoscale settings. The default settings are usually a good starting point for most services, but you’ll want to customize your “Instances” range based on how high and low you’re comfortable scaling.

Screenshot: Judoscale configuration

There’s no “correct” range here. Judoscale defaults to one instance as the minimum, but some teams always want multiple instances running even under light load, so they’ll set the minimum instances to two or higher. The maximum is really about limiting costs. Remember that under heavy load (high queue times), Judoscale will continue scaling your service up until the max instances is reached.

Scroll down and click “Save and enable autoscaling”, and that’s it!

🚨 Warning

If anything in these docs doesn’t work quite right or you have questions, know that you can always reach out to us at [email protected]. Your email goes directly to the Judoscale devs!