Skip to content

Deploying Suroi

Introduction

Suroi is an open-source, browser-based 2D battle royale game inspired by surviv.io. It offers fast-paced multiplayer gameplay where players drop into a shrinking map, scavenge for weapons and equipment, and fight to be the last one standing.

Key highlights of Suroi:

  • Browser Based: No downloads required, play directly in the browser
  • Real-Time Multiplayer: WebSocket-based networking for responsive gameplay
  • Battle Royale Mechanics: Shrinking safe zone, loot system, last player wins
  • Weapon Variety: Multiple weapons, armor, and consumables
  • Custom Maps: Support for custom map configurations
  • Modular Design: Easy to customize and extend
  • Open Source: Fully customizable game mechanics
  • Self-Hosted: Run your own private or public servers

This guide walks through deploying Suroi on Klutch.sh using Docker.

Why Deploy Suroi on Klutch.sh

Deploying Suroi on Klutch.sh provides several advantages:

Simplified Deployment: Klutch.sh automatically detects your Dockerfile and builds Suroi without complex orchestration.

HTTPS by Default: Secure WebSocket connections for multiplayer gameplay.

GitHub Integration: Connect your configuration repository for automatic redeployments.

Scalable: Adjust resources based on player count.

Prerequisites

Before deploying Suroi on Klutch.sh, ensure you have:

Deploying Suroi on Klutch.sh

    Create Your Repository

    Create a new GitHub repository with a Dockerfile for Suroi:

    FROM node:20-alpine AS builder
    WORKDIR /app
    RUN apk add --no-cache git
    RUN git clone https://github.com/HasangerGames/suroi.git .
    RUN npm install
    RUN npm run build
    FROM node:20-alpine
    WORKDIR /app
    COPY --from=builder /app/dist ./dist
    COPY --from=builder /app/node_modules ./node_modules
    COPY --from=builder /app/package.json .
    ENV NODE_ENV=production
    ENV PORT=8080
    EXPOSE 8080
    CMD ["node", "dist/server/index.js"]

    Push to GitHub

    Initialize and push your repository to GitHub with your Dockerfile.

    Create a New Project on Klutch.sh

    Navigate to the Klutch.sh dashboard and create a new project.

    Create a New App

    Within your project, create a new app and connect your GitHub repository.

    Configure HTTP Traffic

    In the deployment settings:

    • Select HTTP as the traffic type
    • Set the internal port to 8080

    Set Environment Variables

    Configure the following environment variables:

    VariableValue
    NODE_ENVproduction
    PORT8080

    Deploy Your Application

    Click Deploy to start the build process.

    Access Suroi

    Once deployment completes, access your Suroi game server at your app URL.

Configuration

Game Settings

Customize game parameters through configuration files:

  • Match duration
  • Safe zone timing
  • Loot spawn rates
  • Maximum players

Custom Maps

Create custom maps by modifying the map configuration files in your repository.

Server Administration

Monitor your server:

  • Track active players
  • View match statistics
  • Manage server restarts

Additional Resources

Conclusion

Deploying Suroi on Klutch.sh gives you your own battle royale game server with automatic builds and secure HTTPS access. Host games for friends or build a community around your own customized battle royale experience.