Co-Authored-By: Paperclip <[email protected]> Made-with: Cursor
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)
Acesso ao wp-admin (operacional)
O domínio público não expõe o WordPress (apenas Astro + bridge em Nginx). Isto é intencional.
| Onde estás | URL |
|---|---|
| Sessão SSH no LXC (CT) | http://127.0.0.1:8080/wp-admin/ |
| No teu portátil (túnel) | Ver abaixo |
Túnel SSH (substitui utilizador e IP do CT):
ssh -L 8080:127.0.0.1:8080 <user>@<ip-ou-dns-do-ct>
Depois no browser: http://localhost:8080/wp-admin/
Credenciais: cofre da equipa (nunca em git). Se ainda não existir utilizador admin, segue a secção Quick Start (setup.sh).
Alternativa (DevOps): expor só para IPs confiáveis — bloco location /wp-admin/ (e opcionalmente /wp-json/) no Nginx do CT com allow/deny, ou host separado no NPM; documentar em docs/deployment.md quando aplicado.
Notes
- WordPress admin credentials are in the team vault — never commit to git
- Docker volumes persist at
db_data(database) andwp_content(uploads/plugins) - The setup script is idempotent (safe to re-run)