Skip to main content

Interactive Autoscaling Demo

This demo applies Autoscaling to a real Counter-Strike 1.6 server. If you haven't read that guide yet, we recommend starting there to get familiar with minInstances, maxInstances, bufferSize and the instance states.

We will create a Project, Image, Server Config and autoscaled Deployment, then allocate and join a ready instance. After allocation, we can watch Fleet automatically start a new instance to restore bufferSize, which is exactly what autoscaling does.

Each step includes Console and API instructions. This demo can also create the resources for each step directly in your Fleet account. To enable this, paste your Fleet Bearer token from User Settings > Tokens below. The API examples require curl, jq and the token in ODIN_API_TOKEN. Counter-Strike 1.6 from Steam is only required for the last step if you want to join the server.

Interactive mode (optional)

Requests run in your browser and send the token only to the Fleet API. The token stays in memory, is never stored, and is cleared when you reload or close this page.

1. Create the Project

View step in Console
Create Project page with Fleet selected for the Counter-Strike 1.6 Autoscaling Demo

In the Console, open Projects and select Create Project. Name it Counter-Strike 1.6 Autoscaling Demo, activate Fleet, accept the Fleet terms, then click Create Project.

2. Create the Image

For this demo, we created and published fourplayers/fleet-cs16-autoscaling-demo:latest, a public Counter-Strike 1.6 server image. You can use it directly without building your own image and check its source on GitHub.

View step in Console
Counter-Strike 1.6 image configured from the public 4Players Docker Hub image

In the Console, open the Project you created, select Fleet, open Images and then select Create Image. Complete the wizard:

  1. Under Name / OS, enter Counter-Strike 1.6 as the Name, latest as the Version and select Linux as the Operating System.
  2. Under Image Type, select Image from container registry.
  3. Under Settings, keep Docker Hub anonymous (default) in Choose Registry and enter fourplayers/fleet-cs16-autoscaling-demo:latest in The image name.

Select Next after the first two steps, then select Create.

Fleet pulls and prepares the image. Continue when its status is ready.

3. Create the Server Config

The Server Config uses the Image from the previous step and defines the game port, Counter-Strike settings and URLs for status updates and health heartbeats.

View step in Console
Counter-Strike 1.6 server config with UDP port 27015Dynamic environment variables mapping Fleet autoscaling URLs and the API token to custom variable names

In the Console, open the Project, select Fleet, open Server Configs, then select Create Server Config. Configure it as follows:

  1. Under Basic Server Settings, enter Counter-Strike 1.6 Match Server as the Name, select the Counter-Strike 1.6 Image and set Restart Policy to Never.

  2. Under Port Settings, add a port named game with 27015 as the Port (in Image) and UDP as the Protocol.

  3. Under Environment Variables, add these static values:

    SERVER_NAME=4Players Fleet Counter-Strike 1.6
    SERVER_MAP=de_dust2
    SERVER_MAX_PLAYERS=16
    SERVER_PORT=27015
    HEALTH_INTERVAL_SECONDS=10
  4. Select Add Dynamic Variable and add these Key=Value mappings:

    ODIN_API_TOKEN=API Token
    ODIN_AUTOSCALING_READY_URL=Autoscaling → Ready URL
    ODIN_AUTOSCALING_HEALTH_URL=Autoscaling → Health URL
    ODIN_AUTOSCALING_SHUTDOWN_URL=Autoscaling → Shutdown URL

The demo image automatically reports ready after the Counter-Strike server has started. If a health URL is configured, it also sends heartbeats every 10 seconds. It reports shutdown when the container stops.

4. Create the Autoscaled Deployment

The deployment uses minInstances: 1, maxInstances: 3 and bufferSize: 1, which means Fleet runs at least one instance, maintains one ready instance in addition to allocated instances and never exceeds three. Health checks stay disabled for now. The deployment still stores the default health settings so we can enable them later without recreating it.

View step in Console
Create Deployment dialog configured with autoscaling and health checks disabled

In the Console, open the Project, select Fleet, open Deployments, then select Add Deployment. Configure it as follows:

  1. Enter Counter-Strike 1.6 Autoscaling as the Deployment Name.
  2. Choose an Available Location and select Counter-Strike 1.6 Match Server as the Config.
  3. Enable Autoscaling and set Minimum to 1, Maximum to 3 and Buffer to 1.
  4. Leave Health checks disabled, then select Save. The Console keeps the default health settings in the background.

Fleet starts the first instance in preparing. Once the Counter-Strike server has started, it reports itself as ready through the injected URL configured in the Server Config.

5. Allocate and Connect

Only a ready instance can be allocated. Allocation changes its status from ready to allocated and returns connection details such as the node address and published port. When we allocate the only ready instance, Fleet starts another one to restore bufferSize: 1.

We do not use metadata for this allocation. Metadata can limit allocation to a matching map, server version, custom flag or any other value previously added to the instance. See how to add metadata to a server.

View step in Console
Allocate Server dialog with the allocated Counter-Strike 1.6 address and port

In the Console, open Deployments and wait until the first instance is ready. Open the deployment actions and select Allocate Server. The dialog returns one ready instance with its address, published game port and other connection details.

Now you can start the game and connect to your allocated server. Start Counter-Strike 1.6, open the developer console and connect using the returned IP address and port:

connect <node.address>:<publishedPort>
Counter-Strike 1.6 connected to an allocated Fleet instance on de_dust2

While the match runs, the deployment contains the allocated instance and another instance moving from preparing to ready.

6. Enable Health Checks (Optional)

For this demo, the image automatically sends heartbeats every 10 seconds when the Server Config provides a health URL. The deployment allows 10 seconds before checking starts, expects a heartbeat every 10 seconds and marks an instance unhealthy after three missed heartbeat periods. Read Health Checks for the complete behavior.

View step in Console
Autoscaling deployment with health checks enabled

In the Console, open Deployments, edit the deployment and enable Health checks. Keep Initial delay (s) and Period (s) at 10 and Failure threshold at 3, then select Save.

7. Finish the Demo

When you no longer need the instance, report shutdown so Fleet can remove it. If you enabled health checks, disable them first.

Test status updates in Console

You can use Autoscaling Controls in the server detail view to report shutdown manually. In production, the server sends this status update itself, for example when a match ends. It can report ready instead if it should be reused.

View step in Console
Autoscaling Controls in the Fleet instance detail view

In the Console:

  1. If needed, edit the deployment, disable Health checks and wait for maintenance to finish.
  2. Open Servers, apply the Autoscaling filter, select the allocated instance and choose Shutdown under Autoscaling Controls.
  3. Return to Deployments, wait for maintenance to finish, then delete Counter-Strike 1.6 Autoscaling.

Troubleshooting

SymptomLikely causeWhat to check
An instance remains in preparing.The server has not reported ready.Check the server logs, API token and autoscaling-ready-url.
Allocation returns 409 Conflict.No matching instance is ready.Wait for the ready status update, then check autoscaling-ready-url and the server logs if it does not arrive.
Instances are replaced repeatedly or the deployment cannot be deleted during maintenance.Health heartbeats have stopped or never started.Disable health checks, wait for maintenance to finish, then delete the deployment or restore heartbeats before enabling them again.
Counter-Strike 1.6 cannot connect.The address or port does not match the allocation.Use node.address and the publishedPort of the game port.
Run this step cannot reach Fleet.The token is invalid or the browser blocks the call.Check the token, then use the matching request in the API tab if the browser reports a network error.