Skip to content

Commit

Permalink
Merge pull request #659 from credebl/qa-to-main-12-04-2024
Browse files Browse the repository at this point in the history
Qa to main
  • Loading branch information
vivekayanworks authored Apr 12, 2024
2 parents ef673cb + b2e5e1d commit fd5964f
Show file tree
Hide file tree
Showing 163 changed files with 8,296 additions and 2,680 deletions.
30 changes: 24 additions & 6 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
MODE=DEV


SUPABASE_URL= // Please specify your Supabase Url
SUPABASE_URL= // Please specify your Supabase URL
SUPABASE_KEY= // Please specify your Supabase Anon key
SUPABASE_JWT_SECRET= // Please specify your Supabase jwt secret

API_GATEWAY_PROTOCOL=http
API_GATEWAY_HOST='0.0.0.0'
API_GATEWAY_PORT=5000

PLATFORM_NAME=CREDEBL
##
PLATFORM_NAME= // Please specify your paltform name
PUBLIC_PLATFORM_SUPPORT_EMAIL= // Please specify your support email
POWERED_BY= // Please specify your powered by org name
PLATFORM_WEB_URL= // Please specify your platform web URL
POWERED_BY_URL= // Please specify your support URL

PUBLIC_LOCALHOST_URL= // Please specify your localhost URL
PUBLIC_DEV_API_URL= // Please specify your DEV environment api URL
PUBLIC_QA_API_URL= // Please specify your your QA environment api URL
PUBLIC_PRODUCTION_API_URL= // Please specify your PRODUCTION environment api URL
PUBLIC_SANDBOX_API_URL= // Please specify your sandbox environment URL


AGENT_HOST=[email protected] // Please specify your agent host VM and IP address
AWS_ACCOUNT_ID=xxxxx // Please provide your AWS account Id
Expand Down Expand Up @@ -47,8 +58,8 @@ PLATFORM_SEED= // The seed should consist of 32 characters.
PLATFORM_ID=

AFJ_AGENT_ENDPOINT_PATH=/apps/agent-provisioning/AFJ/endpoints/
DATABASE_URL="postgresql://postgres:xxxxxx@localhost:5432/postgres?schema=public" #Provide supabase postgres url and Use the correct user/pwd, IP Address
POOL_DATABASE_URL="" #Provide pooler supabase postgres url
DATABASE_URL="postgresql://postgres:xxxxxx@localhost:5432/postgres?schema=public" #Provide supabase postgres URL and Use the correct user/pwd, IP Address
POOL_DATABASE_URL="" #Provide pooler supabase postgres URL
CLUSTER_NAME="" # ecs cluster
TESKDEFINITION_FAMILY="" # ecs task-definition
AGENT_PROTOCOL=http
Expand All @@ -68,4 +79,11 @@ export DEBUG="prisma:engine"
export DEBUG="prisma:client"

# enable both prisma-client- and engine-level debugging output
export DEBUG="prisma:client,prisma:engine"
export DEBUG="prisma:client,prisma:engine"

KEYCLOAK_DOMAIN=http://localhost:8080/
KEYCLOAK_ADMIN_URL=http://localhost:8080
KEYCLOAK_MASTER_REALM=xxxxxxx
KEYCLOAK_MANAGEMENT_CLIENT_ID=xxxxxxx
KEYCLOAK_MANAGEMENT_CLIENT_SECRET=xxxxxxx
KEYCLOAK_REALM=xxxxxxx
40 changes: 30 additions & 10 deletions Dockerfiles/Dockerfile.agent-provisioning
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,23 @@ USER nonroot


