Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Build eBot-CSGO-Web

on:
push:
branches: [ master, main, develop ]
pull_request:
branches: [ master, main, develop ]
workflow_dispatch:

permissions:
contents: read
packages: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP 5.6
uses: shivammathur/setup-php@v2
with:
php-version: '5.6'
extensions: mysqli, pdo_mysql

- name: Check PHP syntax
run: find apps lib -name "*.php" -not -path "lib/vendor/*" -print0 | xargs -0 -n1 php -l

- name: Verify key files exist
run: |
test -f symfony
test -f config/databases.yml
test -f config/app.yml
echo "All key files present"

docker-build:
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push'
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=ref,event=branch
type=sha,prefix={{branch}}-
type=raw,value=latest,enable={{is_default_branch}}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM php:5.6-fpm

# Use archived Debian Stretch repos (required for PHP 5.6 era dependencies)
RUN echo "deb http://archive.debian.org/debian stretch main" > /etc/apt/sources.list

RUN apt-get update && apt-get install -y --force-yes \
git \
default-mysql-client \
&& rm -rf /var/lib/apt/lists/*

# Install PHP extensions
RUN docker-php-ext-install mysqli pdo pdo_mysql && docker-php-ext-enable pdo_mysql

# Set timezone
RUN echo "date.timezone = Europe/Paris" >> /usr/local/etc/php/conf.d/timezone.ini

WORKDIR /app

# Bake source into /app/source at build time — entrypoint copies to volume target at runtime
COPY . /app/source/

COPY docker-entrypoint.sh /app/docker-entrypoint.sh
RUN sed -i 's/\r$//' /app/docker-entrypoint.sh && chmod +x /app/docker-entrypoint.sh

CMD ["/app/docker-entrypoint.sh"]
3 changes: 2 additions & 1 deletion apps/backend/templates/layout_external.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<?php include_javascripts() ?>
<script>
var socketIoAddress = "<?php echo sfConfig::get("app_ebot_ip"); ?>:<?php echo sfConfig::get("app_ebot_port"); ?>";
var httpMode = "<?php echo sfConfig::get("app_ebot_httpmode"); ?>";
var socket = null;
var socketIoLoaded = false;
var loadingSocketIo = false;
Expand All @@ -22,7 +23,7 @@ function initSocketIo(callback) {
}

loadingSocketIo = true;
$.getScript("http://"+socketIoAddress+"/socket.io/socket.io.js", function(){
$.getScript(httpMode+socketIoAddress+"/socket.io/socket.io.js", function(){
socket = io.connect("http://"+socketIoAddress);
socket.on('connect', function(){
socketIoLoaded = true;
Expand Down
6 changes: 5 additions & 1 deletion config/app_user.yml.default
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
default_rules: rules
default_overtime_enable: false
default_overtime_max_round: 3
default_overtime_startmoney: 16000
default_overtime_startmoney: 10000

# If you want a default password for all matches, you can set it here. Otherwise it will be random.
#default_password: ''

# true or false, whether demos will be downloaded by the ebot server
# the demos can be downloaded at the matchpage, if it's true
Expand All @@ -20,6 +23,7 @@
websocket_url: 'http://localhost:12360'
ebot_ip: 192.168.1.1
ebot_port: 12360
httpMode: http

# lan or net, it's to display the server IP or the GO TV IP
# net mode display only started match on home page
Expand Down
51 changes: 51 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash
set -e

APP_DIR="/app/eBot-CSGO-Web"
SOURCE_DIR="/app/source"

# Copy source to volume target if not already present
if [ ! -f "$APP_DIR/symfony" ]; then
echo "[entrypoint] Copying source files to $APP_DIR..."
cp -r "$SOURCE_DIR/." "$APP_DIR/"
fi

cd "$APP_DIR"

# Remove installation wizard (safe on every start)
rm -rf web/installation

# Wait for MySQL to be ready
MYSQL_HOST="${MYSQL_HOST:-mysqldb}"
echo "[entrypoint] Waiting for MySQL at $MYSQL_HOST..."
until mysql -h "$MYSQL_HOST" -u "$MYSQL_USER" -p"$MYSQL_PASSWORD" "$MYSQL_DATABASE" -e "SELECT 1" > /dev/null 2>&1; do
echo "[entrypoint] MySQL not ready yet, retrying in 3s..."
sleep 3
done
echo "[entrypoint] MySQL is ready."

# Check if schema already exists by probing sf_guard_user table
TABLE_EXISTS=$(mysql -h "$MYSQL_HOST" -u "$MYSQL_USER" -p"$MYSQL_PASSWORD" "$MYSQL_DATABASE" \
-e "SHOW TABLES LIKE 'sf_guard_user';" 2>/dev/null | grep -c "sf_guard_user" || true)

if [ "$TABLE_EXISTS" -eq 0 ]; then
echo "[entrypoint] Schema not found — building database..."
php symfony doctrine:build --all --no-confirmation

echo "[entrypoint] Creating admin user..."
php symfony guard:create-user --is-super-admin \
"$EBOT_ADMIN_EMAIL" \
"$EBOT_ADMIN_LOGIN" \
"$EBOT_ADMIN_PASSWORD" \
"${EBOT_ADMIN_FIRSTNAME:-}" \
"${EBOT_ADMIN_LASTNAME:-}"
else
echo "[entrypoint] Schema already exists — skipping doctrine:build."
fi

# Clear Symfony cache (always safe)
echo "[entrypoint] Clearing Symfony cache..."
php symfony cc

echo "[entrypoint] Starting php-fpm..."
exec php-fpm
11 changes: 9 additions & 2 deletions lib/form/doctrine/MatchsForm.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,18 @@ class MatchsForm extends BaseMatchsForm {
public function configure() {
unset($this["config_authkey"], $this["ip"], $this["identifier_id"], $this["force_zoom_match"], $this["config_switch_auto"], $this["server_id"], $this["ingame_enable"], $this["config_auto_change_password"], $this["created_at"], $this["updated_at"], $this["current_map"], $this["status"], $this["score_a"], $this["score_b"], $this["config_heatmap"], $this["enable"], $this["is_paused"]);

$password = array('frosch', 'gehen', 'rennen', 'gucken', 'fliegen', 'rasen', 'snobb', 'peter', 'wackel', 'dackel', 'gut', 'schlecht', 'win', 'loss', 'tragen',
$passwordArray = array('frosch', 'gehen', 'rennen', 'gucken', 'fliegen', 'rasen', 'snobb', 'peter', 'wackel', 'dackel', 'gut', 'schlecht', 'win', 'loss', 'tragen',
'weg', 'berlin', 'aachen', 'mensch', 'tier', 'turtle', 'adler', 'raupe', 'rauben', 'bank', 'schalter', 'ticket', 'bahn', 'zug', 'delay', 'flugzeug', 'ratte',
'nager', 'hase', 'feld', 'gras', 'kraut', 'gurke', 'apfel', 'salat', 'tomate', 'dressing', 'essig', 'zwiebel', 'kuchen', 'zucker', 'salz', 'kaffee', 'tee',
'monday', 'tuesday', 'wednesday', 'friday', 'weekend', 'holiday', 'doctor', 'game', 'cup', 'death', 'player', 'monitor', 'hand', 'food', 'paper', 'windows', 'together');
$password = $password[rand(0, count($password)-1)];

$defaultPassword = sfConfig::get('app_default_password', '');
if (empty($defaultPassword)) {
$password = $passwordArray[rand(0, count($passwordArray) - 1)];
} else {
$password = $defaultPassword;
}

$supportedRoundFormats = array("15" => "MR15", "12" => "MR12", "9" => "MR9", "5" => "MR5", "3" => "MR3");
$defaultRoundFormat = sfConfig::get('app_default_max_round');
if (!array_key_exists($defaultRoundFormat, $supportedRoundFormats)) $defaultRoundFormat = 12;
Expand Down