Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
23 changes: 0 additions & 23 deletions bruno/collections/Rafiki/POS Service APIs/Create Merchant.bru

This file was deleted.

20 changes: 0 additions & 20 deletions bruno/collections/Rafiki/POS Service APIs/Register POS Device.bru

This file was deleted.

16 changes: 0 additions & 16 deletions localenv/cloud-nine-wallet/dbinit.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,10 @@ CREATE USER cloud_nine_wallet_auth WITH PASSWORD 'cloud_nine_wallet_auth';
CREATE DATABASE cloud_nine_wallet_auth;
ALTER DATABASE cloud_nine_wallet_auth OWNER TO cloud_nine_wallet_auth;

CREATE USER cloud_nine_wallet_card_service WITH PASSWORD 'cloud_nine_wallet_card_service';
CREATE DATABASE cloud_nine_wallet_card_service;
ALTER DATABASE cloud_nine_wallet_card_service OWNER TO cloud_nine_wallet_card_service;

CREATE USER happy_life_bank_backend WITH PASSWORD 'happy_life_bank_backend';
CREATE DATABASE happy_life_bank_backend;
ALTER DATABASE happy_life_bank_backend OWNER TO happy_life_bank_backend;

CREATE USER happy_life_bank_auth WITH PASSWORD 'happy_life_bank_auth';
CREATE DATABASE happy_life_bank_auth;
ALTER DATABASE happy_life_bank_auth OWNER TO happy_life_bank_auth;

CREATE USER cloud_nine_wallet_point_of_sale WITH PASSWORD 'cloud_nine_wallet_point_of_sale';
CREATE DATABASE cloud_nine_wallet_point_of_sale;
ALTER DATABASE cloud_nine_wallet_point_of_sale OWNER TO cloud_nine_wallet_point_of_sale;

CREATE USER happy_life_bank_point_of_sale WITH PASSWORD 'happy_life_bank_point_of_sale';
CREATE DATABASE happy_life_bank_point_of_sale;
ALTER DATABASE happy_life_bank_point_of_sale OWNER TO happy_life_bank_point_of_sale;

CREATE USER happy_life_bank_card_service WITH PASSWORD 'happy_life_bank_card_service';
CREATE DATABASE happy_life_bank_card_service;
ALTER DATABASE happy_life_bank_card_service OWNER TO happy_life_bank_card_service;
37 changes: 0 additions & 37 deletions localenv/cloud-nine-wallet/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ services:
TRUST_PROXY: ${TRUST_PROXY}
LOG_LEVEL: debug
CARD_SERVICE_PORT: 3007
DATABASE_URL: postgresql://cloud_nine_wallet_card_service:cloud_nine_wallet_card_service@shared-database/cloud_nine_wallet_card_service
GRAPHQL_URL: http://cloud-nine-wallet-backend:3001/graphql
TENANT_ID: 438fa74a-fa7d-4317-9ced-dde32ece1787
TENANT_SECRET: iyIgCprjb9uL8wFckR+pLEkJWMB7FJhgkvqhTQR/964=
Expand All @@ -37,42 +36,6 @@ services:
interval: 30s
retries: 1
timeout: 3s
cloud-nine-wallet-point-of-sale:
hostname: cloud-nine-wallet-point-of-sale
image: rafiki-point-of-sale
build:
context: ../..
dockerfile: ./packages/point-of-sale/Dockerfile.dev
restart: always
networks:
- rafiki
ports:
- '3008:3008'
volumes:
- type: bind
source: ../../packages/point-of-sale/src
target: /home/rafiki/packages/point-of-sale/src
read_only: true
environment:
NODE_ENV: ${NODE_ENV:-development}
INSTANCE_NAME: CLOUD-NINE
TRUST_PROXY: ${TRUST_PROXY}
LOG_LEVEL: debug
PORT: 3008
DATABASE_URL: postgresql://cloud_nine_wallet_point_of_sale:cloud_nine_wallet_point_of_sale@shared-database/cloud_nine_wallet_point_of_sale
TENANT_ID: 438fa74a-fa7d-4317-9ced-dde32ece1787
TENANT_SECRET: iyIgCprjb9uL8wFckR+pLEkJWMB7FJhgkvqhTQR/964=
GRAPHQL_URL: http://cloud-nine-wallet-backend:3001/graphql
WEBHOOK_SIGNATURE_SECRET: webhook_secret
depends_on:
- shared-database
healthcheck:
test: ["CMD", "wget", "--spider", "http://localhost:3008/healthz"]
start_period: 60s
start_interval: 5s
interval: 30s
retries: 1
timeout: 3s
cloud-nine-mock-ase:
hostname: cloud-nine-wallet
image: rafiki-mock-ase
Expand Down
39 changes: 0 additions & 39 deletions localenv/happy-life-bank/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,5 @@
name: hl
services:
happy-life-bank-card-service:
hostname: happy-life-bank-card-service
image: rafiki-card-service
build:
context: ../..
dockerfile: ./packages/card-service/Dockerfile.dev
restart: always
networks:
- rafiki
ports:
- '4007:4007'
volumes:
- type: bind
source: ../../packages/card-service/src
target: /home/rafiki/packages/card-service/src
read_only: true
environment:
NODE_ENV: ${NODE_ENV:-development}
INSTANCE_NAME: HAPPY-LIFE
TRUST_PROXY: ${TRUST_PROXY}
LOG_LEVEL: debug
CARD_SERVICE_PORT: 4007
DATABASE_URL: postgresql://happy_life_bank_card_service:happy_life_bank_card_service@shared-database/happy_life_bank_card_service
GRAPHQL_URL: http://happy-life-bank-backend:3001/graphql
TENANT_ID: cf5fd7d3-1eb1-4041-8e43-ba45747e9e5d
TENANT_SECRET: iyIgCprjb9uL8wFckR+pLEkJWMB7FJhgkvqhTQR/964=
TENANT_SIGNATURE_VERSION: 1
depends_on:
- shared-database
- cloud-nine-wallet-card-service
healthcheck:
test: ["CMD", "wget", "--spider", "http://localhost:3007/healthz"]
start_period: 60s
start_interval: 5s
interval: 30s
retries: 1
timeout: 3s
happy-life-bank-point-of-sale:
hostname: happy-life-bank-point-of-sale
image: rafiki-point-of-sale
Expand All @@ -60,15 +23,13 @@ services:
TRUST_PROXY: ${TRUST_PROXY}
LOG_LEVEL: debug
PORT: 4008
DATABASE_URL: postgresql://happy_life_bank_point_of_sale:happy_life_bank_point_of_sale@shared-database/happy_life_bank_point_of_sale
TENANT_ID: cf5fd7d3-1eb1-4041-8e43-ba45747e9e5d
TENANT_SECRET: iyIgCprjb9uL8wFckR+pLEkJWMB7FJhgkvqhTQR/964=
GRAPHQL_URL: http://happy-life-bank-backend:3001/graphql
WEBHOOK_SIGNATURE_SECRET: iyIgCprjb9uL8wFckR+pLEkJWMB7FJhgkvqhTQR/964=
WEBHOOK_SIGNATURE_VERSION: 1
depends_on:
- shared-database
- cloud-nine-wallet-point-of-sale
healthcheck:
test: ["CMD", "wget", "--spider", "http://localhost:4008/healthz"]
start_period: 60s
Expand Down
4 changes: 0 additions & 4 deletions packages/card-service/Dockerfile.prod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ RUN --mount=type=cache,id=pnpm,target=/pnpm/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 \
Expand Down Expand Up @@ -49,11 +48,8 @@ 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

