From 65859bd87fe115cbe7ab3c345b8767e22fdd174d Mon Sep 17 00:00:00 2001 From: hakutaku <39969709+allhaileris@users.noreply.github.com> Date: Tue, 23 Sep 2025 19:15:07 +0300 Subject: [PATCH] wip --- .dev/rabbitmq.conf | 20 ---- .dockerignore | 1 + .env | 7 +- .idea/php.xml | 96 +++++++++---------- .idea/runConfigurations/Cache_clear.xml | 17 ++++ .idea/runConfigurations/Composer_install.xml | 17 ++++ .idea/runConfigurations/Roadrunner.xml | 17 ++++ .../runConfigurations/Roadrunner_install.xml | 17 ++++ .idea/runConfigurations/Run_services.xml | 11 +++ .idea/symfony-skeleton.iml | 96 +++++++++---------- .rr.dev.yaml | 24 +---- README.MD | 2 + compose.yaml | 32 +++++-- composer.json | 3 +- shell.nix | 25 ----- 15 files changed, 214 insertions(+), 171 deletions(-) delete mode 100644 .dev/rabbitmq.conf create mode 100644 .idea/runConfigurations/Cache_clear.xml create mode 100644 .idea/runConfigurations/Composer_install.xml create mode 100644 .idea/runConfigurations/Roadrunner.xml create mode 100644 .idea/runConfigurations/Roadrunner_install.xml create mode 100644 .idea/runConfigurations/Run_services.xml create mode 100644 README.MD diff --git a/.dev/rabbitmq.conf b/.dev/rabbitmq.conf deleted file mode 100644 index 5b2b7ea..0000000 --- a/.dev/rabbitmq.conf +++ /dev/null @@ -1,20 +0,0 @@ -## Networking -listeners.tcp.default = 5672 -listeners.tcp.1 = 127.0.0.1:5672 - -## Management Plugin -management.tcp.port = 15672 -management.tcp.ip = 127.0.0.1 - -## Authentication and Authorization -auth_mechanisms.1 = PLAIN -auth_mechanisms.2 = AMQPLAIN -default_user = guest -default_pass = guest - -## Logging -log.console = true - -## Resource Limits -vm_memory_high_watermark.relative = 0.4 -disk_free_limit.relative = 1.0 diff --git a/.dockerignore b/.dockerignore index 467724c..c2eb71d 100644 --- a/.dockerignore +++ b/.dockerignore @@ -15,3 +15,4 @@ Dockerfile Makefile phpunit.dist.xml shell.nix +rr diff --git a/.env b/.env index ff4afdc..74da3a6 100644 --- a/.env +++ b/.env @@ -2,5 +2,10 @@ APP_ENV=dev APP_SECRET= APP_DOCKER_TAG="symfony-skeleton" -DATABASE_URL="postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=16&charset=utf8" +# postgres +POSTGRES_DB=db +POSTGRES_USER=user +POSTGRES_PASSWORD=password + +DATABASE_URL="postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@127.0.0.1:5432/${POSTGRES_DB}?serverVersion=17&charset=utf8" MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages diff --git a/.idea/php.xml b/.idea/php.xml index 7f4d4bc..c2dd7bf 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -19,54 +19,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -140,6 +92,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.idea/runConfigurations/Cache_clear.xml b/.idea/runConfigurations/Cache_clear.xml new file mode 100644 index 0000000..951ce81 --- /dev/null +++ b/.idea/runConfigurations/Cache_clear.xml @@ -0,0 +1,17 @@ + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/Composer_install.xml b/.idea/runConfigurations/Composer_install.xml new file mode 100644 index 0000000..ba93603 --- /dev/null +++ b/.idea/runConfigurations/Composer_install.xml @@ -0,0 +1,17 @@ + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/Roadrunner.xml b/.idea/runConfigurations/Roadrunner.xml new file mode 100644 index 0000000..01d74b7 --- /dev/null +++ b/.idea/runConfigurations/Roadrunner.xml @@ -0,0 +1,17 @@ + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/Roadrunner_install.xml b/.idea/runConfigurations/Roadrunner_install.xml new file mode 100644 index 0000000..e85d6f6 --- /dev/null +++ b/.idea/runConfigurations/Roadrunner_install.xml @@ -0,0 +1,17 @@ + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/Run_services.xml b/.idea/runConfigurations/Run_services.xml new file mode 100644 index 0000000..b4ba413 --- /dev/null +++ b/.idea/runConfigurations/Run_services.xml @@ -0,0 +1,11 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/symfony-skeleton.iml b/.idea/symfony-skeleton.iml index ea290d7..4a1f732 100644 --- a/.idea/symfony-skeleton.iml +++ b/.idea/symfony-skeleton.iml @@ -6,54 +6,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -127,6 +79,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.rr.dev.yaml b/.rr.dev.yaml index d38357c..d1be323 100644 --- a/.rr.dev.yaml +++ b/.rr.dev.yaml @@ -31,25 +31,11 @@ logs: level: debug service: - postgres: - command: "postgres -D .data/postgres" # The command to execute - service_name_in_log: true - processNum: 1 # Number of processes to run - execTimeout: 0 # Execution timeout (0 for no timeout) - remainAfterExit: false # Whether to keep the service running after exit - env: - APP_ENV: "production" - rabbitmq: - command: "rabbitmq-server" # The command to execute - service_name_in_log: true - processNum: 1 # Number of processes to run - execTimeout: 0 # Execution timeout (0 for no timeout) - remainAfterExit: false # Whether to keep the service running after exit - env: - APP_ENV: "production" messenger: - command: "./messenger.sh" + command: "php bin/console messenger:consume async -vvvv" service_name_in_log: true processNum: 1 - execTimeout: 0 # Execution timeout (0 for no timeout) - remainAfterExit: false # Whether to keep the service running after exit + execTimeout: 0 + remainAfterExit: false + env: + APP_ENV: "dev" diff --git a/README.MD b/README.MD new file mode 100644 index 0000000..d053f5a --- /dev/null +++ b/README.MD @@ -0,0 +1,2 @@ +1. ```composer i``` +2. ```vendor/bin/rr get``` diff --git a/compose.yaml b/compose.yaml index c9f77d2..5268add 100644 --- a/compose.yaml +++ b/compose.yaml @@ -1,10 +1,26 @@ services: - - php-roadrunner: - container_name: ${APP_DOCKER_TAG} - platform: linux/amd64 - image: ${APP_DOCKER_TAG} - volumes: - - .:/opt/app:rw + postgres: + image: postgres:17-alpine + environment: + POSTGRES_DB: ${POSTGRES_DB} + POSTGRES_USER: ${POSTGRES_USER} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} ports: - - "8000:8000" + - "127.0.0.1:5432:5432" + healthcheck: + test: [ "CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}" ] + interval: 10s + retries: 5 + start_period: 30s + timeout: 10s + volumes: + - ${PWD}/.data/postgres:/var/lib/postgresql/data + restart: unless-stopped + redis: + image: redis:8.2 + ports: + - "127.0.0.1:6379:6379" + volumes: + - ${PWD}/.data/redis:/data + command: redis-server --appendonly yes # Starts Redis with AOF persistence enabled + restart: unless-stopped diff --git a/composer.json b/composer.json index 27b67b8..c77a706 100644 --- a/composer.json +++ b/composer.json @@ -69,8 +69,7 @@ "assets:install %PUBLIC_DIR%": "symfony-cmd" }, "post-install-cmd": [ - "@auto-scripts", - "vendor/bin/rr get --location bin/" + "@auto-scripts" ], "post-update-cmd": [ "@auto-scripts" diff --git a/shell.nix b/shell.nix index 9cba915..0606ba0 100644 --- a/shell.nix +++ b/shell.nix @@ -1,6 +1,5 @@ let nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-25.05"; - postgresDirectory = ".data/postgres"; pkgs = import nixpkgs { config = { }; @@ -23,8 +22,6 @@ let ); in [ - pkgs.postgresql_16 - pkgs.rabbitmq-server pkgs.nixfmt-rfc-style pkgs.gnumake phpForRuntimeWithXDebug @@ -35,26 +32,4 @@ let in pkgs.mkShell { inherit packages; - - shellHook = '' - export COMPOSER_CACHE_DIR=$(pwd)/var/cache/composer - export RABBITMQ_CONFIG_FILE=$(pwd)/.dev/rabbitmq.conf - export RABBITMQ_MNESIA_BASE=$(pwd)/.data/rabbitmq - export RABBITMQ_LOGS=$(pwd)/var/log/rabbitmq.log - - mkdir -p $(pwd)/var/cache/composer - - if [ ! -d $(pwd)/var/log ]; then - mkdir -p $(pwd)/var/log - fi - - # https://yannesposito.com/posts/0024-replace-docker-compose-with-nix-shell/index.html - if [ ! -d ${postgresDirectory} ]; then - mkdir -p ${postgresDirectory} - initdb -D ${postgresDirectory} - pg_ctl -D ${postgresDirectory} -l $(pwd)/var/log/postgres.log -o "--unix_socket_directories='$PWD'" start - createdb app - pg_ctl -D ${postgresDirectory} stop - fi - ''; }