You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
214 lines
4.4 KiB
Markdown
214 lines
4.4 KiB
Markdown
|
2 months ago
|
# Instalacion Local (Desarrollo) - Direccion de Admision 2026
|
||
|
|
|
||
|
|
## Requisitos previos
|
||
|
|
|
||
|
|
| Herramienta | Version minima | Uso |
|
||
|
|
|---|---|---|
|
||
|
|
| Laragon | - | PHP + Composer (servidor local) |
|
||
|
|
| PHP | 8.4+ | Backend Laravel (Thread Safe, VS17 x64) |
|
||
|
|
| Composer | 2.x | Dependencias PHP |
|
||
|
|
| Node.js | 18+ | Frontend Vue |
|
||
|
|
| npm | 9+ | Dependencias JS |
|
||
|
|
| Docker | 20+ | Solo para MySQL |
|
||
|
|
| Docker Compose | 2+ | Solo para MySQL |
|
||
|
|
|
||
|
|
### Descargar PHP 8.4 para Laragon
|
||
|
|
|
||
|
|
Si Laragon no trae PHP 8.4, descargarlo manualmente:
|
||
|
|
|
||
|
|
1. Descargar desde https://windows.php.net/download/ el archivo **VS17 x64 Thread Safe** (zip)
|
||
|
|
2. Extraer en `C:\laragon\bin\php\php-8.4.xx-Win32-vs17-x64\`
|
||
|
|
3. En Laragon: clic derecho > **PHP** > seleccionar la version 8.4
|
||
|
|
4. Instalar Visual C++ 2022 si no lo tienes: https://aka.ms/vs/17/release/vc_redist.x64.exe
|
||
|
|
5. Agregar al PATH: clic derecho en Laragon > **Tools** > **Path** > **Add Laragon to Path**
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Paso 1: Clonar el repositorio
|
||
|
|
|
||
|
|
```bash
|
||
|
|
git clone <url-del-repo> direccion_de_admision_2026
|
||
|
|
cd direccion_de_admision_2026
|
||
|
|
```
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Paso 2: Levantar MySQL con Docker
|
||
|
|
|
||
|
|
```bash
|
||
|
|
docker compose up -d
|
||
|
|
```
|
||
|
|
|
||
|
|
Esto levanta un contenedor MySQL 8.0 con:
|
||
|
|
- **Host:** 127.0.0.1
|
||
|
|
- **Puerto:** 3306
|
||
|
|
- **Usuario:** root
|
||
|
|
- **Password:** root
|
||
|
|
- **Base de datos:** admision_2026
|
||
|
|
|
||
|
|
Verificar que funcione:
|
||
|
|
|
||
|
|
```bash
|
||
|
|
docker exec admision_2026_db mysql -uroot -proot -e "SELECT 'MySQL OK'"
|
||
|
|
```
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Paso 3: Importar la base de datos
|
||
|
|
|
||
|
|
```bash
|
||
|
|
docker exec -i admision_2026_db mysql -uroot -proot admision_2026 < admision_2026_estructura.sql
|
||
|
|
```
|
||
|
|
|
||
|
|
Verificar tablas importadas:
|
||
|
|
|
||
|
|
```bash
|
||
|
|
docker exec admision_2026_db mysql -uroot -proot admision_2026 -e "SHOW TABLES;"
|
||
|
|
```
|
||
|
|
|
||
|
|
Debe mostrar ~31 tablas (users, postulantes, areas, cursos, examenes, procesos_admision, etc.)
|
||
|
|
|
||
|
|
> **Nota:** El dump ya incluye los registros en la tabla `migrations`, por lo que no es necesario ejecutar `php artisan migrate`.
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Paso 4: Configurar el Backend (Laravel)
|
||
|
|
|
||
|
|
```bash
|
||
|
|
cd back
|
||
|
|
```
|
||
|
|
|
||
|
|
### 4.1 Instalar dependencias
|
||
|
|
|
||
|
|
```bash
|
||
|
|
composer install
|
||
|
|
```
|
||
|
|
|
||
|
|
### 4.2 Configurar variables de entorno
|
||
|
|
|
||
|
|
```bash
|
||
|
|
copy .env.example .env
|
||
|
|
```
|
||
|
|
|
||
|
|
Editar `back/.env` y configurar:
|
||
|
|
|
||
|
|
```
|
||
|
|
DB_PASSWORD=root
|
||
|
|
```
|
||
|
|
|
||
|
|
### 4.3 Generar clave de aplicacion
|
||
|
|
|
||
|
|
```bash
|
||
|
|
php artisan key:generate
|
||
|
|
```
|
||
|
|
|
||
|
|
### 4.4 Crear enlace de storage (para imagenes)
|
||
|
|
|
||
|
|
```bash
|
||
|
|
php artisan storage:link
|
||
|
|
```
|
||
|
|
|
||
|
|
### 4.5 Ejecutar seeders
|
||
|
|
|
||
|
|
```bash
|
||
|
|
php artisan db:seed --class=RoleSeeder
|
||
|
|
```
|
||
|
|
|
||
|
|
Esto crea los roles: `usuario`, `administrador`, `superadmin`.
|
||
|
|
|
||
|
|
> **Nota:** Solo ejecutar `php artisan migrate` si en el futuro se agregan nuevas migraciones al proyecto.
|
||
|
|
|
||
|
|
### 4.6 Asignar rol a tu usuario
|
||
|
|
|
||
|
|
Si ya tienes un usuario creado (por registro o por el dump SQL), asignarle un rol desde tinker:
|
||
|
|
|
||
|
|
```bash
|
||
|
|
php artisan tinker
|
||
|
|
```
|
||
|
|
|
||
|
|
```php
|
||
|
|
$user = \App\Models\User::where('email', 'tu@email.com')->first();
|
||
|
|
$user->assignRole('superadmin');
|
||
|
|
exit
|
||
|
|
```
|
||
|
|
|
||
|
|
> **Importante:** Sin un rol asignado, el login devuelve 200 pero no redirige al dashboard.
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Paso 5: Configurar el Frontend (Vue 3)
|
||
|
|
|
||
|
|
```bash
|
||
|
|
cd front
|
||
|
|
```
|
||
|
|
|
||
|
|
### 5.1 Instalar dependencias
|
||
|
|
|
||
|
|
```bash
|
||
|
|
npm install
|
||
|
|
```
|
||
|
|
|
||
|
|
### 5.2 Configurar variables de entorno
|
||
|
|
|
||
|
|
```bash
|
||
|
|
copy .env.example .env
|
||
|
|
```
|
||
|
|
|
||
|
|
El archivo debe contener:
|
||
|
|
|
||
|
|
```
|
||
|
|
VITE_API_URL=http://127.0.0.1:8000/api
|
||
|
|
```
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Levantar el proyecto
|
||
|
|
|
||
|
|
Necesitas **3 cosas corriendo** al mismo tiempo:
|
||
|
|
|
||
|
|
### 1. MySQL (Docker) - si no esta corriendo
|
||
|
|
|
||
|
|
```bash
|
||
|
|
docker compose up -d
|
||
|
|
```
|
||
|
|
|
||
|
|
### 2. Backend (Terminal 1)
|
||
|
|
|
||
|
|
```bash
|
||
|
|
cd back
|
||
|
|
php artisan serve
|
||
|
|
```
|
||
|
|
|
||
|
|
Estara disponible en: **http://localhost:8000**
|
||
|
|
|
||
|
|
### 3. Frontend (Terminal 2)
|
||
|
|
|
||
|
|
```bash
|
||
|
|
cd front
|
||
|
|
npm run dev
|
||
|
|
```
|
||
|
|
|
||
|
|
Estara disponible en: **http://localhost:5173**
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Stack tecnologico
|
||
|
|
|
||
|
|
| Capa | Tecnologia |
|
||
|
|
|---|---|
|
||
|
|
| Backend | Laravel 12 + PHP 8.4 |
|
||
|
|
| Frontend | Vue 3 + Vite 7 + Ant Design Vue + Pinia |
|
||
|
|
| Base de datos | MySQL 8.0 (Docker) |
|
||
|
|
| Autenticacion | Laravel Sanctum (Bearer tokens) |
|
||
|
|
| Permisos | Spatie Laravel Permission |
|
||
|
|
| QR | SimpleSoftwareIO QRCode |
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Notas importantes
|
||
|
|
|
||
|
|
- **No modificar** `composer.lock` a menos que todos los del equipo acuerden (requiere PHP 8.4+)
|
||
|
|
- El dump SQL (`admision_2026_estructura.sql`) incluye la estructura de todas las tablas + registros en `migrations`. No es necesario ejecutar `php artisan migrate` a menos que se hayan agregado nuevas migraciones al proyecto.
|
||
|
|
- Si el puerto 3306 esta ocupado (por otro MySQL local), detener ese servicio primero o cambiar el puerto en `docker-compose.yml`
|
||
|
|
- Los archivos `.env` no se suben al repositorio (estan en `.gitignore`)
|