Expand Down
71 changes: 3 additions & 68 deletions packages/card-service/jest.setup.ts
Original file line number Diff line number Diff line change
@@ -1,74 +1,9 @@
import { knex } from 'knex'
import { GenericContainer, Wait } from 'testcontainers'
import { GenericContainer } from 'testcontainers'
require('./jest.env') // set environment variables

const POSTGRES_PORT = 5432
const REDIS_PORT = 6379

const setup = async (globalConfig): Promise<void> => {
const workers = globalConfig.maxWorkers

const setupDatabase = async () => {
if (!process.env.DATABASE_URL) {
const postgresContainer = await new GenericContainer('postgres:15')
.withExposedPorts(POSTGRES_PORT)
.withBindMounts([
{
source: __dirname + '/scripts/init.sh',
target: '/docker-entrypoint-initdb.d/init.sh'
}
])
.withEnvironment({
POSTGRES_PASSWORD: 'password'
})
.withHealthCheck({
test: ['CMD-SHELL', 'pg_isready -d testing'],
interval: 10000,
timeout: 5000,
retries: 5
})
.withWaitStrategy(Wait.forHealthCheck())
.start()

process.env.DATABASE_URL = `postgresql://postgres:password@localhost:${postgresContainer.getMappedPort(
POSTGRES_PORT
)}/testing`

global.__CARD_SERVICE_POSTGRES__ = postgresContainer
}

const db = knex({
client: 'postgresql',
connection: process.env.DATABASE_URL,
pool: {
min: 2,
max: 10
},
migrations: {
tableName: 'knex_migrations'
}
})

// node pg defaults to returning bigint as string. This ensures it parses to bigint
db.client.driver.types.setTypeParser(
db.client.driver.types.builtins.INT8,
'text',
BigInt
)
await db.migrate.latest({
directory: __dirname + '/migrations'
})

for (let i = 1; i <= workers; i++) {
const workerDatabaseName = `testing_${i}`

await db.raw(`DROP DATABASE IF EXISTS ${workerDatabaseName}`)
await db.raw(`CREATE DATABASE ${workerDatabaseName} TEMPLATE testing`)
}

global.__CARD_SERVICE_KNEX__ = db
}

const setup = async (): Promise<void> => {
const setupRedis = async () => {
if (!process.env.REDIS_URL) {
const redisContainer = await new GenericContainer('redis:7')
Expand All @@ -82,7 +17,7 @@ const setup = async (globalConfig): Promise<void> => {
}
}

await Promise.all([setupDatabase(), setupRedis()])
await Promise.all([setupRedis()])
}

export default setup
8 changes: 0 additions & 8 deletions packages/card-service/jest.teardown.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
module.exports = async () => {
await global.__CARD_SERVICE_KNEX__.migrate.rollback(
{ directory: __dirname + '/migrations' },
true
)
await global.__CARD_SERVICE_KNEX__.destroy()
if (global.__CARD_SERVICE_POSTGRES__) {
await global.__CARD_SERVICE_POSTGRES__.stop()
}
if (global.__CARD_SERVICE_REDIS__) {
await global.__CARD_SERVICE_REDIS__.stop()
}
Expand Down
47 changes: 0 additions & 47 deletions packages/card-service/knexfile.js

This file was deleted.

This file was deleted.

Loading
Loading