nest-cloud / nestcloud Goto Github PK
View Code? Open in Web Editor NEWA NodeJS micro-service solution, writing by Typescript language and NestJS framework.
License: MIT License
A NodeJS micro-service solution, writing by Typescript language and NestJS framework.
License: MIT License
请问这个项目是已经停止维护了吗
After updating the @nestcloud/config
package as well at the @nestcloud/boot
modules, I noticed some API changes, where dependencies' are now
inject` in some cases and the constants for NEST_CONSUL has been changed to CONSUL
However, the issues I'm having with the config package is with these interfaces,
ERROR in libs/core/src/modules/subscription-base.class.ts:5:28
TS2307: Cannot find module '@nestcloud/config/etcd-config' or its corresponding type declarations.
3 | import { Logger } from '@nestjs/common';
4 | import { NatsPubSub } from '@moonwalker/graphql-nats-subscriptions';
> 5 | import { EtcdConfig } from '@nestcloud/config/etcd-config';
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6 |
7 | export class SubscriptionBaseClass {
8 | public pubsub: MQTTPubSub | NatsPubSub;
ERROR in libs/core/src/modules/subscription-base.provider.ts:5:28
TS2307: Cannot find module '@nestcloud/config/etcd-config' or its corresponding type declarations.
3 | import { Injectable, Logger, OnModuleDestroy, OnModuleInit, Scope } from '@nestjs/common';
4 | import { NatsPubSub } from '@moonwalker/graphql-nats-subscriptions';
> 5 | import { EtcdConfig } from '@nestcloud/config/etcd-config';
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6 | import { InjectConfig } from '@nestcloud/config';
7 |
8 | @Injectable({
ERROR in libs/core/src/services/configs/cache-store-config.service.ts:4:28
TS2307: Cannot find module '@nestcloud/config/etcd-config' or its corresponding type declarations.
2 | import { InjectConfig } from '@nestcloud/config';
3 | import { Etcd3 } from 'etcd3';
> 4 | import { EtcdConfig } from '@nestcloud/config/etcd-config';
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5 | import redisStore from 'cache-manager-redis-store';
6 | import * as redis from 'redis';
7 |
ERROR in libs/core/src/services/configs/jwt-config.service.ts:2:10
TS2305: Module '"../../../../../node_modules/@nestcloud/config"' has no exported member 'ConsulConfig'.
1 | import { Injectable, Logger } from '@nestjs/common';
> 2 | import { ConsulConfig, InjectConfig } from '@nestcloud/config';
| ^^^^^^^^^^^^
3 | import { JwtModuleOptions, JwtOptionsFactory } from '@nestjs/jwt';
4 |
5 | @Injectable()
ERROR in libs/core/src/services/configs/mongo-config.service.ts:3:28
TS2307: Cannot find module '@nestcloud/config/etcd-config' or its corresponding type declarations.
1 | import { Injectable } from '@nestjs/common';
2 | import { InjectConfig } from '@nestcloud/config';
> 3 | import { EtcdConfig } from '@nestcloud/config/etcd-config';
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5 | import { ConsulDatabaseConfig } from '@src/common';
[System Information]
OS Version : macOS Catalina
NodeJS Version : v10.0.0
YARN Version : 1.22.1
[Nest CLI]
Nest CLI Version : 7.1.4
[Nest Platform Information]
platform-express version : 7.4.2
microservices version : 7.4.2
terminus version : 7.0.1
testing version : 7.4.2
common version : 7.4.2
core version : 7.4.2
I just cloned the nestcloud-grpc-example
then upgraded all the nest-cloud modules to the latest versions.
but unfortunately, it does not work even if I did not upgrade the version of the modules.
here is my terminal logs
Hi,
First of all thanks for all the work awesome stuff.
But I have noticed that we can't configure maxSendMessageLength
& maxReceiveMessageLength
in @nestcloud/grpc
.
Is it a forgotten or is it done on purpose ?
Hi,
I managed to get it bootstraping now, but I have a problem that it's trying to connect to 127.0.0.1 for consul but i have the BootModule loaded with my config.yaml.
It is supposed to pick this up right?
Hey is there a slack or discord service for nestcloud - just for future reference?
Here is a capture of the screen
I have this issue when using [email protected] and [email protected]
at Timeout._onTimeout (/Users/�username/Desktop/Projects/nest-cqrs-auth/node_modules/@nestcloud/loadbalance/loadbalance.js:90:45)
at listOnTimeout (internal/timers.js:551:17)
at processTimers (internal/timers.js:494:7)
(Use `node --trace-warnings ...` to show where the warning was created```
I am using nestcloud boot and consul.
When using Nest with Fastify we cannot build an app that uses nestcloud:
$ npm run build
> [email protected] prebuild /home/trenduser/dev/git/new-product-search/b2b-product-search-service
> rimraf dist
> [email protected] build /home/trenduser/dev/git/new-product-search/b2b-product-search-service
> nest build
node_modules/@nestcloud/common/interfaces/proxy.interface.d.ts:1:35 - error TS2307: Cannot find module 'express' or its corresponding type declarations.
1 import { Request, Response } from 'express';
~~~~~~~~~
node_modules/@nestcloud/common/utils/provider.util.d.ts:10:71 - error TS2307: Cannot find module 'typeorm' or its corresponding type declarations.
10 inject: (string | Function | import("@nestjs/common").Type<import("typeorm").Connection>)[];
~~~~~~~~~
node_modules/@nestcloud/common/utils/provider.util.d.ts:15:71 - error TS2307: Cannot find module 'typeorm' or its corresponding type declarations.
15 inject: (string | Function | import("@nestjs/common").Type<import("typeorm").Connection>)[];
~~~~~~~~~
As a workaround I installed express and typeorm, but I don't believe this is the correct approach.
feign.module.ts中引用了import { NEST_CONSUL_CONFIG_PROVIDER } from '../common',应该是import { NEST_CONSUL_CONFIG_PROVIDER } from '@nestcloud/common';
Hi,
I would like to see an example of a service discovery using etcd.
I checked some samples but I don't fully understand it.
How do you register a service using etcd ?
How do you get the IP etc that was registered from another service ?
Any other examples that I have missed ?
Also any specific english documentation ?
Thanks in advance
TypeError: Cannot read property 'choose' of undefined
My app.module.ts like this:
LoggerModule.register(),
BootModule.register(context, filename),
ConsulModule.register({ dependencies: [NEST_BOOT] }),
LoadbalanceModule.register({ dependencies: [NEST_BOOT] }),
ConfigModule.register({ dependencies: [NEST_BOOT, NEST_CONSUL] }),
ProxyModule.register({ dependencies: [NEST_BOOT] }),
I am having troubles with microservice health checks in my consul docker setup, which i believe is a symptom of failure in service discovery as i only have one server in my registry.
Below is consul list of members from inside the docker container.
/ # consul members
Node Address Status Type Build Protocol DC Segment
7b1edb14a647 172.19.0.6:8301 alive server 1.7.4 2 dc1 <all>
/ #
Consul container logs repeat the same error below for all the microservices:
consul | 2020-06-16T12:19:11.087Z [WARN] agent: Check socket connection failed: check=service:ffa44b66c4869601c04abdbea6dc5be5 error="dial tcp 172.19.0.6:50044: connect: connection refused"
I am using docker-compose v.3.2 to create a network for containers.
This is a consul service definition
consul:
container_name: consul
ports:
- '8400:8400'
- '8500:8500'
- '8600:53/udp'
image: consul
command: ['agent', '-server', '-bootstrap', '-ui', '-client', '0.0.0.0']
Microservice definition
service-notification:
build:
context: .
dockerfile: apps/service-notification/Dockerfile
args:
NODE_ENV: development
depends_on:
- consul
image: 'service-notification:latest'
restart: always
environment:
- CONSUL_HOST=consul
ports:
- '50044:50044'
I am using CONSUL_HOST
env variable to pass in correct host url.
Consul config for the microservice
consul:
host: ${{CONSUL_HOST}}
port: 8500
service:
discoveryHost: service-notification
healthCheck:
timeout: 1s
interval: 10s
tcp: ${{ service.discoveryHost }}:${{ service.port }}
maxRetry: 5
retryInterval: 5000
tags: ["v1.0.0", "microservice"]
name: io.ultimatebackend.srv.notification
port: 50044
My conclusion so far is that consul server container fails to reach the agents somehow. But i don't know why and i feel like i am missing some obvious peace of consul structure. Please advise.
Hi,
First of all thanks for all the work awesome stuff.
But I have noticed that the documentation and actual packages are out of sync. In this case @nestcloud/config
.
It does not export Config
class as stated in documentation so it cant be properly injected. Is this a bug because the documentation has Config class in the exports and I have checked and could not find it in exports.
Hello, we a looking into using this framework in our next project. Is there any plans for English documentation ?
服务的注册时机是不是不太妥当, 如果有模块在onModuleInit有阻塞,比如数据库链接,这是时候服务是不可用的,因为还没有 listen,但服务在模块初始化就注册上了
I am a nestjs developer, and working on a lot of micro-service system. This nest micro-service solution is very awesome, so I am looking forward to contribute to this project.
Looking forward to your reply ❤️
I've noticed that nest-cloud/validations is archived. Is this deprecated?
The package is still being used in samples and nestcloud-typeorm-example
repo.
import { Injectable, Body, Inject } from "@nestjs/common";
import { Loadbalanced } from "@nestcloud/loadbalance";
import { Get, ost } from "@nestcloud/feign";
// import { AXIOS_INSTANCE_PROVIDER } from "@nestcloud/http/http.constants";
@Injectable()
// enable loadbalance supports, need import @nestcloud/loadbalance module at first.
@Loadbalanced("service-test")
export class ServiceNodeClient {
// constructor(@Inject(AXIOS_INSTANCE_PROVIDER) private readonly httpService: HttpClient) {}
// constructor() {}
@Post("/service-test/get-service-test-info-by-caller-test")
async getServiceNodeInfo() {}
@Get("http://test.com/users")
// disable loadbalance supports.
@Loadbalanced(false)
getRemoteUsers() {}
}
请问如何在getServiceNodeInfo函数中获得Post返回的数据做二次加工,在返回到controller中,同时对Post传递参数
Hi @miaowing,
Thank you for providing such a great collection of tools for building microservices with NestJS. What I am looking for is a sample to understand how the NestCloud works with few microservices and the way those communicate with each other using Consul. Can you please put together something like below.
Service A - has a method getHello returns 'Hello from A'
Service B - has a method getHello returns 'Hello from B'
Service C - has a method getHello returns 'Hello from C'
Service D - consume all A, B, C services using Service discovery and provide a REST interface(API) to outside.
I am trying to understand how this works with the discovery service.
Please add a sample.
Thanks
初步方案是 k8s + istio
方便一起探讨吗?
When I deploy my services on kubernetes, consul keeps loading on port 127.0.0.1:8500
even after updating my consul option in bootstrap.yaml file.
I'm pinching my hair out. Here is my config.yaml
consul:
host: consul-server-bootstrap
port: 8500
config:
key: ${{ service.name }}
service:
discoveryHost: services-tenant.default.svc.cluster.local
healthCheck:
timeout: 1s
interval: 10s
tcp: ${{ service.discoveryHost }}:${{ service.port }}
maxRetry: 5
retryInterval: 5000
name: service
port: 50090
loadbalance:
ruleCls: RandomRule
logger:
level: info
transports:
- transport: console
colorize: true
datePattern: YYYY-MM-DD h:mm:ss
label: ${{ service.name }}
Please any help would be great
While debugging some missing GRPC options for client credentials I noticed that the latest on NPM is 0.6.11 but in the repo it is 0.7.4. From #19 it indicates as beta release but isn't published as beta neither on NPM.
Are there plans to publish this release as beta/next or being postponed until release is stable?
Hey!
Hum, as of now, https://nestcloud.org redirects to a malicious url domain with some adult content. 😅
I used the link from the repos' readme.md...
服务注册能否提供zookeeper相关模块
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.