mirror of
https://github.com/Bryanthelol/namekoplus
synced 2025-09-13 15:36:03 +08:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
cb5762720f | |||
920e204756 | |||
9ac4a39c0d | |||
37bdf56862 |
@@ -1,3 +1,4 @@
|
||||
include *.py *.md
|
||||
recursive-include namekoplus/chassis *.py
|
||||
recursive-include namekoplus/templates *.py *.yml
|
||||
recursive-include namekoplus/templates *.py *.yml
|
||||
recursive-include namekoplus/chassis-agent *.py *.yml
|
18
README.md
18
README.md
@@ -2,10 +2,6 @@
|
||||
|
||||
A lightweight Python distributed microservice solution
|
||||
|
||||
## Document
|
||||
|
||||
[中文文档](https://doc.bearcatlog.com/)
|
||||
|
||||
## Command Line Tool Usage
|
||||
|
||||
### Checkout Command
|
||||
@@ -14,8 +10,22 @@ A lightweight Python distributed microservice solution
|
||||
namekoplus --help
|
||||
```
|
||||
|
||||
### Start a middleware that nameko depends on
|
||||
|
||||
```shell
|
||||
namekoplus start -m rabbitmq
|
||||
```
|
||||
|
||||
### Initialize a nameko service from templates
|
||||
|
||||
```shell
|
||||
namekoplus init --directory <dir_name> --type <template_type>
|
||||
```
|
||||
|
||||
|
||||
## Detailed Usage
|
||||
|
||||
See Documents:
|
||||
|
||||
- [中文](https://doc.bearcatlog.com/)
|
||||
- [English](https://legendary-sopapillas-e2626d.netlify.app/)
|
0
namekoplus/chassis-agent/__init__.py
Normal file
0
namekoplus/chassis-agent/__init__.py
Normal file
@@ -68,7 +68,7 @@ def cli():
|
||||
@click.option('-t', '--type', '_type',
|
||||
default='all',
|
||||
show_default=True,
|
||||
type=click.Choice(['all', 'rpc', 'event', 'http', 'timer'], case_sensitive=False),
|
||||
type=click.Choice(['all', 'rpc', 'event', 'http', 'timer', 'demo'], case_sensitive=False),
|
||||
help='The template type of nameko service')
|
||||
def init(directory, _type):
|
||||
"""
|
||||
@@ -141,7 +141,7 @@ def stop(middleware):
|
||||
docker_compose_file_dir = os.path.join(get_agent_directory(), middleware)
|
||||
for file_ in os.listdir(docker_compose_file_dir):
|
||||
compose_file_path = os.path.join(docker_compose_file_dir, file_)
|
||||
with status(f'Stoping {middleware}'):
|
||||
with status(f'Stopping {middleware}'):
|
||||
docker = DockerClient(compose_files=[compose_file_path])
|
||||
docker.compose.down()
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
AMQP_URI: pyamqp://${RABBIT_USER:guest}:${RABBIT_PASSWORD:guest}@${RABBIT_HOST:localhost}:${RABBIT_PORT:5672}/
|
||||
AMQP_URI: pyamqp://${RABBIT_USER:admin}:${RABBIT_PASSWORD:admin}@${RABBIT_HOST:localhost}:${RABBIT_PORT:5672}/
|
||||
WEB_SERVER_ADDRESS: '0.0.0.0:8000'
|
||||
RPC_EXCHANGE: 'nameko-rpc'
|
||||
|
||||
max_workers: 10
|
||||
|
0
namekoplus/templates/demo/__init__.py
Normal file
0
namekoplus/templates/demo/__init__.py
Normal file
5
namekoplus/templates/demo/config.yml
Normal file
5
namekoplus/templates/demo/config.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
AMQP_URI: pyamqp://${RABBIT_USER:admin}:${RABBIT_PASSWORD:admin}@${RABBIT_HOST:localhost}:${RABBIT_PORT:5672}/
|
||||
RPC_EXCHANGE: 'nameko-rpc'
|
||||
|
||||
max_workers: 10
|
||||
parent_calls_tracked: 20
|
20
namekoplus/templates/demo/rpc_demo.py
Normal file
20
namekoplus/templates/demo/rpc_demo.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from nameko.rpc import rpc, ServiceRpc
|
||||
|
||||
|
||||
class RpcResponderDemoService:
|
||||
name = "rpc_responder_demo_service"
|
||||
|
||||
@rpc
|
||||
def hello(self, name):
|
||||
return "Hello, {}!".format(name)
|
||||
|
||||
|
||||
class RpcCallerDemoService:
|
||||
name = "rpc_caller_demo_service"
|
||||
|
||||
remote = ServiceRpc("rpc_responder_demo_service")
|
||||
|
||||
@rpc
|
||||
def remote_hello(self, value="John Doe"):
|
||||
res = u"{}".format(value)
|
||||
return self.remote.hello(res)
|
@@ -1,4 +1,4 @@
|
||||
AMQP_URI: pyamqp://${RABBIT_USER:guest}:${RABBIT_PASSWORD:guest}@${RABBIT_HOST:localhost}:${RABBIT_PORT:5672}/
|
||||
AMQP_URI: pyamqp://${RABBIT_USER:admin}:${RABBIT_PASSWORD:admin}@${RABBIT_HOST:localhost}:${RABBIT_PORT:5672}/
|
||||
RPC_EXCHANGE: 'nameko-rpc'
|
||||
|
||||
max_workers: 10
|
||||
|
@@ -1,4 +1,5 @@
|
||||
AMQP_URI: pyamqp://${RABBIT_USER:guest}:${RABBIT_PASSWORD:guest}@${RABBIT_HOST:localhost}:${RABBIT_PORT:5672}/
|
||||
AMQP_URI: pyamqp://${RABBIT_USER:admin}:${RABBIT_PASSWORD:admin}@${RABBIT_HOST:localhost}:${RABBIT_PORT:5672}/
|
||||
WEB_SERVER_ADDRESS: '0.0.0.0:8000'
|
||||
RPC_EXCHANGE: 'nameko-rpc'
|
||||
|
||||
max_workers: 10
|
||||
|
@@ -1,4 +1,4 @@
|
||||
AMQP_URI: pyamqp://${RABBIT_USER:guest}:${RABBIT_PASSWORD:guest}@${RABBIT_HOST:localhost}:${RABBIT_PORT:5672}/
|
||||
AMQP_URI: pyamqp://${RABBIT_USER:admin}:${RABBIT_PASSWORD:admin}@${RABBIT_HOST:localhost}:${RABBIT_PORT:5672}/
|
||||
RPC_EXCHANGE: 'nameko-rpc'
|
||||
|
||||
max_workers: 10
|
||||
|
@@ -1,4 +1,4 @@
|
||||
AMQP_URI: pyamqp://${RABBIT_USER:guest}:${RABBIT_PASSWORD:guest}@${RABBIT_HOST:localhost}:${RABBIT_PORT:5672}/
|
||||
AMQP_URI: pyamqp://${RABBIT_USER:admin}:${RABBIT_PASSWORD:admin}@${RABBIT_HOST:localhost}:${RABBIT_PORT:5672}/
|
||||
RPC_EXCHANGE: 'nameko-rpc'
|
||||
|
||||
max_workers: 10
|
||||
|
4
setup.py
4
setup.py
@@ -9,7 +9,7 @@ with open(path.join(here, 'README.md'), encoding='utf-8') as f:
|
||||
|
||||
setup(
|
||||
name='namekoplus',
|
||||
version='0.2.0',
|
||||
version='0.2.4',
|
||||
description='A lightweight Python distributed microservice solution',
|
||||
long_description=long_description,
|
||||
long_description_content_type='text/markdown',
|
||||
@@ -33,7 +33,7 @@ setup(
|
||||
'Topic :: Software Development :: Libraries :: Python Modules',
|
||||
],
|
||||
platforms='any',
|
||||
python_requires='>=3',
|
||||
python_requires='>=3.8, <4',
|
||||
|
||||
keywords='lightweight python distributed microservice solution',
|
||||
|
||||
|
Reference in New Issue
Block a user