diff --git a/.gitignore b/.gitignore index 3171908..0b99039 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.env src/.env src/.env.local src/.env.development @@ -13,5 +14,3 @@ src/storage/framework/views/ src/bootstrap/cache/ db_data/ *.log -.env -src/.env diff --git a/docker-compose.local.yml b/docker-compose.local.yml index 01f0c11..e5398c5 100644 --- a/docker-compose.local.yml +++ b/docker-compose.local.yml @@ -5,7 +5,7 @@ services: image: mariadb:11 container_name: nexxo_db restart: unless-stopped - env_file: .env + env_file: src/.env.development environment: MARIADB_DATABASE: ${DB_DATABASE} MARIADB_USER: ${DB_USERNAME} diff --git a/docker-compose.staging.yml b/docker-compose.staging.yml new file mode 100644 index 0000000..e9c9af3 --- /dev/null +++ b/docker-compose.staging.yml @@ -0,0 +1,168 @@ +services: + db: + networks: + - nexxo + image: mariadb:11 + container_name: nexxo_db + restart: unless-stopped + env_file: src/.env + environment: + MARIADB_DATABASE: ${DB_DATABASE} + MARIADB_USER: ${DB_USERNAME} + MARIADB_PASSWORD: ${DB_PASSWORD} + MARIADB_ROOT_PASSWORD: ${DB_ROOT_PASSWORD} + ports: + - "3306:3306" + volumes: + - ./db_data:/var/lib/mysql + healthcheck: + test: ["CMD-SHELL", "mariadb-admin ping -h localhost -u root -p$$MARIADB_ROOT_PASSWORD || exit 1"] + interval: 5s + timeout: 5s + retries: 20 + start_period: 20s + + app: + networks: + - nexxo + build: + context: . + dockerfile: docker/php/Dockerfile + args: + UID: 1000 + GID: 1000 + image: nexxo-php + container_name: nexxo_app + restart: unless-stopped + working_dir: /var/www/html + volumes: + - ./src:/var/www/html + env_file: src/.env + environment: + DB_HOST: db + REDIS_HOST: redis + XDG_CONFIG_HOME: /tmp + PSYSH_CONFIG_DIR: /tmp/psysh + depends_on: + db: + condition: service_healthy + + web: + networks: + - nexxo + image: nginx:alpine + container_name: nexxo_web + restart: unless-stopped + ports: + - "80:80" + volumes: + - ./src:/var/www/html:ro + - ./docker/nginx/staging.conf:/etc/nginx/conf.d/default.conf:ro + depends_on: + - app + + redis: + networks: + - nexxo + image: redis:7-alpine + container_name: nexxo_redis + restart: unless-stopped + ports: + - "127.0.0.1:6379:6379" + command: ["redis-server", "--appendonly", "yes"] + + mail-worker: + networks: + - nexxo + image: nexxo-php + container_name: nexxo_mail_worker + restart: unless-stopped + env_file: src/.env + volumes: + - ./src:/var/www/html + working_dir: /var/www/html + command: php artisan app:process-mail-queue + depends_on: + db: + condition: service_healthy + + worker: + networks: + - nexxo + image: nexxo-php + container_name: nexxo_worker + restart: unless-stopped + env_file: src/.env + volumes: + - ./src:/var/www/html + working_dir: /var/www/html + command: php artisan queue:work --sleep=1 --tries=3 --timeout=120 + depends_on: + db: + condition: service_healthy + redis: + condition: service_started + + scheduler: + image: nexxo-php + container_name: nexxo_scheduler + restart: unless-stopped + networks: + - nexxo + volumes: + - ./src:/var/www/html + env_file: src/.env + environment: + DB_HOST: db + REDIS_HOST: redis + command: > + sh -c ' + until nc -z db 3306; do sleep 1; done; + php artisan schedule:work + ' + depends_on: + - db + + reverb: + networks: + - nexxo + image: nexxo-php + container_name: nexxo_reverb + command: php artisan reverb:start --host=0.0.0.0 --port=8080 + env_file: src/.env + ports: + - "8080:8080" + restart: unless-stopped + volumes: + - ./src:/var/www/html + depends_on: + - redis + + ntfy: + image: binwiederhier/ntfy + container_name: nexxo_ntfy + restart: unless-stopped + ports: + - "8082:80" + volumes: + - ./docker/ntfy/cache:/var/cache/ntfy + - ./docker/ntfy/config:/etc/ntfy + command: + - serve + + + horizon: + networks: + - nexxo + image: nexxo-php + container_name: nexxo_horizon + command: php artisan horizon + env_file: src/.env + volumes: + - ./src:/var/www/html + depends_on: + - redis + +networks: + nexxo: + driver: bridge diff --git a/docker-compose.yml b/docker-compose.yml index 84fb344..9b64b4c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,7 @@ services: image: mariadb:11 container_name: nexxo_db restart: unless-stopped - env_file: .env + env_file: src/.env environment: MARIADB_DATABASE: ${DB_DATABASE} MARIADB_USER: ${DB_USERNAME} @@ -39,6 +39,7 @@ services: working_dir: /var/www/html volumes: - ./src:/var/www/html + env_file: src/.env environment: DB_HOST: db REDIS_HOST: redis @@ -78,7 +79,7 @@ services: image: nexxo-php container_name: nexxo_mail_worker restart: unless-stopped - env_file: .env # 🔥 DAS HIER + env_file: src/.env volumes: - ./src:/var/www/html working_dir: /var/www/html @@ -93,7 +94,7 @@ services: image: nexxo-php container_name: nexxo_worker restart: unless-stopped - env_file: .env # 🔥 auch hier + env_file: src/.env volumes: - ./src:/var/www/html working_dir: /var/www/html @@ -112,6 +113,7 @@ services: - nexxo volumes: - ./src:/var/www/html + env_file: src/.env environment: DB_HOST: db REDIS_HOST: redis @@ -129,6 +131,7 @@ services: image: nexxo-php container_name: nexxo_reverb command: php artisan reverb:start --host=0.0.0.0 --port=8080 + env_file: src/.env ports: - "8080:8080" restart: unless-stopped @@ -156,6 +159,7 @@ services: image: nexxo-php container_name: nexxo_horizon command: php artisan horizon + env_file: src/.env volumes: - ./src:/var/www/html depends_on: @@ -163,4 +167,4 @@ services: networks: nexxo: - driver: bridge \ No newline at end of file + driver: bridge diff --git a/docker/nginx/staging.conf b/docker/nginx/staging.conf new file mode 100644 index 0000000..d2e10ed --- /dev/null +++ b/docker/nginx/staging.conf @@ -0,0 +1,59 @@ +server { + listen 80; + server_name app.staging.aziros.com + api.staging.aziros.com + connect.staging.aziros.com + www.staging.aziros.com + socket.staging.aziros.com + 10.10.90.103; + + root /var/www/html/public; + index index.php index.html; + + client_max_body_size 20M; + + access_log /var/log/nginx/access.log; + error_log /var/log/nginx/error.log; + + # Hauptrouting (Laravel) + location / { + try_files $uri $uri/ /index.php?$query_string; + } + + location ^~ /livewire { + try_files $uri $uri/ /index.php?$query_string; + } + + # PHP Handling + location ~ \.php$ { + try_files $uri =404; + + 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; + + fastcgi_param HTTPS on; + fastcgi_param HTTP_X_FORWARDED_PROTO https; + } + + # Security + location ~ /\.ht { + deny all; + } + + # Optional: favicon / robots + location = /favicon.ico { access_log off; log_not_found off; } + location = /robots.txt { access_log off; log_not_found off; } + +} + +# Default Block (alles andere droppen) +server { + listen 80 default_server; + server_name _; + return 444; +} diff --git a/src/.env.example b/src/.env.example index c3217b9..c797eac 100644 --- a/src/.env.example +++ b/src/.env.example @@ -34,6 +34,11 @@ DB_PORT=3306 DB_DATABASE=nexxo DB_USERNAME=nexxo DB_PASSWORD= +DB_ROOT_PASSWORD= +MARIADB_DATABASE=nexxo +MARIADB_USER=nexxo +MARIADB_PASSWORD= +MARIADB_ROOT_PASSWORD= SESSION_DRIVER=redis SESSION_LIFETIME=120