Initial commit
This commit is contained in:
parent
3802950b81
commit
3fc550debe
5 changed files with 168 additions and 0 deletions
1
.build
Submodule
1
.build
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit b29909bdbec03d1cb9566bc0b73e0026e908f427
|
||||
24
.env.example
Normal file
24
.env.example
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
# Database Configuration
|
||||
DB_NAME=servatrice
|
||||
DB_USER=servatrice
|
||||
DB_PASSWORD=changeme_secure_password
|
||||
DB_ROOT_PASSWORD=changeme_root_password
|
||||
|
||||
# Server Configuration
|
||||
SERVER_NAME="Jeirs Cockatrice Server"
|
||||
SERVER_VERSION=2.10.2
|
||||
SERVER_PORT=4747
|
||||
WEBSOCKET_PORT=4748
|
||||
|
||||
# Security & Limits
|
||||
MAX_USERS=500
|
||||
MAX_USERS_PER_ADDRESS=4
|
||||
IDLE_TIMEOUT=3600
|
||||
ENABLE_REGISTRATION=true
|
||||
|
||||
# Room Settings
|
||||
DEFAULT_ROOM=Main
|
||||
MAX_ROOMS=50
|
||||
|
||||
# Logging
|
||||
LOG_LEVEL=info
|
||||
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
.env
|
||||
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
[submodule ".build"]
|
||||
path = .build
|
||||
url = https://github.com/Cockatrice/Cockatrice.git
|
||||
|
|
@ -0,0 +1,139 @@
|
|||
name: cockatrice
|
||||
|
||||
services:
|
||||
servatrice:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: .build/Dockerfile
|
||||
image: servatrice
|
||||
ports:
|
||||
- "${SERVER_PORT:-4747}:4747"
|
||||
- "${WEBSOCKET_PORT:-4748}:4748"
|
||||
environment:
|
||||
- DATABASE_HOST=mariadb
|
||||
- DATABASE_PORT=3306
|
||||
- DATABASE_NAME=${DB_NAME:-servatrice}
|
||||
- DATABASE_USER=${DB_USER:-servatrice}
|
||||
- DATABASE_PASSWORD=${DB_PASSWORD:-changeme}
|
||||
configs:
|
||||
- source: servatrice_config
|
||||
target: /config/servatrice.ini
|
||||
mode: 0444
|
||||
volumes:
|
||||
- ./.data/logs:/var/log/servatrice
|
||||
- ./.data/replays:/var/lib/servatrice/replays
|
||||
depends_on:
|
||||
mariadb:
|
||||
condition: service_healthy
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- servatrice-net
|
||||
|
||||
mariadb:
|
||||
image: mariadb:10.11
|
||||
container_name: servatrice-db
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=${DB_ROOT_PASSWORD:-rootchangeme}
|
||||
- MYSQL_DATABASE=${DB_NAME:-servatrice}
|
||||
- MYSQL_USER=${DB_USER:-servatrice}
|
||||
- MYSQL_PASSWORD=${DB_PASSWORD:-changeme}
|
||||
configs:
|
||||
- source: db_init
|
||||
target: /docker-entrypoint-initdb.d/init.sql
|
||||
mode: 0444
|
||||
volumes:
|
||||
- mariadb-data:/var/lib/mysql
|
||||
healthcheck:
|
||||
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- servatrice-net
|
||||
|
||||
volumes:
|
||||
mariadb-data:
|
||||
driver: local
|
||||
|
||||
networks:
|
||||
servatrice-net:
|
||||
driver: bridge
|
||||
|
||||
|
||||
configs:
|
||||
servatrice_config:
|
||||
content: |
|
||||
[server]
|
||||
name=${SERVER_NAME:-My Cockatrice Server}
|
||||
host=0.0.0.0
|
||||
port=4747
|
||||
serverversion=${SERVER_VERSION:-2.10.2}
|
||||
websocket_port=4748
|
||||
|
||||
[database]
|
||||
type=mysql
|
||||
hostname=mariadb
|
||||
port=3306
|
||||
database=${DB_NAME:-servatrice}
|
||||
user=${DB_USER:-servatrice}
|
||||
password=${DB_PASSWORD:-changeme}
|
||||
|
||||
[security]
|
||||
enable_registration=${ENABLE_REGISTRATION:-true}
|
||||
enable_forgot_password=true
|
||||
max_users_per_address=${MAX_USERS_PER_ADDRESS:-4}
|
||||
max_users_total=${MAX_USERS:-500}
|
||||
idle_client_timeout=${IDLE_TIMEOUT:-3600}
|
||||
|
||||
[authentication]
|
||||
method=sql
|
||||
|
||||
[logging]
|
||||
log_level=${LOG_LEVEL:-info}
|
||||
log_file=/var/log/servatrice/servatrice.log
|
||||
|
||||
[rooms]
|
||||
default_room=${DEFAULT_ROOM:-Main}
|
||||
allow_room_creation=true
|
||||
max_rooms=${MAX_ROOMS:-50}
|
||||
|
||||
db_init:
|
||||
content: |
|
||||
CREATE TABLE IF NOT EXISTS users (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
name VARCHAR(64) NOT NULL UNIQUE,
|
||||
password_hash VARCHAR(128) NOT NULL,
|
||||
email VARCHAR(128),
|
||||
realname VARCHAR(128),
|
||||
country VARCHAR(3),
|
||||
is_admin TINYINT(1) DEFAULT 0,
|
||||
is_moderator TINYINT(1) DEFAULT 0,
|
||||
active TINYINT(1) DEFAULT 1,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
last_login TIMESTAMP NULL,
|
||||
INDEX idx_name (name)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS bans (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
user_id INT,
|
||||
ip_address VARCHAR(45),
|
||||
banned_by INT,
|
||||
ban_reason TEXT,
|
||||
banned_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
expires_at TIMESTAMP NULL,
|
||||
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,
|
||||
INDEX idx_user_id (user_id),
|
||||
INDEX idx_ip (ip_address)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS replays (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
replay_name VARCHAR(128) NOT NULL,
|
||||
creator_id INT,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
game_length INT,
|
||||
player_count INT,
|
||||
FOREIGN KEY (creator_id) REFERENCES users(id) ON DELETE SET NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
Loading…
Add table
Add a link
Reference in a new issue