Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More docker fixes #39

Merged
merged 3 commits into from
Feb 13, 2024
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
4 changes: 2 additions & 2 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ FROM alpine as grpc-probe

ARG TARGETARCH

RUN --mount=type=cache,target=/var/cache/apk apk add wget

COPY ./docker/get_grpc_probe.sh /get_grpc_probe.sh

RUN --mount=type=cache,target=/var/cache/apk apk add --update wget

RUN TARGETARCH=$TARGETARCH ./get_grpc_probe.sh

FROM node:18-alpine as deps
Expand Down
30 changes: 15 additions & 15 deletions docker/docker-compose-live-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,49 +3,49 @@ services:
extends:
file: docker-compose-dev.yml
service: api-gateway
volumes:
- ./packages/api-gateway:/app/packages/api-gateway
- /app/packages/api-gateway/node_modules
develop:
watch:
- action: sync
path: ./packages/api-gateway
target: /app/packages/api-gateway
ignore:
- ./packages/api-gateway/node_modules
- action: rebuild
path: ./package.json
- action: rebuild
path: ./packages/api-gateway/package.json
- action: rebuild
path: ./Dockerfile.dev

auth-service:
extends:
file: docker-compose-dev.yml
service: auth-service
volumes:
- ./packages/auth-service:/app/packages/auth-service
- /app/packages/auth-service/node_modules
develop:
watch:
- action: sync
path: ./packages/auth-service
target: /app/packages/auth-service
ignore:
- ./packages/auth-service/node_modules
- action: rebuild
path: ./package.json
- action: rebuild
path: ./packages/auth-service/package.json
- action: rebuild
path: ./Dockerfile.dev

db-service:
extends:
file: docker-compose-dev.yml
service: db-service
volumes:
- ./packages/db-service:/app/packages/db-service
- /app/packages/db-service/node_modules
develop:
watch:
- action: sync
path: ./packages/db-service
target: /app/packages/db-service
ignore:
- ./packages/db-service/node_modules
- action: rebuild
path: ./package.json
- action: rebuild
path: ./packages/db-service/package.json
- action: rebuild
path: ./Dockerfile.dev

db:
extends:
Expand Down
42 changes: 12 additions & 30 deletions docker/docker-compose-live-proto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,52 +3,34 @@ services:
extends:
file: docker-compose-dev.yml
service: api-gateway
volumes:
- ./packages/proto/dist:/app/packages/node_modules/juno-proto/dist
develop:
watch:
- action: sync
path: ./packages/proto
target: /app/packages/proto
ignore:
- ./packages/proto/node_modules
- action: sync
path: ./packages/proto
target: /app/packages/node_modules/juno-proto
ignore:
- ./packages/proto/node_modules
- action: rebuild
path: ./packages/proto/package.json

auth-service:
extends:
file: docker-compose-dev.yml
service: auth-service
volumes:
- ./packages/proto/dist:/app/packages/node_modules/juno-proto/dist
develop:
watch:
- action: sync
path: ./packages/proto
target: /app/packages/proto
ignore:
- ./packages/proto/node_modules
- action: sync
path: ./packages/proto
target: /app/packages/node_modules/juno-proto
ignore:
- ./packages/proto/node_modules
- action: rebuild
path: ./packages/proto/package.json

db-service:
extends:
file: docker-compose-dev.yml
service: db-service
volumes:
- ./packages/proto/dist:/app/packages/node_modules/juno-proto/dist
develop:
watch:
- action: sync
path: ./packages/proto
target: /app/packages/proto
ignore:
- ./packages/proto/node_modules
- action: sync
path: ./packages/proto
target: /app/packages/node_modules/juno-proto
ignore:
- ./packages/proto/node_modules
- action: rebuild
path: ./packages/proto/package.json

