fix dockerization
This commit is contained in:
parent
f6d322fc76
commit
9ad61bd6aa
11
.env
11
.env
|
@ -1,12 +1,13 @@
|
||||||
# SERVICE
|
# SERVICE
|
||||||
SERVICE_CONTAINER=v3_user
|
SERVICE_CONTAINER=v3-user
|
||||||
SERVICE_PORT=3001
|
SERVICE_URL=0.0.0.0
|
||||||
|
SERVICE_PORT=5001
|
||||||
|
|
||||||
# PRISMA
|
# PRISMA
|
||||||
DATABASE_URL="postgresql://user:user@db:5432/user?schema=public"
|
DATABASE_URL="postgresql://user:user@db:5432/user?schema=public"
|
||||||
|
|
||||||
# POSTGRES
|
# POSTGRES
|
||||||
POSTGRES_CONTAINER=v3_user_db
|
POSTGRES_CONTAINER=v3-user-db
|
||||||
POSTGRES_IMAGE=postgres:15.0
|
POSTGRES_IMAGE=postgres:15.0
|
||||||
POSTGRES_DB=user
|
POSTGRES_DB=user
|
||||||
POSTGRES_PASSWORD=user
|
POSTGRES_PASSWORD=user
|
||||||
|
@ -14,8 +15,8 @@ POSTGRES_USER=user
|
||||||
POSTGRES_PORT=5401
|
POSTGRES_PORT=5401
|
||||||
|
|
||||||
# PGADMIN
|
# PGADMIN
|
||||||
PGADMIN_CONTAINER=v3_user_pgadmin
|
PGADMIN_CONTAINER=v3-user-pgadmin
|
||||||
PGADMIN_IMAGE=dpage/pgadmin4:6.12
|
PGADMIN_IMAGE=dpage/pgadmin4:6.12
|
||||||
PGADMIN_EMAIL=it@mobicoo.org
|
PGADMIN_EMAIL=it@mobicoop.org
|
||||||
PGADMIN_PASSWORD=user
|
PGADMIN_PASSWORD=user
|
||||||
PGADMIN_PORT=8401
|
PGADMIN_PORT=8401
|
||||||
|
|
10
.env.dist
10
.env.dist
|
@ -1,13 +1,13 @@
|
||||||
# SERVICE
|
# SERVICE
|
||||||
SERVICE_CONTAINER=v3_user
|
SERVICE_CONTAINER=v3-user
|
||||||
SERVICE_PORT=3001
|
SERVICE_URL=0.0.0.0
|
||||||
SERVICE_URL=localhost:3001
|
SERVICE_PORT=5001
|
||||||
|
|
||||||
# PRISMA
|
# PRISMA
|
||||||
DATABASE_URL="postgresql://user:user@db:5432/user?schema=public"
|
DATABASE_URL="postgresql://user:user@db:5432/user?schema=public"
|
||||||
|
|
||||||
# POSTGRES
|
# POSTGRES
|
||||||
POSTGRES_CONTAINER=v3_user_db
|
POSTGRES_CONTAINER=v3-user-db
|
||||||
POSTGRES_IMAGE=postgres:15.0
|
POSTGRES_IMAGE=postgres:15.0
|
||||||
POSTGRES_DB=user
|
POSTGRES_DB=user
|
||||||
POSTGRES_PASSWORD=user
|
POSTGRES_PASSWORD=user
|
||||||
|
@ -15,7 +15,7 @@ POSTGRES_USER=user
|
||||||
POSTGRES_PORT=5401
|
POSTGRES_PORT=5401
|
||||||
|
|
||||||
# PGADMIN
|
# PGADMIN
|
||||||
PGADMIN_CONTAINER=v3_user_pgadmin
|
PGADMIN_CONTAINER=v3-user-pgadmin
|
||||||
PGADMIN_IMAGE=dpage/pgadmin4:6.12
|
PGADMIN_IMAGE=dpage/pgadmin4:6.12
|
||||||
PGADMIN_EMAIL=it@mobicoop.org
|
PGADMIN_EMAIL=it@mobicoop.org
|
||||||
PGADMIN_PASSWORD=user
|
PGADMIN_PASSWORD=user
|
||||||
|
|
|
@ -22,6 +22,12 @@ docker-compose up -d
|
||||||
|
|
||||||
The app runs automatically on the port defined in `SERVICE_PORT` of `.env` file (default : _3001_).
|
The app runs automatically on the port defined in `SERVICE_PORT` of `.env` file (default : _3001_).
|
||||||
|
|
||||||
|
You then need to set the appropriate rights for PGAdmin container :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo chown -R 5050:5050 postgresql/.pgadmin_data
|
||||||
|
```
|
||||||
|
|
||||||
## Database migration
|
## Database migration
|
||||||
|
|
||||||
Before using the app, you need to launch the database migration :
|
Before using the app, you need to launch the database migration :
|
||||||
|
|
|
@ -13,11 +13,13 @@ services:
|
||||||
- .env
|
- .env
|
||||||
command: npm run start:dev
|
command: npm run start:dev
|
||||||
ports:
|
ports:
|
||||||
- "${SERVICE_PORT:-3001}:5000"
|
- "${SERVICE_PORT:-5001}:${SERVICE_PORT:-5001}"
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
networks:
|
networks:
|
||||||
- mobicoop-v3
|
v3-network:
|
||||||
|
aliases:
|
||||||
|
- v3-user-api
|
||||||
|
|
||||||
db:
|
db:
|
||||||
container_name: ${POSTGRES_CONTAINER}
|
container_name: ${POSTGRES_CONTAINER}
|
||||||
|
@ -32,7 +34,9 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
- ./postgresql/.db_data:/var/lib/postgresql/data:rw
|
- ./postgresql/.db_data:/var/lib/postgresql/data:rw
|
||||||
networks:
|
networks:
|
||||||
- mobicoop-v3
|
v3-network:
|
||||||
|
aliases:
|
||||||
|
- v3-user-db
|
||||||
|
|
||||||
pgadmin:
|
pgadmin:
|
||||||
container_name: ${PGADMIN_CONTAINER}
|
container_name: ${PGADMIN_CONTAINER}
|
||||||
|
@ -47,11 +51,13 @@ services:
|
||||||
- ./postgresql/.pgadmin_data:/var/lib/pgadmin:rw
|
- ./postgresql/.pgadmin_data:/var/lib/pgadmin:rw
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
networks:
|
networks:
|
||||||
- mobicoop-v3
|
v3-network:
|
||||||
|
aliases:
|
||||||
|
- v3-user-pgadmin
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
mobicoop-v3:
|
v3-network:
|
||||||
external:
|
name: v3-network
|
||||||
name: mobicoop-v3
|
driver: bridge
|
||||||
|
|
|
@ -14,7 +14,8 @@ async function bootstrap() {
|
||||||
__dirname,
|
__dirname,
|
||||||
'modules/users/adapters/primaries/user.proto',
|
'modules/users/adapters/primaries/user.proto',
|
||||||
),
|
),
|
||||||
url: '0.0.0.0:5000',
|
url: process.env.SERVICE_URL + ':' + process.env.SERVICE_PORT,
|
||||||
|
loader: { keepCase: true },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue