mirror of
https://github.com/ToyBattles/MicroVolts-Server-Docker
synced 2026-08-24 08:23:03 -04:00
.
This commit is contained in:
parent
9b7f4aff79
commit
87e6136325
13 changed files with 3018 additions and 0 deletions
427
.gitignore
vendored
Normal file
427
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,427 @@
|
|||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
##
|
||||
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
|
||||
|
||||
# User-specific files
|
||||
*.rsuser
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Mono auto generated files
|
||||
mono_crash.*
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
[Ww][Ii][Nn]32/
|
||||
[Aa][Rr][Mm]/
|
||||
[Aa][Rr][Mm]64/
|
||||
[Aa][Rr][Mm]64[Ee][Cc]/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Oo]ut/
|
||||
[Ll]og/
|
||||
[Ll]ogs/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# Visual Studio 2017 auto generated files
|
||||
Generated\ Files/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUnit
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
nunit-*.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# Benchmark Results
|
||||
BenchmarkDotNet.Artifacts/
|
||||
|
||||
# .NET Core
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
|
||||
# ASP.NET Scaffolding
|
||||
ScaffoldingReadMe.txt
|
||||
|
||||
# StyleCop
|
||||
StyleCopReport.xml
|
||||
|
||||
# Files built by Visual Studio
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_h.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.idb
|
||||
*.iobj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.ipdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
# but not Directory.Build.rsp, as it configures directory-level build defaults
|
||||
!Directory.Build.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*_wpftmp.csproj
|
||||
*.log
|
||||
*.tlog
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# Visual Studio Trace Files
|
||||
*.e2e
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# AxoCover is a Code Coverage Tool
|
||||
.axoCover/*
|
||||
!.axoCover/settings.json
|
||||
|
||||
# Coverlet is a free, cross platform Code Coverage Tool
|
||||
coverage*.json
|
||||
coverage*.xml
|
||||
coverage*.info
|
||||
|
||||
# Visual Studio code coverage results
|
||||
*.coverage
|
||||
*.coveragexml
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# NuGet Symbol Packages
|
||||
*.snupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/[Pp]ackages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/[Pp]ackages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/[Pp]ackages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignorable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directories and files
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
*.appx
|
||||
*.appxbundle
|
||||
*.appxupload
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!?*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.jfm
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
orleans.codegen.cs
|
||||
|
||||
# Including strong name files can present a security risk
|
||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||
#*.snk
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
ServiceFabricBackup/
|
||||
*.rptproj.bak
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
*.ndf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
*.rptproj.rsuser
|
||||
*- [Bb]ackup.rdl
|
||||
*- [Bb]ackup ([0-9]).rdl
|
||||
*- [Bb]ackup ([0-9][0-9]).rdl
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
node_modules/
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||
*.vbw
|
||||
|
||||
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
|
||||
*.vbp
|
||||
|
||||
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
|
||||
*.dsw
|
||||
*.dsp
|
||||
|
||||
# Visual Studio 6 technical files
|
||||
*.ncb
|
||||
*.aps
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# CodeRush personal settings
|
||||
.cr/personal
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
# Cake - Uncomment if you are using it
|
||||
# tools/**
|
||||
# !tools/packages.config
|
||||
|
||||
# Tabs Studio
|
||||
*.tss
|
||||
|
||||
# Telerik's JustMock configuration file
|
||||
*.jmconfig
|
||||
|
||||
# BizTalk build output
|
||||
*.btp.cs
|
||||
*.btm.cs
|
||||
*.odx.cs
|
||||
*.xsd.cs
|
||||
|
||||
# OpenCover UI analysis results
|
||||
OpenCover/
|
||||
|
||||
# Azure Stream Analytics local run output
|
||||
ASALocalRun/
|
||||
|
||||
# MSBuild Binary and Structured Log
|
||||
*.binlog
|
||||
|
||||
# AWS SAM Build and Temporary Artifacts folder
|
||||
.aws-sam
|
||||
|
||||
# NVidia Nsight GPU debugger configuration file
|
||||
*.nvuser
|
||||
|
||||
# MFractors (Xamarin productivity tool) working folder
|
||||
.mfractor/
|
||||
|
||||
# Local History for Visual Studio
|
||||
.localhistory/
|
||||
|
||||
# Visual Studio History (VSHistory) files
|
||||
.vshistory/
|
||||
|
||||
# BeatPulse healthcheck temp database
|
||||
healthchecksdb
|
||||
|
||||
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
||||
MigrationBackup/
|
||||
|
||||
# Ionide (cross platform F# VS Code tools) working folder
|
||||
.ionide/
|
||||
|
||||
# Fody - auto-generated XML schema
|
||||
FodyWeavers.xsd
|
||||
|
||||
# VS Code files for those working on multiple tools
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
*.code-workspace
|
||||
|
||||
# Local History for Visual Studio Code
|
||||
.history/
|
||||
|
||||
# Windows Installer files from build outputs
|
||||
*.cab
|
||||
*.msi
|
||||
*.msix
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
|
||||
x64/
|
||||
ipch/
|
||||
|
||||
AuthServer/x64/
|
||||
CastServer/x64/
|
||||
CastServer/Release/
|
||||
Common/Release/
|
||||
Common/x64/
|
||||
ExternalLibraries/vcpkg/
|
||||
MainServer/x64/
|
||||
MainServer/Release/
|
||||
Microvolts-Emulator-V2/
|
||||
|
||||
ExternalLibraries/CommonLib/Common.lib
|
||||
E x t e r n a l L i b r a r i e s / C o m m o n . l i b
|
||||
|
||||
E x t e r n a l L i b r a r i e s / C o m m o n . l i b
|
||||
|
||||
# Environment files
|
||||
.env
|
||||
|
||||
58
Dockerfile
Normal file
58
Dockerfile
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
FROM ubuntu:22.04 AS builder
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
build-essential \
|
||||
cmake \
|
||||
ninja-build \
|
||||
git \
|
||||
python3 \
|
||||
python3-pip \
|
||||
pkg-config \
|
||||
libssl-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN apt-get update && apt-get install -y software-properties-common \
|
||||
&& add-apt-repository ppa:ubuntu-toolchain-r/test \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y gcc-13 g++-13 \
|
||||
&& update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 100 \
|
||||
&& update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 100 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Clone the MicrovoltsEmulator repository
|
||||
RUN git clone https://github.com/SoWeBegin/MicrovoltsEmulator .
|
||||
|
||||
# Clone and setup vcpkg
|
||||
RUN git clone https://github.com/microsoft/vcpkg.git ExternalLibraries/vcpkg \
|
||||
&& ./ExternalLibraries/vcpkg/bootstrap-vcpkg.sh
|
||||
|
||||
RUN ./ExternalLibraries/vcpkg/vcpkg install --triplet=x64-linux
|
||||
|
||||
RUN cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=ExternalLibraries/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE=Release \
|
||||
&& cmake --build build --config Release
|
||||
|
||||
FROM ubuntu:22.04
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
libssl3 \
|
||||
libmariadb3 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=builder /app/build/AuthServer/AuthServer.elf /app/Output/
|
||||
COPY --from=builder /app/build/MainServer/MainServer.elf /app/Output/
|
||||
COPY --from=builder /app/build/CastServer/CastServer.elf /app/Output/
|
||||
|
||||
COPY Setup/ /app/Setup/
|
||||
COPY microvolts-db.sql /app/
|
||||
|
||||
RUN mkdir -p /app/Output
|
||||
|
||||
ENV MV_DB_PW=default_password
|
||||
|
||||
EXPOSE 13000 13005 13006
|
||||
|
||||
CMD ["/bin/bash"]
|
||||
39
README.md
Normal file
39
README.md
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
# Microvolts Emulator - Docker Setup
|
||||
|
||||
A complete Docker-based setup for running the Microvolts Emulator servers on Linux. This setup includes authentication, main game, and gameplay servers with automatic database initialization.
|
||||
|
||||
## 🚀 Quick Start
|
||||
|
||||
Get the Microvolts Emulator running in minutes:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/SoWeBegin/MicrovoltsEmulator.git
|
||||
cd MicrovoltsEmulator
|
||||
|
||||
./setup.sh --db-password-env MY_DB_PASSWORD
|
||||
|
||||
export MY_DB_PASSWORD=your_secure_password_here
|
||||
|
||||
docker-compose up --build -d
|
||||
|
||||
docker-compose ps
|
||||
```
|
||||
|
||||
That's it! Your Microvolts Emulator is now running with:
|
||||
- ✅ MariaDB database (port 3305)
|
||||
- ✅ Authentication server (port 13000)
|
||||
- ✅ Main game server (ports 13005, 14005)
|
||||
- ✅ Gameplay server (ports 13006, 14006)
|
||||
|
||||
## 📋 Requirements
|
||||
|
||||
- **Docker** 20.10+ and **Docker Compose** 2.0+
|
||||
- **Linux** environment (Ubuntu/Debian recommended)
|
||||
- **4GB+ RAM** available
|
||||
- **Git** for repository access
|
||||
|
||||
## 🆘 Support & Community
|
||||
|
||||
- 📖 **[Full Documentation](docs/)** - Complete guides and references
|
||||
- 🐛 [Discord Server](https://discord.gg/y6yjRKmE6Y) - Bug reports and feature requests
|
||||
---
|
||||
175
README_Docker.md
Normal file
175
README_Docker.md
Normal file
|
|
@ -0,0 +1,175 @@
|
|||
# Microvolts Emulator Docker Setup
|
||||
|
||||
This Docker setup allows you to easily install, configure, build, and run the Microvolts Emulator servers on Linux.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Docker and Docker Compose installed
|
||||
- At least 4GB RAM available
|
||||
- Linux environment (Ubuntu/Debian recommended)
|
||||
|
||||
## Quick Start
|
||||
|
||||
1. **Clone the repository** (if not already done):
|
||||
```bash
|
||||
git clone https://github.com/SoWeBegin/MicrovoltsEmulator .
|
||||
```
|
||||
|
||||
2. **Configure database settings**:
|
||||
```bash
|
||||
./setup.sh --db-password-env MY_DB_PASSWORD
|
||||
# Or with custom settings:
|
||||
./setup.sh --db-host 192.168.1.100 --db-port 3306 --db-name mydb --db-user admin --db-password-env MY_DB_PASSWORD
|
||||
```
|
||||
|
||||
3. **Set the database password environment variable**:
|
||||
```bash
|
||||
export MY_DB_PASSWORD=your_secure_password_here
|
||||
```
|
||||
|
||||
4. **Build and start the services**:
|
||||
```bash
|
||||
docker-compose up --build -d
|
||||
```
|
||||
|
||||
5. **Check that services are running**:
|
||||
```bash
|
||||
docker-compose ps
|
||||
```
|
||||
|
||||
## Services
|
||||
|
||||
- **db**: MariaDB database (port configurable via setup)
|
||||
- **auth-server**: Authentication server (port 13000)
|
||||
- **main-server**: Main game server (ports 13005, 14005)
|
||||
- **cast-server**: Gameplay server (ports 13006, 14006)
|
||||
|
||||
## Setup Script
|
||||
|
||||
The `setup.sh` script configures database connection details and generates a `docker-compose.override.yml` file with the appropriate environment variables.
|
||||
|
||||
Usage:
|
||||
```bash
|
||||
./setup.sh [options]
|
||||
```
|
||||
|
||||
This script:
|
||||
- Updates `Setup/config.ini` with your database settings
|
||||
- Creates `docker-compose.override.yml` with environment variable configurations
|
||||
- Provides instructions for setting the password environment variable
|
||||
|
||||
Run `./setup.sh --help` for all available options.
|
||||
|
||||
## Configuration
|
||||
|
||||
### Database Configuration
|
||||
|
||||
Use the setup script to configure database settings:
|
||||
|
||||
```bash
|
||||
./setup.sh --db-password-env MY_DB_PASSWORD --db-host 192.168.1.100 --db-port 3306
|
||||
```
|
||||
|
||||
Available options:
|
||||
- `--db-host`: Database server IP address
|
||||
- `--db-port`: Database server port
|
||||
- `--db-name`: Database name
|
||||
- `--db-user`: Database username
|
||||
- `--db-password-env`: Name of environment variable containing the password
|
||||
|
||||
After configuration, set the password environment variable:
|
||||
```bash
|
||||
export MY_DB_PASSWORD=your_actual_password
|
||||
```
|
||||
|
||||
### Edit Configuration
|
||||
|
||||
Use the provided script to edit the configuration:
|
||||
|
||||
```bash
|
||||
./edit_config.sh
|
||||
```
|
||||
|
||||
This will open the `Setup/config.ini` file in nano. After editing, the servers will be automatically restarted.
|
||||
|
||||
### Manual Configuration
|
||||
|
||||
Edit `Setup/config.ini` directly. The file is mounted as a volume, so changes are reflected immediately.
|
||||
|
||||
Key settings:
|
||||
- Database connection (uses the configured password environment variable)
|
||||
- Server IPs and ports
|
||||
- Client version
|
||||
|
||||
## Management Commands
|
||||
|
||||
### Restart Specific Servers
|
||||
|
||||
```bash
|
||||
./restart_servers.sh auth # Restart Auth Server
|
||||
./restart_servers.sh main # Restart Main Server
|
||||
./restart_servers.sh cast # Restart Cast Server
|
||||
./restart_servers.sh db # Restart Database
|
||||
./restart_servers.sh all # Restart all servers
|
||||
```
|
||||
|
||||
### View Logs
|
||||
|
||||
```bash
|
||||
docker-compose logs -f [service_name]
|
||||
# Examples:
|
||||
docker-compose logs -f auth-server
|
||||
docker-compose logs -f db
|
||||
```
|
||||
|
||||
### Stop Services
|
||||
|
||||
```bash
|
||||
docker-compose down
|
||||
```
|
||||
|
||||
### Rebuild After Code Changes
|
||||
|
||||
If you modify the source code:
|
||||
|
||||
```bash
|
||||
docker-compose down
|
||||
docker-compose up --build -d
|
||||
```
|
||||
|
||||
## Database
|
||||
|
||||
The database is automatically initialized with the `microvolts-db.sql` file on first run.
|
||||
|
||||
- Database name: Configurable via setup script (default: `microvolts-db`)
|
||||
- User: Configurable via setup script (default: `root`)
|
||||
- Root password: From the configured password environment variable
|
||||
|
||||
## Ports
|
||||
|
||||
- 3305: MariaDB
|
||||
- 13000: Auth Server
|
||||
- 13005: Main Server (game)
|
||||
- 13006: Cast Server (gameplay)
|
||||
- 14005: Main Server IPC
|
||||
- 14006: Cast Server IPC
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Build Issues
|
||||
|
||||
If the build fails, try:
|
||||
```bash
|
||||
docker system prune -a
|
||||
docker-compose up --build --no-cache
|
||||
```
|
||||
|
||||
### Database Connection Issues
|
||||
|
||||
1. Ensure the password environment variable is set:
|
||||
```bash
|
||||
echo $MY_DB_PASSWORD
|
||||
```
|
||||
2. Check that the setup script configured the correct environment variable name
|
||||
3. Verify the docker-compose.override.yml was created correctly
|
||||
4. Check database logs: `docker-compose logs db`
|
||||
77
docker-compose.yml
Normal file
77
docker-compose.yml
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
version: '3.8'
|
||||
|
||||
services:
|
||||
db:
|
||||
image: mariadb:10.11
|
||||
container_name: microvolts-db
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: ${MV_DB_PW:-default_password}
|
||||
MYSQL_DATABASE: microvolts-db
|
||||
MYSQL_USER: microvolts
|
||||
MYSQL_PASSWORD: ${MV_DB_PW:-default_password}
|
||||
ports:
|
||||
- "3305:3306"
|
||||
volumes:
|
||||
- db_data:/var/lib/mysql
|
||||
- ./microvolts-db.sql:/docker-entrypoint-initdb.d/microvolts-db.sql
|
||||
networks:
|
||||
- microvolts-network
|
||||
healthcheck:
|
||||
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
|
||||
timeout: 20s
|
||||
retries: 10
|
||||
|
||||
auth-server:
|
||||
build: .
|
||||
container_name: microvolts-auth
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
ports:
|
||||
- "13000:13000"
|
||||
volumes:
|
||||
- ./Setup:/app/Setup:ro
|
||||
networks:
|
||||
- microvolts-network
|
||||
command: ["/app/Output/AuthServer.elf"]
|
||||
|
||||
main-server:
|
||||
build: .
|
||||
container_name: microvolts-main
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
ports:
|
||||
- "13005:13005"
|
||||
- "14005:14005"
|
||||
volumes:
|
||||
- ./Setup:/app/Setup:ro
|
||||
networks:
|
||||
- microvolts-network
|
||||
command: ["/app/Output/MainServer.elf"]
|
||||
|
||||
cast-server:
|
||||
build: .
|
||||
container_name: microvolts-cast
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
ports:
|
||||
- "13006:13006"
|
||||
- "14006:14006"
|
||||
volumes:
|
||||
- ./Setup:/app/Setup:ro
|
||||
networks:
|
||||
- microvolts-network
|
||||
command: ["/app/Output/CastServer.elf"]
|
||||
|
||||
volumes:
|
||||
db_data:
|
||||
|
||||
networks:
|
||||
microvolts-network:
|
||||
driver: bridge
|
||||
556
docs/configuration.md
Normal file
556
docs/configuration.md
Normal file
|
|
@ -0,0 +1,556 @@
|
|||
# Configuration Guide
|
||||
|
||||
This guide covers all configuration options for the Microvolts Emulator Docker setup, from basic database settings to advanced server configurations.
|
||||
|
||||
## Database Configuration
|
||||
|
||||
### Using the Setup Script
|
||||
|
||||
The recommended way to configure the database:
|
||||
|
||||
```bash
|
||||
# Basic configuration
|
||||
./setup.sh --db-password-env MY_DB_PASSWORD
|
||||
|
||||
# Full configuration
|
||||
./setup.sh \
|
||||
--db-host database.example.com \
|
||||
--db-port 3306 \
|
||||
--db-name microvolts_production \
|
||||
--db-user microvolts_user \
|
||||
--db-password-env MY_DB_PASSWORD
|
||||
```
|
||||
|
||||
### Manual Database Configuration
|
||||
|
||||
Edit `Setup/config.ini`:
|
||||
|
||||
```ini
|
||||
[Database]
|
||||
LocalIp = 127.0.0.1
|
||||
Ip = database.example.com
|
||||
Port = 3306
|
||||
DatabaseName = microvolts_production
|
||||
Username = microvolts_user
|
||||
PasswordEnvironmentName = MY_DB_PASSWORD
|
||||
```
|
||||
|
||||
### Environment Variables
|
||||
|
||||
Set the database password:
|
||||
|
||||
```bash
|
||||
export MY_DB_PASSWORD=your_secure_password
|
||||
```
|
||||
|
||||
### Docker Compose Override
|
||||
|
||||
The setup script creates `docker-compose.override.yml`:
|
||||
|
||||
```yaml
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
db:
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: ${MY_DB_PASSWORD}
|
||||
MYSQL_DATABASE: microvolts_production
|
||||
MYSQL_USER: microvolts_user
|
||||
MYSQL_PASSWORD: ${MY_DB_PASSWORD}
|
||||
ports:
|
||||
- "3306:3306"
|
||||
|
||||
auth-server:
|
||||
environment:
|
||||
- MY_DB_PASSWORD
|
||||
|
||||
main-server:
|
||||
environment:
|
||||
- MY_DB_PASSWORD
|
||||
|
||||
cast-server:
|
||||
environment:
|
||||
- MY_DB_PASSWORD
|
||||
```
|
||||
|
||||
## Server Configuration
|
||||
|
||||
### Authentication Server
|
||||
|
||||
Configure the auth server in `Setup/config.ini`:
|
||||
|
||||
```ini
|
||||
[AuthServer]
|
||||
LocalIp = 127.0.0.1
|
||||
Ip = your-server-ip
|
||||
Port = 13000
|
||||
```
|
||||
|
||||
### Main Server
|
||||
|
||||
Configure the main server:
|
||||
|
||||
```ini
|
||||
[MainServer_1]
|
||||
LocalIp = 127.0.0.1
|
||||
Ip = your-server-ip
|
||||
Port = 13005
|
||||
IpcPort = 14005
|
||||
IsPublic = true
|
||||
```
|
||||
|
||||
### Cast Server
|
||||
|
||||
Configure the cast server:
|
||||
|
||||
```ini
|
||||
[CastServer_1]
|
||||
LocalIp = 127.0.0.1
|
||||
Ip = your-server-ip
|
||||
Port = 13006
|
||||
IpcPort = 14006
|
||||
```
|
||||
|
||||
### Multiple Servers
|
||||
|
||||
Add additional servers:
|
||||
|
||||
```ini
|
||||
[MainServer_2]
|
||||
LocalIp = 127.0.0.1
|
||||
Ip = your-server-ip
|
||||
Port = 13015
|
||||
IpcPort = 14015
|
||||
IsPublic = true
|
||||
|
||||
[CastServer_2]
|
||||
LocalIp = 127.0.0.1
|
||||
Ip = your-server-ip
|
||||
Port = 13016
|
||||
IpcPort = 14016
|
||||
```
|
||||
|
||||
## Client Configuration
|
||||
|
||||
### Version Settings
|
||||
|
||||
Configure client version requirements:
|
||||
|
||||
```ini
|
||||
[Client]
|
||||
ClientVersion = 1.1.1
|
||||
```
|
||||
|
||||
### Website Integration
|
||||
|
||||
Configure website API endpoints:
|
||||
|
||||
```ini
|
||||
[Website]
|
||||
Ip = your-website-ip
|
||||
Port = 8080
|
||||
```
|
||||
|
||||
## Advanced Configuration
|
||||
|
||||
### Custom Ports
|
||||
|
||||
Modify `docker-compose.yml` for custom ports:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
db:
|
||||
ports:
|
||||
- "3307:3306" # Host:Container
|
||||
|
||||
auth-server:
|
||||
ports:
|
||||
- "13001:13000"
|
||||
|
||||
main-server:
|
||||
ports:
|
||||
- "13006:13005"
|
||||
- "14006:14005"
|
||||
|
||||
cast-server:
|
||||
ports:
|
||||
- "13007:13006"
|
||||
- "14007:14006"
|
||||
```
|
||||
|
||||
### Environment Variables
|
||||
|
||||
Override configuration with environment variables:
|
||||
|
||||
```bash
|
||||
# Database settings
|
||||
export DB_HOST=database.example.com
|
||||
export DB_PORT=3306
|
||||
export DB_NAME=microvolts_db
|
||||
export DB_USER=microvolts
|
||||
export DB_PASSWORD_ENV=MY_DB_PASSWORD
|
||||
|
||||
# Server settings
|
||||
export AUTH_PORT=13000
|
||||
export MAIN_PORT=13005
|
||||
export CAST_PORT=13006
|
||||
|
||||
# Client settings
|
||||
export CLIENT_VERSION=1.1.1
|
||||
```
|
||||
|
||||
### Docker Compose Environment File
|
||||
|
||||
Create a `.env` file for sensitive data:
|
||||
|
||||
```bash
|
||||
# .env file
|
||||
MY_DB_PASSWORD=super_secret_password
|
||||
DB_HOST=localhost
|
||||
DB_PORT=3305
|
||||
```
|
||||
|
||||
Then reference it in `docker-compose.yml`:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
db:
|
||||
env_file:
|
||||
- .env
|
||||
```
|
||||
|
||||
## Network Configuration
|
||||
|
||||
### Internal Networking
|
||||
|
||||
Services communicate internally using Docker networks:
|
||||
|
||||
```yaml
|
||||
networks:
|
||||
microvolts-network:
|
||||
driver: bridge
|
||||
ipam:
|
||||
config:
|
||||
- subnet: 172.20.0.0/16
|
||||
```
|
||||
|
||||
### External Access
|
||||
|
||||
Configure external access:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
auth-server:
|
||||
ports:
|
||||
- "0.0.0.0:13000:13000" # Bind to all interfaces
|
||||
networks:
|
||||
- microvolts-network
|
||||
```
|
||||
|
||||
### Firewall Rules
|
||||
|
||||
```bash
|
||||
# Allow emulator ports
|
||||
sudo ufw allow 3305/tcp # Database
|
||||
sudo ufw allow 13000/tcp # Auth
|
||||
sudo ufw allow 13005/tcp # Main
|
||||
sudo ufw allow 13006/tcp # Cast
|
||||
|
||||
# Allow IPC ports (internal only)
|
||||
sudo ufw allow from 172.20.0.0/16 to any port 14005
|
||||
sudo ufw allow from 172.20.0.0/16 to any port 14006
|
||||
```
|
||||
|
||||
## Performance Tuning
|
||||
|
||||
### Database Optimization
|
||||
|
||||
Configure MariaDB performance:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
db:
|
||||
environment:
|
||||
MYSQL_INNODB_BUFFER_POOL_SIZE: 1G
|
||||
MYSQL_INNODB_LOG_FILE_SIZE: 256M
|
||||
MYSQL_MAX_CONNECTIONS: 100
|
||||
command:
|
||||
- --innodb-buffer-pool-size=1G
|
||||
- --innodb-log-file-size=256M
|
||||
- --max-connections=100
|
||||
```
|
||||
|
||||
### Server Resources
|
||||
|
||||
Allocate resources to services:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
main-server:
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '2.0'
|
||||
memory: 2G
|
||||
reservations:
|
||||
cpus: '1.0'
|
||||
memory: 1G
|
||||
|
||||
cast-server:
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '2.0'
|
||||
memory: 2G
|
||||
```
|
||||
|
||||
### Docker Daemon Tuning
|
||||
|
||||
Optimize Docker performance:
|
||||
|
||||
```json
|
||||
// /etc/docker/daemon.json
|
||||
{
|
||||
"log-driver": "json-file",
|
||||
"log-opts": {
|
||||
"max-size": "10m",
|
||||
"max-file": "3"
|
||||
},
|
||||
"storage-driver": "overlay2",
|
||||
"max-concurrent-downloads": 10,
|
||||
"max-concurrent-uploads": 10
|
||||
}
|
||||
```
|
||||
|
||||
## Security Configuration
|
||||
|
||||
### Database Security
|
||||
|
||||
```yaml
|
||||
services:
|
||||
db:
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
|
||||
MYSQL_USER: microvolts
|
||||
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
|
||||
command:
|
||||
- --skip-name-resolve
|
||||
- --bind-address=0.0.0.0
|
||||
```
|
||||
|
||||
### Network Security
|
||||
|
||||
```yaml
|
||||
services:
|
||||
db:
|
||||
networks:
|
||||
- internal
|
||||
auth-server:
|
||||
networks:
|
||||
- internal
|
||||
- external
|
||||
main-server:
|
||||
networks:
|
||||
- internal
|
||||
- external
|
||||
cast-server:
|
||||
networks:
|
||||
- internal
|
||||
- external
|
||||
|
||||
networks:
|
||||
internal:
|
||||
internal: true
|
||||
external:
|
||||
driver: bridge
|
||||
```
|
||||
|
||||
### SSL/TLS Configuration
|
||||
|
||||
For production deployments:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
db:
|
||||
volumes:
|
||||
- ./ssl:/etc/mysql/ssl
|
||||
environment:
|
||||
MYSQL_SSL_CA: /etc/mysql/ssl/ca.pem
|
||||
MYSQL_SSL_CERT: /etc/mysql/ssl/server-cert.pem
|
||||
MYSQL_SSL_KEY: /etc/mysql/ssl/server-key.pem
|
||||
command:
|
||||
- --ssl-ca=/etc/mysql/ssl/ca.pem
|
||||
- --ssl-cert=/etc/mysql/ssl/server-cert.pem
|
||||
- --ssl-key=/etc/mysql/ssl/server-key.pem
|
||||
```
|
||||
|
||||
## Monitoring Configuration
|
||||
|
||||
### Health Checks
|
||||
|
||||
```yaml
|
||||
services:
|
||||
db:
|
||||
healthcheck:
|
||||
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
|
||||
timeout: 20s
|
||||
retries: 10
|
||||
interval: 30s
|
||||
|
||||
auth-server:
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-z", "localhost", "13000"]
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
interval: 30s
|
||||
```
|
||||
|
||||
### Logging Configuration
|
||||
|
||||
```yaml
|
||||
services:
|
||||
auth-server:
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
command: ["/app/Output/AuthServer.elf", "--log-level=info"]
|
||||
```
|
||||
|
||||
## Backup Configuration
|
||||
|
||||
### Database Backup
|
||||
|
||||
```yaml
|
||||
services:
|
||||
backup:
|
||||
image: mariadb:10.11
|
||||
volumes:
|
||||
- db_data:/var/lib/mysql:ro
|
||||
- ./backups:/backups
|
||||
command: >
|
||||
bash -c "
|
||||
mysqldump -h db -u root -p${MYSQL_ROOT_PASSWORD} microvolts-db > /backups/backup-$(date +%Y%m%d-%H%M%S).sql
|
||||
"
|
||||
depends_on:
|
||||
- db
|
||||
```
|
||||
|
||||
### Automated Backups
|
||||
|
||||
Create a backup script:
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
# backup.sh
|
||||
BACKUP_DIR="./backups"
|
||||
DATE=$(date +%Y%m%d_%H%M%S)
|
||||
|
||||
docker-compose exec db mysqldump -u root -p$MYSQL_ROOT_PASSWORD microvolts-db > "$BACKUP_DIR/backup_$DATE.sql"
|
||||
|
||||
# Keep only last 7 backups
|
||||
cd "$BACKUP_DIR"
|
||||
ls -t backup_*.sql | tail -n +8 | xargs -r rm
|
||||
```
|
||||
|
||||
## Troubleshooting Configuration
|
||||
|
||||
### Configuration Validation
|
||||
|
||||
```bash
|
||||
# Check configuration syntax
|
||||
docker-compose config
|
||||
|
||||
# Validate config.ini
|
||||
python3 -c "
|
||||
import configparser
|
||||
config = configparser.ConfigParser()
|
||||
config.read('Setup/config.ini')
|
||||
print('Configuration loaded successfully')
|
||||
for section in config.sections():
|
||||
print(f'Section: {section}')
|
||||
for key, value in config.items(section):
|
||||
print(f' {key} = {value}')
|
||||
"
|
||||
```
|
||||
|
||||
### Environment Variable Debugging
|
||||
|
||||
```bash
|
||||
# Check all environment variables
|
||||
docker-compose exec auth-server env | grep -E "(MY_DB_PASSWORD|DB_)" | sort
|
||||
|
||||
# Test database connection
|
||||
docker-compose exec auth-server mysql -h db -u root -p$MY_DB_PASSWORD -e "SELECT 1;"
|
||||
```
|
||||
|
||||
### Network Debugging
|
||||
|
||||
```bash
|
||||
# Check network connectivity
|
||||
docker-compose exec auth-server ping -c 3 db
|
||||
|
||||
# Inspect networks
|
||||
docker network ls
|
||||
docker network inspect microvolts-emulator_microvolts-network
|
||||
|
||||
# Check port bindings
|
||||
docker-compose ps
|
||||
netstat -tulpn | grep -E "(3305|13000|13005|13006)"
|
||||
```
|
||||
|
||||
## Configuration Examples
|
||||
|
||||
### Development Setup
|
||||
|
||||
```yaml
|
||||
# docker-compose.override.yml
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
db:
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: dev_password
|
||||
ports:
|
||||
- "3305:3306"
|
||||
volumes:
|
||||
- ./dev-data:/var/lib/mysql
|
||||
|
||||
auth-server:
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=dev_password
|
||||
ports:
|
||||
- "13000:13000"
|
||||
```
|
||||
|
||||
### Production Setup
|
||||
|
||||
```yaml
|
||||
# docker-compose.prod.yml
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
db:
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD_FILE: /run/secrets/db_password
|
||||
secrets:
|
||||
- db_password
|
||||
volumes:
|
||||
- db_data:/var/lib/mysql
|
||||
- ./ssl:/etc/mysql/ssl
|
||||
command:
|
||||
- --ssl-ca=/etc/mysql/ssl/ca.pem
|
||||
- --ssl-cert=/etc/mysql/ssl/server-cert.pem
|
||||
- --ssl-key=/etc/mysql/ssl/server-key.pem
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 2G
|
||||
reservations:
|
||||
memory: 1G
|
||||
|
||||
secrets:
|
||||
db_password:
|
||||
file: ./secrets/db_password.txt
|
||||
```
|
||||
225
docs/getting-started.md
Normal file
225
docs/getting-started.md
Normal file
|
|
@ -0,0 +1,225 @@
|
|||
# Getting Started
|
||||
|
||||
Welcome to the Microvolts Emulator Docker setup! This guide will get you up and running in just a few minutes.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Before you begin, ensure you have:
|
||||
|
||||
- **Docker** (version 20.10 or later)
|
||||
- **Docker Compose** (version 2.0 or later)
|
||||
- **Linux environment** (Ubuntu/Debian recommended)
|
||||
- **Git** for cloning repositories
|
||||
- **4GB RAM** available
|
||||
|
||||
### Checking Prerequisites
|
||||
|
||||
```bash
|
||||
# Check Docker version
|
||||
docker --version
|
||||
|
||||
# Check Docker Compose version
|
||||
docker-compose --version
|
||||
|
||||
# Check available memory
|
||||
free -h
|
||||
|
||||
# Check if Git is installed
|
||||
git --version
|
||||
```
|
||||
|
||||
## Quick Installation
|
||||
|
||||
### Step 1: Clone the Repository
|
||||
|
||||
```bash
|
||||
git clone https://github.com/SoWeBegin/MicrovoltsEmulator.git
|
||||
cd MicrovoltsEmulator
|
||||
```
|
||||
|
||||
### Step 2: Configure Database
|
||||
|
||||
Run the setup script to configure your database connection:
|
||||
|
||||
```bash
|
||||
# Basic setup (recommended for most users)
|
||||
./setup.sh --db-password-env MY_DB_PASSWORD
|
||||
|
||||
# Advanced setup with custom database location
|
||||
./setup.sh \
|
||||
--db-host your-db-server.com \
|
||||
--db-port 3306 \
|
||||
--db-name microvolts \
|
||||
--db-user gameuser \
|
||||
--db-password-env MY_DB_PASSWORD
|
||||
```
|
||||
|
||||
### Step 3: Set Database Password
|
||||
|
||||
Set your database password as an environment variable:
|
||||
|
||||
```bash
|
||||
export MY_DB_PASSWORD=your_secure_password_here
|
||||
```
|
||||
|
||||
> **Important**: Choose a strong password and keep it secure. This password will be used for the MariaDB root user.
|
||||
|
||||
### Step 4: Launch Services
|
||||
|
||||
Start all services with Docker Compose:
|
||||
|
||||
```bash
|
||||
docker-compose up --build -d
|
||||
```
|
||||
|
||||
### Step 5: Verify Installation
|
||||
|
||||
Check that all services are running:
|
||||
|
||||
```bash
|
||||
docker-compose ps
|
||||
```
|
||||
|
||||
You should see output similar to:
|
||||
```
|
||||
Name Command State Ports
|
||||
-------------------------------------------------------------------------------------
|
||||
microvolts-auth /app/Output/AuthServer.elf Up 0.0.0.0:13000->13000/tcp
|
||||
microvolts-cast /app/Output/CastServer.elf Up 0.0.0.0:13006->13006/tcp
|
||||
microvolts-db docker-entrypoint.sh mariadbd Up 0.0.0.0:3305->3306/tcp
|
||||
microvolts-main /app/Output/MainServer.elf Up 0.0.0.0:13005->13005/tcp
|
||||
```
|
||||
|
||||
## First Run Experience
|
||||
|
||||
### Accessing the Services
|
||||
|
||||
Once running, your services will be available on these ports:
|
||||
|
||||
- **Database**: `localhost:3305`
|
||||
- **Auth Server**: `localhost:13000`
|
||||
- **Main Server**: `localhost:13005`
|
||||
- **Cast Server**: `localhost:13006`
|
||||
|
||||
### Viewing Logs
|
||||
|
||||
Monitor your services with:
|
||||
|
||||
```bash
|
||||
# View all logs
|
||||
docker-compose logs -f
|
||||
|
||||
# View specific service logs
|
||||
docker-compose logs -f auth-server
|
||||
docker-compose logs -f db
|
||||
```
|
||||
|
||||
### Connecting a Game Client
|
||||
|
||||
To connect your Microvolts game client:
|
||||
|
||||
1. Configure your client to connect to your server's IP address
|
||||
2. Use the default ports (13000 for auth, 13005 for main, 13006 for cast)
|
||||
3. Ensure your firewall allows connections to these ports
|
||||
|
||||
## Post-Installation Tasks
|
||||
|
||||
### 1. Verify Database Setup
|
||||
|
||||
Check that the database was properly initialized:
|
||||
|
||||
```bash
|
||||
docker-compose exec db mysql -u root -p microvolts-db -e "SHOW TABLES;"
|
||||
```
|
||||
|
||||
### 2. Test Server Connectivity
|
||||
|
||||
You can test basic connectivity:
|
||||
|
||||
```bash
|
||||
# Test database connection
|
||||
docker-compose exec db mysql -u root -p microvolts-db -e "SELECT 1;"
|
||||
|
||||
# Check server processes
|
||||
docker-compose exec auth-server ps aux
|
||||
```
|
||||
|
||||
### 3. Configure Your Client
|
||||
|
||||
Update your game client configuration to point to your server:
|
||||
|
||||
```ini
|
||||
[Server]
|
||||
AuthServer=your-server-ip:13000
|
||||
MainServer=your-server-ip:13005
|
||||
CastServer=your-server-ip:13006
|
||||
```
|
||||
|
||||
## Troubleshooting First Run
|
||||
|
||||
### Services Won't Start
|
||||
|
||||
If services fail to start:
|
||||
|
||||
```bash
|
||||
# Check for errors
|
||||
docker-compose logs
|
||||
|
||||
# Restart services
|
||||
docker-compose restart
|
||||
|
||||
# Rebuild if needed
|
||||
docker-compose up --build --no-cache
|
||||
```
|
||||
|
||||
### Database Connection Issues
|
||||
|
||||
If you can't connect to the database:
|
||||
|
||||
```bash
|
||||
# Check database status
|
||||
docker-compose ps db
|
||||
|
||||
# View database logs
|
||||
docker-compose logs db
|
||||
|
||||
# Verify password is set
|
||||
echo $MY_DB_PASSWORD
|
||||
```
|
||||
|
||||
### Port Conflicts
|
||||
|
||||
If ports are already in use:
|
||||
|
||||
```bash
|
||||
# Check what's using the ports
|
||||
netstat -tulpn | grep :3305
|
||||
netstat -tulpn | grep :13000
|
||||
|
||||
# Edit docker-compose.yml to use different ports
|
||||
nano docker-compose.yml
|
||||
```
|
||||
|
||||
## Quick Commands Reference
|
||||
|
||||
```bash
|
||||
# Start services
|
||||
docker-compose up -d
|
||||
|
||||
# Stop services
|
||||
docker-compose down
|
||||
|
||||
# View status
|
||||
docker-compose ps
|
||||
|
||||
# View logs
|
||||
docker-compose logs -f
|
||||
|
||||
# Restart specific service
|
||||
docker-compose restart auth-server
|
||||
|
||||
# Edit configuration
|
||||
./edit_config.sh
|
||||
|
||||
# Restart servers
|
||||
./restart_servers.sh all
|
||||
42
docs/index.md
Normal file
42
docs/index.md
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
# Microvolts Emulator Docker Documentation
|
||||
|
||||
Welcome to the documentation for running the Microvolts Emulator using Docker. This comprehensive setup provides an easy, containerized way to deploy and manage all emulator services.
|
||||
|
||||
## Quick Start
|
||||
|
||||
Get started in 5 minutes:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/SoWeBegin/MicrovoltsEmulator.git
|
||||
cd MicrovoltsEmulator
|
||||
./setup.sh --db-password-env MY_DB_PASSWORD
|
||||
export MY_DB_PASSWORD=your_password
|
||||
docker-compose up --build -d
|
||||
```
|
||||
|
||||
## 📚 Documentation Sections
|
||||
|
||||
### [Getting Started](getting-started.md)
|
||||
- Prerequisites and requirements
|
||||
- Quick installation guide
|
||||
- First run experience
|
||||
|
||||
### [Installation](installation.md)
|
||||
- Detailed setup instructions
|
||||
- Docker configuration
|
||||
- Database initialization
|
||||
|
||||
### [Configuration](configuration.md)
|
||||
- Database settings
|
||||
- Environment variables
|
||||
- Server configuration
|
||||
- Advanced options
|
||||
|
||||
### [Troubleshooting](troubleshooting.md)
|
||||
- Common issues
|
||||
- Debug procedures
|
||||
- Log analysis
|
||||
- Support resources
|
||||
---
|
||||
|
||||
**Ready to get started?** Head to [Getting Started](getting-started.md) to begin your Microvolts journey!
|
||||
428
docs/installation.md
Normal file
428
docs/installation.md
Normal file
|
|
@ -0,0 +1,428 @@
|
|||
# Installation Guide
|
||||
|
||||
This guide provides detailed instructions for installing and setting up the Microvolts Emulator Docker environment.
|
||||
|
||||
## System Requirements
|
||||
|
||||
### Minimum Requirements
|
||||
|
||||
- **Operating System**: Linux (Ubuntu 20.04+, Debian 10+, CentOS 8+)
|
||||
- **CPU**: 2-core processor (4+ cores recommended)
|
||||
- **RAM**: 4GB minimum (8GB recommended)
|
||||
- **Storage**: 10GB free space
|
||||
- **Network**: Stable internet connection
|
||||
|
||||
### Software Requirements
|
||||
|
||||
- **Docker**: Version 20.10 or later
|
||||
- **Docker Compose**: Version 2.0 or later
|
||||
- **Git**: Version 2.25 or later
|
||||
|
||||
## Installing Prerequisites
|
||||
|
||||
### Ubuntu/Debian
|
||||
|
||||
```bash
|
||||
# Update package list
|
||||
sudo apt update
|
||||
|
||||
# Install Docker
|
||||
sudo apt install -y docker.io docker-compose
|
||||
|
||||
# Start and enable Docker service
|
||||
sudo systemctl start docker
|
||||
sudo systemctl enable docker
|
||||
|
||||
# Add user to docker group (optional, avoids using sudo)
|
||||
sudo usermod -aG docker $USER
|
||||
|
||||
# Install Git
|
||||
sudo apt install -y git
|
||||
|
||||
# Verify installations
|
||||
docker --version
|
||||
docker-compose --version
|
||||
git --version
|
||||
```
|
||||
|
||||
### CentOS/RHEL/Fedora
|
||||
|
||||
```bash
|
||||
# Install Docker
|
||||
sudo dnf install -y docker docker-compose
|
||||
|
||||
# Start and enable Docker
|
||||
sudo systemctl start docker
|
||||
sudo systemctl enable docker
|
||||
|
||||
# Add user to docker group
|
||||
sudo usermod -aG docker $USER
|
||||
|
||||
# Install Git
|
||||
sudo dnf install -y git
|
||||
|
||||
# Verify installations
|
||||
docker --version
|
||||
docker-compose --version
|
||||
git --version
|
||||
```
|
||||
|
||||
### Arch Linux
|
||||
|
||||
```bash
|
||||
# Install Docker and Docker Compose
|
||||
sudo pacman -S docker docker-compose
|
||||
|
||||
# Start and enable Docker
|
||||
sudo systemctl start docker
|
||||
sudo systemctl enable docker
|
||||
|
||||
# Add user to docker group
|
||||
sudo usermod -aG docker $USER
|
||||
|
||||
# Install Git
|
||||
sudo pacman -S git
|
||||
|
||||
# Verify installations
|
||||
docker --version
|
||||
docker-compose --version
|
||||
git --version
|
||||
```
|
||||
|
||||
## Docker Post-Installation Steps
|
||||
|
||||
### Configure Docker Daemon (Optional)
|
||||
|
||||
Create or edit `/etc/docker/daemon.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"log-driver": "json-file",
|
||||
"log-opts": {
|
||||
"max-size": "10m",
|
||||
"max-file": "3"
|
||||
},
|
||||
"storage-driver": "overlay2"
|
||||
}
|
||||
```
|
||||
|
||||
Restart Docker:
|
||||
```bash
|
||||
sudo systemctl restart docker
|
||||
```
|
||||
|
||||
### Test Docker Installation
|
||||
|
||||
```bash
|
||||
# Test Docker
|
||||
docker run hello-world
|
||||
|
||||
# Test Docker Compose
|
||||
docker-compose --version
|
||||
```
|
||||
|
||||
## Downloading the Emulator
|
||||
|
||||
### Clone Repository
|
||||
|
||||
```bash
|
||||
# Clone the repository
|
||||
git clone https://github.com/SoWeBegin/MicrovoltsEmulator.git
|
||||
|
||||
# Navigate to directory
|
||||
cd MicrovoltsEmulator
|
||||
|
||||
# Verify contents
|
||||
ls -la
|
||||
```
|
||||
|
||||
### Repository Structure
|
||||
|
||||
After cloning, you should see:
|
||||
|
||||
```
|
||||
.
|
||||
├── Dockerfile
|
||||
├── docker-compose.yml
|
||||
├── setup.sh
|
||||
├── edit_config.sh
|
||||
├── restart_servers.sh
|
||||
├── Setup/
|
||||
│ └── config.ini
|
||||
├── microvolts-db.sql
|
||||
├── docs/
|
||||
└── [source code directories]
|
||||
```
|
||||
|
||||
## Database Configuration
|
||||
|
||||
### Using the Setup Script
|
||||
|
||||
The easiest way to configure the database is using the provided setup script:
|
||||
|
||||
```bash
|
||||
# Make scripts executable
|
||||
chmod +x setup.sh edit_config.sh restart_servers.sh
|
||||
|
||||
# Run basic setup
|
||||
./setup.sh --db-password-env MY_DB_PASSWORD
|
||||
|
||||
# Or run advanced setup
|
||||
./setup.sh \
|
||||
--db-host localhost \
|
||||
--db-port 3305 \
|
||||
--db-name microvolts-db \
|
||||
--db-user root \
|
||||
--db-password-env MY_DB_PASSWORD
|
||||
```
|
||||
|
||||
### Manual Configuration
|
||||
|
||||
If you prefer manual configuration:
|
||||
|
||||
1. Edit the configuration file:
|
||||
```bash
|
||||
nano Setup/config.ini
|
||||
```
|
||||
|
||||
2. Update the database section:
|
||||
```ini
|
||||
[Database]
|
||||
LocalIp = 127.0.0.1
|
||||
Ip = 127.0.0.1
|
||||
Port = 3305
|
||||
DatabaseName = microvolts-db
|
||||
Username = root
|
||||
PasswordEnvironmentName = MY_DB_PASSWORD
|
||||
```
|
||||
|
||||
3. Create Docker Compose override:
|
||||
```bash
|
||||
cat > docker-compose.override.yml << EOF
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
db:
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: \${MY_DB_PASSWORD}
|
||||
MYSQL_DATABASE: microvolts-db
|
||||
MYSQL_USER: root
|
||||
MYSQL_PASSWORD: \${MY_DB_PASSWORD}
|
||||
ports:
|
||||
- "3305:3306"
|
||||
|
||||
auth-server:
|
||||
environment:
|
||||
- MY_DB_PASSWORD
|
||||
|
||||
main-server:
|
||||
environment:
|
||||
- MY_DB_PASSWORD
|
||||
|
||||
cast-server:
|
||||
environment:
|
||||
- MY_DB_PASSWORD
|
||||
EOF
|
||||
```
|
||||
|
||||
## Environment Setup
|
||||
|
||||
### Setting Database Password
|
||||
|
||||
```bash
|
||||
# Set your database password
|
||||
export MY_DB_PASSWORD=your_secure_password_here
|
||||
|
||||
# Make it permanent (optional)
|
||||
echo 'export MY_DB_PASSWORD=your_secure_password_here' >> ~/.bashrc
|
||||
source ~/.bashrc
|
||||
```
|
||||
|
||||
### Verifying Environment
|
||||
|
||||
```bash
|
||||
# Check if password is set
|
||||
echo $MY_DB_PASSWORD
|
||||
|
||||
# Verify it's not empty
|
||||
if [ -z "$MY_DB_PASSWORD" ]; then
|
||||
echo "Error: MY_DB_PASSWORD is not set"
|
||||
exit 1
|
||||
fi
|
||||
```
|
||||
|
||||
## Building and Running
|
||||
|
||||
### First Build
|
||||
|
||||
```bash
|
||||
# Build and start all services
|
||||
docker-compose up --build -d
|
||||
|
||||
# This will:
|
||||
# 1. Download and build the emulator from source
|
||||
# 2. Set up MariaDB with the provided configuration
|
||||
# 3. Start all three server components
|
||||
# 4. Initialize the database schema
|
||||
```
|
||||
|
||||
### Build Process Details
|
||||
|
||||
The build process includes:
|
||||
|
||||
1. **Base Image Setup**: Ubuntu 22.04 with build tools
|
||||
2. **Dependency Installation**: GCC 13, CMake, vcpkg
|
||||
3. **Source Download**: Clone MicrovoltsEmulator from GitHub
|
||||
4. **Compilation**: Build all server components
|
||||
5. **Runtime Image**: Create optimized runtime container
|
||||
|
||||
### Expected Build Time
|
||||
|
||||
- **First build**: 15-30 minutes (downloads dependencies)
|
||||
- **Subsequent builds**: 5-10 minutes
|
||||
- **Network dependent**: Faster with better internet
|
||||
|
||||
## Verification
|
||||
|
||||
### Check Service Status
|
||||
|
||||
```bash
|
||||
# View all services
|
||||
docker-compose ps
|
||||
|
||||
# Expected output:
|
||||
# Name Command State Ports
|
||||
# -------------------------------------------------------------------------------------
|
||||
# microvolts-auth /app/Output/AuthServer.elf Up 0.0.0.0:13000->13000/tcp
|
||||
# microvolts-cast /app/Output/CastServer.elf Up 0.0.0.0:13006->13006/tcp
|
||||
# microvolts-db docker-entrypoint.sh mariadbd Up 0.0.0.0:3305->3306/tcp
|
||||
# microvolts-main /app/Output/MainServer.elf Up 0.0.0.0:13005->13005/tcp
|
||||
```
|
||||
|
||||
### Verify Database
|
||||
|
||||
```bash
|
||||
# Connect to database
|
||||
docker-compose exec db mysql -u root -p$MY_DB_PASSWORD microvolts-db -e "SHOW TABLES;"
|
||||
|
||||
# Check database size
|
||||
docker-compose exec db mysql -u root -p$MY_DB_PASSWORD -e "SELECT table_name, table_rows FROM information_schema.tables WHERE table_schema = 'microvolts-db';"
|
||||
```
|
||||
|
||||
### Test Server Connectivity
|
||||
|
||||
```bash
|
||||
# Check if servers are listening
|
||||
netstat -tulpn | grep :13000
|
||||
netstat -tulpn | grep :13005
|
||||
netstat -tulpn | grep :13006
|
||||
|
||||
# Test database connectivity from container
|
||||
docker-compose exec auth-server nc -zv db 3306
|
||||
```
|
||||
|
||||
## Post-Installation Configuration
|
||||
|
||||
### Firewall Configuration
|
||||
|
||||
Allow necessary ports through firewall:
|
||||
|
||||
```bash
|
||||
# UFW (Ubuntu/Debian)
|
||||
sudo ufw allow 3305/tcp
|
||||
sudo ufw allow 13000/tcp
|
||||
sudo ufw allow 13005/tcp
|
||||
sudo ufw allow 13006/tcp
|
||||
|
||||
# firewalld (CentOS/RHEL)
|
||||
sudo firewall-cmd --permanent --add-port=3305/tcp
|
||||
sudo firewall-cmd --permanent --add-port=13000/tcp
|
||||
sudo firewall-cmd --permanent --add-port=13005/tcp
|
||||
sudo firewall-cmd --permanent --add-port=13006/tcp
|
||||
sudo firewall-cmd --reload
|
||||
```
|
||||
|
||||
### Systemd Service (Optional)
|
||||
|
||||
Create a systemd service for automatic startup:
|
||||
|
||||
```bash
|
||||
# Create service file
|
||||
sudo tee /etc/systemd/system/microvolts-emulator.service > /dev/null << EOF
|
||||
[Unit]
|
||||
Description=Microvolts Emulator Docker Services
|
||||
Requires=docker.service
|
||||
After=docker.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
WorkingDirectory=/path/to/MicrovoltsEmulator
|
||||
ExecStart=/usr/bin/docker-compose up -d
|
||||
ExecStop=/usr/bin/docker-compose down
|
||||
ExecReload=/usr/bin/docker-compose restart
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
# Enable and start service
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable microvolts-emulator
|
||||
sudo systemctl start microvolts-emulator
|
||||
```
|
||||
|
||||
## Troubleshooting Installation
|
||||
|
||||
### Build Failures
|
||||
|
||||
```bash
|
||||
# Clear Docker cache
|
||||
docker system prune -f
|
||||
|
||||
# Rebuild without cache
|
||||
docker-compose build --no-cache
|
||||
|
||||
# Check build logs
|
||||
docker-compose build --progress plain
|
||||
```
|
||||
|
||||
### Permission Issues
|
||||
|
||||
```bash
|
||||
# Fix script permissions
|
||||
chmod +x setup.sh edit_config.sh restart_servers.sh
|
||||
|
||||
# Fix Docker permissions
|
||||
sudo usermod -aG docker $USER
|
||||
newgrp docker
|
||||
```
|
||||
|
||||
### Memory Issues
|
||||
|
||||
If builds fail due to memory:
|
||||
|
||||
```bash
|
||||
# Check available memory
|
||||
free -h
|
||||
|
||||
# Increase Docker memory limit
|
||||
# Edit /etc/docker/daemon.json and add:
|
||||
# {
|
||||
# "memory": "4g",
|
||||
# "memory-swap": "8g"
|
||||
# }
|
||||
```
|
||||
|
||||
### Network Issues
|
||||
|
||||
```bash
|
||||
# Check internet connectivity
|
||||
ping google.com
|
||||
|
||||
# Configure Docker DNS
|
||||
# Edit /etc/docker/daemon.json and add:
|
||||
# {
|
||||
# "dns": ["8.8.8.8", "8.8.4.4"]
|
||||
# }
|
||||
```
|
||||
785
docs/troubleshooting.md
Normal file
785
docs/troubleshooting.md
Normal file
|
|
@ -0,0 +1,785 @@
|
|||
# Troubleshooting Guide
|
||||
|
||||
This comprehensive troubleshooting guide helps you diagnose and resolve common issues with the Microvolts Emulator Docker setup.
|
||||
|
||||
## Quick Diagnosis
|
||||
|
||||
### System Status Check
|
||||
|
||||
```bash
|
||||
# Check all services
|
||||
docker-compose ps
|
||||
|
||||
# Check system resources
|
||||
free -h && df -h
|
||||
|
||||
# Check Docker status
|
||||
docker system info
|
||||
|
||||
# Quick log check
|
||||
docker-compose logs --tail=20
|
||||
```
|
||||
|
||||
### Common Symptoms and Solutions
|
||||
|
||||
| Symptom | Possible Cause | Quick Fix |
|
||||
|---------|---------------|-----------|
|
||||
| Services won't start | Port conflict | `netstat -tulpn \| grep :13000` |
|
||||
| Database connection failed | Wrong password | `echo $MY_DB_PASSWORD` |
|
||||
| High CPU usage | Resource limits | `docker stats` |
|
||||
| Out of disk space | Log accumulation | `docker system prune` |
|
||||
| Slow performance | Memory issues | `free -h` |
|
||||
|
||||
## Service Startup Issues
|
||||
|
||||
### Services Fail to Start
|
||||
|
||||
**Symptoms:**
|
||||
- `docker-compose ps` shows services as "Exit" or "Restarting"
|
||||
- Error messages in logs
|
||||
|
||||
**Diagnosis:**
|
||||
```bash
|
||||
# Check service logs
|
||||
docker-compose logs auth-server
|
||||
|
||||
# Check system resources
|
||||
docker system df
|
||||
free -h
|
||||
|
||||
# Validate configuration
|
||||
docker-compose config
|
||||
```
|
||||
|
||||
**Common Solutions:**
|
||||
|
||||
1. **Port Conflicts:**
|
||||
```bash
|
||||
# Find conflicting processes
|
||||
netstat -tulpn | grep -E "(13000|13005|13006|3305)"
|
||||
|
||||
# Change ports in docker-compose.yml
|
||||
nano docker-compose.yml
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
2. **Resource Constraints:**
|
||||
```bash
|
||||
# Check available memory
|
||||
free -h
|
||||
|
||||
# Increase Docker memory limit
|
||||
# Edit /etc/docker/daemon.json
|
||||
{
|
||||
"memory": "4g"
|
||||
}
|
||||
sudo systemctl restart docker
|
||||
```
|
||||
|
||||
3. **Configuration Errors:**
|
||||
```bash
|
||||
# Validate syntax
|
||||
docker-compose config
|
||||
|
||||
# Check environment variables
|
||||
echo $MY_DB_PASSWORD
|
||||
|
||||
# Verify config.ini
|
||||
cat Setup/config.ini
|
||||
```
|
||||
|
||||
### Database Won't Start
|
||||
|
||||
**Symptoms:**
|
||||
- Database service shows "Exit 1"
|
||||
- Connection refused errors
|
||||
|
||||
**Diagnosis:**
|
||||
```bash
|
||||
# Check database logs
|
||||
docker-compose logs db
|
||||
|
||||
# Check data directory permissions
|
||||
ls -la db_data/
|
||||
|
||||
# Test database connectivity
|
||||
docker-compose exec db mysqladmin ping
|
||||
```
|
||||
|
||||
**Solutions:**
|
||||
|
||||
1. **Data Directory Issues:**
|
||||
```bash
|
||||
# Fix permissions
|
||||
sudo chown -R 999:999 db_data/
|
||||
|
||||
# Reset database
|
||||
docker-compose down -v
|
||||
docker-compose up -d db
|
||||
```
|
||||
|
||||
2. **Password Issues:**
|
||||
```bash
|
||||
# Verify password is set
|
||||
echo $MY_DB_PASSWORD
|
||||
|
||||
# Reset password
|
||||
unset MY_DB_PASSWORD
|
||||
export MY_DB_PASSWORD=new_password
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
3. **Port Conflicts:**
|
||||
```bash
|
||||
# Check if port 3305 is in use
|
||||
netstat -tulpn | grep :3305
|
||||
|
||||
# Change port in docker-compose.yml
|
||||
nano docker-compose.yml
|
||||
```
|
||||
|
||||
## Connection Issues
|
||||
|
||||
### Database Connection Failed
|
||||
|
||||
**Symptoms:**
|
||||
- Services log "Can't connect to MySQL server"
|
||||
- Authentication errors
|
||||
|
||||
**Diagnosis:**
|
||||
```bash
|
||||
# Test database connectivity
|
||||
docker-compose exec auth-server mysql -h db -u root -p$MY_DB_PASSWORD -e "SELECT 1;"
|
||||
|
||||
# Check database service status
|
||||
docker-compose ps db
|
||||
|
||||
# Verify network connectivity
|
||||
docker-compose exec auth-server ping -c 3 db
|
||||
```
|
||||
|
||||
**Solutions:**
|
||||
|
||||
1. **Network Issues:**
|
||||
```bash
|
||||
# Check Docker network
|
||||
docker network ls
|
||||
docker network inspect microvolts-emulator_microvolts-network
|
||||
|
||||
# Restart network
|
||||
docker-compose down
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
2. **Password Mismatch:**
|
||||
```bash
|
||||
# Verify password
|
||||
echo $MY_DB_PASSWORD
|
||||
|
||||
# Update password in config
|
||||
./setup.sh --db-password-env MY_DB_PASSWORD
|
||||
```
|
||||
|
||||
3. **Database Not Ready:**
|
||||
```bash
|
||||
# Wait for database to initialize
|
||||
docker-compose logs db | tail -20
|
||||
|
||||
# Check database health
|
||||
docker-compose exec db mysqladmin ping
|
||||
```
|
||||
|
||||
### Client Connection Issues
|
||||
|
||||
**Symptoms:**
|
||||
- Game client can't connect to server
|
||||
- "Connection refused" errors
|
||||
|
||||
**Diagnosis:**
|
||||
```bash
|
||||
# Check service ports
|
||||
netstat -tulpn | grep -E "(13000|13005|13006)"
|
||||
|
||||
# Test external connectivity
|
||||
telnet localhost 13000
|
||||
|
||||
# Check firewall
|
||||
sudo ufw status
|
||||
```
|
||||
|
||||
**Solutions:**
|
||||
|
||||
1. **Firewall Blocking:**
|
||||
```bash
|
||||
# Allow emulator ports
|
||||
sudo ufw allow 13000/tcp
|
||||
sudo ufw allow 13005/tcp
|
||||
sudo ufw allow 13006/tcp
|
||||
|
||||
# Or disable firewall temporarily
|
||||
sudo ufw disable
|
||||
```
|
||||
|
||||
2. **Port Binding Issues:**
|
||||
```bash
|
||||
# Check Docker port mapping
|
||||
docker-compose ps
|
||||
|
||||
# Verify configuration
|
||||
cat Setup/config.ini
|
||||
```
|
||||
|
||||
3. **Network Configuration:**
|
||||
```bash
|
||||
# Check if services are bound to correct interface
|
||||
docker-compose exec auth-server netstat -tulpn
|
||||
|
||||
# Update IP in config
|
||||
./edit_config.sh
|
||||
```
|
||||
|
||||
## Performance Issues
|
||||
|
||||
### High CPU Usage
|
||||
|
||||
**Symptoms:**
|
||||
- Services consuming excessive CPU
|
||||
- Slow response times
|
||||
|
||||
**Diagnosis:**
|
||||
```bash
|
||||
# Monitor resource usage
|
||||
docker stats
|
||||
|
||||
# Check system load
|
||||
top
|
||||
|
||||
# Analyze service logs
|
||||
docker-compose logs --tail=50 | grep -i error
|
||||
```
|
||||
|
||||
**Solutions:**
|
||||
|
||||
1. **Resource Limits:**
|
||||
```bash
|
||||
# Add resource limits to docker-compose.yml
|
||||
services:
|
||||
main-server:
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '2.0'
|
||||
memory: 2G
|
||||
```
|
||||
|
||||
2. **Database Optimization:**
|
||||
```bash
|
||||
# Optimize database tables
|
||||
docker-compose exec db mysql -u root -p$MY_DB_PASSWORD microvolts-db -e "OPTIMIZE TABLE players, items;"
|
||||
|
||||
# Check slow queries
|
||||
docker-compose exec db mysql -u root -p$MY_DB_PASSWORD -e "SHOW PROCESSLIST;"
|
||||
```
|
||||
|
||||
3. **Service Scaling:**
|
||||
```bash
|
||||
# Scale services
|
||||
docker-compose up -d --scale main-server=2
|
||||
```
|
||||
|
||||
### High Memory Usage
|
||||
|
||||
**Symptoms:**
|
||||
- Services consuming excessive memory
|
||||
- Out of memory errors
|
||||
|
||||
**Diagnosis:**
|
||||
```bash
|
||||
# Check memory usage
|
||||
docker stats --format "table {{.Container}}\t{{.CPUPerc}}\t{{.MemUsage}}"
|
||||
|
||||
# Check system memory
|
||||
free -h
|
||||
|
||||
# Check Docker memory limits
|
||||
docker system info | grep -i memory
|
||||
```
|
||||
|
||||
**Solutions:**
|
||||
|
||||
1. **Memory Limits:**
|
||||
```yaml
|
||||
services:
|
||||
main-server:
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 2G
|
||||
reservations:
|
||||
memory: 1G
|
||||
```
|
||||
|
||||
2. **Database Tuning:**
|
||||
```bash
|
||||
# Adjust MariaDB memory settings
|
||||
docker-compose exec db mysql -u root -p$MY_DB_PASSWORD -e "SET GLOBAL innodb_buffer_pool_size = 536870912;"
|
||||
```
|
||||
|
||||
3. **Memory Cleanup:**
|
||||
```bash
|
||||
# Clear Docker cache
|
||||
docker system prune -f
|
||||
|
||||
# Restart services
|
||||
docker-compose restart
|
||||
```
|
||||
|
||||
### Slow Database Queries
|
||||
|
||||
**Symptoms:**
|
||||
- Slow response times
|
||||
- Database timeouts
|
||||
|
||||
**Diagnosis:**
|
||||
```bash
|
||||
# Check running queries
|
||||
docker-compose exec db mysql -u root -p$MY_DB_PASSWORD -e "SHOW PROCESSLIST;"
|
||||
|
||||
# Analyze slow queries
|
||||
docker-compose exec db mysql -u root -p$MY_DB_PASSWORD -e "SHOW ENGINE INNODB STATUS\G" | grep -A 20 "TRANSACTIONS"
|
||||
|
||||
# Check table indexes
|
||||
docker-compose exec db mysql -u root -p$MY_DB_PASSWORD microvolts-db -e "SHOW INDEX FROM players;"
|
||||
```
|
||||
|
||||
**Solutions:**
|
||||
|
||||
1. **Add Indexes:**
|
||||
```sql
|
||||
-- Connect to database
|
||||
docker-compose exec db mysql -u root -p$MY_DB_PASSWORD microvolts-db
|
||||
|
||||
-- Add performance indexes
|
||||
ALTER TABLE players ADD INDEX idx_name (name);
|
||||
ALTER TABLE items ADD INDEX idx_player_id (player_id);
|
||||
```
|
||||
|
||||
2. **Query Optimization:**
|
||||
```sql
|
||||
-- Analyze query performance
|
||||
EXPLAIN SELECT * FROM players WHERE name = 'testuser';
|
||||
|
||||
-- Optimize table
|
||||
OPTIMIZE TABLE players;
|
||||
```
|
||||
|
||||
3. **Database Configuration:**
|
||||
```yaml
|
||||
services:
|
||||
db:
|
||||
command:
|
||||
- --innodb-buffer-pool-size=1G
|
||||
- --max-connections=100
|
||||
- --query-cache-size=256M
|
||||
```
|
||||
|
||||
## Build Issues
|
||||
|
||||
### Docker Build Failures
|
||||
|
||||
**Symptoms:**
|
||||
- Build process fails
|
||||
- Dependency installation errors
|
||||
|
||||
**Diagnosis:**
|
||||
```bash
|
||||
# Check build logs
|
||||
docker-compose build --progress plain
|
||||
|
||||
# Check available disk space
|
||||
df -h
|
||||
|
||||
# Verify internet connectivity
|
||||
ping google.com
|
||||
```
|
||||
|
||||
**Solutions:**
|
||||
|
||||
1. **Clean Build:**
|
||||
```bash
|
||||
# Clear build cache
|
||||
docker system prune -a
|
||||
|
||||
# Rebuild without cache
|
||||
docker-compose build --no-cache
|
||||
```
|
||||
|
||||
2. **Network Issues:**
|
||||
```bash
|
||||
# Configure DNS
|
||||
sudo tee /etc/docker/daemon.json > /dev/null <<EOF
|
||||
{
|
||||
"dns": ["8.8.8.8", "8.8.4.4"]
|
||||
}
|
||||
EOF
|
||||
sudo systemctl restart docker
|
||||
```
|
||||
|
||||
3. **Resource Issues:**
|
||||
```bash
|
||||
# Increase Docker resources
|
||||
# Edit Docker Desktop settings or daemon.json
|
||||
{
|
||||
"memory": "4g",
|
||||
"cpus": 2
|
||||
}
|
||||
```
|
||||
|
||||
### Compilation Errors
|
||||
|
||||
**Symptoms:**
|
||||
- C++ compilation fails
|
||||
- Missing dependencies
|
||||
|
||||
**Diagnosis:**
|
||||
```bash
|
||||
# Check compiler version
|
||||
docker-compose exec builder gcc --version
|
||||
|
||||
# Check available libraries
|
||||
docker-compose exec builder ldconfig -p | grep -i boost
|
||||
|
||||
# View compilation logs
|
||||
docker-compose logs builder
|
||||
```
|
||||
|
||||
**Solutions:**
|
||||
|
||||
1. **Update Base Image:**
|
||||
```dockerfile
|
||||
FROM ubuntu:22.04
|
||||
```
|
||||
|
||||
2. **Install Missing Dependencies:**
|
||||
```bash
|
||||
# Update package lists
|
||||
docker-compose exec builder apt update
|
||||
|
||||
# Install missing packages
|
||||
docker-compose exec builder apt install -y libssl-dev
|
||||
```
|
||||
|
||||
3. **Clear Build Cache:**
|
||||
```bash
|
||||
docker-compose down
|
||||
docker rmi $(docker images -q)
|
||||
docker-compose up --build
|
||||
```
|
||||
|
||||
## Network Issues
|
||||
|
||||
### Service Communication Problems
|
||||
|
||||
**Symptoms:**
|
||||
- Services can't communicate with each other
|
||||
- IPC connection failures
|
||||
|
||||
**Diagnosis:**
|
||||
```bash
|
||||
# Check Docker network
|
||||
docker network inspect microvolts-emulator_microvolts-network
|
||||
|
||||
# Test inter-service connectivity
|
||||
docker-compose exec auth-server ping -c 3 main-server
|
||||
|
||||
# Check service discovery
|
||||
docker-compose exec auth-server nslookup db
|
||||
```
|
||||
|
||||
**Solutions:**
|
||||
|
||||
1. **Network Recreation:**
|
||||
```bash
|
||||
# Recreate network
|
||||
docker-compose down
|
||||
docker network rm microvolts-emulator_microvolts-network
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
2. **DNS Issues:**
|
||||
```bash
|
||||
# Check DNS resolution
|
||||
docker-compose exec auth-server cat /etc/resolv.conf
|
||||
|
||||
# Update DNS settings
|
||||
sudo tee /etc/docker/daemon.json > /dev/null <<EOF
|
||||
{
|
||||
"dns": ["8.8.8.8"]
|
||||
}
|
||||
EOF
|
||||
```
|
||||
|
||||
3. **Port Conflicts:**
|
||||
```bash
|
||||
# Check IPC ports
|
||||
netstat -tulpn | grep -E "(14005|14006)"
|
||||
```
|
||||
|
||||
### External Connectivity Issues
|
||||
|
||||
**Symptoms:**
|
||||
- Can't connect from external machines
|
||||
- Firewall blocking connections
|
||||
|
||||
**Diagnosis:**
|
||||
```bash
|
||||
# Check external IP
|
||||
curl ifconfig.me
|
||||
|
||||
# Test external connectivity
|
||||
telnet your-server-ip 13000
|
||||
|
||||
# Check routing
|
||||
traceroute your-server-ip
|
||||
```
|
||||
|
||||
**Solutions:**
|
||||
|
||||
1. **Port Forwarding:**
|
||||
```bash
|
||||
# Router port forwarding
|
||||
# Forward external ports to server IP
|
||||
# 13000 → server-ip:13000
|
||||
# 13005 → server-ip:13005
|
||||
# 13006 → server-ip:13006
|
||||
```
|
||||
|
||||
2. **Firewall Configuration:**
|
||||
```bash
|
||||
# Allow ports in firewall
|
||||
sudo ufw allow from any to any port 13000 proto tcp
|
||||
sudo ufw allow from any to any port 13005 proto tcp
|
||||
sudo ufw allow from any to any port 13006 proto tcp
|
||||
```
|
||||
|
||||
3. **Network Interface:**
|
||||
```bash
|
||||
# Bind to all interfaces
|
||||
nano docker-compose.yml
|
||||
# Change "127.0.0.1:13000:13000" to "0.0.0.0:13000:13000"
|
||||
```
|
||||
|
||||
## Data Issues
|
||||
|
||||
### Database Corruption
|
||||
|
||||
**Symptoms:**
|
||||
- Database errors
|
||||
- Table corruption messages
|
||||
|
||||
**Diagnosis:**
|
||||
```bash
|
||||
# Check database logs
|
||||
docker-compose logs db
|
||||
|
||||
# Test table integrity
|
||||
docker-compose exec db mysql -u root -p$MY_DB_PASSWORD microvolts-db -e "CHECK TABLE players;"
|
||||
|
||||
# Check error logs
|
||||
docker-compose exec db tail -50 /var/log/mysql/error.log
|
||||
```
|
||||
|
||||
**Solutions:**
|
||||
|
||||
1. **Table Repair:**
|
||||
```bash
|
||||
# Repair corrupted tables
|
||||
docker-compose exec db mysql -u root -p$MY_DB_PASSWORD microvolts-db -e "REPAIR TABLE players;"
|
||||
```
|
||||
|
||||
2. **Database Recovery:**
|
||||
```bash
|
||||
# Stop services
|
||||
docker-compose down
|
||||
|
||||
# Remove corrupted data
|
||||
sudo rm -rf db_data/
|
||||
|
||||
# Restore from backup
|
||||
docker-compose up -d db
|
||||
gunzip < backup.sql.gz | docker-compose exec -T db mysql -u root -p$MY_DB_PASSWORD microvolts-db
|
||||
```
|
||||
|
||||
3. **Fresh Installation:**
|
||||
```bash
|
||||
# Complete reset
|
||||
docker-compose down -v
|
||||
docker-compose up --build -d
|
||||
```
|
||||
|
||||
### Configuration Errors
|
||||
|
||||
**Symptoms:**
|
||||
- Services fail to start with config errors
|
||||
- Invalid configuration messages
|
||||
|
||||
**Diagnosis:**
|
||||
```bash
|
||||
# Validate configuration
|
||||
docker-compose config
|
||||
|
||||
# Check config.ini syntax
|
||||
cat Setup/config.ini
|
||||
|
||||
# Test configuration parsing
|
||||
python3 -c "
|
||||
import configparser
|
||||
config = configparser.ConfigParser()
|
||||
config.read('Setup/config.ini')
|
||||
print('Configuration valid')
|
||||
"
|
||||
```
|
||||
|
||||
**Solutions:**
|
||||
|
||||
1. **Fix Configuration:**
|
||||
```bash
|
||||
# Edit configuration
|
||||
./edit_config.sh
|
||||
|
||||
# Or manual edit
|
||||
nano Setup/config.ini
|
||||
```
|
||||
|
||||
2. **Reset to Defaults:**
|
||||
```bash
|
||||
# Backup current config
|
||||
cp Setup/config.ini Setup/config.ini.backup
|
||||
|
||||
# Reset configuration
|
||||
./setup.sh --db-password-env MY_DB_PASSWORD
|
||||
```
|
||||
|
||||
3. **Validate Changes:**
|
||||
```bash
|
||||
# Test configuration
|
||||
docker-compose config
|
||||
docker-compose up -d --scale auth-server=0
|
||||
docker-compose up -d --scale auth-server=1
|
||||
```
|
||||
|
||||
## Advanced Troubleshooting
|
||||
|
||||
### Debug Mode
|
||||
|
||||
```bash
|
||||
# Enable debug logging
|
||||
export DOCKER_DEBUG=1
|
||||
|
||||
# Run with verbose output
|
||||
docker-compose up --verbose
|
||||
|
||||
# Debug specific service
|
||||
docker-compose exec auth-server /bin/bash
|
||||
```
|
||||
|
||||
### System Diagnostics
|
||||
|
||||
```bash
|
||||
# System information
|
||||
uname -a
|
||||
lsb_release -a
|
||||
|
||||
# Docker information
|
||||
docker version
|
||||
docker info
|
||||
|
||||
# Hardware information
|
||||
lscpu
|
||||
lsmem
|
||||
```
|
||||
|
||||
### Log Analysis
|
||||
|
||||
```bash
|
||||
# Search for patterns
|
||||
docker-compose logs | grep -i "error\|warn\|fail"
|
||||
|
||||
# Count occurrences
|
||||
docker-compose logs | grep -c ERROR
|
||||
|
||||
# Time-based analysis
|
||||
docker-compose logs --since "1 hour ago"
|
||||
|
||||
# Export for external analysis
|
||||
docker-compose logs > full_logs.txt
|
||||
```
|
||||
|
||||
### Performance Profiling
|
||||
|
||||
```bash
|
||||
# Profile container performance
|
||||
docker stats --format "table {{.Container}}\t{{.CPUPerc}}\t{{.MemPerc}}\t{{.NetIO}}\t{{.BlockIO}}"
|
||||
|
||||
# Database profiling
|
||||
docker-compose exec db mysql -u root -p$MY_DB_PASSWORD -e "SHOW ENGINE INNODB STATUS\G"
|
||||
|
||||
# Network profiling
|
||||
docker-compose exec auth-server netstat -i
|
||||
```
|
||||
|
||||
## Emergency Procedures
|
||||
|
||||
### Complete System Reset
|
||||
|
||||
```bash
|
||||
# Emergency reset (WARNING: destroys all data)
|
||||
docker-compose down -v
|
||||
docker system prune -a
|
||||
docker volume prune -f
|
||||
|
||||
# Fresh installation
|
||||
git clone https://github.com/SoWeBegin/MicrovoltsEmulator.git
|
||||
cd MicrovoltsEmulator
|
||||
./setup.sh --db-password-env MY_DB_PASSWORD
|
||||
export MY_DB_PASSWORD=new_password
|
||||
docker-compose up --build -d
|
||||
```
|
||||
|
||||
### Data Recovery
|
||||
|
||||
```bash
|
||||
# Find latest backup
|
||||
ls -la backups/
|
||||
|
||||
# Restore database
|
||||
LATEST_BACKUP=$(ls -t backups/db_backup_*.sql.gz | head -1)
|
||||
gunzip < "$LATEST_BACKUP" | docker-compose exec -T db mysql -u root -p$MY_DB_PASSWORD microvolts-db
|
||||
|
||||
# Restore configuration
|
||||
tar -xzf backups/config_backup_*.tar.gz
|
||||
```
|
||||
|
||||
## Prevention
|
||||
|
||||
### Regular Maintenance
|
||||
|
||||
```bash
|
||||
# Weekly maintenance script
|
||||
#!/bin/bash
|
||||
echo "=== Weekly Maintenance ==="
|
||||
|
||||
# Check service status
|
||||
docker-compose ps
|
||||
|
||||
# Monitor disk usage
|
||||
df -h
|
||||
|
||||
# Clean old logs
|
||||
docker-compose logs --since 7 days | wc -l
|
||||
|
||||
# Database optimization
|
||||
docker-compose exec db mysql -u root -p$MY_DB_PASSWORD microvolts-db -e "OPTIMIZE TABLE players;"
|
||||
|
||||
echo "Maintenance completed"
|
||||
```
|
||||
35
edit_config.sh
Normal file
35
edit_config.sh
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Script to edit Microvolts Emulator configuration
|
||||
# Usage: ./edit_config.sh [editor]
|
||||
# If no editor specified, defaults to nano
|
||||
|
||||
CONFIG_FILE="./Setup/config.ini"
|
||||
|
||||
if [ ! -f "$CONFIG_FILE" ]; then
|
||||
echo "Error: Configuration file $CONFIG_FILE not found!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Choose editor
|
||||
if [ $# -eq 0 ]; then
|
||||
EDITOR="nano"
|
||||
else
|
||||
EDITOR="$1"
|
||||
fi
|
||||
|
||||
echo "Opening $CONFIG_FILE with $EDITOR..."
|
||||
echo "After editing, the servers will be restarted automatically."
|
||||
|
||||
# Edit the file
|
||||
$EDITOR "$CONFIG_FILE"
|
||||
|
||||
# Check if file was modified
|
||||
if [ "$CONFIG_FILE" -nt "$CONFIG_FILE" ]; then
|
||||
echo "Configuration updated. Restarting servers..."
|
||||
docker-compose down
|
||||
docker-compose up -d
|
||||
echo "Servers restarted successfully!"
|
||||
else
|
||||
echo "No changes detected."
|
||||
fi
|
||||
56
restart_servers.sh
Normal file
56
restart_servers.sh
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Script to restart Microvolts Emulator servers
|
||||
# Usage: ./restart_servers.sh [server_name]
|
||||
# Available servers: auth, main, cast, db, all
|
||||
|
||||
SERVICES=("auth-server" "main-server" "cast-server" "db")
|
||||
|
||||
show_usage() {
|
||||
echo "Usage: $0 [server_name]"
|
||||
echo "Available options:"
|
||||
echo " auth - Restart Auth Server"
|
||||
echo " main - Restart Main Server"
|
||||
echo " cast - Restart Cast Server"
|
||||
echo " db - Restart Database"
|
||||
echo " all - Restart all servers"
|
||||
echo ""
|
||||
echo "If no argument provided, shows this help."
|
||||
}
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
show_usage
|
||||
exit 0
|
||||
fi
|
||||
|
||||
SERVER="$1"
|
||||
|
||||
case "$SERVER" in
|
||||
auth)
|
||||
echo "Restarting Auth Server..."
|
||||
docker-compose restart auth-server
|
||||
;;
|
||||
main)
|
||||
echo "Restarting Main Server..."
|
||||
docker-compose restart main-server
|
||||
;;
|
||||
cast)
|
||||
echo "Restarting Cast Server..."
|
||||
docker-compose restart cast-server
|
||||
;;
|
||||
db)
|
||||
echo "Restarting Database..."
|
||||
docker-compose restart db
|
||||
;;
|
||||
all)
|
||||
echo "Restarting all servers..."
|
||||
docker-compose restart
|
||||
;;
|
||||
*)
|
||||
echo "Error: Unknown server '$SERVER'"
|
||||
show_usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "Restart completed!"
|
||||
115
setup.sh
Normal file
115
setup.sh
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Setup script for Microvolts Emulator Docker
|
||||
# Configures database settings and creates docker-compose override
|
||||
|
||||
CONFIG_FILE="./Setup/config.ini"
|
||||
OVERRIDE_FILE="docker-compose.override.yml"
|
||||
|
||||
# Default values
|
||||
DB_HOST="127.0.0.1"
|
||||
DB_PORT="3305"
|
||||
DB_NAME="microvolts-db"
|
||||
DB_USER="root"
|
||||
DB_PASSWORD_ENV="MV_DB_PASSWORD"
|
||||
|
||||
# Parse arguments
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
--db-host)
|
||||
DB_HOST="$2"
|
||||
shift 2
|
||||
;;
|
||||
--db-port)
|
||||
DB_PORT="$2"
|
||||
shift 2
|
||||
;;
|
||||
--db-name)
|
||||
DB_NAME="$2"
|
||||
shift 2
|
||||
;;
|
||||
--db-user)
|
||||
DB_USER="$2"
|
||||
shift 2
|
||||
;;
|
||||
--db-password-env)
|
||||
DB_PASSWORD_ENV="$2"
|
||||
shift 2
|
||||
;;
|
||||
--help)
|
||||
echo "Usage: $0 [options]"
|
||||
echo "Options:"
|
||||
echo " --db-host HOST Database host IP (default: 127.0.0.1)"
|
||||
echo " --db-port PORT Database port (default: 3305)"
|
||||
echo " --db-name NAME Database name (default: microvolts-db)"
|
||||
echo " --db-user USER Database user (default: root)"
|
||||
echo " --db-password-env ENV Environment variable name for password (default: MV_DB_PASSWORD)"
|
||||
echo " --help Show this help"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "Unknown option: $1"
|
||||
echo "Use --help for usage"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Check if config file exists
|
||||
if [ ! -f "$CONFIG_FILE" ]; then
|
||||
echo "Error: Configuration file $CONFIG_FILE not found!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Updating configuration with:"
|
||||
echo " DB Host: $DB_HOST"
|
||||
echo " DB Port: $DB_PORT"
|
||||
echo " DB Name: $DB_NAME"
|
||||
echo " DB User: $DB_USER"
|
||||
echo " DB Password Env: $DB_PASSWORD_ENV"
|
||||
echo ""
|
||||
|
||||
# Update config.ini
|
||||
sed -i "s|^Ip = .*|Ip = $DB_HOST|" "$CONFIG_FILE"
|
||||
sed -i "s|^Port = .*|Port = $DB_PORT|" "$CONFIG_FILE"
|
||||
sed -i "s|^DatabaseName = .*|DatabaseName = $DB_NAME|" "$CONFIG_FILE"
|
||||
sed -i "s|^Username = .*|Username = $DB_USER|" "$CONFIG_FILE"
|
||||
sed -i "s|^PasswordEnvironmentName = .*|PasswordEnvironmentName = $DB_PASSWORD_ENV|" "$CONFIG_FILE"
|
||||
|
||||
echo "Configuration updated successfully!"
|
||||
|
||||
# Create docker-compose.override.yml
|
||||
cat > "$OVERRIDE_FILE" << EOF
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
db:
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: \${$DB_PASSWORD_ENV}
|
||||
MYSQL_DATABASE: $DB_NAME
|
||||
MYSQL_USER: $DB_USER
|
||||
MYSQL_PASSWORD: \${$DB_PASSWORD_ENV}
|
||||
ports:
|
||||
- "$DB_PORT:3306"
|
||||
|
||||
auth-server:
|
||||
environment:
|
||||
- $DB_PASSWORD_ENV
|
||||
|
||||
main-server:
|
||||
environment:
|
||||
- $DB_PASSWORD_ENV
|
||||
|
||||
cast-server:
|
||||
environment:
|
||||
- $DB_PASSWORD_ENV
|
||||
EOF
|
||||
|
||||
echo "Docker Compose override file created: $OVERRIDE_FILE"
|
||||
echo ""
|
||||
echo "Next steps:"
|
||||
echo "1. Set your database password environment variable:"
|
||||
echo " export $DB_PASSWORD_ENV=your_actual_password"
|
||||
echo "2. Run: docker-compose up --build -d"
|
||||
echo ""
|
||||
echo "Note: Make sure the password environment variable is set before running docker-compose."
|
||||
Loading…
Add table
Add a link
Reference in a new issue