Actualizar la configuración del README.md, agregar archivo .env.example y mejorar el .gitignore
This commit is contained in:
21
.env.example
Normal file
21
.env.example
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# Microsoft E5 Auto-Renewal Configuration
|
||||||
|
# Copy this file to .env and fill in your actual values
|
||||||
|
# DO NOT commit .env to version control
|
||||||
|
|
||||||
|
# === Engine (odengin) Configuration ===
|
||||||
|
# Microsoft Azure credentials
|
||||||
|
E5_CLIENT_ID=your_client_id_here
|
||||||
|
E5_CLIENT_SECRET=your_client_secret_here
|
||||||
|
E5_REFRESH_TOKEN=your_refresh_token_here
|
||||||
|
|
||||||
|
# Web application passwords
|
||||||
|
WEB_APP_PASSWORD=your_secure_password_here
|
||||||
|
E5_WEB_APP_PASSWORD=your_e5_password_here
|
||||||
|
|
||||||
|
# === Cron Service (odcron) Configuration ===
|
||||||
|
# Engine connection
|
||||||
|
CRON_IP=odengin:8080
|
||||||
|
|
||||||
|
# Authentication
|
||||||
|
CRON_PASSWORD=your_cron_password_here
|
||||||
|
CRON_REFRESH_TOKEN=your_cron_refresh_token_here
|
||||||
47
.gitignore
vendored
Normal file
47
.gitignore
vendored
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
# Environment variables
|
||||||
|
.env
|
||||||
|
.env.local
|
||||||
|
.env.*.local
|
||||||
|
|
||||||
|
# IDE
|
||||||
|
.vscode/
|
||||||
|
.idea/
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
*~
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# Docker
|
||||||
|
docker-compose.override.yml
|
||||||
|
|
||||||
|
# Python
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
*$py.class
|
||||||
|
*.so
|
||||||
|
.Python
|
||||||
|
build/
|
||||||
|
develop-eggs/
|
||||||
|
dist/
|
||||||
|
downloads/
|
||||||
|
eggs/
|
||||||
|
.eggs/
|
||||||
|
lib/
|
||||||
|
lib64/
|
||||||
|
parts/
|
||||||
|
sdist/
|
||||||
|
var/
|
||||||
|
wheels/
|
||||||
|
*.egg-info/
|
||||||
|
.installed.cfg
|
||||||
|
*.egg
|
||||||
|
|
||||||
|
# Logs
|
||||||
|
logs/
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# Node modules (if applicable)
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# OS
|
||||||
|
Thumbs.db
|
||||||
96
README.md
96
README.md
@@ -41,22 +41,41 @@ git clone <tu-repositorio>
|
|||||||
cd onedrive
|
cd onedrive
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Configura las variables de entorno en `docker-compose.yml`:
|
2. Copia el archivo de configuración de ejemplo:
|
||||||
|
|
||||||
```yaml
|
```bash
|
||||||
|
cp .env.example .env
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Edita el archivo `.env` con tus credenciales:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Linux/Mac
|
||||||
|
nano .env
|
||||||
|
|
||||||
|
# Windows
|
||||||
|
notepad .env
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Rellena todas las variables requeridas:
|
||||||
|
|
||||||
|
```env
|
||||||
E5_CLIENT_ID=tu_client_id
|
E5_CLIENT_ID=tu_client_id
|
||||||
E5_CLIENT_SECRET=tu_client_secret
|
E5_CLIENT_SECRET=tu_client_secret
|
||||||
E5_REFRESH_TOKEN=tu_refresh_token
|
E5_REFRESH_TOKEN=tu_refresh_token
|
||||||
WEB_APP_PASSWORD=tu_password_segura
|
WEB_APP_PASSWORD=tu_password_segura
|
||||||
|
E5_WEB_APP_PASSWORD=tu_e5_password
|
||||||
|
CRON_PASSWORD=tu_cron_password
|
||||||
|
CRON_REFRESH_TOKEN=tu_cron_refresh_token
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Inicia los servicios:
|
5. Inicia los servicios:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker-compose up -d
|
docker-compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Verifica el estado:
|
6. Verifica el estado:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker-compose ps
|
docker-compose ps
|
||||||
@@ -65,25 +84,35 @@ docker-compose logs -f
|
|||||||
|
|
||||||
## ⚙️ Configuración
|
## ⚙️ Configuración
|
||||||
|
|
||||||
|
### Archivo `.env`
|
||||||
|
|
||||||
|
El archivo `.env` contiene todas las variables de entorno necesarias. **Nunca** debes:
|
||||||
|
|
||||||
|
- ❌ Subir `.env` a Git
|
||||||
|
- ❌ Compartir `.env` públicamente
|
||||||
|
- ❌ Guardar credenciales en el código
|
||||||
|
|
||||||
|
El archivo `.env.example` se incluye como referencia para documentar qué variables se necesitan.
|
||||||
|
|
||||||
### Variables de Entorno
|
### Variables de Entorno
|
||||||
|
|
||||||
#### Servicio `odengin`
|
#### Servicio `odengin`
|
||||||
|
|
||||||
| Variable | Descripción | Requerida |
|
| Variable | Descripción | Requerida | Variable de Entorno |
|
||||||
| --------------------- | ------------------------------- | --------- |
|
| --------------------- | ------------------------------- | --------- | --------------------- |
|
||||||
| `E5_CLIENT_ID` | Client ID de Microsoft Azure | ✅ |
|
| `E5_CLIENT_ID` | Client ID de Microsoft Azure | ✅ | `E5_CLIENT_ID` |
|
||||||
| `E5_CLIENT_SECRET` | Client Secret de Azure | ✅ |
|
| `E5_CLIENT_SECRET` | Client Secret de Azure | ✅ | `E5_CLIENT_SECRET` |
|
||||||
| `E5_REFRESH_TOKEN` | Token de renovación | ✅ |
|
| `E5_REFRESH_TOKEN` | Token de renovación | ✅ | `E5_REFRESH_TOKEN` |
|
||||||
| `WEB_APP_PASSWORD` | Contraseña de la aplicación web | ✅ |
|
| `WEB_APP_PASSWORD` | Contraseña de la aplicación web | ✅ | `WEB_APP_PASSWORD` |
|
||||||
| `E5_WEB_APP_PASSWORD` | Contraseña adicional E5 | ✅ |
|
| `E5_WEB_APP_PASSWORD` | Contraseña adicional E5 | ✅ | `E5_WEB_APP_PASSWORD` |
|
||||||
|
|
||||||
#### Servicio `odcron`
|
#### Servicio `odcron`
|
||||||
|
|
||||||
| Variable | Descripción | Requerida |
|
| Variable | Descripción | Requerida | Variable de Entorno |
|
||||||
| --------------- | -------------------------------------------- | --------- |
|
| ------------------- | -------------------------------------------- | --------- | -------------------- |
|
||||||
| `IP` | Dirección del motor (formato: `host:puerto`) | ✅ |
|
| IP del motor | Dirección del motor (formato: `host:puerto`) | ✅ | `CRON_IP` |
|
||||||
| `PASSWORD` | Contraseña de autenticación | ✅ |
|
| Contraseña | Contraseña de autenticación | ✅ | `CRON_PASSWORD` |
|
||||||
| `REFRESH_TOKEN` | Token de renovación | ✅ |
|
| Token de renovación | Token de renovación | ✅ | `CRON_REFRESH_TOKEN` |
|
||||||
|
|
||||||
### Puertos
|
### Puertos
|
||||||
|
|
||||||
@@ -170,12 +199,35 @@ docker exec -it odcron ping odengin
|
|||||||
|
|
||||||
## 🛡️ Seguridad
|
## 🛡️ Seguridad
|
||||||
|
|
||||||
> ⚠️ **Importante**:
|
### Gestión de Credenciales
|
||||||
>
|
|
||||||
> - Nunca subas credenciales al repositorio
|
✅ **HACER:**
|
||||||
> - Usa variables de entorno o archivos `.env`
|
|
||||||
> - Cambia las contraseñas por defecto
|
- ✅ Usar archivo `.env` para variables sensibles
|
||||||
> - Mantén las imágenes actualizadas
|
- ✅ Incluir `.env` en `.gitignore`
|
||||||
|
- ✅ Compartir solo `.env.example` con placeholders
|
||||||
|
- ✅ Cambiar contraseñas por defecto
|
||||||
|
- ✅ Restringir permisos del archivo `.env`: `chmod 600 .env`
|
||||||
|
- ✅ Usar secretos de Docker/Kubernetes en producción
|
||||||
|
|
||||||
|
❌ **NO HACER:**
|
||||||
|
|
||||||
|
- ❌ Nunca subir `.env` a Git
|
||||||
|
- ❌ No guardar credenciales en el código
|
||||||
|
- ❌ No compartir `.env` por mensajes o email
|
||||||
|
- ❌ No usar contraseñas débiles
|
||||||
|
- ❌ No hacer commit accidental de `.env`
|
||||||
|
|
||||||
|
### Verificar antes de subir
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Asegurate de que .env NO está en Git
|
||||||
|
git status
|
||||||
|
|
||||||
|
# Si fue agregado accidentalmente:
|
||||||
|
git rm --cached .env
|
||||||
|
git commit --amend -m "Remove .env from repository"
|
||||||
|
```
|
||||||
|
|
||||||
## 📝 Notas
|
## 📝 Notas
|
||||||
|
|
||||||
|
|||||||
@@ -1,32 +1,36 @@
|
|||||||
---
|
---
|
||||||
services:
|
services:
|
||||||
odengin:
|
odengin:
|
||||||
build: ./odengin # Ajusta la ruta al directorio con su Dockerfile
|
build: ./engine
|
||||||
container_name: odengin
|
container_name: odengin
|
||||||
|
env_file: .env
|
||||||
environment:
|
environment:
|
||||||
- E5_CLIENT_ID=id
|
- E5_CLIENT_ID=${E5_CLIENT_ID}
|
||||||
- E5_CLIENT_SECRET=secret
|
- E5_CLIENT_SECRET=${E5_CLIENT_SECRET}
|
||||||
- E5_REFRESH_TOKEN=tokenit
|
- E5_REFRESH_TOKEN=${E5_REFRESH_TOKEN}
|
||||||
- WEB_APP_PASSWORD=123
|
- WEB_APP_PASSWORD=${WEB_APP_PASSWORD}
|
||||||
- E5_WEB_APP_PASSWORD=123
|
- E5_WEB_APP_PASSWORD=${E5_WEB_APP_PASSWORD}
|
||||||
ports:
|
ports:
|
||||||
- 8089:8080
|
- "8089:8080"
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
hostname: odengin
|
hostname: odengin
|
||||||
networks:
|
networks:
|
||||||
- odeng-net
|
- odeng-net
|
||||||
|
|
||||||
odcron:
|
odcron:
|
||||||
build: ./odcron # Ajusta la ruta al directorio con su Dockerfile
|
build: ./cron
|
||||||
container_name: odcron
|
container_name: odcron
|
||||||
|
env_file: .env
|
||||||
environment:
|
environment:
|
||||||
- IP=odengin:8080 # Usa el nombre del servicio para comunicación interna
|
- IP=${CRON_IP:-odengin:8080}
|
||||||
- PASSWORD=pass
|
- PASSWORD=${CRON_PASSWORD}
|
||||||
- REFRESH_TOKEN=tokenit
|
- REFRESH_TOKEN=${CRON_REFRESH_TOKEN}
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
hostname: odcron
|
hostname: odcron
|
||||||
networks:
|
networks:
|
||||||
- odeng-net
|
- odeng-net
|
||||||
|
depends_on:
|
||||||
|
- odengin
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
odeng-net:
|
odeng-net:
|
||||||
|
|||||||
Reference in New Issue
Block a user