|
1 # CLAUDE.md |
|
2 |
|
3 This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
|
4 |
|
5 ## Project Overview |
|
6 |
|
7 This is a WordPress multisite installation for the ENMI Conference website (enmi-conf.org) running in a containerized environment. The project uses Docker Compose with Caddy as a web server, MariaDB for the database, and PHP-FPM for processing. |
|
8 |
|
9 ## Architecture |
|
10 |
|
11 - **`wp/`**: Primary WordPress installation (production-like) |
|
12 - **`wordpress/`**: Secondary WordPress installation (backup/staging) |
|
13 - **`enmi12/`**: Legacy conference materials from 2012 |
|
14 - `freemind/`: Mind mapping files |
|
15 - `glossaire/`: Glossary with graph visualization |
|
16 - **Docker services**: |
|
17 - `web`: Caddy server (port 8080) |
|
18 - `fpm`: PHP-FPM container |
|
19 - `db`: MariaDB database |
|
20 - `wpcli`: WordPress CLI (dev profile only) |
|
21 |
|
22 ## Development Environment |
|
23 |
|
24 The project uses Nix for development dependencies and direnv for environment management. |
|
25 |
|
26 ### Prerequisites |
|
27 - Docker and Docker Compose (or Podman Compose) |
|
28 - Nix (optional, for development shell) |
|
29 |
|
30 ### Development Setup |
|
31 |
|
32 1. **Start the environment:** |
|
33 ```bash |
|
34 docker compose pull |
|
35 docker compose build |
|
36 docker compose up -d |
|
37 ``` |
|
38 |
|
39 2. **Access the site:** |
|
40 - Local URL: http://enmi-conf.127.0.0.1.nip.io:8080 |
|
41 |
|
42 ### Database Operations |
|
43 |
|
44 **Import database backup:** |
|
45 ```bash |
|
46 zcat ../dev/enmi-conf_db_export_2022-09-21.sql.gz | docker compose --profile=dev run -T -w "/var/www/html/wp" wpcli wp db cli |
|
47 ``` |
|
48 |
|
49 **Update URLs for local development:** |
|
50 ```bash |
|
51 # Test URL replacement (dry run) |
|
52 docker compose --profile=dev run -w "/var/www/html/wp" wpcli wp search-replace --dry-run --network "enmi-conf.org" "enmi-conf.local:8080" |
|
53 |
|
54 # Update blog domains |
|
55 echo "update wp_blogs set domain='enmi-conf.local:8080';" | docker compose --profile=dev run -T -w "/var/www/html/wp" wpcli wp db cli |
|
56 |
|
57 # Update home and siteurl options for all sites |
|
58 echo "select path from wp_blogs;" | docker compose --profile=dev run -T -w "/var/www/html/wp" wpcli wp db cli --skip-column-names | xargs -I % docker compose --profile=dev run -T -w "/var/www/html/wp" wpcli wp --url="http://enmi-conf.local:8080%" option update home "http://enmi-conf.local:8080%/" |
|
59 |
|
60 echo "select path from wp_blogs;" | docker compose --profile=dev run -T -w "/var/www/html/wp" wpcli wp db cli --skip-column-names | xargs -I % docker compose --profile=dev run -T -w "/var/www/html/wp" wpcli wp --url="http://enmi-conf.local:8080%" option update siteurl "http://enmi-conf.local:8080%/" |
|
61 |
|
62 # Update database schema |
|
63 docker compose --profile=dev run -w "/var/www/html/wp" wpcli wp core update-db --network |
|
64 ``` |
|
65 |
|
66 ### WordPress CLI Operations |
|
67 |
|
68 All WP-CLI commands should be run in the `/var/www/html/wp` directory: |
|
69 ```bash |
|
70 docker compose --profile=dev run -w "/var/www/html/wp" wpcli wp [command] |
|
71 ``` |
|
72 |
|
73 ### File Synchronization |
|
74 |
|
75 **Sync uploads from production:** |
|
76 ```bash |
|
77 rsync -avz -h --stats -P charlie.iri.centrepompidou.fr:/shared/php-01/enmi-conf.org/wp/wp-content/uploads/ ./ |
|
78 ``` |
|
79 |
|
80 **Sync WordPress core files (dry-run first):** |
|
81 ```bash |
|
82 rsync -arvz --delete --dry-run --exclude wp-content --exclude wp-config.php ./wordpress/ ./wp/ |
|
83 ``` |
|
84 |
|
85 ## WordPress Configuration |
|
86 |
|
87 - **Database**: `wordpress_ec` |
|
88 - **DB User**: `iri` |
|
89 - **Themes**: IN-MOTION-package-u1 (parent), IN-MOTION-package-u1-child |
|
90 - **Key Plugins**: |
|
91 - portfolio |
|
92 - include-mastodon-feed |
|
93 - blog-copier |
|
94 - option-tree |
|
95 |
|
96 ## Important Files |
|
97 |
|
98 - `docker-compose.yml`: Container orchestration |
|
99 - `Caddyfile`: Web server configuration |
|
100 - `wp-config.php`: WordPress configuration (root level) |
|
101 - `wp/wp-config.php`: Site-specific WordPress config |
|
102 - `fpm.Dockerfile`: PHP-FPM container build |
|
103 - `Readme`: Setup and maintenance commands |
|
104 |
|
105 ## Version Control (Mercurial) |
|
106 |
|
107 This project uses Mercurial (hg) for version control. |
|
108 |
|
109 **Add files to tracking:** |
|
110 ```bash |
|
111 hg add [file] |
|
112 ``` |
|
113 |
|
114 **Remove files from tracking:** |
|
115 ```bash |
|
116 hg remove [file] |
|
117 # or to remove from tracking but keep file: |
|
118 hg forget [file] |
|
119 ``` |
|
120 |
|
121 **Add new files and remove deleted files automatically:** |
|
122 ```bash |
|
123 hg addremove |
|
124 ``` |
|
125 |
|
126 **Check repository status:** |
|
127 ```bash |
|
128 hg status |
|
129 ``` |
|
130 |
|
131 ## Alternative with Podman |
|
132 |
|
133 For systems using Podman instead of Docker, replace `docker compose` with `podman-compose` and use the nip.io domain format: |
|
134 ```bash |
|
135 podman-compose --profile=dev run -w "/var/www/html/wp" wpcli wp search-replace --network "enmi-conf.org" "enmi-conf.127.0.0.1.nip.io:8080" |
|
136 ``` |