Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 97 additions & 0 deletions .rabbit/context.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Generated by dev.kit repo — do not edit manually.
# Run `dev.kit repo` to refresh.
kind: repoContext
version: udx.dev/dev.kit/v1
generator:
tool: dev.kit
repo: https://github.com/udx/dev.kit
version: 0.13.0
generated_at: 2026-06-05T10:03:56Z
sources:
homepage: https://udx.dev/kit
repository: https://github.com/udx/dev.kit
package: https://www.npmjs.com/package/@udx/dev-kit
installation: https://github.com/udx/dev.kit/blob/latest/docs/installation.md

repo:
name: worker-php
archetype: manifest-repo

# Refs — Direct-read files and paths that define the repo contract.
# Note: Include only files or directories a repo consumer should read before code exploration.
# Note: Prefer README, focused docs, workflows, manifests, and explicit operational files.
# Note: Exclude broad implementation directories unless they are the contract themselves.

refs:
- ./README.md
- ./Makefile
- ./.github/workflows
- ./Dockerfile
- ./docs

# Commands — Canonical repo entrypoints detected from strong repo signals.
# Note: Prefer declared make targets and package scripts before regex matches in docs.
# Note: Emit only commands that can be traced to a concrete source.
# Note: Record the source path so the command can be reviewed and corrected.

commands:
verify:
run: make test
source: Makefile
build:
run: make build
source: Makefile
run:
run: make run
source: Makefile

# Gaps — Factors that are missing or only partially supported by current repo signals.
# Note: Base the result on explicit factor rules, not free-form judgment.
# Note: Include message and evidence so the status can be reviewed.
# Note: Prefer traceable refs and missing signals over vague advice.

gaps:
- factor: config
status: partial
message: Configuration is documented in README.md, but the repo does not declare a canonical checked-in config contract yet.
repair_target: README.md or .env.example
reference: README.md
evidence:
- env vars documented in README.md

# Dependencies — Meaningful dependency-repo contracts such as reusable workflows, images, or versioned manifests this repo relies on.
# Note: Capture execution-shaping behavior defined outside the current checkout.
# Note: Avoid promoting standard package inventory or ordinary GitHub action refs into top-level context.
# Note: Normalize same-org versioned refs into repo slugs when possible.

dependencies:
- repo: udx/reusable-workflows
kind: reusable workflow
resolved: true
archetype: manifest-repo
description: Reusable GitHub Actions workflow templates for CI/CD
used_by:
- .github/workflows/docker-ops.yml
- repo: usabilitydynamics/udx-worker:0.42.0
kind: base image
resolved: true
source_repo: udx/worker
archetype: manifest-repo
description: UDX Worker Docker image
used_by:
- Dockerfile

# Manifests — YAML files that define repo-specific workflow, deploy, or contract behavior.
# Note: Include custom config/manifests that materially shape repo behavior or contract understanding.
# Note: Do not include workflow YAML only because it lives under .github/workflows.
# Note: Promote workflow files only when they declare reusable workflow refs or other repo-specific execution contracts.
# Note: Prefer structured kind and description metadata from the manifest itself.
# Note: Include hidden or nested contract dirs when they contain repo-owned manifests with meaningful metadata.

manifests:
- path: .github/workflows/docker-ops.yml
kind: githubWorkflow
used_by:
- README.md
evidence:
- path reference: README.md
12 changes: 6 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Use the UDX worker as the base image
FROM usabilitydynamics/udx-worker:0.41.0
FROM usabilitydynamics/udx-worker:0.42.0

# Add metadata labels
LABEL maintainer="UDX"
LABEL version="0.31.0"

# Arguments and Environment Variables
ARG PHP_VERSION=8.4
ARG PHP_PACKAGE_VERSION=8.4.11-1ubuntu1.1
ARG NGINX_VERSION=1.28.0-6ubuntu1.1
ARG PHP_PACKAGE_VERSION=8.4.11-1ubuntu1.2
ARG NGINX_VERSION=1.28.0-6ubuntu1.4
Comment thread
fqjony marked this conversation as resolved.
ARG MYSQL_CLIENT_VERSION=8.4.9-0ubuntu0.25.10.1