# RUN apk add aws-cli
RUN npm install --ignore-scripts -g pnpm \
&& apk update \
&& apk add openssh-client \
&& apk add aws-cli
RUN set -eux \
&& apk --no-cache add \
openssh-client \
aws-cli \
docker \
docker-compose \
&& npm install -g pnpm --ignore-scripts \
&& export PATH=$PATH:/usr/lib/node_modules/pnpm/bin \
&& rm -rf /var/cache/apk/*

RUN docker --version && \
docker-compose --version

ARG ROOT_PATH
ENV ROOT_PATH ${ROOT_PATH}

RUN echo "ROOT_PATH is set to: $ROOT_PATH"

# Set the working directory
WORKDIR /app
Expand Down Expand Up @@ -39,10 +52,15 @@ RUN addgroup -S nonroot \

USER nonroot
# RUN apk add aws-cli
RUN npm install --ignore-scripts -g pnpm \
&& apk update \
&& apk add openssh-client \
&& apk add aws-cli
RUN set -eux \
&& apk --no-cache add \
openssh-client \
aws-cli \
docker \
docker-compose \
&& npm install -g pnpm --ignore-scripts \
&& export PATH=$PATH:/usr/lib/node_modules/pnpm/bin \
&& rm -rf /var/cache/apk/*

WORKDIR /app

Expand All @@ -51,6 +69,7 @@ RUN mkdir -p ./agent-provisioning/AFJ/agent-config
RUN mkdir -p ./agent-provisioning/AFJ/port-file
RUN mkdir -p ./agent-provisioning/AFJ/token


# Copy the compiled code
COPY --from=build /app/dist/apps/agent-provisioning/ ./dist/apps/agent-provisioning/
COPY --from=build /app/node_modules ./node_modules
Expand All @@ -60,15 +79,16 @@ COPY --from=build /app/apps/agent-provisioning/AFJ/port-file ./agent-provisionin
# Set permissions
RUN chmod +x /app/agent-provisioning/AFJ/scripts/start_agent.sh
RUN chmod +x /app/agent-provisioning/AFJ/scripts/start_agent_ecs.sh
RUN chmod +x /app/agent-provisioning/AFJ/scripts/docker_start_agent.sh
RUN chmod 777 /app/agent-provisioning/AFJ/endpoints
RUN chmod 777 /app/agent-provisioning/AFJ/agent-config
RUN chmod 777 /app/agent-provisioning/AFJ/token

# Copy the libs folder
COPY libs/ ./libs/

# Set the command to run the microservice
CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate && cd ../.. && node dist/apps/agent-provisioning/main.js"]

CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate && cd ../.. && node dist/apps/agent-provisioning/main.js $ROOT_PATH"]

# docker build -t agent-provisioning-service -f Dockerfiles/Dockerfile.agent-provisioning .
# docker run -d --env-file .env --name agent-provisioning-service docker.io/library/agent-provisioning-service
25 changes: 16 additions & 9 deletions Dockerfiles/Dockerfile.agent-service
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# Stage 1: Build the application
FROM node:18-alpine as build

RUN addgroup -S nonroot \
&& adduser -S nonroot -G nonroot

USER nonroot
RUN npm install --ignore-scripts -g pnpm
RUN npm install -g pnpm --ignore-scripts \
&& apk update \
&& apk add openssh-client \
&& apk add aws-cli \
&& apk add docker \
&& apk add docker-compose

RUN npm install -g pnpm
# Set the working directory
WORKDIR /app

Expand All @@ -25,11 +28,15 @@ RUN pnpm run build agent-service
# Stage 2: Create the final image
FROM node:18-alpine

RUN addgroup -S nonroot \
&& adduser -S nonroot -G nonroot
RUN npm install -g pnpm --ignore-scripts \
&& apk update \
&& apk add openssh-client \
&& apk add aws-cli \
&& apk add docker \
&& apk add docker-compose

USER nonroot
RUN npm install --ignore-scripts -g pnpm
RUN npm install -g pnpm
# Set the working directory
WORKDIR /app

# Copy the compiled code from the build stage
Expand Down
41 changes: 41 additions & 0 deletions Dockerfiles/Dockerfile.notification
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Stage 1: Build the application
FROM node:18-alpine as build
RUN npm install -g pnpm --ignore-scripts
# Set the working directory
WORKDIR /app

# Copy package.json and package-lock.json
COPY package.json ./
#COPY package-lock.json ./

# Install dependencies
RUN pnpm i --ignore-scripts

# Copy the rest of the application code
COPY . .
RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate

# Build the notification service
RUN npm run build notification


# Stage 2: Create the final image
FROM node:18-alpine
RUN npm install -g pnpm --ignore-scripts
# Set the working directory
WORKDIR /app

# Copy the compiled code from the build stage
COPY --from=build /app/dist/apps/notification/ ./dist/apps/notification/

# Copy the libs folder from the build stage
COPY --from=build /app/libs/ ./libs/
#COPY --from=build /app/package.json ./
COPY --from=build /app/node_modules ./node_modules

# Set the command to run the microservice
CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate && cd ../.. && node dist/apps/notification/main.js"]

# docker build -t notification -f Dockerfiles/Dockerfile.notification .
# docker run -d --env-file .env --name notification docker.io/library/notification
# docker logs -f notification
4 changes: 3 additions & 1 deletion Dockerfiles/Dockerfile.user
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ RUN npm install --ignore-scripts -g pnpm

# We don't need the standalone Chromium
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
ENV PUPPETEER_SKIP_DOWNLOAD true

# Install Google Chrome Stable and fonts
# Note: this installs the necessary libs to make the browser work with Puppeteer.
Expand Down Expand Up @@ -46,6 +47,7 @@ USER nonroot
RUN npm install --ignore-scripts -g pnpm
# We don't need the standalone Chromium
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
ENV PUPPETEER_SKIP_DOWNLOAD true

# Install Google Chrome Stable and fonts
# Note: this installs the necessary libs to make the browser work with Puppeteer.
Expand Down Expand Up @@ -74,4 +76,4 @@ CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && npx pri

# docker build -t user -f Dockerfiles/Dockerfile.user .
# docker run -d --env-file .env --name user docker.io/library/user
# docker logs -f user
# docker logs -f user
Loading

0 comments on commit fd5964f

Please sign in to comment.