Guillaume630
PPrisma
•Created by Guillaume630 on 5/23/2024 in #help-and-questions
How to order multiple index
4 replies
PPrisma
•Created by Guillaume630 on 5/2/2024 in #help-and-questions
Deploy on GCP
➜ nricher-nest-api git:(docker-img) docker run -p 8080:8080 my-nestjs-app
yarn run v1.22.19
$ yarn prisma migrate deploy && node dist/src/main.js
$ /usr/src/app/node_modules/.bin/prisma migrate deploy
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Datasource "db": PostgreSQL database "mydatabase", schema "public" at "34.175.... (ect)"
Error: P1001: Can't reach database server at `/cloudsql/nricher-nest-...`:`5432`
Please make sure your database server is running at `/cloudsql/nricher-nest-....
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
➜ nest-api git:(docker-img)
➜ nricher-nest-api git:(docker-img) docker run -p 8080:8080 my-nestjs-app
yarn run v1.22.19
$ yarn prisma migrate deploy && node dist/src/main.js
$ /usr/src/app/node_modules/.bin/prisma migrate deploy
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Datasource "db": PostgreSQL database "mydatabase", schema "public" at "34.175.... (ect)"
Error: P1001: Can't reach database server at `/cloudsql/nricher-nest-...`:`5432`
Please make sure your database server is running at `/cloudsql/nricher-nest-....
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
➜ nest-api git:(docker-img)
5 replies
PPrisma
•Created by Guillaume630 on 5/2/2024 in #help-and-questions
Deploy on GCP
On my local environnement it doesnt work also with docker when i'm using the GCP database URL :
Part of the problem looks to comes from the URL format :
➜ nest-api git:(docker-img) docker build -t my-nestjs-app .
[+] Building 10.4s (14/14) FINISHED docker:desktop-linux
...
=> [development 1/7] FROM docker.io/... 0.0s
=> CACHED [development 2/7] WORKDIR /usr/src/app
=> CACHED [development 3/7] COPY package.json yarn.lock ./
=> CACHED [development 4/7] RUN yarn install --frozen-lockfile
=> [development 5/7] COPY . .
=> [development 6/7] RUN npx prisma generate
=> [development 7/7] RUN yarn build
=> CACHED [production 3/4] RUN ls -la /usr/src/app
=> [production 4/4] COPY --from=development /usr/src/app .
=> exporting to image
=> => exporting layers
=> => writing image sha256:123456... 0.0s
=> => naming to docker.io/library/my-nestjs-app
➜ nest-api git:(docker-img) docker build -t my-nestjs-app .
[+] Building 10.4s (14/14) FINISHED docker:desktop-linux
...
=> [development 1/7] FROM docker.io/... 0.0s
=> CACHED [development 2/7] WORKDIR /usr/src/app
=> CACHED [development 3/7] COPY package.json yarn.lock ./
=> CACHED [development 4/7] RUN yarn install --frozen-lockfile
=> [development 5/7] COPY . .
=> [development 6/7] RUN npx prisma generate
=> [development 7/7] RUN yarn build
=> CACHED [production 3/4] RUN ls -la /usr/src/app
=> [production 4/4] COPY --from=development /usr/src/app .
=> exporting to image
=> => exporting layers
=> => writing image sha256:123456... 0.0s
=> => naming to docker.io/library/my-nestjs-app
5 replies
PPrisma
•Created by Guillaume630 on 5/2/2024 in #help-and-questions
Deploy on GCP
Also i'm running prisma in the Dockerfiles :
# Development stage
FROM node:20-bullseye-slim AS development
WORKDIR /usr/src/app
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile
COPY . .
RUN npx prisma generate
RUN yarn build
USER node
# Production stage (clean image)
FROM node:20-bullseye-slim AS production
# Same repo as development stage
WORKDIR /usr/src/app
# Copy from development stage
COPY --from=development /usr/src/app .
CMD ["yarn", "start:prod"]
# Development stage
FROM node:20-bullseye-slim AS development
WORKDIR /usr/src/app
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile
COPY . .
RUN npx prisma generate
RUN yarn build
USER node
# Production stage (clean image)
FROM node:20-bullseye-slim AS production
# Same repo as development stage
WORKDIR /usr/src/app
# Copy from development stage
COPY --from=development /usr/src/app .
CMD ["yarn", "start:prod"]
5 replies