Back-end server created from scratch for an old RTS flash game called Colony.
Colony is an old multiplayer flash game, its source code was lost long ago, and the server shut down.
With the assistance of the lovely fan community of the game and permission from the author,the back-end server was reversed engineered for them to play with each other again. The project involved working with ActionScript3, XML, and Python.
Development involves inspecting decompiled code of the client and listening to network packets sent by the client (See Packet Inspector).
Colony Discord: https://discord.gg/rP8nhm8
Colony-Server includes complete Docker support for easy deployment and consistent runtime environments. This is the recommended way to run the server in production.
Before you begin, ensure you have the following installed:
- Docker (version 20.10 or higher) - Installation Guide
- Docker Compose (version 2.0 or higher) - Installation Guide
Follow these steps to get Colony-Server running with Docker:
-
Clone the repository (if you haven't already):
git clone <repository-url> cd Colony-Server
-
Create your environment file:
cp .env.example .env
-
Configure your Discord bot token:
Edit the
.envfile and replaceyour_discord_bot_token_herewith your actual Discord bot token:DISCORD_API=your_actual_discord_bot_token
Get your Discord bot token from the Discord Developer Portal.
-
Build and start the server:
docker-compose up -d
The
-dflag runs the container in detached mode (background). -
View server logs:
docker-compose logs -f
Press
Ctrl+Cto stop following logs.
Your Colony-Server should now be running on port 25565!
Here are the essential commands for managing your Colony-Server with Docker Compose:
# Start the server (detached mode)
docker-compose up -d
# Stop the server
docker-compose down
# View logs (follow mode)
docker-compose logs -f
# View logs (last 100 lines)
docker-compose logs --tail=100
# Rebuild and restart after making changes
docker-compose up -d --build
# Restart the server
docker-compose restart
# Check server status
docker-compose ps
# Stop and remove everything including volumes (⚠️ DELETES DATA!)
docker-compose down -vIf you prefer to use Docker without Compose:
# Build the image
docker build -t colony-server .
# Run the container
docker run -d \
--name colony-server \
-p 25565:25565 \
-v colony-data:/app/data \
-v $(pwd)/config.ini:/app/config.ini:ro \
--env-file .env \
--restart unless-stopped \
colony-server
# Stop the container
docker stop colony-server
# Start the container
docker start colony-server
# Remove the container
docker rm colony-server
# View logs
docker logs -f colony-server
# View last 100 log lines
docker logs --tail=100 colony-serverThe config.ini file is mounted as read-only into the container. To modify server configuration:
- Edit the
config.inifile on your host machine - Restart the container for changes to take effect:
docker-compose restart
Available configuration options in config.ini:
- version: Game client version (default: 175)
- address: Server bind address (default: 0.0.0.0)
- port: Server port (default: 25565)
- database path: SQLite database location (default: data/server.db)
- logging level: Log verbosity (default: info)
- moderators: List of moderator usernames
- welcome message: Message shown to connecting players
Environment variables are managed through the .env file:
- DISCORD_API (required): Your Discord bot token
- PORT (optional): Override the default port 25565
- LOG_LEVEL (optional): Application log level
Colony-Server uses a Docker named volume called colony-data to persist the SQLite database across container restarts and updates.
To backup your database:
# Create a backup directory
mkdir -p backups
# Copy database from the volume
docker run --rm \
-v colony-data:/data \
-v $(pwd)/backups:/backup \
alpine \
cp /data/server.db /backup/server-backup-$(date +%Y%m%d-%H%M%S).dbTo inspect the contents of the data volume:
# List files in the volume
docker run --rm -v colony-data:/data alpine ls -lah /data
# Open a shell in the volume
docker run --rm -it -v colony-data:/data alpine shTo restore a database backup:
# Stop the server first
docker-compose down
# Restore the database
docker run --rm \
-v colony-data:/data \
-v $(pwd)/backups:/backup \
alpine \
cp /backup/server-backup-YYYYMMDD-HHMMSS.db /data/server.db
# Start the server
docker-compose up -dDO NOT use docker-compose down -v unless you want to delete all persistent data! The -v flag removes volumes, which will permanently delete your database.
By default, Colony-Server listens on port 25565. This is configured in both config.ini and docker-compose.yml.
To change the server port:
-
Edit
docker-compose.yml:ports: - "YOUR_PORT:25565" # Change YOUR_PORT to desired port
-
Optionally, edit
config.iniif you want to change the internal port:[connection] port = YOUR_PORT
-
Restart the server:
docker-compose up -d --build
Issue: Container won't start
Check the logs for errors:
docker-compose logsIssue: Port already in use
Check if another process is using port 25565:
# Linux/Mac
sudo lsof -i :25565
# Windows
netstat -ano | findstr :25565Stop the conflicting process or change Colony-Server's port mapping.
Issue: Permission denied errors
The container runs as a non-root user (UID 1000). Ensure your volumes have appropriate permissions:
sudo chown -R 1000:1000 ./dataIssue: Database connection errors
Verify the data volume is properly mounted:
docker inspect colony-server | grep -A 10 MountsCheck the container's health status:
# Detailed health information
docker inspect colony-server | grep -A 10 Health
# Quick status check
docker psA healthy server should show healthy in the STATUS column.
Different ways to view logs:
# Follow logs in real-time
docker-compose logs -f
# View last 50 lines
docker-compose logs --tail=50
# View logs with timestamps
docker-compose logs -t
# View logs for a specific time period
docker-compose logs --since 30mIf the container appears frozen:
# Check if the process is running
docker exec colony-server ps aux
# Restart the container
docker-compose restart
# Force restart if needed
docker-compose stop
docker-compose up -dFor production deployments, consider the following best practices:
- Never commit
.envto version control - It contains sensitive tokens - Use strong, unique Discord bot tokens
- Consider using Docker secrets for sensitive data in production
- Regularly update the base image for security patches
Set up automated backups using a cron job:
# Add to crontab (crontab -e)
0 2 * * * docker run --rm -v colony-data:/data -v /path/to/backups:/backup alpine cp /data/server.db /backup/server-backup-$(date +\%Y\%m\%d).dbThe docker-compose.yml includes resource limits:
- CPU limit: 2.0 cores (max)
- Memory limit: 2GB (max)
- CPU reservation: 0.5 cores (guaranteed)
- Memory reservation: 512MB (guaranteed)
Adjust these based on your server load and available resources.
Log rotation is already configured in docker-compose.yml:
- Maximum log file size: 10MB
- Maximum log files: 3
- Logs are stored in JSON format
Consider setting up monitoring for:
- Container health status
- Resource usage (CPU, memory)
- Log analysis for errors
- Database size growth
To update to a newer version:
# Pull latest changes
git pull
# Rebuild and restart
docker-compose up -d --build
# Verify health
docker-compose psIf exposing to the internet:
- Use a reverse proxy (nginx, Traefik) with rate limiting
- Implement DDoS protection
- Consider using a VPN for administrative access
- Monitor connection logs for suspicious activity

