{"id":15009237,"url":"https://github.com/knitmesh/servos-framework","last_synced_at":"2025-04-09T17:23:10.324Z","repository":{"id":191342989,"uuid":"113420793","full_name":"knitmesh/servos-framework","owner":"knitmesh","description":"Adopt decentralized development and unified management Develop on a service basis Each service can be started individually or multiple services can be started at the same time Configuration file management specifies which services take effect and deployment is flexible","archived":false,"fork":false,"pushed_at":"2019-11-13T08:38:16.000Z","size":45,"stargazers_count":129,"open_issues_count":0,"forks_count":52,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-23T19:22:50.875Z","etag":null,"topics":["python27"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/knitmesh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-12-07T08:01:20.000Z","updated_at":"2021-07-03T15:54:06.000Z","dependencies_parsed_at":"2023-08-29T11:57:24.527Z","dependency_job_id":null,"html_url":"https://github.com/knitmesh/servos-framework","commit_stats":null,"previous_names":["knitmesh/servos-framework"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knitmesh%2Fservos-framework","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knitmesh%2Fservos-framework/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knitmesh%2Fservos-framework/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knitmesh%2Fservos-framework/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/knitmesh","download_url":"https://codeload.github.com/knitmesh/servos-framework/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248075341,"owners_count":21043567,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python27"],"created_at":"2024-09-24T19:23:55.547Z","updated_at":"2025-04-09T17:23:10.305Z","avatar_url":"https://github.com/knitmesh.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Servos Framework: *The process level Concurrent Toolkit* \n[![Python 2.7](https://img.shields.io/badge/python-2.7-yellow.svg)](https://www.python.org/) [![License](https://img.shields.io/badge/license-GPLv2-red.svg)](https://raw.githubusercontent.com/Xyntax/POC-T/master/doc/LICENSE.txt) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/1413552d34bc4a4aa84539db1780eb56)](https://www.codacy.com/app/xyntax/POC-T?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=Xyntax/POC-T\u0026amp;utm_campaign=Badge_Grade) \n\n## 框架说明\n\n### 服务的组织\n采用分散开发统一管理。以服务为单位进行开发。每个服务可以单独启动，也可以多个服务同时启动，通过配置文件进行管理指定哪些服务生效，部署方式灵活。\n\n特点\n---\n* 框架代码结构简单易用，易于修改。新手、老鸟皆可把控。\n\n* 采用gevent实现并发操作，与scrapy的twisted相比，代码更容易理解。\n\n* 完全模块化的设计，强大的可扩展性。\n\n* 支持多线程/Gevent两种并发模式\n\n* 支持分布式\n\n### 扩展性\n- plugin扩展。框架已经预设了一些调用点，方便对各个环节进行修改。可以针对这些调用点编写相应的处理，当框架启动时会自动进行采集，当程序运行到调用点位置时，自动调用对应的插件函数。\n- middleware 中间件扩展。与`web framework`类似，这里是对服务接口调用进行扩展。\n- injection 注入式扩展。可向框架注入 functions, global_objects 等。\n\n## 新增服务流程\n- 增加服务包。\n- 从基类继承，并使用 `entry` 装饰器标记。\n- 编码服务逻辑。\n- 配置文件中增加要启动的服务。\n\n用户手册\n----\n\n* [快速开始](https://github.com/knitmesh/servos-framework/blob/master/docs/helloworld.md)\n* [日志处理说明](https://github.com/knitmesh/servos-framework/blob/master/docs/log.md)\n* [命令行命令说明](https://github.com/knitmesh/servos-framework/blob/master/docs/manage.md)\n* [配置文件说明](https://github.com/knitmesh/servos-framework/blob/master/docs/settings.md)\n\n依赖\n---\n* Python 2.7\n* pip\n\n\n### 安装\n\n- 安装服务框架。新构建的服务依赖 **servos-framework** 框架，先 ```pip install servos-framework```。\n- 安装服务依赖。运行命令 ```servos install```，该命令会自动安装各服务在自己目录下 requirements.txt 定义的依赖包，具体参数可以运行 ```servos help``` 命令查看。\n- 启动服务。运行 ```servos runserver --settings cache_settings.ini```。\n- 调试服务。使用 **manage.py** 作为启动文件，在IDE的 Parameters 配置处输入将要使用的命令行, 如： ```runserver --settings cache_settings.ini```。\n\n### 部署安装\n\n- 执行`./setenv.sh`会自动创建virtualenv虚拟环境。\n- 执行`source .virtualenvs/services/bin/activate`切换到虚拟环境。\n- 启动服务。\n    1. cache服务：运行 ```servos runserver --settings cache_settings.ini```。\n    2. websocket服务：运行 ```servos runserver --settings wss_settings.ini```。\n\n### Docker\n构建base镜像\n```bash\n# 初始化外部依赖\npython2 docker/prepare.py -v VERSION --pip-server 192.168.103.137:8000 --yum-repo http://192.168.103.137:8001\ndocker build . -f docker/base/Dockerfile -t service_base:VERSION\n```\n\n构建功能镜像（以cache为例）\n```bash\ncd docker/cache/\ndocker build . -t service-cache:VERSION\n```\n\n运行服务（以cache为例）\n```bash\ndocker run --rm --network host \\\n    -v /etc/portal/cache_settings.ini:/etc/portal/cache_settings.ini \\\n    --name service-wss \\\n    t2cloud-service-wss:VERSION\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknitmesh%2Fservos-framework","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fknitmesh%2Fservos-framework","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknitmesh%2Fservos-framework/lists"}