Compare commits
10 Commits
dfeaea4223
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 70f94c8897 | |||
| 9eca2c2493 | |||
| 24af1dff01 | |||
|
|
950a1704ee | ||
|
|
c0522c5870 | ||
|
|
867fdd776c | ||
|
|
730ae6124a | ||
|
|
158a7ca904 | ||
|
|
e3d0f4f40d | ||
|
|
5d882a1eb2 |
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
|
||||||
236
README.md
236
README.md
@@ -1 +1,235 @@
|
|||||||
Pruebas con docker
|
# OneDrive Engine
|
||||||
|
|
||||||
|
Sistema automatizado para la renovación de Microsoft E5 usando Docker, compuesto por dos servicios principales que trabajan en conjunto.
|
||||||
|
|
||||||
|
## 📋 Descripción
|
||||||
|
|
||||||
|
Este proyecto implementa un sistema de dos contenedores Docker:
|
||||||
|
|
||||||
|
- **odengin**: Motor principal que gestiona la renovación automática de Microsoft E5
|
||||||
|
- **odcron**: Servicio de tareas programadas que se comunica con el motor principal
|
||||||
|
|
||||||
|
## 🏗️ Arquitectura
|
||||||
|
|
||||||
|
```
|
||||||
|
┌─────────────────┐ ┌─────────────────┐
|
||||||
|
│ odcron │────────>│ odengin │
|
||||||
|
│ (Scheduler) │ HTTP │ (Engine) │
|
||||||
|
│ Port: N/A │ │ Port: 8080 │
|
||||||
|
└─────────────────┘ └─────────────────┘
|
||||||
|
```
|
||||||
|
|
||||||
|
Los servicios se comunican a través de una red Docker privada (`odeng-net`).
|
||||||
|
|
||||||
|
## 🚀 Inicio Rápido
|
||||||
|
|
||||||
|
### Prerrequisitos
|
||||||
|
|
||||||
|
- Docker
|
||||||
|
- Docker Compose
|
||||||
|
- Credenciales de Microsoft E5:
|
||||||
|
- Client ID
|
||||||
|
- Client Secret
|
||||||
|
- Refresh Token
|
||||||
|
|
||||||
|
### Instalación
|
||||||
|
|
||||||
|
1. Clona el repositorio:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone <tu-repositorio>
|
||||||
|
cd onedrive
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Copia el archivo de configuración de ejemplo:
|
||||||
|
|
||||||
|
```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_SECRET=tu_client_secret
|
||||||
|
E5_REFRESH_TOKEN=tu_refresh_token
|
||||||
|
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
|
||||||
|
```
|
||||||
|
|
||||||
|
5. Inicia los servicios:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
6. Verifica el estado:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose ps
|
||||||
|
docker-compose logs -f
|
||||||
|
```
|
||||||
|
|
||||||
|
## ⚙️ 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
|
||||||
|
|
||||||
|
#### Servicio `odengin`
|
||||||
|
|
||||||
|
| Variable | Descripción | Requerida | Variable de Entorno |
|
||||||
|
| --------------------- | ------------------------------- | --------- | --------------------- |
|
||||||
|
| `E5_CLIENT_ID` | Client ID de Microsoft Azure | ✅ | `E5_CLIENT_ID` |
|
||||||
|
| `E5_CLIENT_SECRET` | Client Secret de Azure | ✅ | `E5_CLIENT_SECRET` |
|
||||||
|
| `E5_REFRESH_TOKEN` | Token de renovación | ✅ | `E5_REFRESH_TOKEN` |
|
||||||
|
| `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` |
|
||||||
|
|
||||||
|
#### Servicio `odcron`
|
||||||
|
|
||||||
|
| Variable | Descripción | Requerida | Variable de Entorno |
|
||||||
|
| ------------------- | -------------------------------------------- | --------- | -------------------- |
|
||||||
|
| IP del motor | Dirección del motor (formato: `host:puerto`) | ✅ | `CRON_IP` |
|
||||||
|
| Contraseña | Contraseña de autenticación | ✅ | `CRON_PASSWORD` |
|
||||||
|
| Token de renovación | Token de renovación | ✅ | `CRON_REFRESH_TOKEN` |
|
||||||
|
|
||||||
|
### Puertos
|
||||||
|
|
||||||
|
- **8089**: Puerto expuesto del servicio odengin (mapea al 8080 interno)
|
||||||
|
|
||||||
|
## 📁 Estructura del Proyecto
|
||||||
|
|
||||||
|
```
|
||||||
|
onedrive/
|
||||||
|
├── docker-compose.yml # Orquestación de servicios
|
||||||
|
├── README.md # Este archivo
|
||||||
|
├── cron/ # Servicio de tareas programadas
|
||||||
|
│ ├── Dockerfile
|
||||||
|
│ ├── docker-compose.yml
|
||||||
|
│ ├── requirements.txt
|
||||||
|
│ ├── script.py
|
||||||
|
│ └── README.md
|
||||||
|
└── engine/ # Motor principal
|
||||||
|
├── Dockerfile
|
||||||
|
├── docker-compose.yml
|
||||||
|
└── README.md
|
||||||
|
```
|
||||||
|
|
||||||
|
## 🔧 Comandos Útiles
|
||||||
|
|
||||||
|
### Gestión de Contenedores
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Iniciar servicios
|
||||||
|
docker-compose up -d
|
||||||
|
|
||||||
|
# Detener servicios
|
||||||
|
docker-compose down
|
||||||
|
|
||||||
|
# Ver logs en tiempo real
|
||||||
|
docker-compose logs -f
|
||||||
|
|
||||||
|
# Ver logs de un servicio específico
|
||||||
|
docker-compose logs -f odengin
|
||||||
|
docker-compose logs -f odcron
|
||||||
|
|
||||||
|
# Reiniciar servicios
|
||||||
|
docker-compose restart
|
||||||
|
|
||||||
|
# Reconstruir imágenes
|
||||||
|
docker-compose build --no-cache
|
||||||
|
docker-compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
### Monitoreo
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Estado de los contenedores
|
||||||
|
docker-compose ps
|
||||||
|
|
||||||
|
# Inspeccionar un contenedor
|
||||||
|
docker inspect odengin
|
||||||
|
|
||||||
|
# Acceder al shell de un contenedor
|
||||||
|
docker exec -it odengin /bin/bash
|
||||||
|
docker exec -it odcron /bin/bash
|
||||||
|
```
|
||||||
|
|
||||||
|
## 🔍 Troubleshooting
|
||||||
|
|
||||||
|
### El servicio odengin no inicia
|
||||||
|
|
||||||
|
- Verifica que las credenciales de E5 sean correctas
|
||||||
|
- Revisa los logs: `docker-compose logs odengin`
|
||||||
|
- Asegúrate de que el puerto 8089 no esté en uso
|
||||||
|
|
||||||
|
### El servicio odcron no se conecta
|
||||||
|
|
||||||
|
- Verifica que odengin esté corriendo: `docker-compose ps`
|
||||||
|
- Confirma que la variable `IP` apunte a `odengin:8080`
|
||||||
|
- Revisa la configuración de la red: `docker network inspect onedrive_odeng-net`
|
||||||
|
|
||||||
|
### Problemas de red entre contenedores
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Verificar conectividad
|
||||||
|
docker exec -it odcron ping odengin
|
||||||
|
```
|
||||||
|
|
||||||
|
## 🛡️ Seguridad
|
||||||
|
|
||||||
|
### Gestión de Credenciales
|
||||||
|
|
||||||
|
✅ **HACER:**
|
||||||
|
|
||||||
|
- ✅ Usar archivo `.env` para variables sensibles
|
||||||
|
- ✅ 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
|
||||||
|
|
||||||
|
- Los contenedores se reinician automáticamente (`restart: unless-stopped`)
|
||||||
|
- La comunicación entre servicios usa la red interna `odeng-net`
|
||||||
|
|||||||
10
cron/Dockerfile
Normal file
10
cron/Dockerfile
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
FROM python:3.9-slim
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY requirements.txt .
|
||||||
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
|
COPY script.py .
|
||||||
|
|
||||||
|
CMD ["python", "script.py"]
|
||||||
3
cron/README.md
Normal file
3
cron/README.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
## Actualizado, puede contener errores
|
||||||
|
|
||||||
|
|
||||||
12
cron/docker-compose.yml
Normal file
12
cron/docker-compose.yml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
services:
|
||||||
|
odcron:
|
||||||
|
build: .
|
||||||
|
container_name: odcron
|
||||||
|
environment:
|
||||||
|
- IP=host:8080 # Cambia esto por la IP y puerto deseado
|
||||||
|
- PASSWORD=pass # Cambia esto por la contraseña deseada
|
||||||
|
- REFRESH_TOKEN=tokenit # Cambia esto por el token deseado
|
||||||
|
restart: unless-stopped
|
||||||
|
hostname: odcron
|
||||||
|
network_mode: bridge
|
||||||
2
cron/requirements.txt
Normal file
2
cron/requirements.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
requests
|
||||||
|
schedule
|
||||||
46
cron/script.sh
Normal file
46
cron/script.sh
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
import requests
|
||||||
|
import schedule
|
||||||
|
import time
|
||||||
|
import logging
|
||||||
|
import os
|
||||||
|
|
||||||
|
# Configuración del logging
|
||||||
|
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
||||||
|
|
||||||
|
# Leer variables de entorno
|
||||||
|
IP = os.getenv("IP", "127.0.0.0:8080") # IP y puerto por defecto
|
||||||
|
PASSWORD = os.getenv("PASSWORD", "pass") # Password por defecto
|
||||||
|
REFRESH_TOKEN = os.getenv("REFRESH_TOKEN", "tokenit") # Token por defecto
|
||||||
|
|
||||||
|
# Construir la URL correctamente
|
||||||
|
URL = f"http://{IP}/call" # Incluye el protocolo y la ruta
|
||||||
|
HEADERS = {"Content-Type": "application/json"}
|
||||||
|
DATA = {"password": PASSWORD, "refresh_token": REFRESH_TOKEN}
|
||||||
|
|
||||||
|
def perform_curl():
|
||||||
|
try:
|
||||||
|
# Realiza la solicitud POST
|
||||||
|
response = requests.post(URL, headers=HEADERS, json=DATA)
|
||||||
|
response.raise_for_status() # Lanza una excepción si la respuesta no es exitosa
|
||||||
|
logging.info(f"Success: {response.status_code} - {response.text[:100]}...") # Muestra solo los primeros 100 caracteres
|
||||||
|
except requests.exceptions.RequestException as e:
|
||||||
|
logging.error(f"Error: {e}")
|
||||||
|
|
||||||
|
def initial_test():
|
||||||
|
logging.info("Running initial test...")
|
||||||
|
perform_curl()
|
||||||
|
|
||||||
|
def main():
|
||||||
|
# Ejecuta la prueba inicial
|
||||||
|
initial_test()
|
||||||
|
|
||||||
|
# Programa la ejecución cada minuto
|
||||||
|
schedule.every(1).minutes.do(perform_curl)
|
||||||
|
|
||||||
|
# Bucle para mantener el script en ejecución
|
||||||
|
while True:
|
||||||
|
schedule.run_pending()
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
37
docker-compose.yml
Normal file
37
docker-compose.yml
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
---
|
||||||
|
services:
|
||||||
|
odengin:
|
||||||
|
build: ./engine
|
||||||
|
container_name: odengin
|
||||||
|
env_file: .env
|
||||||
|
environment:
|
||||||
|
- E5_CLIENT_ID=${E5_CLIENT_ID}
|
||||||
|
- E5_CLIENT_SECRET=${E5_CLIENT_SECRET}
|
||||||
|
- E5_REFRESH_TOKEN=${E5_REFRESH_TOKEN}
|
||||||
|
- WEB_APP_PASSWORD=${WEB_APP_PASSWORD}
|
||||||
|
- E5_WEB_APP_PASSWORD=${E5_WEB_APP_PASSWORD}
|
||||||
|
ports:
|
||||||
|
- "8089:8080"
|
||||||
|
restart: unless-stopped
|
||||||
|
hostname: odengin
|
||||||
|
networks:
|
||||||
|
- odeng-net
|
||||||
|
|
||||||
|
odcron:
|
||||||
|
build: ./cron
|
||||||
|
container_name: odcron
|
||||||
|
env_file: .env
|
||||||
|
environment:
|
||||||
|
- IP=${CRON_IP:-odengin:8080}
|
||||||
|
- PASSWORD=${CRON_PASSWORD}
|
||||||
|
- REFRESH_TOKEN=${CRON_REFRESH_TOKEN}
|
||||||
|
restart: unless-stopped
|
||||||
|
hostname: odcron
|
||||||
|
networks:
|
||||||
|
- odeng-net
|
||||||
|
depends_on:
|
||||||
|
- odengin
|
||||||
|
|
||||||
|
networks:
|
||||||
|
odeng-net:
|
||||||
|
driver: bridge
|
||||||
26
engine/Dockerfile
Normal file
26
engine/Dockerfile
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
# Usar una imagen base más ligera y específica
|
||||||
|
FROM python:3.9-slim
|
||||||
|
|
||||||
|
# Establecer el directorio de trabajo
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Instalar dependencias del sistema y limpiar caché en un solo RUN
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y --no-install-recommends git wget && \
|
||||||
|
apt-get clean && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Clonar el repositorio
|
||||||
|
RUN git clone https://github.com/TheCaduceus/Microsoft-E5-Auto-Renewal /app
|
||||||
|
|
||||||
|
# Instalar dependencias de Python
|
||||||
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
|
# Copiar el resto de los archivos
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Exponer el puerto
|
||||||
|
EXPOSE 8080
|
||||||
|
|
||||||
|
# Establecer el comando de entrada
|
||||||
|
CMD ["python", "main.py"]
|
||||||
2
engine/README.md
Normal file
2
engine/README.md
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
## Actualizado, puede contener errores
|
||||||
|
|
||||||
16
engine/docker-compose.yml
Normal file
16
engine/docker-compose.yml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
---
|
||||||
|
services:
|
||||||
|
odengin:
|
||||||
|
build: .
|
||||||
|
container_name: odengin
|
||||||
|
environment:
|
||||||
|
- E5_CLIENT_ID=id
|
||||||
|
- E5_CLIENT_SECRET=secret
|
||||||
|
- E5_REFRESH_TOKEN=tokenit
|
||||||
|
- WEB_APP_PASSWORD=123
|
||||||
|
- E5_WEB_APP_PASSWORD=123
|
||||||
|
ports:
|
||||||
|
- 8089:8080
|
||||||
|
restart: unless-stopped
|
||||||
|
hostname: odengin
|
||||||
|
network_mode: bridge
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
FROM ubuntu
|
|
||||||
|
|
||||||
RUN apt update && apt upgrade -y && apt install wget -y
|
|
||||||
|
|
||||||
RUN wget https://github.com/layou233/NeverIdle/releases/download/0.2.3/NeverIdle-linux-arm64 -O NeverIdle
|
|
||||||
|
|
||||||
RUN chmod 777 NeverIdle
|
|
||||||
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
RUN chmod +x test.sh
|
|
||||||
|
|
||||||
ENTRYPOINT ./test.sh
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
./NeverIdle -c 2h1m2s -m 2 -n 4h
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
FROM ubuntu
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
RUN apt update && apt upgrade -y && apt autoremove -y && apt install python3 python3-pip -y && apt install git nano wget curl -y
|
|
||||||
|
|
||||||
RUN pip install schedule
|
|
||||||
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
ENV IP_PING="http://127.0.0.1:8080/call"
|
|
||||||
|
|
||||||
ENV TOKEN="token"
|
|
||||||
|
|
||||||
ENV PASSWORD_WEB="pass"
|
|
||||||
|
|
||||||
ENV SUPERCOMANDO='curl -X POST -H "Content-Type: application/json" -d '{"password": "$PASSWORD_WEB" ,"refresh_token": "$TOKEN"}' "$IP_PING"'
|
|
||||||
|
|
||||||
RUN chmod +x run.sh
|
|
||||||
|
|
||||||
ENTRYPOINT ./run.sh
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
## actualmente da error
|
|
||||||
|
|
||||||
#### manual
|
|
||||||
```sh
|
|
||||||
apt update && apt install wget -y && bash -c "$(wget -qLO - https://raw.githubusercontent.com/kadma/pruebasdocker/main/onedrive/cron/script.sh)"
|
|
||||||
```
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
import os
|
|
||||||
import schedule
|
|
||||||
import time
|
|
||||||
import subprocess
|
|
||||||
|
|
||||||
def ejecutar_comando():
|
|
||||||
comando = os.environ.get('SUPERCOMANDO', default=None)
|
|
||||||
|
|
||||||
if comando is not None:
|
|
||||||
subprocess.run(comando, shell=True)
|
|
||||||
else:
|
|
||||||
print("La variable de entorno no tiene un valor definido.")
|
|
||||||
|
|
||||||
schedule.every(1).minutes.do(ejecutar_comando)
|
|
||||||
|
|
||||||
while True:
|
|
||||||
# Ejecuta las tareas pendientes
|
|
||||||
schedule.run_pending()
|
|
||||||
|
|
||||||
# Espera 1 segundo antes de volver a verificar
|
|
||||||
time.sleep(1)
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
import os
|
|
||||||
import schedule
|
|
||||||
import time
|
|
||||||
import subprocess
|
|
||||||
|
|
||||||
def ejecutar_comando():
|
|
||||||
comando = os.environ.get('SUPERCOMANDO', default=None)
|
|
||||||
|
|
||||||
if comando is not None:
|
|
||||||
subprocess.run(comando, shell=True)
|
|
||||||
else:
|
|
||||||
print("La variable de entorno no tiene un valor definido.")
|
|
||||||
|
|
||||||
schedule.every(7).hours.do(ejecutar_comando)
|
|
||||||
|
|
||||||
while True:
|
|
||||||
# Ejecuta las tareas pendientes
|
|
||||||
schedule.run_pending()
|
|
||||||
|
|
||||||
# Espera 1 segundo antes de volver a verificar
|
|
||||||
time.sleep(1)
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
python3 cron7h.py
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
apt update && apt upgrade -y && apt autoremove -y && apt install python3 python3-pip -y && apt install git nano curl -y
|
|
||||||
pip3 install schedule
|
|
||||||
wget -b -P /app/ https://raw.githubusercontent.com/kadma/pruebasdocker/main/onedrive/cron/cron1m.py
|
|
||||||
wget -b -P /app/ https://raw.githubusercontent.com/kadma/pruebasdocker/main/onedrive/cron/cron7h.py
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
FROM ubuntu
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
RUN apt update && apt upgrade -y && apt autoremove -y && apt install python3 python3-pip -y && apt install git nano wget -y
|
|
||||||
|
|
||||||
RUN git clone https://github.com/TheCaduceus/Microsoft-E5-Auto-Renewal /app
|
|
||||||
|
|
||||||
RUN pip install -r requirements.txt
|
|
||||||
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
ENV E5_CLIENT_ID="id"
|
|
||||||
|
|
||||||
ENV E5_CLIENT_SECRET="secret"
|
|
||||||
|
|
||||||
ENV E5_REFRESH_TOKEN="token"
|
|
||||||
|
|
||||||
ENV WEB_APP_PASSWORD="pass"
|
|
||||||
|
|
||||||
EXPOSE 8080
|
|
||||||
|
|
||||||
RUN chmod +x run.sh
|
|
||||||
|
|
||||||
ENTRYPOINT ./run.sh
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
## sin actualziar
|
|
||||||
|
|
||||||
#### manual
|
|
||||||
```sh
|
|
||||||
apt update && apt install wget -y && bash -c "$(wget -qLO - https://raw.githubusercontent.com/kadma/pruebasdocker/main/onedrive/engine/script.sh)"
|
|
||||||
```
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
python3 main.py
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
apt update && apt upgrade -y && apt autoremove -y && apt install python3 python3-pip -y && apt install git nano curl -y
|
|
||||||
git clone https://github.com/TheCaduceus/Microsoft-E5-Auto-Renewal /app
|
|
||||||
pip3 install -r /app/requirements.txt
|
|
||||||
python3 /app/main.py
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
FROM ubuntu
|
|
||||||
|
|
||||||
RUN apt update && apt upgrade -y && apt autoremove -y && apt install python3 python3-pip -y && apt install git nano wget -y
|
|
||||||
|
|
||||||
ENV URL_DESCARGA_RCLONE="https://downloads.rclone.org/v1.65.0/rclone-v1.65.0-linux-amd64.deb"
|
|
||||||
|
|
||||||
EXPOSE 5572
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
RUN wget $URL_DESCARGA_RCLONE
|
|
||||||
|
|
||||||
RUN dpkg -i rclone-v1.65.0-linux-amd64.deb
|
|
||||||
|
|
||||||
ENV USER_RCLONE=adm PASSWORD_RCLONE=pass
|
|
||||||
|
|
||||||
RUN wget https://raw.githubusercontent.com/kadma/pruebasdocker/main/rclone-gui/test.sh
|
|
||||||
|
|
||||||
RUN chmod +x test.sh
|
|
||||||
|
|
||||||
ENTRYPOINT ./test.sh
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
rclone rcd --rc-web-gui --rc-addr :5572 --rc-serve --rc-user=$USER_RCLONE --rc-pass=$PASSWORD_RCLONE --rc-no-auth --config "/root/.config/rclone/rclone.conf" --user-agent "Mozilla" --transfers 24
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
FROM ubuntu
|
|
||||||
|
|
||||||
RUN apt update && apt upgrade -y && apt autoremove -y && apt install python3 python3-pip -y && apt install git nano wget -y
|
|
||||||
|
|
||||||
ENV URL_DESCARGA_RCLONE="https://downloads.rclone.org/v1.66.0/rclone-v1.66.0-linux-amd64.deb"
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
RUN wget $URL_DESCARGA_RCLONE
|
|
||||||
|
|
||||||
RUN dpkg -i rclone-v1.66.0-linux-amd64.deb
|
|
||||||
|
|
||||||
RUN rm rclone-v1.66.0-linux-amd64.deb
|
|
||||||
|
|
||||||
ENV USER_RCLONE=adm PASSWORD_RCLONE=pass
|
|
||||||
|
|
||||||
RUN wget https://raw.githubusercontent.com/kadma/pruebasdocker/main/rclone-webdav/test.sh
|
|
||||||
|
|
||||||
RUN chmod +x test.sh
|
|
||||||
|
|
||||||
ENTRYPOINT ./test.sh
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
---
|
|
||||||
services:
|
|
||||||
rclone-webdav:
|
|
||||||
build:
|
|
||||||
context: .
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
container_name: rclone-webdav
|
|
||||||
volumes:
|
|
||||||
- /path/to/config:/root/.config/rclone
|
|
||||||
restart: unless-stopped
|
|
||||||
network_mode: bridge
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
rclone serve webdav --vfs-cache-mode writes --addr :80 drive: --buffer-size 250M --vfs-read-chunk-size 256M --ignore-size --ignore-checksum --update &
|
|
||||||
rclone serve webdav --vfs-cache-mode writes --addr :81 drive1: --buffer-size 250M --vfs-read-chunk-size 256M --ignore-size --ignore-checksum --update &
|
|
||||||
rclone serve webdav --vfs-cache-mode writes --addr :82 drive2: --buffer-size 250M --vfs-read-chunk-size 256M --ignore-size --ignore-checksum --update &
|
|
||||||
rclone serve webdav --vfs-cache-mode writes --addr :83 drive3: --buffer-size 250M --vfs-read-chunk-size 256M --ignore-size --ignore-checksum --update
|
|
||||||
Reference in New Issue
Block a user