This commit is contained in:
Torsten Schneider 2026-04-03 17:31:33 +02:00
parent e003ae1bce
commit 0fda05bd95
11 changed files with 245 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
.DS_Store

View file

@ -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

4
tippspiel2/.env Normal file
View file

@ -0,0 +1,4 @@
#DOCKER_DEFAULT_PLATFORM=linux/amd64
DB_DATABASE=pf2_db
DB_PASSWORD=pf2_password
DB_USERNAME=pf2_user

35
tippspiel2/Dockerfile.dev Normal file
View file

@ -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

View file

@ -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;

View file

@ -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

View file

@ -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'@'%';

View file

@ -0,0 +1,4 @@
[mysqld]
general_log = 1
general_log_file = /var/lib/mysql/general.log

View file

@ -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;
}
}

4
tippspiel2/env_local Normal file
View file

@ -0,0 +1,4 @@
#DOCKER_DEFAULT_PLATFORM=linux/amd64
DB_DATABASE=pf2_db
DB_PASSWORD=pf2_password
DB_USERNAME=pf2_user

View file

@ -0,0 +1 @@
<?php phpinfo();