ethan0905 / ft_transcendence

Fully explained concepts, to save time on ft_transcendance!
2 stars 0 forks source link

Optimization: Refactor of Docker installation #24

Open ethan0905 opened 1 year ago

ethan0905 commented 1 year ago

The first goal was to dockerized the full Web Application, connect all the services (frontend, backend, database, orm). The new goal is now to refactor the code, to make it more efficient.

ethan0905 commented 1 year ago

1- Replaced all files copy by volumes on the repository directly. ✅

ethan0905 commented 1 year ago

to fix:

backend_nestjs    | (node:309) [DEP0164] DeprecationWarning: Implicit coercion to integer for exit code is deprecated.
backend_nestjs    | (Use `node --trace-deprecation ...` to show where the warning was created)
ethan0905 commented 1 year ago

to fix:

frontend_reactjs  | (node:38) [DEP_WEBPACK_DEV_SERVER_ON_AFTER_SETUP_MIDDLEWARE] DeprecationWarning: 'onAfterSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option.
frontend_reactjs  | (Use `node --trace-deprecation ...` to show where the warning was created)
frontend_reactjs  | (node:38) [DEP_WEBPACK_DEV_SERVER_ON_BEFORE_SETUP_MIDDLEWARE] DeprecationWarning: 'onBeforeSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option.
ethan0905 commented 1 year ago

to keep in mind:

backend_postgres  | Success. You can now start the database server using:
backend_postgres  | 
backend_postgres  |     pg_ctl -D /var/lib/postgresql/data -l logfile start
ethan0905 commented 1 year ago

after switching the database inside the repository and after build when npx prisma migrate dev:

backend_nestjs    | Starting inspector on 127.0.0.1:9229 failed: address already in use
backend_nestjs    | (node:32) [DEP0164] DeprecationWarning: Implicit coercion to integer for exit code is deprecated.
backend_nestjs    |     at process.exit (node:internal/process/per_thread:201:7)
backend_nestjs    |     at process.<anonymous> (/app/node_modules/@prisma/engine-core/src/library/ExitHooks.ts:63:17)
backend_nestjs    |     at Object.onceWrapper (node:events:627:26)
backend_nestjs    |     at process.emit (node:events:512:28)
backend_nestjs    |     at process.emit (/app/node_modules/source-map-support/source-map-support.js:516:21)
ethan0905 commented 1 year ago

same error

backend_nestjs    | Starting inspector on 127.0.0.1:9229 failed: address already in use
backend_nestjs    | (node:958) [DEP0164] DeprecationWarning: Implicit coercion to integer for exit code is deprecated.
backend_nestjs    |     at process.exit (node:internal/process/per_thread:201:7)
backend_nestjs    |     at process.<anonymous> (/app/node_modules/@prisma/engine-core/src/library/ExitHooks.ts:63:17)
backend_nestjs    |     at Object.onceWrapper (node:events:627:26)
backend_nestjs    |     at process.emit (node:events:512:28)
backend_nestjs    |     at process.emit (/app/node_modules/source-map-support/source-map-support.js:516:21)
ethan0905 commented 1 year ago

We changed in the backend dockerfile the CMD: npm run start ; npx prisma db push in order to apply the current prisma.schema config on docker build. To view the Database after build, you must go inside the container, and run npx prisma studio