fix: corregir migraciones fallidas, redis doble carga y cache de assets
- Eliminar .env del tracking de git (credenciales no deben ir en repo) - Agregar .env y .env.* al .dockerignore (no hornear credenciales en imagen) - Quitar extension=redis.so duplicada en php.ini - Activar cache 7d para assets estáticos en nginx - Corregir 5 migraciones: eliminar INSERT INTO migrations con columna incorrecta y remover semicolons en comentarios -- que partian el parser SQL Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
a39e94c71b
commit
1342d305ec
+4
-3
@@ -30,9 +30,10 @@ Thumbs.db
|
|||||||
.vscode/
|
.vscode/
|
||||||
*.sublime-*
|
*.sublime-*
|
||||||
|
|
||||||
# Variables de entorno locales
|
# Variables de entorno — nunca en la imagen
|
||||||
.env.local
|
.env
|
||||||
.env.*.local
|
.env.*
|
||||||
|
!.env.example
|
||||||
|
|
||||||
# Backups
|
# Backups
|
||||||
backups/
|
backups/
|
||||||
|
|||||||
@@ -1,55 +0,0 @@
|
|||||||
# ============================================================
|
|
||||||
# WhatsApp Bot Manager — Variables de entorno
|
|
||||||
# Fuente única de verdad para desarrollo local.
|
|
||||||
# En producción (Coolify): configurar en Environment Variables de la app.
|
|
||||||
# ⚠️ Este archivo NO se sube a git (.gitignore lo excluye).
|
|
||||||
# ============================================================
|
|
||||||
|
|
||||||
# ── Base de datos ─────────────────────────────────────────────
|
|
||||||
DB_HOST=46.202.93.92
|
|
||||||
DB_PORT=3306
|
|
||||||
DB_NAME=usite_whatsapp_bot
|
|
||||||
DB_USER=usite_whatsapp_user
|
|
||||||
DB_PASS=6q!Vio0fn@PFmsLyHjH5
|
|
||||||
DB_ROOT_PASSWORD=root_password_2026
|
|
||||||
DB_CHARSET=utf8mb4
|
|
||||||
|
|
||||||
# ── Redis ─────────────────────────────────────────────────────
|
|
||||||
REDIS_HOST=127.0.0.1
|
|
||||||
REDIS_PORT=6379
|
|
||||||
REDIS_PASSWORD=
|
|
||||||
|
|
||||||
# ── WhatsApp Business API ─────────────────────────────────────
|
|
||||||
WHATSAPP_TOKEN=EAAcGjPRqunIBQjy3mZAVLX2vfMcyfUtcAXAwul5tZCQjsdxyEljIV1C4mOfTNAOIseZCMDZCy2O5AVM6wBXZC6nEfSNxkhosevtlZCRDr8uxe4zHiiZClW88mnjj2sv2t6PAh63VtUfY5DYAands4O5E9E6L6yiugZCZCBRIFjEWEtE1WXOn6GZCy8mgKpqTD2aQvNogZDZD
|
|
||||||
WHATSAPP_PHONE_NUMBER_ID=959898150536936
|
|
||||||
WHATSAPP_API_URL=https://graph.facebook.com/v22.0/
|
|
||||||
WEBHOOK_VERIFY_TOKEN=XimenaCaicedo2026*+
|
|
||||||
AUTO_APPROVE_TEMPLATES=true
|
|
||||||
|
|
||||||
# ── Aplicación ────────────────────────────────────────────────
|
|
||||||
APP_ENV=development
|
|
||||||
APP_DEBUG=true
|
|
||||||
APP_NAME=WhatsApp Bot System
|
|
||||||
APP_VERSION=2.0.0
|
|
||||||
APP_URL=https://bot.u-s.app/
|
|
||||||
TIMEZONE=America/Bogota
|
|
||||||
|
|
||||||
# ── Logs ──────────────────────────────────────────────────────
|
|
||||||
# Valores: DEBUG | INFO | WARNING | ERROR
|
|
||||||
LOG_LEVEL=DEBUG
|
|
||||||
ENABLE_LOGGING=true
|
|
||||||
LOG_FILE=logs/system.log
|
|
||||||
|
|
||||||
# ── Seguridad ─────────────────────────────────────────────────
|
|
||||||
SESSION_TIMEOUT=1800
|
|
||||||
MAX_LOGIN_ATTEMPTS=3
|
|
||||||
LOGIN_LOCKOUT_TIME=900
|
|
||||||
|
|
||||||
# ── Rate Limiting ─────────────────────────────────────────────
|
|
||||||
ENABLE_RATE_LIMIT=false
|
|
||||||
|
|
||||||
# ── PHP ───────────────────────────────────────────────────────
|
|
||||||
PHP_MEMORY_LIMIT=512M
|
|
||||||
PHP_MAX_EXECUTION_TIME=300
|
|
||||||
DISPLAY_ERRORS=1
|
|
||||||
ERROR_REPORTING=E_ALL
|
|
||||||
-50
@@ -1,50 +0,0 @@
|
|||||||
# Variables de entorno para Docker Compose
|
|
||||||
# Copia este archivo como .env y completa los valores
|
|
||||||
|
|
||||||
# ===========================================
|
|
||||||
# APLICACIÓN
|
|
||||||
# ===========================================
|
|
||||||
APP_ENV=production
|
|
||||||
APP_PORT=8080
|
|
||||||
|
|
||||||
# ===========================================
|
|
||||||
# BASE DE DATOS
|
|
||||||
# ===========================================
|
|
||||||
DB_HOST=db
|
|
||||||
DB_PORT=3306
|
|
||||||
DB_NAME=whatsapp_bot
|
|
||||||
DB_USER=whatsapp_user
|
|
||||||
DB_PASS=tu_password_seguro_aqui
|
|
||||||
DB_ROOT_PASSWORD=root_password_super_seguro
|
|
||||||
|
|
||||||
# ===========================================
|
|
||||||
# REDIS
|
|
||||||
# ===========================================
|
|
||||||
REDIS_HOST=127.0.0.1
|
|
||||||
REDIS_PORT=6379
|
|
||||||
REDIS_PASSWORD=
|
|
||||||
REDIS_DB=0
|
|
||||||
|
|
||||||
# ===========================================
|
|
||||||
# WHATSAPP API
|
|
||||||
# ===========================================
|
|
||||||
WHATSAPP_TOKEN=tu_token_de_whatsapp_aqui
|
|
||||||
WHATSAPP_PHONE_NUMBER_ID=tu_phone_number_id_aqui
|
|
||||||
WEBHOOK_VERIFY_TOKEN=tu_token_verificacion_webhook
|
|
||||||
|
|
||||||
# ===========================================
|
|
||||||
# LOGGING
|
|
||||||
# ===========================================
|
|
||||||
LOG_LEVEL=INFO
|
|
||||||
ENABLE_RATE_LIMIT=true
|
|
||||||
|
|
||||||
# ===========================================
|
|
||||||
# WORKERS
|
|
||||||
# ===========================================
|
|
||||||
WORKER_REPLICAS=2
|
|
||||||
|
|
||||||
# ===========================================
|
|
||||||
# HERRAMIENTAS DE DESARROLLO (opcional)
|
|
||||||
# ===========================================
|
|
||||||
PHPMYADMIN_PORT=8081
|
|
||||||
REDIS_COMMANDER_PORT=8082
|
|
||||||
@@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
# Ignorar credenciales y entornos
|
# Ignorar credenciales y entornos
|
||||||
.env
|
.env
|
||||||
|
.env.*
|
||||||
|
!.env.example
|
||||||
CREDENCIALES_BASICO.txt
|
CREDENCIALES_BASICO.txt
|
||||||
|
|
||||||
# Logs y temporales
|
# Logs y temporales
|
||||||
|
|||||||
@@ -5,11 +5,6 @@ server {
|
|||||||
root /var/www/html;
|
root /var/www/html;
|
||||||
index index.php index.html;
|
index index.php index.html;
|
||||||
|
|
||||||
# 🚫 CACHE DESACTIVADO GLOBALMENTE
|
|
||||||
add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0" always;
|
|
||||||
add_header Pragma "no-cache" always;
|
|
||||||
add_header Expires "0" always;
|
|
||||||
|
|
||||||
# Security headers
|
# Security headers
|
||||||
add_header X-Frame-Options "SAMEORIGIN" always;
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||||
add_header X-Content-Type-Options "nosniff" always;
|
add_header X-Content-Type-Options "nosniff" always;
|
||||||
@@ -84,12 +79,10 @@ server {
|
|||||||
access_log off;
|
access_log off;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Static assets - SIN CACHE para desarrollo
|
# Static assets
|
||||||
location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg|woff|woff2|ttf|eot)$ {
|
location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg|woff|woff2|ttf|eot)$ {
|
||||||
# CACHE DESACTIVADO
|
expires 7d;
|
||||||
add_header Cache-Control "no-store, no-cache, must-revalidate, max-age=0" always;
|
add_header Cache-Control "public, max-age=604800" always;
|
||||||
add_header Pragma "no-cache" always;
|
|
||||||
expires off;
|
|
||||||
access_log off;
|
access_log off;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -56,5 +56,4 @@ realpath_cache_ttl = 600
|
|||||||
; Output buffering
|
; Output buffering
|
||||||
output_buffering = 4096
|
output_buffering = 4096
|
||||||
|
|
||||||
; Redis
|
; Redis extension habilitada vía docker-php-ext-enable en builder stage (conf.d/docker-php-ext-redis.ini)
|
||||||
extension = redis.so
|
|
||||||
|
|||||||
@@ -22,6 +22,3 @@ WHERE permission = 'write' OR permission IS NULL;
|
|||||||
|
|
||||||
-- Los que tienen permission='read' solo tienen can_view = 1 (ya es el DEFAULT, no tocar)
|
-- Los que tienen permission='read' solo tienen can_view = 1 (ya es el DEFAULT, no tocar)
|
||||||
|
|
||||||
-- Registrar migración
|
|
||||||
INSERT IGNORE INTO migrations (migration, executed_at)
|
|
||||||
VALUES ('001_rbac_expandido', NOW());
|
|
||||||
|
|||||||
@@ -38,6 +38,3 @@ INSERT IGNORE INTO role_modules (role_id, module_slug, can_view, can_create, can
|
|||||||
SELECT r.id, 'whatsapp', 1, 1, 1, 0, 1
|
SELECT r.id, 'whatsapp', 1, 1, 1, 0, 1
|
||||||
FROM roles r WHERE r.slug = 'operador_bot';
|
FROM roles r WHERE r.slug = 'operador_bot';
|
||||||
|
|
||||||
-- Registrar migración
|
|
||||||
INSERT IGNORE INTO migrations (migration, executed_at)
|
|
||||||
VALUES ('002_nuevos_roles', NOW());
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ CREATE TABLE IF NOT EXISTS exam_tipo_consentimientos (
|
|||||||
COMMENT='M:N entre tipos de examen y formularios de consentimiento';
|
COMMENT='M:N entre tipos de examen y formularios de consentimiento';
|
||||||
|
|
||||||
-- ── 3. Lugares / estaciones de servicio configurables ───────
|
-- ── 3. Lugares / estaciones de servicio configurables ───────
|
||||||
-- Recepción NO es un lugar; es el paso implícito del flujo.
|
-- Recepcion NO es un lugar (es el paso implicito del flujo).
|
||||||
-- Cada lugar tiene su propia cola y su propia pantalla TV.
|
-- Cada lugar tiene su propia cola y su propia pantalla TV.
|
||||||
CREATE TABLE IF NOT EXISTS turnero_lugares (
|
CREATE TABLE IF NOT EXISTS turnero_lugares (
|
||||||
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
-- Rol formularios_readonly: solo acceso a lab_formularios con permiso write
|
-- Rol formularios_readonly: solo acceso a lab_formularios con permiso write
|
||||||
-- Permite crear y editar formularios; los envíos/resultados son solo lectura (UI)
|
-- Permite crear y editar formularios - los envios/resultados son solo lectura (UI)
|
||||||
UPDATE role_modules
|
UPDATE role_modules
|
||||||
SET permission = 'write'
|
SET permission = 'write'
|
||||||
WHERE role_id = (SELECT id FROM roles WHERE slug = 'formularios_readonly')
|
WHERE role_id = (SELECT id FROM roles WHERE slug = 'formularios_readonly')
|
||||||
|
|||||||
@@ -10,6 +10,3 @@ ALTER TABLE `roles`
|
|||||||
COMMENT 'Ruta de inicio al hacer login. NULL = usa reglas heredadas.'
|
COMMENT 'Ruta de inicio al hacer login. NULL = usa reglas heredadas.'
|
||||||
AFTER `color`;
|
AFTER `color`;
|
||||||
|
|
||||||
-- Registrar migración
|
|
||||||
INSERT IGNORE INTO migrations (migration, executed_at)
|
|
||||||
VALUES ('20260416_roles_home_page', NOW());
|
|
||||||
|
|||||||
Reference in New Issue
Block a user