Skip to content

Commit

Permalink
Merge pull request #10 from labteral/develop
Browse files Browse the repository at this point in the history
2.215.0
  • Loading branch information
brunneis authored May 7, 2021
2 parents 6497633 + c2c7d5c commit 1ea3a22
Show file tree
Hide file tree
Showing 9 changed files with 98 additions and 44 deletions.
40 changes: 40 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from setuptools import setup
from setuptools import find_packages
import stopover_server

setup(name='stopover-server',
version=stopover_server.__version__,
description='Message Broker powered by RocksDB',
url='https://github.com/labteral/stopover',
author='Rodrigo Martínez Castaño',
author_email='dev@brunneis.com',
license='GNU General Public License v3 (GPLv3)',
packages=find_packages(),
zip_safe=False,
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Console',
'Intended Audience :: Developers',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Software Development :: Libraries :: Python Modules',
],
python_requires='>=3.6',
install_requires=[
'msgpack==1.0.2,<2.0.0',
'python-snappy>=0.6.0,<1.0.0',
'easyrocks>=2.214.0,<3.0.0'
'pyyaml==5.4.1,<6.0.0',
'falcon>=3.0.0,<4.0.0',
'cherrybone',
],
entry_points={
'console_scripts': [
'stopover = stopover_server.__main__:main',
],
})
37 changes: 0 additions & 37 deletions stopover/server.py

This file was deleted.

4 changes: 4 additions & 0 deletions stopover_server/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from stopover import __version__
43 changes: 41 additions & 2 deletions stopover/stopover.py → stopover_server/__main__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

version = '2.214.1'
from .version import __version__
from .broker import Broker
import falcon
import logging
import yaml
import sys
from cherrybone import Server

banner = f"""
███████████ ███████████
Expand All @@ -25,5 +31,38 @@
███████████████████████
███████████████████
███████████ ___________________
Stopover v{version}
Stopover v{__version__}
"""

CONFIG_PATH = './config.yaml'

logging.getLogger().setLevel(logging.INFO)
logging.basicConfig(format='%(asctime)-15s [%(levelname)s] %(message)s',
datefmt='%Y-%m-%d %H:%M:%S')


def main():
logging.info(f'\n{banner}')

with open(CONFIG_PATH, 'r') as input_file:
config = yaml.safe_load(input_file)

try:
open(f"{config['global']['data_dir']}/streams/.active")

except FileNotFoundError:
logging.critical('the streams dir is not active')
sys.exit(1)

api = falcon.App()
api.add_route('/', Broker(config))

threads = None
if 'threads' in config['global'] and config['global']['threads'] > 0:
threads = config['global']['threads']

Server(api, port=5704, threads=threads).start()


if __name__ == "__main__":
main()
8 changes: 4 additions & 4 deletions stopover/broker.py → stopover_server/broker.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from stopover import version
from partition import Partition, PartitionItem
from .version import __version__
from .partition import Partition, PartitionItem
from . import utils
from os import listdir, path
from threading import Lock, Thread
import traceback
import random
import falcon
import utils
import time
import json
import logging
Expand Down Expand Up @@ -48,7 +48,7 @@ def __init__(self, config):
@staticmethod
def on_get(request, response):
response.content_type = 'text/html; charset=utf-8'
response.body = f'Labteral Stopover {version}'
response.body = f'Labteral Stopover {__version__}'

def on_post(self, request, response):
bin_data = request.stream.read()
Expand Down
2 changes: 1 addition & 1 deletion stopover/partition.py → stopover_server/partition.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import utils
from . import utils
from os import makedirs
from easyrocks import RocksDB, WriteBatch, CompressionType
from easyrocks.utils import int_to_padded_bytes
Expand Down
File renamed without changes.
5 changes: 5 additions & 0 deletions stopover_server/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

__version__ = '2.215.0'

3 changes: 3 additions & 0 deletions upload.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
python3 setup.py bdist_wheel
twine upload dist/*.whl

0 comments on commit 1ea3a22

Please sign in to comment.