Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
APP_MODE=production
API_URL=https://api.example.com
DB_HOST=prod-db.example.com
3 changes: 3 additions & 0 deletions .env-staging
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
APP_MODE=staging
API_URL=https://staging.api.example.com
DB_HOST=staging-db.example.com
1 change: 0 additions & 1 deletion .gitattributes

This file was deleted.

49 changes: 34 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions docker/app3/Dockerfile
Original file line number Diff line number Diff line change
@@ -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;"]
30 changes: 30 additions & 0 deletions docker/app3/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<title>Volver al Futuro (Staging)</title>
<style>
body {
font-family: Arial, sans-serif;
background: #333;
color: #eee;
text-align: center;
padding: 50px;
}
h1 { font-size: 3em; margin-bottom: 20px; }
p { font-size: 1.2em; }
.delorean {
max-width: 300px;
margin: 20px auto;
border: 2px solid #fff;
}
</style>
</head>
<body>
<h1>Volver al Futuro</h1>
<img class="delorean" src="https://upload.wikimedia.org/wikipedia/commons/f/f4/DeLorean_DMC-12_side.jpg" alt="DeLorean">
<p>Bienvenido a la versión Staging de la App3.</p>
<p>Acá probamos nuevas funcionalidades antes de llevarlas a producción.</p>
<p><em>"¿Carretera? A donde vamos, no necesitamos carreteras."</em></p>
</body>
</html>
46 changes: 32 additions & 14 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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


Expand All @@ -55,4 +72,5 @@ networks:





39 changes: 39 additions & 0 deletions docker/nginx/nginx-staging.conf
Original file line number Diff line number Diff line change
@@ -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";
}
}
}
Binary file added mock-data/usuarios.json
Binary file not shown.
Binary file added scripts/generar_usuarios.sh
Binary file not shown.
Binary file added tools/README.md
Binary file not shown.