1
0
mirror of https://github.com/deStrO/eBot-docker.git synced 2025-12-10 03:22:49 +01:00

Adding configuration script and rename folders

This commit is contained in:
Julien Pardons 2023-10-13 19:03:36 +02:00
parent 02e9d7e935
commit dc3b67d8ed
20 changed files with 219 additions and 40 deletions

15
.env.sample Normal file
View File

@ -0,0 +1,15 @@
# eBot configuration
EBOT_IP=127.0.0.1
LOG_ADDRESS_SERVER=http://127.0.0.1:12345
EBOT_ADMIN_LOGIN=admin
EBOT_ADMIN_PASSWORD=admin
EBOT_ADMIN_EMAIL=admin@admin
WEBSOCKET_SECRET_KEY=strongpassword
COMMAND_STOP_DISABLED=true
# Database configuration
MYSQL_USER=ebotv3
MYSQL_DATABASE=ebotv3
MYSQL_PASSWORD=strongpassword
MYSQL_ROOT_PASSWORD=strongpassword

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
.env.bak
data/
*.bak
.env

View File

@ -6,6 +6,9 @@ It is a containerized version of eBot, which is a full managed server-bot writte
## How to run it ## How to run it
You should download the repository content, place it in a folder, and then execute the following commands in the specified order: You should download the repository content, place it in a folder, and then execute the following commands in the specified order:
``` ```
cp .env.sample .env
chmod a+x setup.sh configure.sh
./setup.sh
docker-compose build docker-compose build
docker-compose up docker-compose up
``` ```

53
configure.sh Executable file
View File

@ -0,0 +1,53 @@
#!/usr/bin/env bash
red='\e[1;31m%s\e[0m\n'
green='\e[1;32m%s\e[0m\n'
yellow='\e[1;33m%s\e[0m\n'
blue='\e[1;34m%s\e[0m\n'
magenta='\e[1;35m%s\e[0m\n'
cyan='\e[1;36m%s\e[0m\n'
printf "$green" "eBot configuration script"
# eBot configuration
EBOT_IP=10.10.10.91
LOG_ADDRESS_SERVER=http://10.10.10.91:12345
EBOT_ADMIN_LOGIN=admin
EBOT_ADMIN_PASSWORD=admin
EBOT_ADMIN_EMAIL=admin@tset.com
WEBSOCKET_SECRET_KEY=f0ad422482332a9a9a4fbcfaaa65a696
COMMAND_STOP_DISABLED=true
# Database configuration
MYSQL_USER=ebotv3
MYSQL_DATABASE=ebotv3
MYSQL_PASSWORD=a3368dabb311bb66540e9bb9030714e7
MYSQL_ROOT_PASSWORD=501e0a10b2702be5350915784ad2aca1
source .env
echo "Patching ./etc/eBotSocket/config.ini"
cp ./etc/eBotSocket/config.ini ./etc/eBotSocket/config.ini.bak
sed -i "s/MYSQL_IP =.*/MYSQL_IP = \"mysqldb\"/g" ./etc/eBotSocket/config.ini
sed -i "s/MYSQL_PASS =.*/MYSQL_PASS = \"$MYSQL_PASSWORD\"/g" ./etc/eBotSocket/config.ini
sed -i "s/MYSQL_BASE =.*/MYSQL_BASE = \"$MYSQL_DATABASE\"/g" ./etc/eBotSocket/config.ini
sed -i "s/MYSQL_BASE =.*/MYSQL_BASE = \"$MYSQL_DATABASE\"/g" ./etc/eBotSocket/config.ini
sed -i "s/COMMAND_STOP_DISABLED =.*/COMMAND_STOP_DISABLED = $COMMAND_STOP_DISABLED/g" ./etc/eBotSocket/config.ini
sed -i "s#LOG_ADDRESS_SERVER =.*#LOG_ADDRESS_SERVER = \"$LOG_ADDRESS_SERVER\"#g" ./etc/eBotSocket/config.ini
sed -i "s/WEBSOCKET_SECRET_KEY =.*/WEBSOCKET_SECRET_KEY = \"$WEBSOCKET_SECRET_KEY\"/g" ./etc/eBotSocket/config.ini
sed -i "s/REDIS_HOST =.*/REDIS_HOST = \"redis\"/g" ./etc/eBotSocket/config.ini
sed -i "s/BOT_IP =.*/BOT_IP = \"0.0.0.0\"/g" ./etc/eBotSocket/config.ini
echo "Patching ./etc/eBotWeb/app_user.yml"
cp ./etc/eBotWeb/app_user.yml ./etc/eBotWeb/app_user.yml.bak
sed -i "s|log_match:.*|log_match: /app/ebot-logs/log_match|" ./etc/eBotWeb/app_user.yml
sed -i "s|log_match_admin:.*|log_match_admin: /app/ebot-logs/log_match_admin|" ./etc/eBotWeb/app_user.yml
sed -i "s|demo_path:.*|demo_path: /app/ebot-demos|" ./etc/eBotWeb/app_user.yml
sed -i "s|websocket_secret_key:.*|websocket_secret_key: $WEBSOCKET_SECRET_KEY|" ./etc/eBotWeb/app_user.yml
sed -i "s|ebot_ip:.*|ebot_ip: $EBOT_IP|g" ./etc/eBotWeb/app_user.yml
echo "Patching ./etc/eBotWeb/database.yml"
cp ./etc/eBotWeb/databases.yml ./etc/eBotWeb/databases.yml.bak
sed -i "s|dsn:.*|dsn: \"mysql:host=mysqldb;dbname=${MYSQL_DATABASE}\"|" ./etc/eBotWeb/databases.yml
sed -i "s|username:.*|username: ${MYSQL_USER}|" ./etc/eBotWeb/databases.yml
sed -i "s|password:.*|password: ${MYSQL_PASSWORD}|" ./etc/eBotWeb/databases.yml

