|
5 | 5 | [](https://hub.docker.com/r/usabilitydynamics/udx-worker-php) |
6 | 6 | [](LICENSE) |
7 | 7 |
|
8 | | -PHP runtime image built on UDX Worker with NGINX + PHP-FPM preconfigured. |
| 8 | +PHP runtime image built on UDX Worker with NGINX and PHP-FPM wired for `/var/www`. |
9 | 9 |
|
10 | | -[Quick Start](#quick-start) • [Usage](#usage) • [Development](#development) • [Resources](#resources) |
| 10 | +[Quick Start](#quick-start) - [Runtime](#runtime) - [Development](#development) - [Deployment](#deployment) - [Agent Context](#agent-context) |
11 | 11 |
|
12 | 12 | ## Overview |
13 | 13 |
|
14 | | -`udx-worker-php` extends [`udx/worker`](https://github.com/udx/worker) and keeps the same worker runtime model while adding: |
| 14 | +`udx-worker-php` extends [`usabilitydynamics/udx-worker`](https://github.com/udx/worker) and keeps the worker runtime model while adding a PHP web stack: |
15 | 15 |
|
16 | | -- NGINX configured for `/var/www` |
17 | | -- PHP-FPM (`8.4`) with socket-based NGINX integration |
18 | | -- Worker service definitions that autostart both `php-fpm` and `nginx` |
| 16 | +- NGINX serves `/var/www`. |
| 17 | +- PHP-FPM runs behind NGINX through a Unix socket. |
| 18 | +- PHP CLI and common extensions are installed for application and automation workloads. |
| 19 | +- Worker service definitions start both `php-fpm` and `nginx`. |
19 | 20 |
|
20 | | -This image is intended as a base runtime for PHP applications and PHP-focused automation workloads. |
| 21 | +Use this image as a base for PHP applications, automation jobs, or deployment workflows that need the Worker runtime contract. |
21 | 22 |
|
22 | 23 | ## Quick Start |
23 | 24 |
|
24 | | -Requirements: Docker (and Make if you want local dev commands). |
| 25 | +Requirements: Docker. Make is optional but recommended for local development. |
25 | 26 |
|
26 | | -### Run from Docker Hub |
| 27 | +Run the published image: |
27 | 28 |
|
28 | 29 | ```bash |
29 | 30 | docker run -d \ |
30 | 31 | --name my-php-app \ |
31 | | - -p 80:80 \ |
| 32 | + -p 8080:80 \ |
32 | 33 | -v "$(pwd)/my-php-app:/var/www" \ |
33 | 34 | usabilitydynamics/udx-worker-php:latest |
34 | 35 | ``` |
35 | 36 |
|
36 | | -Then open `http://localhost` (or your mapped host port). |
| 37 | +Then open `http://localhost:8080`. |
37 | 38 |
|
38 | | -### Local Development Workflow |
| 39 | +Build and run locally: |
39 | 40 |
|
40 | 41 | ```bash |
41 | 42 | git clone https://github.com/udx/worker-php.git |
42 | 43 | cd worker-php |
43 | 44 |
|
44 | 45 | make build |
45 | | -make run |
| 46 | +make run HOST_PORT=8080 |
46 | 47 | make log FOLLOW_LOGS=true |
47 | 48 | ``` |
48 | 49 |
|
49 | | -`make run` uses these defaults from `Makefile.variables`: |
| 50 | +`make run` uses defaults from `Makefile.variables`, including `./src/scripts:/var/www`, `.env`, and container port `80`. |
50 | 51 |
|
51 | | -- volume: `./src/scripts:/var/www` |
52 | | -- host/container port: `80:80` |
53 | | -- env file: `.env` |
| 52 | +## Runtime |
54 | 53 |
|
55 | | -## Usage |
| 54 | +The runtime contract is defined by the Dockerfile and the configs copied into the image: |
56 | 55 |
|
57 | | -### Mount your own app code |
| 56 | +- `Dockerfile` pins the base Worker image and Ubuntu package versions. |
| 57 | +- `etc/configs/nginx/` defines the NGINX server and PHP FastCGI integration. |
| 58 | +- `etc/configs/php/` defines PHP-FPM process and pool behavior. |
| 59 | +- `etc/configs/worker/services.yaml` declares Worker-managed services. |
58 | 60 |
|
59 | | -```bash |
60 | | -make run VOLUMES="$(pwd)/path-to-app:/var/www" HOST_PORT=8080 |
61 | | -``` |
62 | | - |
63 | | -### Run interactively |
| 61 | +See [docs/runtime.md](docs/runtime.md) for runtime layout. |
64 | 62 |
|
65 | | -```bash |
66 | | -make run-it |
67 | | -``` |
| 63 | +## Development |
68 | 64 |
|
69 | | -### Execute into the running container |
| 65 | +Common commands: |
70 | 66 |
|
71 | 67 | ```bash |
| 68 | +make help |
| 69 | +make build |
| 70 | +make run HOST_PORT=8080 |
72 | 71 | make exec |
| 72 | +make log |
| 73 | +make clean |
73 | 74 | ``` |
74 | 75 |
|
75 | | -### Deploy with Worker CLI config |
76 | | - |
77 | | -This repo includes a sample `deploy.yml` for [`@udx/worker-deployment`](https://www.npmjs.com/package/@udx/worker-deployment). |
| 76 | +Run all validation: |
78 | 77 |
|
79 | 78 | ```bash |
80 | | -npm install -g @udx/worker-deployment |
81 | | -worker run |
| 79 | +make test |
82 | 80 | ``` |
83 | 81 |
|
84 | | -## Testing |
85 | | - |
86 | | -Run all built-in tests: |
| 82 | +Run only the container test suite against an already built image: |
87 | 83 |
|
88 | 84 | ```bash |
89 | 85 | make run-all-tests |
90 | 86 | ``` |
91 | 87 |
|
92 | | -Run full validation (build + tests): |
93 | | - |
94 | | -```bash |
95 | | -make test |
96 | | -``` |
97 | | - |
98 | | -Run a specific test script: |
| 88 | +Run one test script: |
99 | 89 |
|
100 | 90 | ```bash |
101 | 91 | make run-test TEST_SCRIPT=10_nginx_test.php |
102 | 92 | ``` |
103 | 93 |
|
104 | | -Current tests live in `src/tests/` and cover: |
| 94 | +Current tests live in `src/tests/` and cover NGINX HTTP response, PHP runtime availability, PHP CLI execution, and write permissions under `/var/www`. |
105 | 95 |
|
106 | | -- NGINX HTTP response |
107 | | -- PHP runtime availability |
108 | | -- CLI execution |
109 | | -- write permissions under `/var/www` |
| 96 | +## Deployment |
110 | 97 |
|
111 | | -## Configuration |
| 98 | +This repo includes `deploy.yml`, a minimal [`@udx/worker-deployment`](https://www.npmjs.com/package/@udx/worker-deployment) config for running the image through Worker CLI tooling: |
112 | 99 |
|
113 | | -Primary defaults are in `Makefile.variables`: |
| 100 | +```bash |
| 101 | +npm install -g @udx/worker-deployment |
| 102 | +worker run |
| 103 | +``` |
114 | 104 |
|
115 | | -- `DOCKER_IMAGE` |
116 | | -- `CONTAINER_NAME` |
117 | | -- `HOST_PORT` / `CONTAINER_PORT` |
118 | | -- `VOLUMES` |
119 | | -- `PHP_VERSION` |
| 105 | +The GitHub release pipeline is declared in `.github/workflows/docker-ops.yml` and delegates Docker publishing to `udx/reusable-workflows`. |
120 | 106 |
|
121 | | -Container/runtime config files: |
| 107 | +For dependency upgrades, include the changed base image/packages and the local verification result in the PR description. |
122 | 108 |
|
123 | | -- `etc/configs/nginx/default.conf` |
124 | | -- `etc/configs/php/php-fpm.conf` |
125 | | -- `etc/configs/php/www.conf` |
126 | | -- `etc/configs/worker/services.yaml` |
| 109 | +## Agent Context |
127 | 110 |
|
128 | | -## Development |
| 111 | +This repo exposes generated agent context in `.rabbit/context.yaml`. Treat it as evidence for agents and automation, not as a hand-authored contract. |
129 | 112 |
|
130 | | -Useful commands: |
| 113 | +Do not edit `.rabbit/context.yaml` manually. After changing source docs, Dockerfile, workflows, or manifests, refresh it with: |
131 | 114 |
|
132 | 115 | ```bash |
133 | | -make help |
134 | | -make build |
135 | | -make run |
136 | | -make log |
137 | | -make clean |
138 | | -make test |
| 116 | +dev.kit repo |
139 | 117 | ``` |
140 | 118 |
|
| 119 | +The human-authored deployment contract remains `deploy.yml`. |
| 120 | + |
141 | 121 | ## Resources |
142 | 122 |
|
143 | 123 | - Docker Hub: https://hub.docker.com/r/usabilitydynamics/udx-worker-php |
144 | 124 | - Source: https://github.com/udx/worker-php |
145 | 125 | - Base runtime docs: https://github.com/udx/worker/tree/latest/docs |
146 | 126 | - Deployment config docs: https://github.com/udx/worker-deployment/blob/latest/docs/deploy-config.md |
147 | 127 |
|
148 | | -## Contributing |
149 | | - |
150 | | -1. Fork the repository |
151 | | -2. Create a feature branch |
152 | | -3. Commit your changes |
153 | | -4. Push to your branch |
154 | | -5. Open a pull request |
155 | | - |
156 | | -Include relevant tests and documentation updates with your changes. |
157 | | - |
158 | 128 | ## License |
159 | 129 |
|
160 | | -MIT. See [`LICENSE`](LICENSE). |
| 130 | +MIT. See [LICENSE](LICENSE). |
0 commit comments