Mate11 commited on
Commit
0e12506
Β·
1 Parent(s): f681360

migra base de datos a Neon (cloud PostgreSQL)

Browse files

- Reemplaza servicio db local por DATABASE_URL externa en docker-compose
- Actualiza .env.example con formato de conexiΓ³n Neon

Files changed (2) hide show
  1. .env.example +2 -7
  2. docker-compose.yml +0 -25
.env.example CHANGED
@@ -1,11 +1,6 @@
1
  # ─── Base de datos ─────────────────────────────────────────────────────────
2
- # Formato: postgresql://USUARIO:CONTRASEΓ‘A@HOST:PUERTO/NOMBRE_BD
3
- DATABASE_URL=postgresql://admin:CAMBIAR_CONTRASENA@db:5432/internacion_db
4
-
5
- # Variables de PostgreSQL (usadas por el servicio 'db' en docker-compose)
6
- POSTGRES_DB=internacion_db
7
- POSTGRES_USER=admin
8
- POSTGRES_PASSWORD=CAMBIAR_CONTRASENA
9
 
10
  # ─── JWT ───────────────────────────────────────────────────────────────────
11
  # Generar con: python -c "import secrets; print(secrets.token_hex(32))"
 
1
  # ─── Base de datos ─────────────────────────────────────────────────────────
2
+ # Formato Neon: postgresql://USUARIO:CONTRASEΓ‘A@HOST/NOMBRE_BD?sslmode=require&channel_binding=require
3
+ DATABASE_URL=postgresql://USUARIO:CONTRASEΓ‘A@HOST/NOMBRE_BD?sslmode=require&channel_binding=require
 
 
 
 
 
4
 
5
  # ─── JWT ───────────────────────────────────────────────────────────────────
6
  # Generar con: python -c "import secrets; print(secrets.token_hex(32))"
docker-compose.yml CHANGED
@@ -1,31 +1,11 @@
1
  services:
2
- db:
3
- image: postgres:16-alpine
4
- container_name: m6_db
5
- environment:
6
- POSTGRES_DB: ${POSTGRES_DB:-internacion_db}
7
- POSTGRES_USER: ${POSTGRES_USER:-admin}
8
- POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-secret}
9
- volumes:
10
- - postgres_data:/var/lib/postgresql/data
11
- healthcheck:
12
- test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-admin} -d ${POSTGRES_DB:-internacion_db}"]
13
- interval: 5s
14
- timeout: 5s
15
- retries: 10
16
-
17
  backend:
18
  build:
19
  context: .
20
  dockerfile: Dockerfile
21
  container_name: m6_backend
22
- depends_on:
23
- db:
24
- condition: service_healthy
25
  env_file:
26
  - .env
27
- environment:
28
- DATABASE_URL: postgresql://${POSTGRES_USER:-admin}:${POSTGRES_PASSWORD:-secret}@db:5432/${POSTGRES_DB:-internacion_db}
29
  ports:
30
  - "8006:8006"
31
  volumes:
@@ -41,9 +21,4 @@ services:
41
  PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_PASSWORD:-admin}
42
  ports:
43
  - "5050:80"
44
- depends_on:
45
- - db
46
  restart: unless-stopped
47
-
48
- volumes:
49
- postgres_data:
 
1
  services:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  backend:
3
  build:
4
  context: .
5
  dockerfile: Dockerfile
6
  container_name: m6_backend
 
 
 
7
  env_file:
8
  - .env
 
 
9
  ports:
10
  - "8006:8006"
11
  volumes:
 
21
  PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_PASSWORD:-admin}
22
  ports:
23
  - "5050:80"
 
 
24
  restart: unless-stopped