View File

@ -1,28 +1,36 @@
version: '3' version: '3'
services: services:
ebotweb: ebot-web:
build: build:
context: ./ebotweb context: ./ebot-web
environment:
- EBOT_ADMIN_LOGIN
- EBOT_ADMIN_PASSWORD
- EBOT_ADMIN_EMAIL
volumes: volumes:
- "eBotWebVolume:/app/eBot-CSGO-Web" - "eBotWebVolume:/app/eBot-CSGO-Web"
- "./ebot-logs:/app/ebot-logs"
- "./ebot-demos:/app/ebot-demos"
- "./etc/eBotWeb/app_user.yml:/app/eBot-CSGO-Web/config/app_user.yml" - "./etc/eBotWeb/app_user.yml:/app/eBot-CSGO-Web/config/app_user.yml"
- "./etc/eBotWeb/databases.yml:/app/eBot-CSGO-Web/config/databases.yml" - "./etc/eBotWeb/databases.yml:/app/eBot-CSGO-Web/config/databases.yml"
depends_on: depends_on:
- mysqldb - mysqldb
ebotsocket: ebot-socket:
build: build:
context: ./ebotsocket context: ./ebot-socket
ports: ports:
- "12360:12360" - "12360:12360"
volumes: volumes:
- "./ebot-logs:/app/eBot-CSGO/logs"
- "./ebot-demos:/app/eBot-CSGO/demos"
- "./etc/eBotSocket/config.ini:/app/eBot-CSGO/config/config.ini" - "./etc/eBotSocket/config.ini:/app/eBot-CSGO/config/config.ini"
depends_on: depends_on:
- mysqldb - mysqldb
- ebotweb - ebot-web
- redis - redis
ebotlogreceiver: ebot-logs-receiver:
build: build:
context: ./ebotlogreceiver context: ./ebot-logs-receiver
ports: ports:
- "12345:12345" - "12345:12345"
volumes: volumes:
@ -33,10 +41,10 @@ services:
image: biarms/mysql:5.7 image: biarms/mysql:5.7
restart: always restart: always
environment: environment:
- MYSQL_DATABASE=ebotv3 - MYSQL_DATABASE
- MYSQL_ROOT_PASSWORD=7w£6GfV0z92 - MYSQL_ROOT_PASSWORD
- MYSQL_USER=ebotv3 - MYSQL_USER
- MYSQL_PASSWORD=7w£6GfV0z92 - MYSQL_PASSWORD
volumes: volumes:
- "./data/db/mysql:/var/lib/mysql" - "./data/db/mysql:/var/lib/mysql"
redis: redis:
@ -54,7 +62,7 @@ services:
- "443:443" - "443:443"
restart: always restart: always
depends_on: depends_on:
- ebotweb - ebot-web
- mysqldb - mysqldb
volumes: volumes:
eBotWebVolume: eBotWebVolume:

0
ebot-demos/.gitignore vendored Normal file
View File

0
ebot-logs/.gitignore vendored Normal file
View File

0
ebot-logs/log_match/.gitignore vendored Normal file
View File

0
ebot-logs/log_match_admin/.gitignore vendored Normal file
View File

View File

@ -17,7 +17,7 @@ if [ ! -f .installed ]; then
php symfony doctrine:build --all --no-confirmation php symfony doctrine:build --all --no-confirmation
php symfony guard:create-user --is-super-admin admin@ebot admin admin php symfony guard:create-user --is-super-admin $EBOT_ADMIN_EMAIL $EBOT_ADMIN_LOGIN $EBOT_ADMIN_PASSWORD
rm -rf web/installation rm -rf web/installation
@ -28,5 +28,9 @@ if [ ! -f .installed ]; then
php-fpm php-fpm
else else
echo "eBot Web is already installed. Skipping setup." echo "eBot Web is already installed. Skipping setup."
cd eBot-CSGO-Web
php symfony cc
echo "Clearing cache"
php-fpm php-fpm
fi fi

