From 1089d57adfec8212c94f48a90658d632ab66aca4 Mon Sep 17 00:00:00 2001 From: Sergey Paramoshkin Date: Sun, 7 Dec 2025 10:58:24 +0300 Subject: [PATCH] fix owner and dirs --- CLAUDE.md | 75 +++++++++++++++++++++++++++++++++++++++ configs/php/entrypoint.sh | 11 ++++++ docker-compose.yml | 3 ++ 3 files changed, 89 insertions(+) create mode 100644 CLAUDE.md create mode 100644 configs/php/entrypoint.sh diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..e9ec23c --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,75 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Overview + +This is a Docker Compose infrastructure configuration repository for the **staging** environment of the dot-dot.ru platform. It contains service configurations, environment files, and deployment scripts. + +## Common Commands + +All commands are run via `./app.sh`: + +```bash +./app.sh up # Start all services (docker compose up -d + nginx reload) +./app.sh down # Stop all services +./app.sh init # Initialize environment (requires backup in backups/) +./app.sh db # Open MySQL shell +./app.sh console # Run Symfony console command +./app.sh composer # Run composer in PHP container +./app.sh psalm # Run static analysis +./app.sh php-fixer # Run code style fixer +./app.sh deptrac # Run dependency analysis +./app.sh tests # Run test suite +./app.sh restore-db # Restore database from S3 backup +./app.sh purge-db # Drop and recreate database +``` + +## Architecture + +### Services (docker-compose.yml) + +- **backend/php**: Main PHP application (Symfony) with multiple message consumers +- **db**: MariaDB 10.3 database +- **nginx**: Reverse proxy with SSL termination +- **rabbitmq**: Message broker for async processing +- **redis**: Caching layer +- **centrifugo**: WebSocket server for real-time updates +- **lms**: Learning Management System (Node.js) +- **admin**: Admin panel (PHP) +- **cabinet**: Cargo carrier cabinet (Node.js) +- **landing-ttl**: Landing page service +- **1c-view**: 1C integration viewer + +### Message Consumers + +The PHP application runs several Symfony Messenger consumers as separate containers: +- StatisticExport, OrderImport, ReconciliationAct, WSOrderStateUpdate +- UserTrust, SyncAuctions, SyncCarriers, SyncChangeData + +### Configuration Structure + +``` +configs/ +├── nginx/ # Nginx configs and SSL certificates +├── php/ # PHP-FPM config and .env.local +├── rabbitmq/ # RabbitMQ config and definitions +├── lms/ # LMS environment and entrypoint +├── admin/ # Admin panel config +├── cabinet/ # Carrier cabinet config +├── centrifugo/ # WebSocket server config +└── signer/ # Digital signature service (currently disabled) +``` + +### Environment + +- Main environment variables are in `.env` +- Service image tags are controlled via `dotdot_tag`, `LMS_TAG`, `ADMIN_TAG`, etc. +- Network name: `staging` +- MySQL port exposed on: `33067` + +### Key Files + +- `.env` - Main environment variables and service tags +- `docker-compose.yml` - Service definitions with YAML anchors (`x-defaults-php`) +- `configs/php/.env.local` - PHP application environment diff --git a/configs/php/entrypoint.sh b/configs/php/entrypoint.sh new file mode 100644 index 0000000..dbc0e6c --- /dev/null +++ b/configs/php/entrypoint.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +# Create required directories +mkdir -p /application/var/cache +mkdir -p /application/var/log +mkdir -p /application/var/documents + +# Fix ownership (www-data uid=33 in php image) +chown -R www-data:www-data /application/var + +exec "$@" diff --git a/docker-compose.yml b/docker-compose.yml index 6012799..12f936d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,9 +13,11 @@ volumes: x-defaults-php: &defaults-php image: registry.dot-dot.ru/dot-dot:${dotdot_tag} restart: unless-stopped + entrypoint: /entrypoint.sh volumes: - ./configs/php/.env.local:/application/.env.local - ./configs/php/zz-docker.conf:/usr/local/etc/php-fpm.d/zz-docker.conf + - ./configs/php/entrypoint.sh:/entrypoint.sh - php_var_volume:/application/var - php_support_volume:/application/var/support-issue - ./configs/php/www.conf:/usr/local/etc/php-fpm.d/www.conf @@ -68,6 +70,7 @@ services: backend: <<: *defaults-php + command: php-fpm php: command: ./bin/console app:auction:reload