Comments (9)
BTW guys. this is a logs from one of my deployments.
from moleculer-template-project-typescript.
I tried running this
moleculer-runner --instances=4 services/**/*.service.ts
and returns an error on docker
Failed to load service '/app/services/api.service.ts' /app/services/api.service.ts:1
import {IncomingMessage} from "http";
from moleculer-template-project-typescript.
@devalexandre could you help him?
from moleculer-template-project-typescript.
Thnks @icebob .
Also just for helping debug the error.
I changes my start command on package.json.
"start": "moleculer-runner --instances=4 services",
from moleculer-template-project-typescript.
@olivinesguerra Can you show your package.json
, Dockerfile
, docker-compose.yml
or kubernetes.yml
?
from moleculer-template-project-typescript.
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": "/coverage",
"testEnvironment": "node",
"moduleFileExtensions": [
"ts",
"tsx",
"js"
],
"transform": {
"^.+\.(ts|tsx)$": "ts-jest"
},
"testMatch": [
"/*.spec.(ts|js)"
],
"globals": {
"ts-jest": {
"tsConfig": "tsconfig.json"
}
}
}
}
Dockerfile:
FROM node:12.0.0
ENV export NODE_ENV=production
Working directory
RUN mkdir /app
WORKDIR /app
Install dependencies
COPY package.json package-lock.json tsconfig.json ./
COPY .env.default .env
RUN npm ci --quiet --only=production
Copy source
COPY . .
Build and cleanup
ENV NODE_ENV=production
RUN npm run build
&& npm prune
EXPOSE 3000
Start server
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:
- "traefik.enable=true"
- "traefik.http.routers.api-gw.rule=PathPrefix(/
)"
- "traefik.http.services.api-gw.loadbalancer.server.port=3000"
networks:
- 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:
- "--api.insecure=true" # Don't do that in production!
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
ports:
- 3000:80
- 3001:8080
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
networks:
- internal
- default
networks:
internal:
from moleculer-template-project-typescript.
@oanhnn or just create an empty project. and run npm start . Thanks
from moleculer-template-project-typescript.
@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
from moleculer-template-project-typescript.
@devalexandre could you help him?
yes, your docker compose this without identification @olivinesguerra
from moleculer-template-project-typescript.
Related Issues (20)
- moleculer init project-typescript transporter not configered HOT 3
- Upgrade template to 0.14 HOT 6
- How to access cacher? HOT 2
- Created and Started hooks are not called. HOT 2
- undefined in events - event not fired problem
- [Bug] Service products cannot modify
- Default tests are not working HOT 12
- Debug not working - Could not read source map for file /node_modules/typescript/lib/typescript.js HOT 1
- VsCode Debugging
- I got syntax error on "authenticate" method of the API service (line 115) HOT 1
- Problems with metrics and tracking not working as config. HOT 4
- Problem installing moleculer-template-project-ts HOT 1
- delete this sorry
- Unable to compile TypeScript HOT 6
- Unable to create ServiceBroker. BrokerOptionsError: Invalid tracing exporter type ''." HOT 1
- Compilation issues HOT 1
- TS2305: Module "moleculer" has no exported member StartedStoppedHandler
- Broker with API Gateway not starting after init. HOT 2
- Support for typed "this" in lifecycle methods (created, started, stopped) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from moleculer-template-project-typescript.