Closed olivinesguerra closed 3 years ago
BTW guys. this is a logs from one of my deployments.
I tried running this
moleculer-runner --instances=4 services/*/.service.ts
and returns an error on docker
![Uploading Screen Shot 2020-10-02 at 8.57.50 PM.png…]() Failed to load service '/app/services/api.service.ts' /app/services/api.service.ts:1 import {IncomingMessage} from "http";
@devalexandre could you help him?
Thnks @icebob .
Also just for helping debug the error.
I changes my start command on package.json.
"start": "moleculer-runner --instances=4 services",
@olivinesguerra Can you show your package.json
, Dockerfile
, docker-compose.yml
or kubernetes.yml
?
Hi @oanhnn .
This is the json file.
{
"name": "backend",
"version": "1.0.0",
"description": "My Moleculer-based microservices project",
"scripts": {
"build": "tsc --build tsconfig.json",
"dev": "ts-node ./node_modules/moleculer/bin/moleculer-runner.js --hot --repl --config moleculer.config.ts services/*/.service.ts",
"start": "moleculer-runner.js",
"cli": "moleculer connect Redis",
"ci": "jest --watch",
"test": "jest --coverage",
"lint": "eslint --ext .js,.ts .",
"dc:up": "docker-compose up --build -d",
"dc:logs": "docker-compose logs -f",
"dc:down": "docker-compose down"
},
"keywords": [
"microservices",
"moleculer"
],
"author": "",
"devDependencies": {
"eslint": "^6.8.0",
"eslint-plugin-import": "^2.20.2",
"@typescript-eslint/eslint-plugin": "^2.26.0",
"@typescript-eslint/parser": "^2.26.0",
"eslint-plugin-prefer-arrow": "^1.2.2",
"jest": "^25.1.0",
"jest-cli": "^25.1.0",
"moleculer-repl": "^0.6.2",
"ts-jest": "^25.3.0",
"ts-node": "^8.8.1"
},
"dependencies": {
"@types/jest": "^25.1.4",
"@types/mkdirp": "^1.0.0",
"@types/node": "^13.9.8",
"axios": "^0.20.0",
"dotenv": "^8.2.0",
"firebase": "^7.21.1",
"firebase-admin": "^9.2.0",
"geolib": "^3.3.1",
"ioredis": "^4.14.1",
"kleur": "^4.1.2",
"moleculer": "^0.14.0",
"moleculer-db": "^0.8.4",
"moleculer-db-adapter-mongo": "^0.4.7",
"moleculer-web": "^0.9.0",
"moment": "^2.29.0",
"protobufjs": "^6.10.1",
"typescript": "^3.8.3"
},
"engines": {
"node": ">= 10.x.x"
},
"jest": {
"coverageDirectory": "
Dockerfile:
FROM node:12.0.0
ENV export NODE_ENV=production
RUN mkdir /app WORKDIR /app
COPY package.json package-lock.json tsconfig.json ./ COPY .env.default .env
RUN npm ci --quiet --only=production
COPY . .
ENV NODE_ENV=production RUN npm run build \ && npm prune
EXPOSE 3000
RUN npm start
docker-compose.yml
version: "3.3"
services:
api: build: context: . image: backend env_file: docker-compose.env environment: SERVICES: api PORT: 3000 labels:
/
)"internal
auth: build: context: . image: backend env_file: docker-compose.env environment: SERVICES: greeter networks:
internal
rider: build: context: . image: backend env_file: docker-compose.env environment: SERVICES: greeter networks:
internal
health: build: context: . image: backend env_file: docker-compose.env environment: SERVICES: greeter networks:
internal
traefik: image: traefik:v2.1 command:
networks: internal:
@oanhnn or just create an empty project. and run npm start . Thanks
@olivinesguerra Please edit your comment follow markdown syntax https://www.markdownguide.org/basic-syntax/#code-blocks It look like you using Typescript template (old template) with Redis transporter. Can you try with latest Typescript template? It run success with Redis https://github.com/moleculerjs/moleculer-template-project-typescript/runs/1219539367?check_suite_focus=true
@devalexandre could you help him?
yes, your docker compose this without identification @olivinesguerra
Hi.
I'm using this template for my backend project. I successfully run the app locally by running "npm run dev" but when I tried to deploy using kubernetes/docker with this commands
and in the config file. "start": "moleculer-runner services/**".