Service registry using pymicroservice
Project description
Emerald - a service registry
============================
This is a simple service registry compatible with [pymicroservice](http://github.com/vladcalin/pymicroservice) based
services which uses JSON RPC protocol for communication and sqlalchemy for data persistance.
What is this?
-------------
This service registry tracks microservices and helps them to identify
each other with little knowledge (just the location of the service registry.
This service is implemented using te [pymicroservice](http://github.com/vladcalin/pymicroservice)
library and exposes the following methods:
- ``ping(name, host, port)`` - registers the fact that at ``http://host:port/api``
is a service running with the name ``name``. A service must call ping at least
once every 60 seconds in order to be considered active.
- ``locate_service(name)`` - locates a service based on a given pattern (glob-like pattern).
returns a list of ``{host: ..., port: ...}` (multiple instances of the same service
can run at the same time).
Installation
------------
```
git clone https://github.com/vladcalin/emerald.git
python emerald/setup.py install
```
To run the tests, use the command
```
python emerald/setup.py test
```
Start the service
-----------------
In order to start the service at ``http://0.0.0.0:5000/api``, use the command
```
emerald --host=0.0.0.0 --port=0.0.0.0 --dburl=sqlite:///:memory: --accesslog=access.log
```
The following parameters can be specified:
- ``--host`` = the address to bind
- ``--port`` = the port to bind
- ``--dburl`` = a database url (as in the
[sqlalchemy](http://docs.sqlalchemy.org/en/latest/dialects/index.html)
specifications). Here are some quick examples:
- using SQLite: ``sqlite:///mydatabase.db``,
``sqlite:////etc/run/servreg/servreg.db``, ``sqlite://:memory:``
- using MySQL: ``mysql+mysqldb://<user>:<password>@<host>:<port>/<dbname>`` (requires mysql-python),
``mysql+pymysql://<user>:<password>@<host>:<port>/<dbname>`` (requires pymysql)
- using Oracle with cx_oracle: ``oracle+cx_oracle://user:pass@host:port/dbname``
- using PostgreSQL with psycopg2: ``postgresql+psycopg2://user:password@host:port/dbname``
- using PostgreSQL with pg8000: ``postgresql+pg8000://user:password@host:port/dbname``
**Note** : you must install the database driver separately (except for sqlite).
- ``--accesslog`` = the file where the access log will be stored
============================
This is a simple service registry compatible with [pymicroservice](http://github.com/vladcalin/pymicroservice) based
services which uses JSON RPC protocol for communication and sqlalchemy for data persistance.
What is this?
-------------
This service registry tracks microservices and helps them to identify
each other with little knowledge (just the location of the service registry.
This service is implemented using te [pymicroservice](http://github.com/vladcalin/pymicroservice)
library and exposes the following methods:
- ``ping(name, host, port)`` - registers the fact that at ``http://host:port/api``
is a service running with the name ``name``. A service must call ping at least
once every 60 seconds in order to be considered active.
- ``locate_service(name)`` - locates a service based on a given pattern (glob-like pattern).
returns a list of ``{host: ..., port: ...}` (multiple instances of the same service
can run at the same time).
Installation
------------
```
git clone https://github.com/vladcalin/emerald.git
python emerald/setup.py install
```
To run the tests, use the command
```
python emerald/setup.py test
```
Start the service
-----------------
In order to start the service at ``http://0.0.0.0:5000/api``, use the command
```
emerald --host=0.0.0.0 --port=0.0.0.0 --dburl=sqlite:///:memory: --accesslog=access.log
```
The following parameters can be specified:
- ``--host`` = the address to bind
- ``--port`` = the port to bind
- ``--dburl`` = a database url (as in the
[sqlalchemy](http://docs.sqlalchemy.org/en/latest/dialects/index.html)
specifications). Here are some quick examples:
- using SQLite: ``sqlite:///mydatabase.db``,
``sqlite:////etc/run/servreg/servreg.db``, ``sqlite://:memory:``
- using MySQL: ``mysql+mysqldb://<user>:<password>@<host>:<port>/<dbname>`` (requires mysql-python),
``mysql+pymysql://<user>:<password>@<host>:<port>/<dbname>`` (requires pymysql)
- using Oracle with cx_oracle: ``oracle+cx_oracle://user:pass@host:port/dbname``
- using PostgreSQL with psycopg2: ``postgresql+psycopg2://user:password@host:port/dbname``
- using PostgreSQL with pg8000: ``postgresql+pg8000://user:password@host:port/dbname``
**Note** : you must install the database driver separately (except for sqlite).
- ``--accesslog`` = the file where the access log will be stored
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
emerald-0.0.1.dev0.tar.gz
(1.1 MB
view details)
File details
Details for the file emerald-0.0.1.dev0.tar.gz
.
File metadata
- Download URL: emerald-0.0.1.dev0.tar.gz
- Upload date:
- Size: 1.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59460f812102bb92847d7ae8ef5808a51223fdb933ea389d800993a0a4ab6f7e |
|
MD5 | 80f421e49aefe0bb9e41e71343df19c8 |
|
BLAKE2b-256 | 806a5d0d861c2552e765116e591af0e3423b78339e797c7d6bb8f26e8d99947b |