db:
extends:
Expand Down
2 changes: 1 addition & 1 deletion packages/api-gateway/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"test:cov": "jest --coverage",
"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 --runInBand",
"test:e2e:watch": "jest --config ./test/jest-e2e.json --runInBand --watch",
"test:e2e:watch": "jest --config ./test/jest-e2e.json --runInBand --watchAll",
"tsc": "tsc"
},
"dependencies": {
Expand Down
2 changes: 2 additions & 0 deletions packages/api-gateway/test/project.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import * as ProtoLoader from '@grpc/proto-loader';

let app: INestApplication;

jest.setTimeout(10000);

beforeAll(async () => {
const proto = ProtoLoader.loadSync([ResetProtoFile]) as any;

Expand Down
2 changes: 2 additions & 0 deletions packages/api-gateway/test/user.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import * as ProtoLoader from '@grpc/proto-loader';

let app: INestApplication;

jest.setTimeout(10000);

beforeAll(async () => {
const proto = ProtoLoader.loadSync([ResetProtoFile]) as any;

Expand Down
2 changes: 1 addition & 1 deletion packages/auth-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"test:cov": "jest --coverage",
"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 --runInBand",
"test:e2e:watch": "jest --config ./test/jest-e2e.json --runInBand --watch",
"test:e2e:watch": "jest --config ./test/jest-e2e.json --runInBand --watchAll",
"tsc": "tsc"
},
"dependencies": {
Expand Down
2 changes: 2 additions & 0 deletions packages/auth-service/test/app.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import {
} from 'juno-proto';

let app: INestMicroservice;

jest.setTimeout(10000);
// TODO: make api key tests actually work once implemented

const { AUTHSERVICE_API_KEY_PACKAGE_NAME } = ApiKeyProto;
Expand Down
2 changes: 1 addition & 1 deletion packages/db-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"test:cov": "jest --coverage",
"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 --runInBand",
"test:e2e:watch": "jest --config ./test/jest-e2e.json --runInBand --watch"
"test:e2e:watch": "jest --config ./test/jest-e2e.json --runInBand --watchAll"
},
"dependencies": {
"@grpc/grpc-js": "^1.9.7",
Expand Down
2 changes: 2 additions & 0 deletions packages/db-service/test/project.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ const { DBSERVICE_PROJECT_PACKAGE_NAME } = ProjectProto;

let app: INestMicroservice;

jest.setTimeout(10000);

async function initApp() {
const moduleFixture: TestingModule = await Test.createTestingModule({
imports: [AppModule],
Expand Down
2 changes: 2 additions & 0 deletions packages/db-service/test/user.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ const { DBSERVICE_PROJECT_PACKAGE_NAME } = ProjectProto;

let app: INestMicroservice;

jest.setTimeout(10000);

async function initApp() {
const moduleFixture: TestingModule = await Test.createTestingModule({
imports: [AppModule],
Expand Down
13 changes: 13 additions & 0 deletions packages/proto/copy_protos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
EXEC_PATH=${EXEC_PATH-.}

mkdir -p ../${EXEC_PATH}/api-gateway/node_modules/juno-proto/dist
mkdir -p ../${EXEC_PATH}/auth-service/node_modules/juno-proto/dist
mkdir -p ../${EXEC_PATH}/db-service/node_modules/juno-proto/dist

cp -r ${EXEC_PATH}/dist/* ../${EXEC_PATH}/api-gateway/node_modules/juno-proto/dist
cp -r ${EXEC_PATH}/dist/* ../${EXEC_PATH}/auth-service/node_modules/juno-proto/dist
cp -r ${EXEC_PATH}/dist/* ../${EXEC_PATH}/db-service/node_modules/juno-proto/dist

cp -r ${EXEC_PATH}/package.json ../${EXEC_PATH}/api-gateway/node_modules/juno-proto/
cp -r ${EXEC_PATH}/package.json ../${EXEC_PATH}/auth-service/node_modules/juno-proto/
cp -r ${EXEC_PATH}/package.json ../${EXEC_PATH}/db-service/node_modules/juno-proto/
24 changes: 0 additions & 24 deletions packages/proto/gen_protos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,3 @@ protoc \
--ts_proto_opt=lowerCaseServiceMethods=false \
-I ${EXEC_PATH}/definitions/ \
${EXEC_PATH}/definitions/*.proto

rm -rf ../${EXEC_PATH}/api-gateway/node_modules/juno-proto
rm -rf ../${EXEC_PATH}/auth-service/node_modules/juno-proto
rm -rf ../${EXEC_PATH}/db-service/node_modules/juno-proto

mkdir -p ../${EXEC_PATH}/api-gateway/node_modules/juno-proto/dist
mkdir -p ../${EXEC_PATH}/auth-service/node_modules/juno-proto/dist
mkdir -p ../${EXEC_PATH}/db-service/node_modules/juno-proto/dist

mkdir -p ../${EXEC_PATH}/api-gateway/node_modules/juno-proto/definitions
mkdir -p ../${EXEC_PATH}/auth-service/node_modules/juno-proto/definitions
mkdir -p ../${EXEC_PATH}/db-service/node_modules/juno-proto/definitions

cp -r ${EXEC_PATH}/dist/* ../${EXEC_PATH}/api-gateway/node_modules/juno-proto/dist
cp -r ${EXEC_PATH}/dist/* ../${EXEC_PATH}/auth-service/node_modules/juno-proto/dist
cp -r ${EXEC_PATH}/dist/* ../${EXEC_PATH}/db-service/node_modules/juno-proto/dist

cp -r ${EXEC_PATH}/definitions/* ../${EXEC_PATH}/api-gateway/node_modules/juno-proto/definitions
cp -r ${EXEC_PATH}/definitions/* ../${EXEC_PATH}/auth-service/node_modules/juno-proto/definitions
cp -r ${EXEC_PATH}/definitions/* ../${EXEC_PATH}/db-service/node_modules/juno-proto/definitions

cp -r ${EXEC_PATH}/package.json ../${EXEC_PATH}/api-gateway/node_modules/juno-proto/
cp -r ${EXEC_PATH}/package.json ../${EXEC_PATH}/auth-service/node_modules/juno-proto/
cp -r ${EXEC_PATH}/package.json ../${EXEC_PATH}/db-service/node_modules/juno-proto/
5 changes: 3 additions & 2 deletions packages/proto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"main": "dist/main.js",
"license": "MIT",
"scripts": {
"build": "yarn gen-proto && yarn format && tsc && ncp ./definitions ./dist/definitions",
"build": "yarn gen-proto && yarn format && tsc && ncp ./definitions ./dist/definitions && yarn copy-changes",
"format": "prettier --write \"src/**/*.ts\"",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"test": "jest",
Expand All @@ -13,7 +13,8 @@
"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",
"tsc": "tsc && cp -r ./definitions ./dist/",
"gen-proto": "bash ./gen_protos.sh"
"gen-proto": "bash ./gen_protos.sh",
"copy-changes": "bash ./copy_protos.sh"
},
"dependencies": {
"@nestjs/common": "^10.3.0",
Expand Down
Loading