Files
news-platform/wordpress/README.md
T
Artur MoreiraandPaperclip 3cda2063dd feat: headless WordPress Docker Compose setup (BIT-351)
- docker-compose.yml: WordPress 6/PHP8.3 + MariaDB 11, port 8080
- setup.sh: WP-CLI install, headless config, 5 categories, 10 sample articles
- php.ini: upload/memory limits for media-heavy news content
- .env.example: credential placeholders (values in vault)
- README.md: quick-start and REST API reference

Tested on CT 222 (news-project-test, 10.10.50.140):
- REST API /wp-json/wp/v2/ → 200 OK
- 5 categories: Football, Basketball, F1, Tennis, MMA
- 11 posts confirmed via REST API

Co-Authored-By: Paperclip <[email protected]>
Made-with: Cursor
2026-03-23 15:45:36 +00:00

1.7 KiB

WordPress Headless CMS

Headless WordPress instance serving the News Platform via the REST API. The WP frontend theme is suppressed — all content is consumed by the Fastify bridge at port 3200.

Services

Service Port Notes
WordPress 8080 Apache + PHP 8.3; REST API only
MariaDB 11 3306 Internal only — not exposed to host

Quick Start (on CT 222)

# 1. Clone repo and enter wordpress dir
cd /opt/news-platform/wordpress

# 2. Copy env and fill credentials
cp .env.example .env
# Edit .env — set MYSQL_ROOT_PASSWORD, MYSQL_PASSWORD, WP_ADMIN_PASSWORD

# 3. Start services
docker compose up -d

# 4. Wait for WordPress to be ready (~60s), then run setup
WP_ADMIN_PASSWORD=your_password docker compose exec wordpress bash /var/www/html/setup.sh

REST API

After setup, the REST API is available at:

http://10.10.50.140:8080/wp-json/wp/v2/posts
http://10.10.50.140:8080/wp-json/wp/v2/categories

The Fastify bridge (port 3200) proxies these endpoints and adds Redis caching.

Plugins Installed

Plugin Purpose
Advanced Custom Fields Custom field support for article metadata
Yoast SEO SEO meta exposed via REST API
JWT Auth for WP REST API Token-based auth for protected endpoints
Disable XML-RPC Security hardening

Sample Content

The setup script creates:

  • 5 categories: Football, Basketball, Formula 1, Tennis, MMA
  • 10+ sample articles (2 per category)

Notes

  • WordPress admin credentials are in the team vault — never commit to git
  • Docker volumes persist at db_data (database) and wp_content (uploads/plugins)
  • The setup script is idempotent (safe to re-run)