Skip to content
This repository has been archived by the owner on Jun 4, 2024. It is now read-only.

Commit

Permalink
chore: prisma problema
Browse files Browse the repository at this point in the history
  • Loading branch information
hermesalvesbr committed May 25, 2024
1 parent c66f5c8 commit 9421c5b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
4 changes: 3 additions & 1 deletion Docker/prisma-init.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
const { execSync } = require('child_process')

try {
console.log('Running Prisma migrations...')
console.log('Generating Prisma Client...')
execSync('npx prisma generate', { stdio: 'inherit' })

console.log('Running Prisma migrations...')
execSync('npx prisma migrate deploy', { stdio: 'inherit' })
console.log('Prisma migrations completed successfully.')

Expand Down
16 changes: 14 additions & 2 deletions Docker/start-server.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
#!/bin/sh

echo "Bem-vindo ao EduPrime Hub!"
echo "Aguardando a inicialização do banco de dados..."
sleep 20

# Verifica se o banco de dados está acessível antes de prosseguir
node check-db-connection.js

# Gera o cliente Prisma
npx prisma generate

# Aplica as migrações do Prisma
node prisma-init.js

echo "As APIs estão disponíveis na porta 3000."
node check-db-connection.js && pnpm run start:prod

# Inicia o servidor
npm run start:prod
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- '${POSTGRES_PORT}:5432'
- '5432:5432'
volumes:
- eduprimedb_data:/var/lib/postgresql/data
healthcheck:
Expand All @@ -20,7 +20,7 @@ services:
retries: 5

eduprime_core:
image: softagon/eduprimecore:0.1
image: softagon/eduprimecore:latest
container_name: eduprime-core
env_file:
- .env
Expand Down

0 comments on commit 9421c5b

Please sign in to comment.