reward
reward copied to clipboard
php-fpm Error and Incorrect reward info Status for Non-PHP Node.js Environment
## Bug Report: `php-fpm` Error and Incorrect `reward info` Status for Node.js Environment
### Description
When running `reward env up` for a Node.js + MySQL environment (non-PHP), I encounter the error: `service "php-fpm" has neither an image nor a build context specified: invalid compose project`. Running `docker compose -f .reward/reward-env.yml up -d` successfully starts the containers (`node` and `db`), but `reward info` incorrectly shows "Environment Status: Stopped" despite the containers running. This suggests issues with Reward’s handling of the `local` environment type and its state tracking.
### Steps to Reproduce
1. Initialize a new Reward environment in the project directory (`~/Sites/my-node-react`):
```bash
reward env-init node-react
- Configure the project’s
.envfile (my-node-react-project/.env):REWARD_ENV_NAME=node-react REWARD_ENV_TYPE=local REWARD_WEB_ROOT=/app/frontend TRAEFIK_DOMAIN=node-react.test TRAEFIK_SUBDOMAIN= TRAEFIK_EXTRA_HOSTS= REWARD_DB=true REWARD_ELASTICSEARCH=false REWARD_OPENSEARCH=false REWARD_OPENSEARCH_DASHBOARDS=false REWARD_VARNISH=false REWARD_RABBITMQ=false REWARD_REDIS=false REWARD_MERCURE=false MARIADB_VERSION=10.6 NODE_VERSION=20 REWARD_SYNC_ENABLED=false REWARD_SYNC_IGNORE= REWARD_ALLURE=false REWARD_SELENIUM=false REWARD_SELENIUM_DEBUG=false REWARD_BLACKFIRE=false REWARD_SPLIT_SALES=false REWARD_SPLIT_CHECKOUT=false REWARD_TEST_DB=false REWARD_MAGEPACK=false BLACKFIRE_CLIENT_ID= BLACKFIRE_CLIENT_TOKEN= BLACKFIRE_SERVER_ID= BLACKFIRE_SERVER_TOKEN= XDEBUG_VERSION= REWARD_SHELL_CONTAINER=node REWARD_SHELL_COMMAND=bash REWARD_SHELL_USER=root REWARD_PHP_ENABLED=false - Configure the project’s
.reward/reward-env.ymlfile:services: node: image: node:${NODE_VERSION:-20} ports: - "3000:3000" - "3001:3001" volumes: - ../frontend:/app/frontend - ../backend:/app/backend - /app/node_modules working_dir: /app environment: - NODE_ENV=development labels: - traefik.http.routers.${REWARD_ENV_NAME}-node.rule=Host(`${TRAEFIK_DOMAIN}`) - traefik.http.services.${REWARD_ENV_NAME}-node.loadbalancer.server.port=3000 db: image: mariadb:${MARIADB_VERSION:-10.6} ports: - "3306:3306" environment: - MYSQL_ROOT_PASSWORD=root - MYSQL_DATABASE=myapp volumes: - db_data:/var/lib/mysql volumes: db_data: - Create global
~/.reward/.envto override PHP defaults:REWARD_SHELL_CONTAINER=node REWARD_SHELL_COMMAND=bash REWARD_SHELL_USER=root REWARD_PHP_ENABLED=false - Run
reward env up:- Error:
service "php-fpm" has neither an image nor a build context specified: invalid compose project.
- Error:
- Run
docker compose -f .reward/reward-env.yml up -d:- Containers (
nodeanddb) start successfully, verifiable withdocker ps.
- Containers (
- Run
reward info:- Shows "Environment Status: Stopped" despite running containers.
Expected Behavior
-
reward env upshould start the environment without including aphp-fpmservice, respectingREWARD_PHP_ENABLED=falseand the project’s.reward/reward-env.ymlwhich defines onlynodeanddbservices. -
reward infoshould show "Environment Status: Running" when containers are active, whether started viareward env upordocker compose.
Actual Behavior
-
reward env upfails with the error:service "php-fpm" has neither an image nor a build context specified: invalid compose project. -
reward infoincorrectly reports "Environment Status: Stopped" after starting containers withdocker compose -f .reward/reward-env.yml up -d.
Environment
- Reward Version: [reward version 0.7.3+202501091243]
- Docker Version: [Docker version 28.0.4, build b8034c0]
- Docker Compose Version: [Docker Compose version v2.34.0-desktop.1]
- Operating System: [Windows 11 with ubuntu virtualization]
-
Global Configuration:
# Contents of ~/.reward.yml log_level: info debug: false reward_shared_composer: true reward_traefik_bind_additional_http_ports: [] reward_traefik_bind_additional_https_ports: []# Contents of ~/.reward/.env REWARD_SHELL_CONTAINER=node REWARD_SHELL_COMMAND=bash REWARD_SHELL_USER=root REWARD_PHP_ENABLED=false
Additional Information
- The
php-fpmservice appears to be included by Reward’s defaultlocaltemplate, despite settingREWARD_PHP_ENABLED=falsein both project and global configurations. - Running
docker compose -f .reward/reward-env.yml up -dbypasses thephp-fpmerror, confirming the project-specific configuration is correct. - Clearing the cache (
rm -rf ~/.reward/cache) and reinitializing the environment (reward env-init node-react) did not resolve the issue. - The
reward infocommand fails to detect running containers, suggesting a bug in Reward’s state tracking for non-PHP environments or when usingdocker composedirectly. - The
--forceflag inreward env-init node-react --forcewas unsupported, as noted previously, requiring manual.envdeletion to reinitialize. - The project is a Node.js + React.js + MySQL application (User Management App), not a PHP-based project like Magento or Shopware.
Suggested Fix
- Ensure Reward respects
REWARD_PHP_ENABLED=falseand excludesphp-fpmfrom thelocalenvironment template for non-PHP projects. - Fix
reward infoto accurately reflect container states when containers are started viadocker composeor when bypassing Reward’s internal templates. - Consider documenting or supporting non-PHP environments (e.g., Node.js) more explicitly in the
localenvironment type.
Workaround
- Use
docker compose -f .reward/reward-env.yml up -dto start the environment without errors. - Stop the environment with
docker compose -f .reward/reward-env.yml down. - Alternatively, use a standard
docker-compose.ymlto avoid Reward entirely:services: node: image: node:20 ports: - "3000:3000" - "3001:3001" volumes: - ./frontend:/app/frontend - ./backend:/app/backend - /app/node_modules working_dir: /app environment: - NODE_ENV=development db: image: mariadb:10.6 ports: - "3306:3306" environment: - MYSQL_ROOT_PASSWORD=root - MYSQL_DATABASE=myapp volumes: - db_data:/var/lib/mysql volumes: db_data:
This issue is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days.