From 0fda05bd95751361e50fa755d32a7d7bbaf1e56d Mon Sep 17 00:00:00 2001 From: Torsten Schneider Date: Fri, 3 Apr 2026 17:31:33 +0200 Subject: [PATCH] ... --- .gitignore | 1 + prompts/table_structure.txt | 49 +++++++++++++++ tippspiel2/.env | 4 ++ tippspiel2/Dockerfile.dev | 35 +++++++++++ tippspiel2/create_files.sql | 60 +++++++++++++++++++ tippspiel2/docker-compose.yml | 59 ++++++++++++++++++ .../mysql/init/01-databases.sql | 7 +++ tippspiel2/docker-compose/mysql/my.cnf | 4 ++ tippspiel2/docker-compose/nginx/default.conf | 21 +++++++ tippspiel2/env_local | 4 ++ tippspiel2/public/index.php | 1 + 11 files changed, 245 insertions(+) create mode 100644 .gitignore create mode 100644 prompts/table_structure.txt create mode 100644 tippspiel2/.env create mode 100644 tippspiel2/Dockerfile.dev create mode 100644 tippspiel2/create_files.sql create mode 100644 tippspiel2/docker-compose.yml create mode 100644 tippspiel2/docker-compose/mysql/init/01-databases.sql create mode 100644 tippspiel2/docker-compose/mysql/my.cnf create mode 100644 tippspiel2/docker-compose/nginx/default.conf create mode 100644 tippspiel2/env_local create mode 100644 tippspiel2/public/index.php diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e43b0f9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store diff --git a/prompts/table_structure.txt b/prompts/table_structure.txt new file mode 100644 index 0000000..afdfedd --- /dev/null +++ b/prompts/table_structure.txt @@ -0,0 +1,49 @@ +table: users +id +lastname +email +password +is_admin +gets_reminder +iban +bankname +blz +mobile +created_at +deleted_at + +table: seasons +id +name +max_identical_jokertipps +created_at +updated_at + +table: rounds +id +name +season_id +report +created_at + +table: games +id +round_id +team1 +team2 +score1 +score2 +kickoff + +table: payments +id +season_id +user_id +paid_date + +table: quotas +id +season_id +name +order +prc diff --git a/tippspiel2/.env b/tippspiel2/.env new file mode 100644 index 0000000..fe7110c --- /dev/null +++ b/tippspiel2/.env @@ -0,0 +1,4 @@ +#DOCKER_DEFAULT_PLATFORM=linux/amd64 +DB_DATABASE=pf2_db +DB_PASSWORD=pf2_password +DB_USERNAME=pf2_user diff --git a/tippspiel2/Dockerfile.dev b/tippspiel2/Dockerfile.dev new file mode 100644 index 0000000..0c606db --- /dev/null +++ b/tippspiel2/Dockerfile.dev @@ -0,0 +1,35 @@ +FROM php:8.4-fpm + +# Arguments defined in docker-compose.yml +ARG user +ARG uid + +# Install system dependencies +RUN apt-get update && apt-get install -y \ + git \ + curl \ + libpng-dev \ + libonig-dev \ + libxml2-dev \ + zip \ + unzip \ + libzip-dev \ + mariadb-client + +# Clear cache +RUN apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install PHP extensions +RUN docker-php-ext-install zip mysqli pdo_mysql mbstring exif pcntl bcmath gd + +COPY --from=composer:latest /usr/bin/composer /usr/bin/composer + +# Create system user to run Composer and Artisan Commands +RUN useradd -G www-data,root -u $uid -d /home/$user $user +RUN mkdir -p /home/$user/.composer && \ + chown -R $user:$user /home/$user + +# Set working directory +WORKDIR /var/www + +USER $user diff --git a/tippspiel2/create_files.sql b/tippspiel2/create_files.sql new file mode 100644 index 0000000..5611bbc --- /dev/null +++ b/tippspiel2/create_files.sql @@ -0,0 +1,60 @@ +CREATE TABLE IF NOT EXISTS `users` ( + `id` INT AUTO_INCREMENT PRIMARY KEY, + `lastname` VARCHAR(255) NOT NULL, + `email` VARCHAR(255) NOT NULL UNIQUE, + `password` VARCHAR(255) NOT NULL, + `is_admin` BOOLEAN DEFAULT FALSE, + `gets_reminder` BOOLEAN DEFAULT TRUE, + `iban` VARCHAR(34), + `bankname` VARCHAR(255), + `blz` VARCHAR(11), + `mobile` VARCHAR(20), + `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + `deleted_at` TIMESTAMP NULL DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +CREATE TABLE IF NOT EXISTS `seasons` ( + `id` INT AUTO_INCREMENT PRIMARY KEY, + `name` VARCHAR(255) NOT NULL, + `max_identical_jokertipps` INT DEFAULT 1, + `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +CREATE TABLE IF NOT EXISTS `rounds` ( + `id` INT AUTO_INCREMENT PRIMARY KEY, + `name` VARCHAR(255) NOT NULL, + `season_id` INT NOT NULL, + `report` TEXT, + `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + CONSTRAINT `fk_rounds_season` FOREIGN KEY (`season_id`) REFERENCES `seasons` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +CREATE TABLE IF NOT EXISTS `games` ( + `id` INT AUTO_INCREMENT PRIMARY KEY, + `round_id` INT NOT NULL, + `team1` VARCHAR(255) NOT NULL, + `team2` VARCHAR(255) NOT NULL, + `score1` INT DEFAULT NULL, + `score2` INT DEFAULT NULL, + `kickoff` DATETIME NOT NULL, + CONSTRAINT `fk_games_round` FOREIGN KEY (`round_id`) REFERENCES `rounds` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +CREATE TABLE IF NOT EXISTS `payments` ( + `id` INT AUTO_INCREMENT PRIMARY KEY, + `season_id` INT NOT NULL, + `user_id` INT NOT NULL, + `paid_date` DATE DEFAULT NULL, + CONSTRAINT `fk_payments_season` FOREIGN KEY (`season_id`) REFERENCES `seasons` (`id`) ON DELETE CASCADE, + CONSTRAINT `fk_payments_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +CREATE TABLE IF NOT EXISTS `quotas` ( + `id` INT AUTO_INCREMENT PRIMARY KEY, + `season_id` INT NOT NULL, + `name` VARCHAR(255) NOT NULL, + `order` INT NOT NULL, + `prc` DECIMAL(5,2) NOT NULL, + CONSTRAINT `fk_quotas_season` FOREIGN KEY (`season_id`) REFERENCES `seasons` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; diff --git a/tippspiel2/docker-compose.yml b/tippspiel2/docker-compose.yml new file mode 100644 index 0000000..f046047 --- /dev/null +++ b/tippspiel2/docker-compose.yml @@ -0,0 +1,59 @@ +services: + app: + build: + args: + user: torsten + uid: 1000 + context: ./ + dockerfile: Dockerfile.dev + container_name: tippspiel-app + working_dir: /var/www/ + environment: + - COMPOSER_MEMORY_LIMIT=-1 + depends_on: + - db + volumes: + - ./:/var/www + networks: + - tippspiel-network + + db: + image: mariadb:10.11.14 + container_name: tippspiel-db + environment: + MYSQL_DATABASE: ${DB_DATABASE} + MYSQL_ROOT_PASSWORD: ${DB_PASSWORD} + MYSQL_PASSWORD: ${DB_PASSWORD} + MYSQL_USER: ${DB_USERNAME} + SERVICE_TAGS: dev + SERVICE_NAME: mysql + volumes: + - tippspiel-db-data:/var/lib/mysql + - ./docker-compose/mysql/my.cnf:/etc/mysql/my.cnf + - ./docker-compose/mysql/init:/docker-entrypoint-initdb.d + ports: + - 3307:3306 + networks: + - tippspiel-network + + nginx: + image: nginx:alpine + container_name: tippspiel-nginx + ports: + - 8005:80 + depends_on: + - db + - app + volumes: + - ./:/var/www + - ./docker-compose/nginx:/etc/nginx/conf.d/ + networks: + - tippspiel-network + +networks: + tippspiel-network: + driver: bridge + +volumes: + tippspiel-db-data: + driver: local diff --git a/tippspiel2/docker-compose/mysql/init/01-databases.sql b/tippspiel2/docker-compose/mysql/init/01-databases.sql new file mode 100644 index 0000000..c082fb8 --- /dev/null +++ b/tippspiel2/docker-compose/mysql/init/01-databases.sql @@ -0,0 +1,7 @@ +# create databases +CREATE DATABASE IF NOT EXISTS `local_laravel`; + +# create local_developer user and grant rights +CREATE USER 'local_developer'@'db' IDENTIFIED BY 'secret'; +GRANT ALL PRIVILEGES ON *.* TO 'local_developer'@'%'; + diff --git a/tippspiel2/docker-compose/mysql/my.cnf b/tippspiel2/docker-compose/mysql/my.cnf new file mode 100644 index 0000000..992792d --- /dev/null +++ b/tippspiel2/docker-compose/mysql/my.cnf @@ -0,0 +1,4 @@ +[mysqld] +general_log = 1 +general_log_file = /var/lib/mysql/general.log + diff --git a/tippspiel2/docker-compose/nginx/default.conf b/tippspiel2/docker-compose/nginx/default.conf new file mode 100644 index 0000000..dbd65ac --- /dev/null +++ b/tippspiel2/docker-compose/nginx/default.conf @@ -0,0 +1,21 @@ +server { + listen 80; + index index.php index.html; + error_log /var/log/nginx/error.log; + access_log /var/log/nginx/access.log; + root /var/www/public; + location ~ \.php$ { + try_files $uri =404; + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass app:9000; + fastcgi_index index.php; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $fastcgi_path_info; + } + location / { + try_files $uri $uri/ /index.php?$query_string; + gzip_static on; + } +} + diff --git a/tippspiel2/env_local b/tippspiel2/env_local new file mode 100644 index 0000000..fe7110c --- /dev/null +++ b/tippspiel2/env_local @@ -0,0 +1,4 @@ +#DOCKER_DEFAULT_PLATFORM=linux/amd64 +DB_DATABASE=pf2_db +DB_PASSWORD=pf2_password +DB_USERNAME=pf2_user diff --git a/tippspiel2/public/index.php b/tippspiel2/public/index.php new file mode 100644 index 0000000..c4837a3 --- /dev/null +++ b/tippspiel2/public/index.php @@ -0,0 +1 @@ +