Envoxy Platform Framework
Project description
Envoxy Platform Framework
The Envoxy is a different kind of API REST framework and application daemon, we are trying to use all the best tools and technics together getting all their power and performance to be able to have all the platform running in one unique framework allowing communications and task distribution with:
- Zapata using (ZeroMQ / UPnP);
- RabbitMQ using (MQTT / AMQP);
- Celery;
- CouchDB;
- PostgreSQL;
Build envoxyd (Envoxy Daemon) and envoxy python package:
What is envoxyd
? It is the process daemon using embeded uWSGI customized to be able to boot our modules using the envoxy
structure and API's.
$ make install
or using docker
$ docker build -t envoxy .
Steps during the build processs
- Install dependencies
- Delete previous virtualenv dir if exists (/opt/envoxy)
- Create clean virtualenv (/opt/envoxy) with python3.6 version and activate
- Give current user permissions to virtualenv dir
- Install envoxy:
python setup install
- Prepare envoxyd files:
- Delete src dir (vendors/src)
- Create envoxyd src dir and make a clean copy o uWSGI
- Copy envoxyd files to customize uWSGI
- Install envoxyd:
python setup install
Prepare packages to pypi repository
$ make packages
Steps during the packaging processs
- Install Process
- Create a Source distribution for both packages:
python3 setup.py sdist bdist_wheel
Publish to pypi repository
On project root for envoxy and ./vendors dir for envoxyd
- Make sure
build
dir was created build
dir must contain a.whl
and.tar.gz
of the current version
envoxy-0.0.2-py3-none-any.whl
envoxy-0.0.2.tar.gz
- Upload current package using twine command and enter your credentials for the account you registered on the real PyPI.
$ twine upload dist/*
Run envoxyd
$ envoxyd --http :8080 --set conf=/path/to/confs/envoxy.json
How to use envoxy
Create a new project
$ envoxy-cli --create-project --name my-container
How to build envoxy with Docker
$ docker build --no-cache -t envoxy-ubuntu:20.04 -f envoxy-ubuntu.Dockerfile .
$ docker build -t envoxy .
Use an existent project path as volume
$ docker run -it -d -p 8080:8080 -v /path/to/project:/home/envoxy -v /path/to/plugins:/usr/envoxy/plugins envoxy
PostgreSQL connector samples
Select Query
from envoxy import pgsqlc
result = pgsqlc.query(
"db_name",
"select * from sample_table where id = 1;"
)
Insert statement and Transaction block
from envoxy import pgsqlc
with pgsqlc.transaction('db_name') as db_conn:
r = db_conn.query(
sql="select * from sample_table limit 2"
)
db_conn.insert('sample_table2', {
"field1": "test",
"field2": "test",
"id": 1
})
all inserts statements must be placed inside a transaction block
CouchDB connector samples
Find
valid selectors: eq, gt, gte, lt, lte fields: if defined will only return this fields, otherwise will return all fields
from envoxy import couchdbc
perms = couchdbc.find(
db="server_key.db_name",
fields=["id", "field2"]
params={
"id": "1234"
"field1__gt": "2345"
}
)
Get
Get the document by id
from envoxy import couchdbc
perms = couchdbc.get(
"005r9odyj91dw0y1ho32lvzh5r2avzngvrouyj",
db="server_key.db_name",
)
Redis connector samples
Get value
from envoxy import redisc
redisc.get(
"server_key",
"my_key"
)
redisc.set(
"server_key",
"my_key",
{
"a": 1,
"b": 2
}
)
# for more operations get raw client
client = redisc.client('server_key')
client.hgetall('my_hash')
MQTT connector samples
Publish
from envoxy import mqttc
mqttc.publish(
'server_key',
'/v3/topic/channel',
{ "data": "test" },
no_envelope=True)
Subscribe
from envoxy import mqttc
mqttc.subscribe(
'server_key',
'/v3/topic/channels/#',
callback
)
on_event
from envoxy import on
from envoxy.decorators import log_event
@on(endpoint='/v3/topic/channels/#', protocols=['mqtt'], server='server_key')
class MqttViewCtrl(View):
@log_event
def on_event(self, data, **kwargs):
do_stuff(data)
client
from envoxy.mqtt.client import Client as MqttClient
credentials = {
"client_id": ":client_id"
"access_token": ":access_token"
}
conf = {
"myserver": {
"bind": "mqtt://localhost:8000",
"cert_path": "/usr/lib/ssl/certs/ca-certificates.crt"
}
}
mqtt_client = MqttClient(conf, credentials=credentials)
mqtt_cient.publish(
"myserver",
"/v3/topic/channel",
{ "data": "test" }
)
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
Built Distribution
File details
Details for the file envoxy-0.2.11.tar.gz
.
File metadata
- Download URL: envoxy-0.2.11.tar.gz
- Upload date:
- Size: 31.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.10.0 requests/2.31.0 setuptools/59.6.0 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e5a1633b67914eddd4bcb4695800b7519d05da8c89bb2ee8c7a6b0a4f1a1fd8 |
|
MD5 | 4ffa7021b423e2a864881e53d6ae4012 |
|
BLAKE2b-256 | 6a5f365be6d60cb2571cb5544cda7193f5b6d246e40b144f2a41c675fa17dda4 |
File details
Details for the file envoxy-0.2.11-py3-none-any.whl
.
File metadata
- Download URL: envoxy-0.2.11-py3-none-any.whl
- Upload date:
- Size: 41.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.10.0 requests/2.31.0 setuptools/59.6.0 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8ce4357ed364b2a0dc3fe234e94a447c0a83953868467efab368ad467bc4228 |
|
MD5 | ab7b5be0e6a02051bcac48d8126fa563 |
|
BLAKE2b-256 | edc530da78d7e1cbbbcd1b242fb320e1a0d6ba07c1e5b5a07a95fe3862e5b3af |