View File

@ -32,14 +32,6 @@
"path": "logs", "path": "logs",
"split": true "split": true
} }
},
{
"path": "src/logs-receiver/plugins/mapper.ts",
"config": {
"mapping": {
"127.0.0.1:27015": "192.168.0.1:27015"
}
}
} }
] ]
} }

View File

@ -8,11 +8,11 @@
MYSQL_IP = "mysqldb" MYSQL_IP = "mysqldb"
MYSQL_PORT = "3306" MYSQL_PORT = "3306"
MYSQL_USER = "ebotv3" MYSQL_USER = "ebotv3"
MYSQL_PASS = "7w£6GfV0z92" MYSQL_PASS = "5bbcb2cb12525f00d608b38b187f55fa"
MYSQL_BASE = "ebotv3" MYSQL_BASE = "ebotv3"
[Config] [Config]
BOT_IP = "0.0.0.0" ; leave it as is (Docker) BOT_IP = "0.0.0.0"
BOT_PORT = 12360 BOT_PORT = 12360
SSL_ENABLED = false SSL_ENABLED = false
SSL_CERTIFICATE_PATH = "ssl/cert.pem" SSL_CERTIFICATE_PATH = "ssl/cert.pem"
@ -23,8 +23,8 @@ DELAY_BUSY_SERVER = 120
NB_MAX_MATCHS = 0 NB_MAX_MATCHS = 0
PAUSE_METHOD = "nextRound" ; nextRound or instantConfirm or instantNoConfirm PAUSE_METHOD = "nextRound" ; nextRound or instantConfirm or instantNoConfirm
NODE_STARTUP_METHOD = "node" ; binary file name or none in case you are starting it with forever or manually NODE_STARTUP_METHOD = "node" ; binary file name or none in case you are starting it with forever or manually
LOG_ADDRESS_SERVER = "http://127.0.0.1:12345" ; change the address to your extenral one LOG_ADDRESS_SERVER = "http://10.10.10.91:12345"
WEBSOCKET_SECRET_KEY = "helloworld" WEBSOCKET_SECRET_KEY = "f6c106f706d2ce59a136c509c1e2f1a1"
[Redis] [Redis]
REDIS_HOST = "redis" REDIS_HOST = "redis"

View File

@ -2,11 +2,11 @@
# white space are VERY important, don't remove it or it will not work # white space are VERY important, don't remove it or it will not work
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
log_match: ../../ebot-csgo/logs/log_match log_match: /app/ebot-logs/log_match
log_match_admin: ../../ebot-csgo/logs/log_match_admin log_match_admin: /app/ebot-logs/log_match_admin
demo_path: ../../ebot-csgo/demos demo_path: /app/ebot-demos
default_max_round: 15 default_max_round: 12
default_rules: rules default_rules: rules
default_overtime_max_round: 3 default_overtime_max_round: 3
default_overtime_startmoney: 16000 default_overtime_startmoney: 16000
@ -16,7 +16,7 @@
demo_download: true demo_download: true
ebot_ip: 127.0.0.1 # Change to your external IP ebot_ip: 127.0.0.1
ebot_port: 12360 ebot_port: 12360
# lan or net, it's to display the server IP or the GO TV IP # lan or net, it's to display the server IP or the GO TV IP
@ -33,4 +33,4 @@
toornament_plugin_key: test-123457890 toornament_plugin_key: test-123457890
# Same as eBot config # Same as eBot config
websocket_secret_key: helloworld websocket_secret_key: f6c106f706d2ce59a136c509c1e2f1a1

View File

@ -5,6 +5,6 @@ all:
doctrine: doctrine:
class: sfDoctrineDatabase class: sfDoctrineDatabase
param: param:
dsn: mysql:host=mysqldb;dbname=ebotv3 dsn: "mysql:host=mysqldb;dbname=ebotv3"
username: ebotv3 username: ebotv3
password: 7w£6GfV0z92 password: 5bbcb2cb12525f00d608b38b187f55fa

View File

@ -20,7 +20,7 @@ server {
fastcgi_param HTTPS off; fastcgi_param HTTPS off;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_pass eBotWeb:9000; fastcgi_pass ebot-web:9000;
fastcgi_read_timeout 120; fastcgi_read_timeout 120;
} }

100
setup.sh Executable file
View File

