diff --git a/.env b/.env new file mode 100644 index 0000000..4019fa2 --- /dev/null +++ b/.env @@ -0,0 +1,3 @@ +APP_MODE=production +API_URL=https://api.example.com +DB_HOST=prod-db.example.com diff --git a/.env-staging b/.env-staging new file mode 100644 index 0000000..6d6e437 --- /dev/null +++ b/.env-staging @@ -0,0 +1,3 @@ +APP_MODE=staging +API_URL=https://staging.api.example.com +DB_HOST=staging-db.example.com diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index dfdb8b7..0000000 --- a/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -*.sh text eol=lf diff --git a/README.md b/README.md index a7c7098..b389fc1 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,38 @@ -# Proyecto Integrado Basado en Clases +# (Staging Branch) -Este proyecto implementa los conceptos aprendidos en las clases. Se incluyen: -1. **Balanceo de cargas (NGINX)** -2. **Almacenamiento por bloques** -3. **Creación y despliegue de imágenes Docker** -4. **Repositorios y ramas** +Welcome to the staging branch—the foundation of the development pipeline for this project. This is where all ideas, prototypes, experiments, and unconventional tests are implemented, free from the worry of breaking anything. Think of it as the workshop for trial and error, the "laboratory" where we see what works and what doesn't. ---- +## Why Call It the "Lowest Level" Branch? -## Requisitos Previos -- Docker y Docker Compose instalados. -- Git configurado. +In this workflow, **staging** is like the basement of a tall building: + +- Above it are more "polished" floors (like `develop` or `master`) where things are more refined. +- Here in `staging`, however, we embrace freedom to test any changes without the need for neatness or completion. +- Imagine a warehouse filled with scrap, loose parts, prototypes, trials, and countless raw ideas. That's `staging`. + +## What Happens Here? + +- **Big Experiments:** + Add new services (perhaps an improvised app3), modify nginx.conf as many times as necessary, change volumes, bind mounts, images, and environment variables—all without concerns. + +- **Testing Unstable Configurations:** + If something doesn't work, that's fine. We leave it as is; it might be useful later. If something works, great! It can be "promoted" to the feature/new-functionality branch for further development and refinement. + +- **Deciding the Fate of Ideas:** + Anything that shows potential in staging—like functional code or promising configurations—gets carried over to `feature/new-functionality` for enhancement. If all goes well, it may eventually reach higher branches (develop, then master). + +## What Happens to Things That Don’t Work? + +Here’s the interesting part: + +- In `staging`, we don’t delete things that don’t work. We keep them in place, just in case they inspire us or become useful for another experiment in the future. +- The beauty of `staging` lies in being a creative space where what doesn't work today might find its purpose tomorrow. + +## Summary + +- **staging = Experimental Basement**: We test, trial, and explore freely. +- Things that work: Get promoted to feature/new-functionality for deeper development.. +- Things that don’t work: Stay here for potential future use. + +In essence, the staging branch is the perfect space for me, as the sole developer, to unleash creativity, play with configurations, test new Docker images, adjust docker-compose.yml repeatedly, and do so without affecting the more "serious" code in the upper branches. -## Pasos para Ejecutar el Proyecto -### 1. Clonar el Repositorio -```bash -git clone https://github.com/usuario/proyecto-integrado.git -cd proyecto-integrado diff --git a/docker/app3/Dockerfile b/docker/app3/Dockerfile new file mode 100644 index 0000000..9e5c74f --- /dev/null +++ b/docker/app3/Dockerfile @@ -0,0 +1,11 @@ +FROM nginx:alpine + +# En caso de que queramos usar variables de entorno, usar así: +# ARG APP_MODE=staging +# RUN echo "Ejecutando en modo $APP_MODE" + +COPY index.html /usr/share/nginx/html/index.html + +EXPOSE 80 + +CMD ["nginx", "-g", "daemon off;"] diff --git a/docker/app3/index.html b/docker/app3/index.html new file mode 100644 index 0000000..9587ae7 --- /dev/null +++ b/docker/app3/index.html @@ -0,0 +1,30 @@ + + +
+ +
+ Bienvenido a la versión Staging de la App3.
+Acá probamos nuevas funcionalidades antes de llevarlas a producción.
+"¿Carretera? A donde vamos, no necesitamos carreteras."
+ + diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 6f1c6d9..deaca74 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,40 +1,57 @@ +version: '3.8' + services: app1: build: context: ./app1 - image: app1_image:latest + image: app1_image:dev + # Cambiar el volumen o bind mount para staging volumes: - - app1-data:/var/www/html + - ./app1-staging:/var/www/html + environment: + - APP_ENV=staging networks: - - my-network + - my-staging-network app2: build: context: ./app2 - image: app2_image:latest + image: app2_image:dev + volumes: - - ./app2:/var/www/html + - ./app2-staging:/var/www/html + environment: + - APP_ENV=staging + networks: + - my-staging-network + + app3: + build: + context: ./app3 + image: app3_image:dev + # Este servicio no existe en master, es solo para staging + environment: + - APP_ENV=staging networks: - - my-network + - my-staging-network nginx: build: context: ./nginx - image: nginx_image:latest + image: nginx_image:staging ports: - - "80:80" + - "8080:80" # Nota: un puerto distinto a master para no colisionar + volumes: + - ./nginx/nginx-staging.conf:/etc/nginx/nginx.conf:ro depends_on: - app1 - app2 + - app3 networks: - - my-network - -volumes: - app1-data: - app2-data: + - my-staging-network networks: - my-network: + my-staging-network: driver: bridge @@ -55,4 +72,5 @@ networks: + diff --git a/docker/nginx/nginx-staging.conf b/docker/nginx/nginx-staging.conf new file mode 100644 index 0000000..8d6654d --- /dev/null +++ b/docker/nginx/nginx-staging.conf @@ -0,0 +1,39 @@ +events {} + +http { + upstream app1_staging { + server app1:80; + } + + upstream app2_staging { + server app2:80; + } + + upstream app3_staging { + server app3:80; + } + + server { + listen 80; + + + location /app1/ { + proxy_pass http://app1_staging/; + } + + + location /app2/ { + proxy_pass http://app2_staging/; + } + + + location /app3/ { + proxy_pass http://app3_staging/; + } + + + location / { + return 200 "Bienvenido al entorno STAGING"; + } + } +} diff --git a/mock-data/usuarios.json b/mock-data/usuarios.json new file mode 100644 index 0000000..bf5f4f0 Binary files /dev/null and b/mock-data/usuarios.json differ diff --git a/scripts/generar_usuarios.sh b/scripts/generar_usuarios.sh new file mode 100644 index 0000000..3606a6c Binary files /dev/null and b/scripts/generar_usuarios.sh differ diff --git a/tools/README.md b/tools/README.md new file mode 100644 index 0000000..2ba572d Binary files /dev/null and b/tools/README.md differ