docs: actualizar PRODUCCION.md y DEPLOY_WEB.md con datos reales del servidor .3
This commit is contained in:
+42
-68
@@ -1,90 +1,64 @@
|
||||
# Deploy Web — pflores.linkedcorp.net
|
||||
|
||||
## Previo a cualquier push
|
||||
## Checklist previo a cualquier push
|
||||
|
||||
- [ ] `git status` — sin `.env` ni `.token_gitea` en staging
|
||||
- [ ] Site responde: `curl -s http://127.0.0.1:8081/ | grep -c "Patricia Soledad"` → debe retornar ≥ 1
|
||||
- [ ] PDF funciona: `curl -sI http://127.0.0.1:8081/?cv_pdf=1 | grep Content-Type` → `application/pdf`
|
||||
- [ ] Site local responde: `curl -s http://127.0.0.1:8081/ | grep -c "Patricia Soledad"` ≥ 1
|
||||
- [ ] PDF local funciona: `curl -sI http://127.0.0.1:8081/?cv_pdf=1 | grep Content-Type`
|
||||
- [ ] Si hubo cambios funcionales: actualizar `VERSION` y `CHANGELOG.md`
|
||||
|
||||
## Pasos — ciclo normal de cambios
|
||||
## Pasos — ciclo normal de deploy
|
||||
|
||||
```bash
|
||||
# 1. Ver qué cambió
|
||||
git status
|
||||
git diff --stat
|
||||
|
||||
# 2. Agregar archivos (selectivo, nunca git add -A sin revisar)
|
||||
git add frontend/persona-cv-theme/
|
||||
git add frontend/lumina-cv-theme/
|
||||
git add frontend/cvfolio-theme/
|
||||
# 1. En desarrollo — agregar y commitear
|
||||
git add frontend/ backend/wordpress/wp-content/plugins/pflores-cv-fields/
|
||||
git add backend/wordpress/wp-content/themes/apex-cv/
|
||||
git add backend/wordpress/wp-content/plugins/pflores-cv-fields/
|
||||
git add backend/wordpress/wp-config.php
|
||||
git add README.md CHANGELOG.md VERSION PROMPT_IA.md
|
||||
# ... agregar solo lo que corresponde
|
||||
git add backend/wordpress/wp-config.php README.md CHANGELOG.md VERSION PROMPT_IA.md
|
||||
git status | grep -E "\.env|token_gitea|LOCAL_DEPLOY" # debe retornar vacío
|
||||
git commit -m "tipo: descripción"
|
||||
|
||||
# 3. Commit
|
||||
git commit -m "fix: descripción del cambio"
|
||||
# Prefijos: feat: / fix: / docs: / chore: / style:
|
||||
# 2. Push a Gitea
|
||||
TOKEN="ae4c49a577402354b88c14870821de85a9622019"
|
||||
git push "https://mgonzalez:${TOKEN}@gitea.linkedcorp.net/mgonzalez/pflores.linkedcorp.net.git" main
|
||||
|
||||
# 4. Push a Gitea
|
||||
git push origin main
|
||||
# 3. Entrar al servidor de producción
|
||||
ssh deploy@192.168.222.3 -p 2203
|
||||
|
||||
# 4. Ejecutar el script de deploy
|
||||
cd /opt/apps/pflores.linkedcorp.net
|
||||
bash scripts/deploy_prod_web.sh
|
||||
|
||||
# 5. Verificar
|
||||
curl -s -o /dev/null -w "HTTP %{http_code}" http://127.0.0.1:8081/
|
||||
curl -sI http://127.0.0.1:8081/?cv_pdf=1 | grep Content-Type
|
||||
```
|
||||
|
||||
## Credenciales para git push
|
||||
## Script de deploy (`scripts/deploy_prod_web.sh`)
|
||||
|
||||
Las credenciales de Gitea se guardan en `.token_gitea` (nunca versionado):
|
||||
|
||||
```text
|
||||
# Token gitea
|
||||
usuario: mgonzalez
|
||||
token: [tu personal access token de gitea.linkedcorp.net]
|
||||
|
||||
# Gitea web
|
||||
user: mgonzalez
|
||||
passwd: [contraseña de acceso]
|
||||
```
|
||||
|
||||
Si Git pide usuario y contraseña al hacer push, usar:
|
||||
- **Usuario:** `mgonzalez`
|
||||
- **Contraseña:** el personal access token (no la contraseña web)
|
||||
|
||||
Crear token en Gitea: `https://gitea.linkedcorp.net/user/settings/applications`
|
||||
|
||||
### Guardar credenciales para no escribirlas cada vez
|
||||
|
||||
```bash
|
||||
git config credential.helper store
|
||||
# La primera vez que hagas push te pedirá usuario+token y los guardará
|
||||
```
|
||||
|
||||
## Remoto configurado
|
||||
|
||||
```
|
||||
origin https://gitea.linkedcorp.net/mgonzalez/pflores.linkedcorp.net.git
|
||||
```
|
||||
El script hace automáticamente:
|
||||
1. `git fetch + git reset --hard` — actualiza el código
|
||||
2. Verifica que los plugins de terceros estén instalados
|
||||
3. `sudo systemctl restart pflores-web`
|
||||
4. Verifica HTTP 200
|
||||
|
||||
## No tocar durante el deploy
|
||||
|
||||
- `.env` — credenciales de BD y servidor
|
||||
- Base de datos (no hacer migrate sin confirmar)
|
||||
- El proceso PHP del servidor (no reiniciar en producción sin verificar)
|
||||
- `/opt/apps/pflores.linkedcorp.net/.env` — credenciales de producción
|
||||
- Base de datos de producción (`.32`)
|
||||
- Plugins de terceros (`cmb2/`, `wp-mail-smtp/`) si ya están instalados
|
||||
|
||||
## Si el servidor necesita actualizar el código
|
||||
## Servidor de producción
|
||||
|
||||
Este proyecto corre directamente desde el directorio de trabajo. Si hay un clon separado en producción:
|
||||
- SSH: `deploy@192.168.222.3 -p 2203`
|
||||
- Credenciales: `.token_gitea` bloque `# Produccion user`
|
||||
- Servicio: `pflores-web.service` (systemd)
|
||||
- Puerto interno: `127.0.0.1:8081`
|
||||
- NPM apunta a: `192.168.222.3:8081`
|
||||
|
||||
## Comandos útiles en producción
|
||||
|
||||
```bash
|
||||
# En el servidor de producción
|
||||
cd /ruta/al/proyecto
|
||||
git pull origin main
|
||||
# Reiniciar el proceso PHP si es necesario
|
||||
```
|
||||
|
||||
## Verificación post-push
|
||||
|
||||
```bash
|
||||
# Confirmar que Gitea recibió los cambios
|
||||
# Ir a: https://gitea.linkedcorp.net/mgonzalez/pflores.linkedcorp.net
|
||||
sudo systemctl status pflores-web
|
||||
sudo systemctl restart pflores-web
|
||||
sudo journalctl -u pflores-web -n 50 --no-pager
|
||||
```
|
||||
|
||||
+53
-48
@@ -12,74 +12,79 @@
|
||||
- Admin: `https://pflores.linkedcorp.net/wp-admin`
|
||||
- PDF: `https://pflores.linkedcorp.net/?cv_pdf=1`
|
||||
|
||||
## Servidor
|
||||
## Servidor de aplicación
|
||||
|
||||
- IP local: `192.168.222.40`
|
||||
- Puerto WordPress: `8081` (PHP built-in server, `0.0.0.0:8081`)
|
||||
- Proxy: Nginx Proxy Manager → `http://192.168.222.40:8081`
|
||||
- SSL: certificado en NPM, Force SSL activado, `X-Forwarded-Proto: https`
|
||||
- Host: `192.168.222.3`
|
||||
- SSH: `deploy@192.168.222.3 -p 2203`
|
||||
- Ruta base: `/opt/apps/pflores.linkedcorp.net`
|
||||
- Credenciales SSH: ver `.token_gitea` bloque `# Produccion user`
|
||||
|
||||
## Proceso WordPress
|
||||
## Estructura en servidor
|
||||
|
||||
- Código fuente: `/opt/apps/pflores.linkedcorp.net/`
|
||||
- WordPress: `/opt/apps/pflores.linkedcorp.net/backend/wordpress/`
|
||||
- Plugins propios: `backend/wordpress/wp-content/plugins/pflores-cv-fields/`
|
||||
- Temas: `backend/wordpress/wp-content/themes/`
|
||||
- Config: `/opt/apps/pflores.linkedcorp.net/.env` (local, nunca versionar)
|
||||
- Script de deploy: `scripts/deploy_prod_web.sh`
|
||||
|
||||
## Servicio systemd
|
||||
|
||||
- Servicio: `pflores-web.service`
|
||||
- Puerto interno: `127.0.0.1:8081`
|
||||
|
||||
```bash
|
||||
# Ver si está corriendo
|
||||
lsof -i tcp:8081
|
||||
|
||||
# Arrancar
|
||||
bash /home/mgonzalez/desarrollo/web/pflores.linkedcorp.net/backend/start-wordpress.sh &
|
||||
|
||||
# Detener
|
||||
kill $(lsof -ti tcp:8081)
|
||||
sudo systemctl status pflores-web
|
||||
sudo systemctl restart pflores-web
|
||||
sudo journalctl -u pflores-web -n 50 --no-pager
|
||||
```
|
||||
|
||||
## Base de datos
|
||||
## Nginx Proxy Manager
|
||||
|
||||
- Host: `192.168.222.20`
|
||||
- Domain: `pflores.linkedcorp.net`
|
||||
- Forward Hostname/IP: `192.168.222.3`
|
||||
- Forward Port: `8081`
|
||||
- Scheme: `http`
|
||||
- SSL: certificado `pflores.linkedcorp.net`, Force SSL activado
|
||||
- `X-Forwarded-Proto: https` — wp-config.php lo detecta automáticamente
|
||||
|
||||
## Base de datos (producción)
|
||||
|
||||
- Host: `192.168.222.32`
|
||||
- Base: `paty.wordpress`
|
||||
- Usuario: `paty.wordpress`
|
||||
- Prefijo de tablas: `cv_`
|
||||
- Credenciales completas: ver `.env`
|
||||
- Credenciales: ver `.token_gitea` bloque `# Base de datos`
|
||||
|
||||
## Plugins activos
|
||||
## Plugins de terceros (no en git — reinstalar si es necesario)
|
||||
|
||||
| Plugin | Archivo | Función |
|
||||
|--------|---------|---------|
|
||||
| CMB2 | `cmb2/init.php` | Campos personalizados del CV |
|
||||
| Pflores CV Fields | `pflores-cv-fields/pflores-cv-fields.php` | Admin + PDF |
|
||||
| WP Mail SMTP | `wp-mail-smtp/wp_mail_smtp.php` | Email (pendiente config) |
|
||||
|
||||
Verificar plugins activos:
|
||||
```bash
|
||||
mysql -u "paty.wordpress" -p"paty.wordpress" -h 192.168.222.20 "paty.wordpress" --ssl=0 \
|
||||
-e "SELECT option_value FROM cv_options WHERE option_name='active_plugins';" 2>/dev/null
|
||||
cd /opt/apps/pflores.linkedcorp.net/backend/wordpress/wp-content/plugins
|
||||
# CMB2
|
||||
wget -q https://downloads.wordpress.org/plugin/cmb2.latest-stable.zip -O cmb2.zip
|
||||
python3 -c "import zipfile; zipfile.ZipFile('cmb2.zip').extractall('.')" && rm cmb2.zip
|
||||
# WP Mail SMTP
|
||||
wget -q https://downloads.wordpress.org/plugin/wp-mail-smtp.latest-stable.zip -O wpmail.zip
|
||||
python3 -c "import zipfile; zipfile.ZipFile('wpmail.zip').extractall('.')" && rm wpmail.zip
|
||||
```
|
||||
|
||||
## Tema activo
|
||||
|
||||
- Slug: `persona-cv`
|
||||
- Fuente: `frontend/persona-cv-theme/` (symlink)
|
||||
|
||||
## Repositorio Git
|
||||
|
||||
- Remoto: `https://gitea.linkedcorp.net/mgonzalez/pflores.linkedcorp.net.git`
|
||||
- Rama principal: `main`
|
||||
- Credenciales: `~/.gitconfig` o `.token_gitea` (no versionado)
|
||||
|
||||
## Comandos de verificación rápida
|
||||
## WordPress core (no en git — reinstalar si es necesario)
|
||||
|
||||
```bash
|
||||
# Site responde
|
||||
curl -s http://127.0.0.1:8081/ | grep -c "Patricia Soledad"
|
||||
cd /opt/apps/pflores.linkedcorp.net/backend/wordpress
|
||||
wget -q https://wordpress.org/wordpress-7.0.zip -O /tmp/wp.zip
|
||||
python3 -c "import zipfile,shutil,os; ..."
|
||||
```
|
||||
|
||||
# PDF funciona
|
||||
## Verificación rápida
|
||||
|
||||
```bash
|
||||
# Desde el servidor de producción:
|
||||
curl -s -o /dev/null -w "HTTP %{http_code}" http://127.0.0.1:8081/
|
||||
curl -sI http://127.0.0.1:8081/?cv_pdf=1 | grep Content-Type
|
||||
|
||||
# Limpiar caché WP si algo no se actualiza
|
||||
mysql -u "paty.wordpress" -p"paty.wordpress" -h 192.168.222.20 "paty.wordpress" --ssl=0 \
|
||||
-e "DELETE FROM cv_options WHERE option_name LIKE '_site_transient_%' OR option_name LIKE '_transient_%';" 2>/dev/null
|
||||
```
|
||||
|
||||
## Pendientes
|
||||
|
||||
- [ ] Configurar SMTP en WP Mail SMTP (Gmail u otro proveedor)
|
||||
- [ ] Revisar si el proceso WordPress arranca automáticamente al reiniciar el servidor
|
||||
- [ ] Configurar SMTP en WP Mail SMTP
|
||||
- [ ] Confirmar que NPM apunta a `192.168.222.3:8081`
|
||||
|
||||
Reference in New Issue
Block a user