This guide will help you set up TravianZ using Docker and Docker Compose for easy deployment.
- Docker Engine 20.10 or higher
- Docker Compose 1.29 or higher
- At least 2GB of free RAM
- At least 5GB of free disk space
git clone https://github.com/Shadowss/TravianZ.git
cd TravianZCopy the example environment file and customize it if needed:
cp .env.example .envEdit .env file to set your database credentials:
MARIADB_ROOT_PASSWORD=yourStrongRootPassword
MARIADB_DATABASE=travian
MARIADB_USER=travianz
MARIADB_PASSWORD=yourStrongPassworddocker compose up -dThis command will:
- Build the TravianZ web application container
- Start a MariaDB (latest) database container
- Start a phpMyAdmin container for database management
- Set up a network for all containers to communicate
Once the containers are running, open your browser and navigate to:
http://localhost:8080/install
During the installation wizard, use these database settings:
- SQL Hostname:
db(this is the Docker container name) - Port:
3306 - Username:
travianz(or the value from your.envfile) - Password:
travianzpass(or the value from your.envfile) - DB name:
travian(or the value from your.envfile) - Prefix:
s1_(or customize as needed) - Type:
MYSQLi
Complete the rest of the installation wizard with your preferred server settings.
After starting the containers, the following services will be available:
- TravianZ Web Application: http://localhost:8080
- phpMyAdmin: http://localhost:8081
- MariaDB Database: localhost:3306 (for external connections)
docker compose ps# All containers
docker compose logs
# Specific container
docker compose logs web
docker compose logs db
docker compose logs phpmyadmin
# Follow logs in real-time
docker compose logs -f webdocker compose downWARNING: This will delete all database data!
docker compose down -vdocker compose restartIf you make changes to the Dockerfile or application code:
docker compose down
docker compose up -d --builddocker exec -it travianz-web bashdocker exec -it travianz-db mysql -u root -pEnter the root password from your .env file.
If you get permission errors during installation:
docker exec -it travianz-web chown -R www-data:www-data /var/www/html
docker exec -it travianz-web chmod -R 777 /var/www/html/var- Make sure the database container is running:
docker compose ps
2. Check database logs:
```bash
docker compose logs db
- Verify the hostname is set to
db(notlocalhostor127.0.0.1)
If you need to start the installation over:
- Stop containers:
docker compose down -v
2. Remove the installed flag:
```bash
rm -f var/installed
rm -f GameEngine/config.php
- Start containers again:
docker compose up -d
4. Access the installation wizard again at http://localhost:8080/install
### Port Already in Use
If port 8080 or 8081 is already in use, edit `docker compose` configuration (`docker-compose.yml`) and change the ports:
```yaml
services:
web:
ports:
- "9080:80" # Change 8080 to any available port
phpmyadmin:
ports:
- "9081:80" # Change 8081 to any available port
docker exec travianz-db mariadb-dump -u root -p travian > backup_$(date +%Y%m%d).sqldocker exec -i travianz-db mariadb -u root -p travian < backup_20231125.sqltar -czf travianz_backup_$(date +%Y%m%d).tar.gz \
--exclude='./var/db' \
--exclude='./.git' \
.For production environments, consider the following:
-
Use Strong Passwords: Change all default passwords in
.env -
Use SSL/TLS: Set up a reverse proxy (nginx/traefik) with Let's Encrypt
-
Limit Database Access: Remove the database port exposure in the
docker composeconfiguration (docker-compose.yml) -
Regular Backups: Set up automated backup scripts
-
Resource Limits: Add resource constraints to containers:
services:
web:
deploy:
resources:
limits:
cpus: '1.0'
memory: 1G- Monitoring: Consider adding monitoring tools like Prometheus and Grafana
Edit docker-compose.yml to add MariaDB configuration:
services:
db:
command: >
--sql_mode=""
--max_connections=200
--innodb_buffer_pool_size=512M
--query_cache_size=32M
--query_cache_limit=2MCreate a custom PHP configuration file php-custom.ini:
memory_limit = 256M
upload_max_filesize = 20M
post_max_size = 20M
max_execution_time = 300Then mount it in docker-compose.yml:
services:
web:
volumes:
- ./php-custom.ini:/usr/local/etc/php/conf.d/custom.iniTo update TravianZ to the latest version:
git pull origin main
docker compose down
docker compose up -d --buildFor issues and questions:
- GitHub Issues: https://github.com/Shadowss/TravianZ/issues
- Gitter Chat: https://gitter.im/TravianZ-V8/Lobby
TravianZ Project - See LICENSE file for details