@ -0,0 +1,100 @@
#!/usr/bin/env bash
red='\e[1;31m%s\e[0m\n'
green='\e[1;32m%s\e[0m\n'
yellow='\e[1;33m%s\e[0m\n'
blue='\e[1;34m%s\e[0m\n'
magenta='\e[1;35m%s\e[0m\n'
cyan='\e[1;36m%s\e[0m\n'
function yesNo() {
while true; do
read -p "$1 [y/n]: " yn
case $yn in
[Yy]* ) return 0;;
[Nn]* ) return 1;;
* ) echo "Please answer yes or no.";;
esac
done
}
function ask_with_default() {
local prompt="$1"
local default_value="$2"
read -p "${prompt} [current: ${default_value}]: " input_value
if [[ -z "$input_value" ]]; then
echo "$default_value"
else
echo "$input_value"
fi
}
printf "$green" "eBot setup script"
printf "This script will only configure the .env file. You must run or accept to run the ./configure.sh\r\n"
if yesNo "Would you like to fresh the configs files by downloading recent configuration from github (main branch) ?"
then
wget https://raw.githubusercontent.com/deStrO/eBot-CSGO-Web/master/config/app_user.yml.default -O ./etc/eBotWeb/app_user.yml
wget https://raw.githubusercontent.com/deStrO/eBot-CSGO-Web/master/config/databases.yml -O ./etc/eBotWeb/databases.yml
wget https://raw.githubusercontent.com/deStrO/eBot-CSGO/master/config/config.ini.smp -O ./etc/eBotSocket/config.ini
fi
function generatePassword() {
openssl rand -hex 16
}
cp .env .env.bak
if yesNo "Would you like generate a new random websocket secrets ?"
then
NEW_WEBSOCKET_SECRET_KEY=$(generatePassword)
sed -i -e "s#WEBSOCKET_SECRET_KEY=.*#WEBSOCKET_SECRET_KEY=${NEW_WEBSOCKET_SECRET_KEY}#g" \
"$(dirname "$0")/.env"
fi
if yesNo "Would you like generate new mysql random password "
then
NEW_MYSQL_ROOT_PASSWORD=$(generatePassword)
NEW_MYSQL_PASSWORD=$(generatePassword)
sed -i -e "s#MYSQL_ROOT_PASSWORD=.*#MYSQL_ROOT_PASSWORD=${NEW_MYSQL_ROOT_PASSWORD}#g" \
-e "s#MYSQL_PASSWORD=.*#MYSQL_PASSWORD=${NEW_MYSQL_PASSWORD}#g" \
"$(dirname "$0")/.env"
fi
source .env
printf "$green" "Now doing the default configuration of eBot web"
EBOT_ADMIN_LOGIN=$(ask_with_default "eBot Web login" $EBOT_ADMIN_LOGIN)
EBOT_ADMIN_PASSWORD=$(ask_with_default "eBot Web password" $EBOT_ADMIN_PASSWORD)
EBOT_ADMIN_EMAIL=$(ask_with_default "eBot Web email" $EBOT_ADMIN_EMAIL)
sed -i -e "s#EBOT_ADMIN_LOGIN=.*#EBOT_ADMIN_LOGIN=${EBOT_ADMIN_LOGIN}#g" \
-e "s#EBOT_ADMIN_PASSWORD=.*#EBOT_ADMIN_PASSWORD=${EBOT_ADMIN_PASSWORD}#g" \
-e "s#EBOT_ADMIN_EMAIL=.*#EBOT_ADMIN_EMAIL=${EBOT_ADMIN_EMAIL}#g" \
"$(dirname "$0")/.env"
printf "$green" "Now configuring IP & logs receiver"
echo "Before going further, you need to understand the concept with the new system of logs"
echo "The CS2 server will send the logs via HTTP to the logs-receiver"
echo "This log receiver is exposed by docker on port 12345 by default"
echo "On the next question, you will have to give the full web address of the logger, that have to be reachable from the server"
echo "If your ip is 123.123.123.123, you must fill http://123.123.123.123:12345"
LOG_ADDRESS_SERVER=$(ask_with_default "Log address server" $LOG_ADDRESS_SERVER)
sed -i -e "s#LOG_ADDRESS_SERVER=.*#LOG_ADDRESS_SERVER=${LOG_ADDRESS_SERVER}#g" \
"$(dirname "$0")/.env"
echo "Now, for the web part, we need to know on which IP the server will run, please fill in the IP of the server (public or lan) (format 123.123.123.123)"
echo "You won't be able to connect to the websocket server for realtime updates if you don't give us the right IP."
EBOT_IP=$(ask_with_default "Log address server" $EBOT_IP)
sed -i -e "s#EBOT_IP=.*#EBOT_IP=${EBOT_IP}#g" \
"$(dirname "$0")/.env"
if yesNo "Would you like regenerate all configuration files ?"
then
./configure.sh
fi