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
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user