# Set the PHP_VERSION and PHP_PACKAGE_VERSION as environment variables
ENV PHP_VERSION="${PHP_VERSION}"
Expand All @@ -28,7 +28,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
php"${PHP_VERSION}"-curl="${PHP_PACKAGE_VERSION}" \
php"${PHP_VERSION}"-xml="${PHP_PACKAGE_VERSION}" \
php"${PHP_VERSION}"-zip="${PHP_PACKAGE_VERSION}" \
mysql-client=8.4.8-0ubuntu0.25.10.1 && \
mysql-client="${MYSQL_CLIENT_VERSION}" && \
apt-get clean && \
rm -rf /tmp/* /var/tmp/* && \
mkdir -p /etc/apt/sources.list.d && \
Expand Down Expand Up @@ -77,4 +77,4 @@ VOLUME [ "$APP_HOME" ]
WORKDIR $APP_HOME

# Keep container running
CMD ["tail", "-f", "/dev/null"]
CMD ["tail", "-f", "/dev/null"]
127 changes: 47 additions & 80 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,158 +3,125 @@
# UDX Worker PHP

[![Docker Pulls](https://img.shields.io/docker/pulls/usabilitydynamics/udx-worker-php.svg)](https://hub.docker.com/r/usabilitydynamics/udx-worker-php)
[![GitHub Release](https://img.shields.io/github/v/release/udx/worker-php?sort=semver)](https://github.com/udx/worker-php/releases/latest)
[![License](https://img.shields.io/github/license/udx/worker-php.svg)](LICENSE)

PHP runtime image built on UDX Worker with NGINX + PHP-FPM preconfigured.
PHP runtime image built on UDX Worker with NGINX and PHP-FPM wired for `/var/www`.

[Quick Start](#quick-start) • [Usage](#usage) • [Development](#development) • [Resources](#resources)
[Quick Start](#quick-start) - [Runtime](#runtime) - [Development](#development) - [Deployment](#deployment) - [Agent Context](#agent-context)

## Overview

`udx-worker-php` extends [`udx/worker`](https://github.com/udx/worker) and keeps the same worker runtime model while adding:
`udx-worker-php` extends [`udx/worker`](https://github.com/udx/worker), published as `usabilitydynamics/udx-worker`, and keeps the worker runtime model while adding a PHP web stack:

- NGINX configured for `/var/www`
- PHP-FPM (`8.4`) with socket-based NGINX integration
- Worker service definitions that autostart both `php-fpm` and `nginx`
- NGINX serves `/var/www`.
- PHP-FPM runs behind NGINX through a Unix socket.
- PHP CLI and common extensions are installed for application and automation workloads.
- Worker service definitions start both `php-fpm` and `nginx`.

This image is intended as a base runtime for PHP applications and PHP-focused automation workloads.
Use this image as a base for PHP applications, automation jobs, or deployment workflows that need the Worker runtime contract.

## Quick Start

Requirements: Docker (and Make if you want local dev commands).
Requirements: Docker. Make is optional but recommended for local development.

### Run from Docker Hub
Run the published image:

```bash
docker run -d \
--name my-php-app \
-p 80:80 \
-p 8080:80 \
-v "$(pwd)/my-php-app:/var/www" \
usabilitydynamics/udx-worker-php:latest
```

Then open `http://localhost` (or your mapped host port).
Then open `http://localhost:8080`.

### Local Development Workflow
Build and run locally:

```bash
git clone https://github.com/udx/worker-php.git
cd worker-php

make build
make run
make run HOST_PORT=8080
make log FOLLOW_LOGS=true
```

`make run` uses these defaults from `Makefile.variables`:
`make run` uses defaults from `Makefile.variables`, including `./src/scripts:/var/www` and container port `80`.

- volume: `./src/scripts:/var/www`
- host/container port: `80:80`
- env file: `.env`
This image does not define an application environment contract. Application-specific configuration belongs to the child app or target platform.

## Usage
## Runtime

### Mount your own app code
The runtime contract is defined by the Dockerfile and the configs copied into the image:

```bash
make run VOLUMES="$(pwd)/path-to-app:/var/www" HOST_PORT=8080
```
- `Dockerfile` pins the base Worker image and Ubuntu package versions.
- `etc/configs/nginx/` defines the NGINX server and PHP FastCGI integration.
- `etc/configs/php/` defines PHP-FPM process and pool behavior.
- `etc/configs/worker/services.yaml` declares Worker-managed services.

### Run interactively
`/var/www` is both the declared volume and working directory. NGINX sends PHP requests to the PHP-FPM Unix socket configured during the image build.

```bash
make run-it
```
## Development

### Execute into the running container
Common commands:

```bash
make help
make build
make run HOST_PORT=8080
make exec
make log
make clean
```

### Deploy with Worker CLI config

This repo includes a sample `deploy.yml` for [`@udx/worker-deployment`](https://www.npmjs.com/package/@udx/worker-deployment).
Run all validation:

```bash
npm install -g @udx/worker-deployment
worker run
make test
```

## Testing

Run all built-in tests:
Run only the container test suite against an already built image:

```bash
make run-all-tests
```

Run full validation (build + tests):

```bash
make test
```

Run a specific test script:
Run one test script:

```bash
make run-test TEST_SCRIPT=10_nginx_test.php
```

Current tests live in `src/tests/` and cover:
Current tests live in `src/tests/` and cover NGINX HTTP response, PHP runtime availability, PHP CLI execution, and write permissions under `/var/www`.

- NGINX HTTP response
- PHP runtime availability
- CLI execution
- write permissions under `/var/www`
## Deployment

## Configuration
Deployment uses the host-native tool for the target environment. Mount application code at `/var/www` and publish container port `80` through the platform.

Primary defaults are in `Makefile.variables`:
The GitHub release pipeline is declared in `.github/workflows/docker-ops.yml` and delegates Docker publishing to `udx/reusable-workflows`.

- `DOCKER_IMAGE`
- `CONTAINER_NAME`
- `HOST_PORT` / `CONTAINER_PORT`
- `VOLUMES`
- `PHP_VERSION`
For dependency upgrades, include the changed base image/packages and the local verification result in the PR description.

Container/runtime config files:
## Agent Context

- `etc/configs/nginx/default.conf`
- `etc/configs/php/php-fpm.conf`
- `etc/configs/php/www.conf`
- `etc/configs/worker/services.yaml`
This repo exposes generated agent context in `.rabbit/context.yaml`. Treat it as evidence for agents and automation, not as a hand-authored contract.

## Development

Useful commands:
Do not edit `.rabbit/context.yaml` manually. After changing source docs, Dockerfile, workflows, or manifests, refresh it with:

```bash
make help
make build
make run
make log
make clean
make test
dev.kit repo
```

Human-authored repo contracts remain in `README.md`, `Dockerfile`, `Makefile`, and `.github/workflows/`.

## Resources

- Docker Hub: https://hub.docker.com/r/usabilitydynamics/udx-worker-php
- Source: https://github.com/udx/worker-php
- Base runtime docs: https://github.com/udx/worker/tree/latest/docs
- Deployment config docs: https://github.com/udx/worker-deployment/blob/latest/docs/deploy-config.md

## Contributing

1. Fork the repository
2. Create a feature branch
3. Commit your changes
4. Push to your branch
5. Open a pull request

Include relevant tests and documentation updates with your changes.

## License

MIT. See [`LICENSE`](LICENSE).
MIT. See [LICENSE](LICENSE).
18 changes: 0 additions & 18 deletions deploy.yml

This file was deleted.

Loading