New Filestructure for Docker
This commit is contained in:
+10
-11
@@ -1,23 +1,22 @@
|
||||
config/.env.db
|
||||
config/.env.db-tables
|
||||
config/.env.db-guest
|
||||
config/.env.redis
|
||||
config/.env.pw-encryption-key
|
||||
config/.env.wk-id
|
||||
config/.env.mail
|
||||
config/.env.db-wkvs-user
|
||||
config/.env.docker.db
|
||||
websocket/node_modules
|
||||
composer/vendor
|
||||
private-files/rechnungen/*
|
||||
private-files/config-uploads/*
|
||||
.php-ini
|
||||
.php-version
|
||||
www/externe-geraete/json/*
|
||||
www/files/ranglisten/*
|
||||
www/sponsoren.php
|
||||
www/css/sponsoren.css
|
||||
www/scripts
|
||||
www/files/music/*
|
||||
!www/files/music/piep.mp3
|
||||
www/.well-known
|
||||
www/intern/kampfrichter/ajax/ajax-neu_dynamic-rangliste.php
|
||||
html/externe-geraete/json/*
|
||||
html/files/ranglisten/*
|
||||
html/sponsoren.php
|
||||
html/css/sponsoren.css
|
||||
html/scripts
|
||||
html/files/music/*
|
||||
!html/files/music/piep.mp3
|
||||
html/.well-known
|
||||
html/intern/kampfrichter/ajax/ajax-neu_dynamic-rangliste.php
|
||||
+23
-93
@@ -1,125 +1,55 @@
|
||||
services:
|
||||
|
||||
nginx:
|
||||
image: nginx:latest
|
||||
container_name: wkvs-nginx
|
||||
ports:
|
||||
- "127.0.0.1:8080:80"
|
||||
- "127.0.0.1:8082:8082"
|
||||
volumes:
|
||||
- .:/var/wkvs
|
||||
- ./config/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
- "127.0.0.1:8081:80"
|
||||
depends_on:
|
||||
- apache
|
||||
- node
|
||||
volumes:
|
||||
- ./docker/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
networks:
|
||||
- wkvs
|
||||
|
||||
env-init:
|
||||
build: ./config/apache
|
||||
container_name: wkvs-env-init
|
||||
volumes:
|
||||
- .:/var/wkvs
|
||||
working_dir: /var/wkvs
|
||||
command: php setup/init-env.php
|
||||
|
||||
composer-init:
|
||||
image: composer:latest
|
||||
container_name: wkvs-composer-init
|
||||
volumes:
|
||||
- .:/app
|
||||
working_dir: /app/composer
|
||||
command: composer install --no-interaction --prefer-dist
|
||||
depends_on:
|
||||
env-init:
|
||||
condition: service_completed_successfully
|
||||
- app-network
|
||||
|
||||
apache:
|
||||
build: ./config/apache
|
||||
container_name: wkvs-apache
|
||||
build: ./docker/apache
|
||||
volumes:
|
||||
- .:/var/wkvs
|
||||
- ./config/apache/php/custom.ini:/usr/local/etc/php/conf.d/custom.ini
|
||||
depends_on:
|
||||
db-init:
|
||||
condition: service_completed_successfully
|
||||
composer-init:
|
||||
condition: service_completed_successfully
|
||||
- .:/var/www/wkvs
|
||||
networks:
|
||||
- wkvs
|
||||
- app-network
|
||||
|
||||
mariadb:
|
||||
image: mariadb:latest
|
||||
container_name: wkvs-mariadb
|
||||
image: mariadb:11
|
||||
container_name: test-mariadb
|
||||
restart: unless-stopped
|
||||
env_file:
|
||||
- path: ./config/.env.db
|
||||
required: false
|
||||
- ./config/.env.docker.db
|
||||
volumes:
|
||||
- db_data:/var/lib/mysql
|
||||
healthcheck:
|
||||
test: ["CMD", "mariadb-admin", "ping", "-h", "127.0.0.1"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
depends_on:
|
||||
env-init:
|
||||
condition: service_completed_successfully
|
||||
networks:
|
||||
- wkvs
|
||||
- app-network
|
||||
|
||||
db-init:
|
||||
build: ./config/apache
|
||||
container_name: wkvs-db-init
|
||||
node:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: docker/node/Dockerfile
|
||||
expose:
|
||||
- "8082"
|
||||
volumes:
|
||||
- .:/var/wkvs
|
||||
working_dir: /var/wkvs
|
||||
depends_on:
|
||||
mariadb:
|
||||
condition: service_healthy
|
||||
env-init:
|
||||
condition: service_completed_successfully
|
||||
- .:/var/www/wkvs
|
||||
- /var/www/wkvs/websocket/node_modules
|
||||
networks:
|
||||
- wkvs
|
||||
command: php setup/database/init-db.php
|
||||
- app-network
|
||||
|
||||
redis:
|
||||
image: redis:7
|
||||
container_name: wkvs-redis
|
||||
restart: unless-stopped
|
||||
env_file:
|
||||
- path: ./config/.env.redis
|
||||
required: false
|
||||
command: ["sh", "-c", "exec redis-server --requirepass \"$REDDIS_PASSWORD\""]
|
||||
depends_on:
|
||||
env-init:
|
||||
condition: service_completed_successfully
|
||||
networks:
|
||||
- wkvs
|
||||
|
||||
node:
|
||||
image: node:latest
|
||||
container_name: wkvs-node
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- .:/var/wkvs
|
||||
working_dir: /var/wkvs/websocket
|
||||
env_file:
|
||||
- path: ./config/.env.redis
|
||||
required: false
|
||||
environment:
|
||||
- REDDIS_HOST=redis
|
||||
command: sh -c "npm install && npm install -g pm2 && pm2-runtime start index.js --max-memory-restart 1G --node-args=\"--max-old-space-size=1024\" --name=\"WebSocket WKVS\""
|
||||
depends_on:
|
||||
redis:
|
||||
condition: service_started
|
||||
env-init:
|
||||
condition: service_completed_successfully
|
||||
networks:
|
||||
- wkvs
|
||||
- app-network
|
||||
|
||||
volumes:
|
||||
db_data:
|
||||
|
||||
networks:
|
||||
wkvs:
|
||||
app-network:
|
||||
driver: bridge
|
||||
@@ -1,7 +0,0 @@
|
||||
# This Account must have have permissions SELECT, INSERT, UPDATE !
|
||||
|
||||
DB_USER=DB_GUESTUSER_USERNAME
|
||||
DB_PASSWORD=DB_GUESTUSER_PASSWORD
|
||||
DB_NAME=DATABASE_NAME # Same as .env.db-wkvs-user
|
||||
DB_HOST=mariadb # Same as .env.db-wkvs-user, An IP without Port, often 127.0.0.1 or localhost
|
||||
DB_PORT=3306 # default Port is 3306
|
||||
@@ -1,5 +1,3 @@
|
||||
DB_PREFIX=PREFIX
|
||||
|
||||
# Tabellennamen
|
||||
DB_TABLE_TEILNEHMENDE=teilnehmende
|
||||
DB_TABLE_TEILNEHMENDE_GRUPPEN=teilnehmende_gruppen
|
||||
@@ -1,7 +0,0 @@
|
||||
# This Account must have at least have permissions SELECT, INSERT, UPDATE, DELETE !
|
||||
|
||||
DB_USER=DB_USER_USERNAME
|
||||
DB_PASSWORD=DB_USER_PASSWORD
|
||||
DB_NAME=DATABASE_NAME
|
||||
DB_HOST=mariadb # mariadb for Docker Use, otherwsie An IP with Port 127.0.0.1 or localhost
|
||||
DB_PORT=3306 # default Port is 3306
|
||||
@@ -1,3 +0,0 @@
|
||||
MYSQL_ROOT_PASSWORD=YOUR_PASSWORD_FOR_ROOT
|
||||
MYSQL_DATABASE=YOUR_DATABASE_NAME
|
||||
MYSQL_HOST=localhost
|
||||
@@ -1 +0,0 @@
|
||||
PW_ENCRYPTION_KEY=YOUR_CUSTOM_PASSWORD_ENCRYPTION_KEY
|
||||
@@ -1,3 +0,0 @@
|
||||
REDDIS_PASSWORD=YOUR_REDDIS_PASSWORD
|
||||
REDDIS_HOST=YOUR_REDDIS_IP # An IP, often 127.0.0.1 or localhost
|
||||
REDDIS_PORT=YOUR_REDDIS_PORT # Default 6379
|
||||
@@ -1,12 +0,0 @@
|
||||
FROM php:8.3-apache
|
||||
|
||||
# Enable the rewrite module
|
||||
RUN a2enmod rewrite
|
||||
|
||||
RUN docker-php-ext-install mysqli && docker-php-ext-enable mysqli
|
||||
|
||||
# Set Apache DocumentRoot to /var/wkvs/www
|
||||
ENV APACHE_DOCUMENT_ROOT /var/wkvs/www
|
||||
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf \
|
||||
&& sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf \
|
||||
&& sed -i 's/AllowOverride None/AllowOverride All/g' /etc/apache2/apache2.conf
|
||||
@@ -1,33 +0,0 @@
|
||||
events {}
|
||||
|
||||
http {
|
||||
server {
|
||||
listen 80;
|
||||
|
||||
location / {
|
||||
proxy_pass http://apache:80;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
location /ws/ {
|
||||
proxy_pass http://node:8082;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "Upgrade";
|
||||
proxy_set_header Host $host;
|
||||
|
||||
# Prevent WebSocket timeout
|
||||
proxy_read_timeout 36000s; # 1 hour
|
||||
proxy_send_timeout 36000s; # 1 hour
|
||||
proxy_connect_timeout 75s; # optional
|
||||
}
|
||||
location ~ /\. {
|
||||
deny all;
|
||||
access_log off;
|
||||
log_not_found off;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
# 1. Reset containers and volumes
|
||||
docker compose down -v
|
||||
|
||||
# Ensure the config directory exists
|
||||
mkdir -p config
|
||||
|
||||
# 2. Generate Random Variables correctly using $(...)
|
||||
MYSQL_USER=$(openssl rand -hex 16)
|
||||
MYSQL_PASSWORD=$(openssl rand -base64 32)
|
||||
MYSQL_DATABASE="wkvs_database"
|
||||
MYSQL_ROOT_PASSWORD=$(openssl rand -base64 32)
|
||||
|
||||
cat <<EOF > config/.env.docker.db
|
||||
MYSQL_ROOT_PASSWORD="$MYSQL_ROOT_PASSWORD"
|
||||
MYSQL_DATABASE=$MYSQL_DATABASE
|
||||
MYSQL_USER=$MYSQL_USER
|
||||
MYSQL_PASSWORD="$MYSQL_PASSWORD"
|
||||
EOF
|
||||
|
||||
# 3. Handle Admin Hashing
|
||||
KEYWORD=$(openssl rand -hex 16)
|
||||
HASHED_KEYWORD=$(php -r "echo password_hash('$KEYWORD', PASSWORD_ARGON2ID);")
|
||||
|
||||
# Replace placeholder in SQL template
|
||||
sed "s|__ARGON_HASH_PLACEHOLDER__|$HASHED_KEYWORD|g" docker/database/wkvs-database-template.sql > docker/database/db-sql.sql
|
||||
|
||||
# 1. Generate password
|
||||
REDIS_PASSWORD=$(openssl rand -hex 32)
|
||||
|
||||
# 3. Save variables to your .env file
|
||||
cat <<EOF > config/.env.redis
|
||||
REDIS_PASSWORD="$REDIS_PASSWORD"
|
||||
REDIS_HOST=redis
|
||||
REDIS_PORT=6379
|
||||
EOF
|
||||
|
||||
# 4. Start Docker Containers
|
||||
docker compose up -d --build
|
||||
|
||||
# 5. Wait until MariaDB is fully up and accepting connections
|
||||
echo "Waiting for MariaDB to start..."
|
||||
|
||||
sleep 5
|
||||
|
||||
until docker compose exec -T mariadb mariadb-admin ping -h localhost -u root -p"$MYSQL_ROOT_PASSWORD" --silent >/dev/null 2>&1; do
|
||||
sleep 2
|
||||
done
|
||||
|
||||
# 6. Execute Primary Schema Import
|
||||
docker compose exec -T mariadb mariadb -u root -p"$MYSQL_ROOT_PASSWORD" "$MYSQL_DATABASE" < docker/database/db-sql.sql
|
||||
rm docker/database/db-sql.sql
|
||||
|
||||
# 7. Generate Additional Application Users & Passwords
|
||||
MYSQL_WKVS_USERNAME="wkvs_normal_user"
|
||||
MYSQL_GUEST_USERNAME="wkvs_guest_user"
|
||||
|
||||
MYSQL_WKVS_PASSWORD=$(openssl rand -hex 32)
|
||||
MYSQL_GUEST_PASSWORD=$(openssl rand -hex 16)
|
||||
|
||||
# Write app user configuration files
|
||||
cat <<EOF > config/.env.db-wkvs-user
|
||||
DB_USER=$MYSQL_WKVS_USERNAME
|
||||
DB_PASSWORD="$MYSQL_WKVS_PASSWORD"
|
||||
DB_NAME=$MYSQL_DATABASE
|
||||
DB_HOST=mariadb
|
||||
DB_PORT=3306
|
||||
EOF
|
||||
|
||||
|
||||
|
||||
cat <<EOF > config/.env.db-guest
|
||||
DB_GUEST_USER=$MYSQL_GUEST_USERNAME
|
||||
DB_GUEST_PASSWORD="$MYSQL_GUEST_PASSWORD"
|
||||
DB_NAME=$MYSQL_DATABASE
|
||||
DB_HOST=mariadb
|
||||
DB_PORT=3306
|
||||
EOF
|
||||
|
||||
# 8. Create Additional Users & Grant Permissions in MariaDB
|
||||
echo "Creating application users and setting permissions..."
|
||||
|
||||
docker compose exec -T mariadb mariadb -u root -p"$MYSQL_ROOT_PASSWORD" <<EOF
|
||||
-- Create Normal User
|
||||
CREATE USER IF NOT EXISTS '$MYSQL_WKVS_USERNAME'@'%' IDENTIFIED BY '$MYSQL_WKVS_PASSWORD';
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE ON \`$MYSQL_DATABASE\`.* TO '$MYSQL_WKVS_USERNAME'@'%';
|
||||
|
||||
-- Create Guest User
|
||||
CREATE USER IF NOT EXISTS '$MYSQL_GUEST_USERNAME'@'%' IDENTIFIED BY '$MYSQL_GUEST_PASSWORD';
|
||||
GRANT SELECT, INSERT, UPDATE ON \`$MYSQL_DATABASE\`.* TO '$MYSQL_GUEST_USERNAME'@'%';
|
||||
|
||||
FLUSH PRIVILEGES;
|
||||
EOF
|
||||
|
||||
SERVICE_NAME="apache"
|
||||
COMPOSER_DIR="/var/www/wkvs/composer"
|
||||
|
||||
echo "Running Composer setup via Docker Compose..."
|
||||
|
||||
# 1. Download Composer inside the service container if not installed globally
|
||||
docker compose exec "$SERVICE_NAME" bash -c '
|
||||
if ! command -v composer &> /dev/null && [ ! -f "composer.phar" ]; then
|
||||
php -r "copy('\''https://getcomposer.org/installer'\'', '\''composer-setup.php'\'');"
|
||||
php composer-setup.php --quiet
|
||||
php -r "unlink('\''composer-setup.php'\'');"
|
||||
fi
|
||||
'
|
||||
|
||||
# 2. Run composer install against the specified directory
|
||||
docker compose exec "$SERVICE_NAME" bash -c "
|
||||
COMPOSER_CMD=\$(command -v composer || echo \"php \$(pwd)/composer.phar\")
|
||||
TARGET_DIR=\"$COMPOSER_DIR\"
|
||||
|
||||
if [ -f \"\$TARGET_DIR/composer.lock\" ] || [ -f \"\$TARGET_DIR/composer.json\" ]; then
|
||||
\$COMPOSER_CMD install --working-dir=\"\$TARGET_DIR\" --no-interaction --prefer-dist --quiet
|
||||
else
|
||||
echo \"Error: Neither composer.json nor composer.lock found in '\$TARGET_DIR'.\" >&2
|
||||
exit 1
|
||||
fi
|
||||
"
|
||||
|
||||
echo "Konfiguriere Redis..."
|
||||
|
||||
# 2. Set password in the currently running Redis container
|
||||
docker compose exec redis redis-cli CONFIG SET requirepass "$REDIS_PASSWORD"
|
||||
|
||||
PASSWORD_KEY=openssl rand -base64 32
|
||||
|
||||
cat <<EOF > config/.env.pw-encryption-key
|
||||
PW_ENCRYPTION_KEY=$PASSWORD_KEY
|
||||
EOF
|
||||
|
||||
echo "------------------------------------------------------"
|
||||
echo "Setup Complete!"
|
||||
echo "Admin Plain Keyword: $KEYWORD"
|
||||
echo "------------------------------------------------------"
|
||||
@@ -0,0 +1,27 @@
|
||||
FROM php:8.5-apache
|
||||
|
||||
# Enable Apache rewrite module
|
||||
RUN a2enmod rewrite
|
||||
|
||||
# Install system dependencies, PHP extensions, and clean up apt cache
|
||||
RUN apt-get update && apt-get install -y \
|
||||
unzip \
|
||||
libzip-dev \
|
||||
libicu-dev \
|
||||
git \
|
||||
&& docker-php-ext-install \
|
||||
bcmath \
|
||||
mysqli \
|
||||
pdo_mysql \
|
||||
zip \
|
||||
intl \
|
||||
&& pecl install redis \
|
||||
&& docker-php-ext-enable redis \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Update Apache DocumentRoot to /var/www/wkvs/html/ and enable .htaccess overrides
|
||||
ENV APACHE_DOCUMENT_ROOT=/var/www/wkvs/html/
|
||||
|
||||
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf \
|
||||
&& sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf \
|
||||
&& sed -i 's/AllowOverride None/AllowOverride All/g' /etc/apache2/apache2.conf
|
||||
@@ -0,0 +1,335 @@
|
||||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||
START TRANSACTION;
|
||||
SET time_zone = "+00:00";
|
||||
|
||||
-- --------------------------------------------------------
|
||||
-- Tabellenstruktur für Tabelle `audiofiles`
|
||||
-- --------------------------------------------------------
|
||||
|
||||
CREATE TABLE `audiofiles` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`file_name` varchar(1024) NOT NULL,
|
||||
`file_path` varchar(1024) NOT NULL,
|
||||
`edited_by` int(11) DEFAULT NULL,
|
||||
`timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
-- Tabellenstruktur für Tabelle `disziplinen`
|
||||
-- --------------------------------------------------------
|
||||
|
||||
CREATE TABLE `disziplinen` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(1024) DEFAULT NULL,
|
||||
`start_index` int(11) DEFAULT NULL,
|
||||
`color_kampfrichter` char(7) NOT NULL DEFAULT '#424242',
|
||||
`audiofile` tinyint(1) DEFAULT NULL,
|
||||
`audiofile_max_duration` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
-- Tabellenstruktur für Tabelle `einmal_links`
|
||||
-- --------------------------------------------------------
|
||||
|
||||
CREATE TABLE `einmal_links` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`url` varchar(1000) DEFAULT NULL,
|
||||
`user_id` int(11) NOT NULL DEFAULT 0,
|
||||
`type` enum('login','pwreset','create_profile','') NOT NULL,
|
||||
`timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
|
||||
`expires_at` timestamp NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `url` (`url`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `before_insert_login_tokens`
|
||||
BEFORE INSERT ON `einmal_links`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
IF NEW.url IS NULL THEN
|
||||
SET NEW.url = HEX(RANDOM_BYTES(32));
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
-- Tabellenstruktur für Tabelle `gruppen`
|
||||
-- --------------------------------------------------------
|
||||
|
||||
CREATE TABLE `gruppen` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(100) NOT NULL DEFAULT 'KEIN NAME',
|
||||
`order_index` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
-- Tabellenstruktur für Tabelle `gruppen_zeiten`
|
||||
-- --------------------------------------------------------
|
||||
|
||||
CREATE TABLE `gruppen_zeiten` (
|
||||
`zeitplan_id` int(11) NOT NULL,
|
||||
`start_time` time NOT NULL,
|
||||
`end_time` time DEFAULT NULL,
|
||||
`abt_id` int(11) NOT NULL,
|
||||
UNIQUE KEY `unique_index` (`zeitplan_id`,`abt_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
-- Tabellenstruktur für Tabelle `intern_benutzende`
|
||||
-- --------------------------------------------------------
|
||||
|
||||
CREATE TABLE `intern_benutzende` (
|
||||
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`username` varchar(191) DEFAULT NULL,
|
||||
`name_person` varchar(255) DEFAULT NULL,
|
||||
`password_hash` varchar(255) DEFAULT NULL,
|
||||
`password_cipher` text DEFAULT NULL,
|
||||
`created_at` datetime NOT NULL DEFAULT current_timestamp(),
|
||||
`updated_at` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
||||
`edited_by` varchar(20) NOT NULL DEFAULT '0',
|
||||
`freigabe` varchar(500) NOT NULL DEFAULT 'keine',
|
||||
`login_active` tinyint(1) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `username_page_unique` (`username`,`password_hash`) USING BTREE,
|
||||
KEY `indexFreigabe` (`freigabe`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
-- Admin Seed Entry (Uses Argon2id placeholder for replacement via bash sed script)
|
||||
INSERT INTO `intern_benutzende` (`username`, `password_hash`, `password_cipher`, `freigabe`, `login_active`)
|
||||
VALUES ('admin', '__ARGON_HASH_PLACEHOLDER__', 'not_set', '{"types":["wk_leitung","trainer","kampfrichter"],"freigabenTrainer":["admin"],"freigabenKampfrichter":["A"]}', 1);
|
||||
|
||||
-- --------------------------------------------------------
|
||||
-- Tabellenstruktur für Tabelle `kategorien`
|
||||
-- --------------------------------------------------------
|
||||
|
||||
CREATE TABLE `kategorien` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`programm` text NOT NULL,
|
||||
`order_index` int(11) DEFAULT NULL,
|
||||
`preis` decimal(10,2) DEFAULT 0.00,
|
||||
`aktiv` tinyint(1) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
-- Tabellenstruktur für Tabelle `tabellen_konfiguration`
|
||||
-- --------------------------------------------------------
|
||||
|
||||
CREATE TABLE `tabellen_konfiguration` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`type_slug` varchar(128) NOT NULL,
|
||||
`json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`json`)),
|
||||
`all_noten_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`all_noten_json`)),
|
||||
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
|
||||
`updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
||||
`created_by` int(11) DEFAULT NULL,
|
||||
`updated_by` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `unique_slug` (`type_slug`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
-- Tabellenstruktur für Tabelle `teilnehmende`
|
||||
-- --------------------------------------------------------
|
||||
|
||||
CREATE TABLE `teilnehmende` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`wk_id` int(11) DEFAULT NULL,
|
||||
`name` text NOT NULL,
|
||||
`vorname` text NOT NULL,
|
||||
`geburtsdatum` date NOT NULL,
|
||||
`programm` text NOT NULL,
|
||||
`verein` text NOT NULL,
|
||||
`bezahlt` int(11) NOT NULL DEFAULT 1,
|
||||
`bezahltoverride` int(11) NOT NULL DEFAULT 0,
|
||||
`betrag_bezahlt` decimal(12,2) NOT NULL DEFAULT 0.00,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `wk_index` (`wk_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
-- Tabellenstruktur für Tabelle `teilnehmende_audiofiles`
|
||||
-- --------------------------------------------------------
|
||||
|
||||
CREATE TABLE `teilnehmende_audiofiles` (
|
||||
`person_id` int(7) NOT NULL,
|
||||
`geraet_id` int(7) NOT NULL,
|
||||
`audiofile_id` int(7) NOT NULL,
|
||||
UNIQUE KEY `unique_combo` (`person_id`,`geraet_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
-- Tabellenstruktur für Tabelle `teilnehmende_gruppen`
|
||||
-- --------------------------------------------------------
|
||||
|
||||
CREATE TABLE `teilnehmende_gruppen` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`turnerin_id` int(11) NOT NULL,
|
||||
`abteilung_id` int(11) NOT NULL,
|
||||
`geraet_id` int(11) NOT NULL,
|
||||
`turnerin_index` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `unique_turnerin` (`turnerin_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
-- Tabellenstruktur für Tabelle `variables`
|
||||
-- --------------------------------------------------------
|
||||
|
||||
CREATE TABLE `variables` (
|
||||
`name` varchar(255) NOT NULL DEFAULT 'NaN',
|
||||
`value` varchar(255) DEFAULT NULL,
|
||||
UNIQUE KEY `uniqueIndex` (`name`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
-- Tabellenstruktur für Tabelle `verbuchte_startgebueren`
|
||||
-- --------------------------------------------------------
|
||||
|
||||
CREATE TABLE `verbuchte_startgebueren` (
|
||||
`order_id` int(11) NOT NULL,
|
||||
`order_type` varchar(100) DEFAULT NULL,
|
||||
`preis` float DEFAULT NULL,
|
||||
`user_id` int(11) NOT NULL,
|
||||
`item_ids` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`item_ids`)),
|
||||
`used_verein_konten` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
|
||||
`order_status` int(11) NOT NULL DEFAULT 0,
|
||||
`timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
|
||||
`edited_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
||||
PRIMARY KEY (`order_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
-- Tabellenstruktur für Tabelle `verbuchte_startgebueren_log`
|
||||
-- --------------------------------------------------------
|
||||
|
||||
CREATE TABLE `verbuchte_startgebueren_log` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`order_id` int(11) NOT NULL,
|
||||
`old_order_status` int(11) NOT NULL,
|
||||
`new_order_status` int(11) NOT NULL,
|
||||
`edited_by` int(11) NOT NULL,
|
||||
`edited_at` timestamp NOT NULL DEFAULT current_timestamp(),
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
-- Tabellenstruktur für Tabelle `vereine`
|
||||
-- --------------------------------------------------------
|
||||
|
||||
CREATE TABLE `vereine` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`verein` text NOT NULL,
|
||||
`email` varchar(100) NOT NULL DEFAULT 'forms@testseite-fh.ch',
|
||||
`konto` decimal(12,2) NOT NULL DEFAULT 0.00,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `indexturnerinnen` (`id`,`verein`(31))
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
-- Tabellenstruktur für Tabelle `warenkorb_startgebueren`
|
||||
-- --------------------------------------------------------
|
||||
|
||||
CREATE TABLE `warenkorb_startgebueren` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`user_id` bigint(20) UNSIGNED NOT NULL,
|
||||
`item_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `basket_items_ibfk_1` (`user_id`),
|
||||
KEY `basket_items_ibfk_2` (`item_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
-- Tabellenstruktur für Tabelle `wertungen`
|
||||
-- --------------------------------------------------------
|
||||
|
||||
CREATE TABLE `wertungen` (
|
||||
`person_id` int(11) NOT NULL,
|
||||
`note_bezeichnung_id` int(11) NOT NULL,
|
||||
`geraet_id` int(11) NOT NULL,
|
||||
`wk_id` int(11) NOT NULL,
|
||||
`run_number` tinyint(3) NOT NULL DEFAULT 1,
|
||||
`value` float DEFAULT NULL,
|
||||
`is_public` tinyint(1) DEFAULT NULL,
|
||||
`public_value` float DEFAULT NULL,
|
||||
`timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
|
||||
UNIQUE KEY `uniquePersonNoteJahrGereat` (`person_id`,`note_bezeichnung_id`,`wk_id`,`geraet_id`,`run_number`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
-- Tabellenstruktur für Tabelle `wertungen_log`
|
||||
-- --------------------------------------------------------
|
||||
|
||||
CREATE TABLE `wertungen_log` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`person_id` int(11) NOT NULL,
|
||||
`note_bezeichnung_id` int(11) NOT NULL,
|
||||
`geraet_id` int(11) NOT NULL,
|
||||
`wk_id` int(11) NOT NULL,
|
||||
`run_number` tinyint(3) NOT NULL DEFAULT 1,
|
||||
`old_value` float DEFAULT NULL,
|
||||
`new_value` float DEFAULT NULL,
|
||||
`edited_by` int(11) NOT NULL,
|
||||
`timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
-- Tabellenstruktur für Tabelle `wertungstypen`
|
||||
-- --------------------------------------------------------
|
||||
|
||||
CREATE TABLE `wertungstypen` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`default_value` float DEFAULT NULL,
|
||||
`type` enum('input','berechnung') NOT NULL DEFAULT 'input',
|
||||
`berechnung` varchar(255) DEFAULT NULL,
|
||||
`berechnung_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`berechnung_json`)),
|
||||
`max_value` float DEFAULT NULL,
|
||||
`min_value` float DEFAULT NULL,
|
||||
`pro_geraet` tinyint(1) NOT NULL DEFAULT 1,
|
||||
`anzahl_laeufe_json` text DEFAULT NULL,
|
||||
`geraete_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT '[]',
|
||||
`zeige_auf_rangliste` float DEFAULT NULL,
|
||||
`groesse_auf_rangliste` int(11) NOT NULL DEFAULT 0,
|
||||
`nullstellen` int(11) NOT NULL DEFAULT 2,
|
||||
`display_string` varchar(63) NOT NULL DEFAULT '${note}',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uniqueName` (`name`) USING BTREE,
|
||||
KEY `indexMaxValue` (`max_value`),
|
||||
KEY `indexMinValue` (`min_value`),
|
||||
KEY `indexBerechnungJson` (`berechnung_json`(768)),
|
||||
KEY `indexDefaultValue` (`default_value`),
|
||||
KEY `indexType` (`type`),
|
||||
KEY `indexNullstellen` (`nullstellen`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
-- Tabellenstruktur für Tabelle `wettkaempfe`
|
||||
-- --------------------------------------------------------
|
||||
|
||||
CREATE TABLE `wettkaempfe` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(256) NOT NULL,
|
||||
`slug` varchar(64) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `slug` (`slug`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
-- Tabellenstruktur für Tabelle `zeitplan_types`
|
||||
-- --------------------------------------------------------
|
||||
|
||||
CREATE TABLE `zeitplan_types` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(2048) NOT NULL,
|
||||
`has_endtime` tinyint(1) DEFAULT NULL,
|
||||
`display_index` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||
|
||||
COMMIT;
|
||||
@@ -0,0 +1,51 @@
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
# Dynamically set Connection header (handles 'upgrade' and 'Upgrade')
|
||||
map $http_upgrade $connection_upgrade {
|
||||
default upgrade;
|
||||
'' close;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
|
||||
# Standard HTTP Proxy to Apache
|
||||
location / {
|
||||
proxy_pass http://apache:80;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
# WebSocket Proxy to Node
|
||||
location /ws/ {
|
||||
# Note: Add trailing slash if you want Nginx to strip '/ws/' before reaching Node
|
||||
proxy_pass http://node:8082/;
|
||||
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade; # Dynamic connection header
|
||||
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
# Keep-alive settings for long-lived WebSocket connections
|
||||
proxy_read_timeout 36000s;
|
||||
proxy_send_timeout 36000s;
|
||||
proxy_connect_timeout 75s;
|
||||
}
|
||||
|
||||
# Block access to hidden files (.htaccess, .git, .env, etc.)
|
||||
location ~ /\. {
|
||||
deny all;
|
||||
access_log off;
|
||||
log_not_found off;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
FROM node:20-alpine
|
||||
|
||||
WORKDIR /var/www/wkvs/websocket
|
||||
|
||||
# Install pm2 globally
|
||||
RUN npm install -g pm2
|
||||
|
||||
# Copy package files from the websocket folder
|
||||
COPY websocket/package*.json ./
|
||||
|
||||
# Install dependencies strictly following lockfile
|
||||
RUN npm ci
|
||||
|
||||
# Copy the rest of the application source code from websocket folder
|
||||
COPY websocket/ ./
|
||||
|
||||
# Change ownership to the non-root node user for security
|
||||
RUN chown -R node:node /var/www/wkvs/websocket
|
||||
USER node
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
CMD ["pm2-runtime", "start", "index.js"]
|
||||
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user