Skip to content

Commit

Permalink
chore: prisma npmrc (#98)
Browse files Browse the repository at this point in the history
* chore: prisma npmrc

* chore: renamed backend to main_server

* fix: dockerfile

* chore: update lock file

* chore: updated realm name

* chore: updated lock file
  • Loading branch information
mrtousif authored Dec 11, 2022
1 parent 0891b17 commit 63a0ea3
Show file tree
Hide file tree
Showing 83 changed files with 2,627 additions and 2,591 deletions.
3 changes: 2 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
auto-install-peers=true
strict-peer-dependencies=false
strict-peer-dependencies=false
public-hoist-pattern[]=*prisma*
53 changes: 53 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
FROM node:16-alpine AS baseImage
ARG PNPM_VERSION=7.16.1
ARG SERVICE_PATH
ARG PACKAGE_NAME

# Install package manager
RUN --mount=type=cache,id=pnpm-store,target=/root/.pnpm-store \
npm i --global --no-update-notifier --no-fund pnpm@${PNPM_VERSION}

# Use the node user from the image (instead of the root user)
USER node

# Get all dependencies and install
FROM baseImage AS dependencies

WORKDIR /usr/app

COPY --chown=node:node pnpm-lock.yaml pnpm-workspace.yaml package.json .npmrc ./
COPY --chown=node:node ${SERVICE_PATH}/package.json ./${SERVICE_PATH}/package.json

RUN --mount=type=cache,id=pnpm-store,target=/root/.pnpm-store \
pnpm install --frozen-lockfile --filter ${PACKAGE_NAME}\
| grep -v "cross-device link not permitted\|Falling back to copying packages from store"

# Build application using all dependencies, copy necessary files
FROM dependencies AS build
ARG NODE_ENV=production
ENV NODE_ENV=${NODE_ENV}

WORKDIR /usr/app/${SERVICE_PATH}

COPY --chown=node:node ${SERVICE_PATH} ./

RUN pnpm build
RUN rm -rf node_modules src \
&& pnpm -r exec -- rm -rf node_modules

# Use base image for correct context, get built files from build stage
# Install only production dependencies
FROM baseImage AS deploy

WORKDIR /usr/app

ENV NODE_ENV production

COPY --chown=node:node --from=build /usr/app .
RUN --mount=type=cache,id=pnpm-store,target=/root/.pnpm-store \
pnpm install --frozen-lockfile --filter ${PACKAGE_NAME} --prod \
| grep -v "cross-device link not permitted\|Falling back to copying packages from store"

ENV EXEC_PATH=${SERVICE_PATH}/dist/main.js

CMD node ${EXEC_PATH}
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Keycloak

```sh
curl --request POST \
--url http://localhost:8180/realms/myrealm/protocol/openid-connect/token \
--url http://localhost:8180/realms/development_realm/protocol/openid-connect/token \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data [email protected] \
--data password=password123 \
Expand All @@ -22,9 +22,9 @@ curl -XPOST 127.0.0.1:9080/apisix/admin/routes -H "X-Api-Key: edd1c9f034335f136
"client_id": "hasura",
"client_secret": "sGDpddl2JcwvrUk7IERmqDA9QTyNqwyN",
"disable": false,
"discovery": "https://8180-mrtousif-youtubeclone-6p60rhw8gtr.ws-us67.gitpod.io/realms/myrealm/.well-known/openid-configuration",
"discovery": "https://8180-mrtousif-youtubeclone-6p60rhw8gtr.ws-us67.gitpod.io/realms/development_realm/.well-known/openid-configuration",
"introspection_endpoint_auth_method": "client_secret_post",
"realm": "myrealm",
"realm": "development_realm",
"redirect_uri": "https://9080-mrtousif-youtubeclone-6p60rhw8gtr.ws-us67.gitpod.io/",
"scope": "openid profile"
}
Expand Down
21 changes: 0 additions & 21 deletions apps/backend/Dockerfile

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ NESTJS_EVENT_WEBHOOK_SHARED_SECRET=super_secret
RABBIT_MQ_HOST=amqp://rabbit:rabbit@localhost:5672

API_DOMAIN=https://6000-mrtousif-youtubeclone-6yuz01oux6a.ws-us73.gitpod.io
OPENID_CLIENT_PROVIDER_OIDC_ISSUER=https://8180-mrtousif-youtubeclone-6yuz01oux6a.ws-us73.gitpod.io/realms/myrealm
OPENID_CLIENT_PROVIDER_OIDC_ISSUER=https://8180-mrtousif-youtubeclone-6yuz01oux6a.ws-us73.gitpod.io/realms/development_realm
OPENID_CLIENT_REGISTRATION_LOGIN_CLIENT_ID=hasura
OPENID_CLIENT_REGISTRATION_LOGIN_CLIENT_SECRET=qKy2zE4vWli6RWT327a7H89rKan8BPFu
OPENID_CLIENT_REGISTRATION_LOGIN_REDIRECT_URI="${API_DOMAIN}/auth/callback"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 2 additions & 3 deletions apps/backend/package.json → apps/main_server/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "backend",
"name": "main_server",
"version": "0.0.1",
"description": "",
"author": "",
Expand All @@ -25,8 +25,7 @@
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:e2e": "jest --config ./test/jest-e2e.json",
"hasura": "hasura --project ../hasura --envfile ../backend/.env.development --skip-update-check",
"generate": "pnpm graphql-codegen",
"cucumber": "cucumber-js --require-module ts-node/register --require 'integration/**/*.ts'"
"generate": "pnpm graphql-codegen"
},
"prisma": {
"seed": "ts-node prisma/seed.ts"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Test, TestingModule } from '@nestjs/testing';
import { INestApplication } from '@nestjs/common';
import * as request from 'supertest';
import { AppModule } from './../src/app.module';
import { AppModule } from '../src/app.module';

describe('AppController (e2e)', () => {
let app: INestApplication;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ services:

hasura:
container_name: hasura
image: hasura/graphql-engine:v2.12.0-beta.1
image: hasura/graphql-engine:v2.16.0
restart: unless-stopped
depends_on:
- postgres
Expand All @@ -44,7 +44,7 @@ services:
## enable debugging mode. It is recommended to disable this in production
HASURA_GRAPHQL_DEV_MODE: "true"
HASURA_GRAPHQL_ENABLED_LOG_TYPES: startup, http-log, webhook-log, websocket-log, query-log
HASURA_GRAPHQL_JWT_SECRET: '{ "type": "RS256", "jwk_url": "http://keycloak:8080/realms/myrealm/protocol/openid-connect/certs" }'
HASURA_GRAPHQL_JWT_SECRET: '{ "type": "RS256", "jwk_url": "http://keycloak:8080/realms/development_realm/protocol/openid-connect/certs" }'
HASURA_GRAPHQL_ADMIN_SECRET: ${HASURA_GRAPHQL_ADMIN_SECRET}
HASURA_GRAPHQL_UNAUTHORIZED_ROLE: anonymous
HASURA_GRAPHQL_ENABLE_REMOTE_SCHEMA_PERMISSIONS: 'true'
Expand Down
Loading

0 comments on commit 63a0ea3

Please sign in to comment.