Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
20cad32
Added card-service and point-of-sale images when pushing to registry
oana-lolea Sep 19, 2025
ad454d1
Added dockerfile.prod for card-service
oana-lolea Sep 19, 2025
8f234f4
Added spectral to validate card-service open api specs
oana-lolea Sep 19, 2025
2d2455c
Fix on building the packages
oana-lolea Sep 19, 2025
3e32309
Fixed dockerfile
oana-lolea Sep 19, 2025
96ac9e6
Added token-introspection
oana-lolea Sep 19, 2025
a07b242
trying to fix crypto issue
oana-lolea Sep 19, 2025
130fa28
Another try to fix card-service pipeline
oana-lolea Sep 22, 2025
47573c8
Still trying
oana-lolea Sep 22, 2025
be2db81
Testing if crypto is actually the issue here
oana-lolea Sep 23, 2025
968c491
Trying to debug
oana-lolea Sep 23, 2025
67a84bb
Added @types/node so it can see the crypto package
oana-lolea Sep 23, 2025
59d6258
Updated yaml for card-service, removed unnecessary changes
oana-lolea Sep 23, 2025
6a654cf
Fix format
oana-lolea Sep 23, 2025
0a4860c
Updated axios version of pos
oana-lolea Sep 23, 2025
391c62a
Merge branch 'pos-card-services' into oana/raf-1167
oana-lolea Sep 23, 2025
501f9ef
Added tags to card-service.yaml
oana-lolea Sep 23, 2025
eaf4a0b
Removed token-introspection from pos and card services
oana-lolea Sep 23, 2025
e4d68ce
Added command to run pos and card services in docker file
oana-lolea Sep 24, 2025
71eec80
Merge branch 'pos-card-services' into oana/raf-1167
oana-lolea Sep 26, 2025
8ab2b37
Merge branch 'pos-card-services' into oana/raf-1167
oana-lolea Sep 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion .github/workflows/node-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ jobs:
- uses: actions/checkout@v4
- uses: ./.github/workflows/rafiki/env-setup
- run: pnpm --filter card-service test:ci
- run: pnpm --filter card-service build
- name: AsyncAPI extension
run: |
echo "{\"extends\":[\"spectral:oas\",\"spectral:asyncapi\"]}" >> .spectral.json
- name: Validate Open API specs
run: |
npx @stoplight/spectral-cli lint ./packages/card-service/src/openapi/specs/*.yaml

point-of-sale:
runs-on: ubuntu-latest
Expand All @@ -100,7 +107,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ./.github/workflows/rafiki/env-setup
- run: pnpm --filter point-of-sale build:deps
- run: pnpm --filter point-of-sale build
- run: pnpm --filter point-of-sale test:ci

mock-account-servicing-entity:
Expand Down Expand Up @@ -426,6 +433,8 @@ jobs:
- auth
- backend
- frontend
- card-service
- point-of-sale
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down Expand Up @@ -461,6 +470,8 @@ jobs:
- auth
- backend
- frontend
- card-service
- point-of-sale
steps:
- uses: actions/checkout@v4
- name: Fetch docker image from cache
Expand Down Expand Up @@ -497,6 +508,8 @@ jobs:
- auth
- backend
- frontend
- card-service
- point-of-sale
steps:
- uses: actions/checkout@v4
- name: Fetch docker image from cache
Expand Down Expand Up @@ -529,6 +542,8 @@ jobs:
- auth
- backend
- frontend
- card-service
- point-of-sale
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/image-push
Expand All @@ -550,6 +565,8 @@ jobs:
- auth
- backend
- frontend
- card-service
- point-of-sale
steps:
- uses: actions/checkout@v4
- name: Push manifest list
Expand Down
65 changes: 65 additions & 0 deletions packages/card-service/Dockerfile.prod
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
FROM node:20-alpine3.20 AS base

WORKDIR /home/rafiki

ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"

RUN corepack enable
RUN corepack prepare [email protected] --activate

COPY pnpm-lock.yaml ./

RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
pnpm fetch \
| grep -v "cross-device link not permitted\|Falling back to copying packages from store"

FROM base AS prod-deps

COPY package.json pnpm-workspace.yaml .npmrc ./
COPY packages/card-service/knexfile.js ./packages/card-service/knexfile.js
COPY packages/card-service/package.json ./packages/card-service/package.json
RUN pnpm clean
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
pnpm install \
--recursive \
--prefer-offline \
--frozen-lockfile \
--prod \
| grep -v "cross-device link not permitted\|Falling back to copying packages from store"

FROM base AS builder

COPY package.json pnpm-workspace.yaml .npmrc tsconfig.json tsconfig.build.json ./
COPY packages/card-service ./packages/card-service

RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
pnpm install \
--recursive \
--offline \
--frozen-lockfile
RUN pnpm --filter card-service build

FROM node:20-alpine3.20 AS runner

# Since this is from a fresh image, we need to first create the Rafiki user
RUN adduser -D rafiki
WORKDIR /home/rafiki

COPY --from=prod-deps /home/rafiki/node_modules ./node_modules
COPY --from=prod-deps /home/rafiki/packages/card-service/node_modules ./packages/card-service/node_modules
COPY --from=prod-deps /home/rafiki/packages/card-service/package.json ./packages/card-service/package.json
COPY --from=prod-deps /home/rafiki/packages/card-service/knexfile.js ./packages/card-service/knexfile.js

COPY --from=builder /home/rafiki/packages/card-service/migrations/ ./packages/card-service/migrations
COPY --from=builder /home/rafiki/packages/card-service/dist ./packages/card-service/dist
COPY --from=builder /home/rafiki/packages/card-service/knexfile.js ./packages/card-service/knexfile.js

USER root

# For additional paranoia, we make it so that the Rafiki user has no write access to the packages
RUN chown -R :rafiki /home/rafiki/packages
RUN chmod -R 750 /home/rafiki/packages
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we are missing a CMD here to run the app, same thing for the pos-service one


USER rafiki
CMD ["node", "/home/rafiki/packages/card-service/dist/index.js"]
7 changes: 2 additions & 5 deletions packages/card-service/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{
"name": "card-service",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist/**/*"
],
"main": "index.js",
"scripts": {
"build": "pnpm clean && tsc --build tsconfig.json",
"clean": "rm -fr dist/",
Expand Down Expand Up @@ -37,6 +33,7 @@
"@types/koa-bodyparser": "^4.3.12",
"@types/koa__cors": "^5.0.0",
"@types/koa__router": "^12.0.4",
"@types/node": "^20.14.15",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed this so that the pipeline can recognise crypto library.

"@types/uuid": "^9.0.8",
"jest-environment-node": "^29.7.0",
"nock": "14.0.0-beta.19",
Expand Down
14 changes: 14 additions & 0 deletions packages/card-service/src/openapi/specs/card-server.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
openapi: 3.0.3

Check warning on line 1 in packages/card-service/src/openapi/specs/card-server.yaml

View workflow job for this annotation

GitHub Actions / card-service

oas3-api-servers
info:
title: Card Service API
version: 1.0.0
description: Card Service API specs
contact:
email: [email protected]
tags:
- name: payment
description: Operations related to payments
paths:
/payment:
post:
Expand Down Expand Up @@ -96,6 +102,9 @@
type: string
'500':
description: Internal server error
description: 'POS service calls this endpoint to initiate a payment request.'
tags:
- payment
/payment-event:
post:
summary: Handle payment event result from backend
Expand Down Expand Up @@ -158,3 +167,8 @@
description: Payment event accepted
'400':
description: Malformed request body
'404':
description: Request not found
description: 'Rafiki backend calls this endpoint to send the payment result.'
tags:
- payment
8 changes: 3 additions & 5 deletions packages/point-of-sale/Dockerfile.prod
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ FROM base AS prod-deps
COPY package.json pnpm-workspace.yaml .npmrc ./
COPY packages/point-of-sale/knexfile.js ./packages/point-of-sale/knexfile.js
COPY packages/point-of-sale/package.json ./packages/point-of-sale/package.json
COPY packages/token-introspection/package.json ./packages/token-introspection/package.json

RUN pnpm clean
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
Expand All @@ -34,7 +33,6 @@ FROM base AS builder

COPY package.json pnpm-workspace.yaml .npmrc tsconfig.json tsconfig.build.json ./
COPY packages/point-of-sale ./packages/point-of-sale
COPY packages/token-introspection ./packages/token-introspection

RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
pnpm install \
Expand All @@ -52,17 +50,17 @@ WORKDIR /home/rafiki
COPY --from=prod-deps /home/rafiki/node_modules ./node_modules
COPY --from=prod-deps /home/rafiki/packages/point-of-sale/node_modules ./packages/point-of-sale/node_modules
COPY --from=prod-deps /home/rafiki/packages/point-of-sale/package.json ./packages/point-of-sale/package.json
COPY --from=prod-deps /home/rafiki/packages/token-introspection/node_modules ./packages/token-introspection/node_modules
COPY --from=prod-deps /home/rafiki/packages/token-introspection/package.json ./packages/token-introspection/package.json
COPY --from=prod-deps /home/rafiki/packages/point-of-sale/knexfile.js ./packages/point-of-sale/knexfile.js

COPY --from=builder /home/rafiki/packages/point-of-sale/migrations/ ./packages/point-of-sale/migrations
COPY --from=builder /home/rafiki/packages/point-of-sale/dist ./packages/point-of-sale/dist
COPY --from=builder /home/rafiki/packages/token-introspection/dist ./packages/token-introspection/dist
COPY --from=builder /home/rafiki/packages/point-of-sale/knexfile.js ./packages/point-of-sale/knexfile.js

USER root

# For additional paranoia, we make it so that the Rafiki user has no write access to the packages
RUN chown -R :rafiki /home/rafiki/packages
RUN chmod -R 750 /home/rafiki/packages

USER rafiki
CMD ["node", "/home/rafiki/packages/point-of-sale/dist/index.js"]
5 changes: 2 additions & 3 deletions packages/point-of-sale/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
"generate": "graphql-codegen --config codegen.yml",
"knex": "knex",
"dev": "ts-node-dev --inspect=0.0.0.0:9229 --respawn --transpile-only src/index.ts",
"build": "pnpm build:deps && pnpm clean && tsc --build tsconfig.json",
"build:deps": "pnpm --filter token-introspection build",
"build": "pnpm clean && tsc --build tsconfig.json",
"clean": "rm -fr dist/"
},
"keywords": [],
Expand All @@ -25,7 +24,7 @@
"@faker-js/faker": "^8.4.1",
"@koa/cors": "^5.0.0",
"@koa/router": "^12.0.2",
"axios": "1.8.2",
"axios": "1.12.0",
"dotenv": "^16.4.7",
"graphql": "^16.11.0",
"json-canonicalize": "^1.0.6",
Expand Down
Loading
Loading