Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Grey2k committed Dec 16, 2015
0 parents commit 76f6180
Show file tree
Hide file tree
Showing 97 changed files with 12,981 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
@@ -0,0 +1,3 @@
.idea
*.pyc
fm.db
18 changes: 18 additions & 0 deletions Dockerfile
@@ -0,0 +1,18 @@
FROM beget/fmcore-python

RUN apt-get install --no-install-recommends -qq -y \
unzip zip

COPY requirements.txt /
RUN pip install -r /requirements.txt

COPY run-rpc.sh /etc/services.d/rpc/run
COPY run-sendfile.sh /etc/services.d/sendfile/run

COPY init-db.sh /etc/cont-init.d/10-init-db.sh
COPY init-tmp.sh /etc/cont-init.d/20-init-tmp.sh
COPY init-passwd.sh /etc/cont-init.d/30-init-passwd.sh

COPY ./ /rpc/

WORKDIR /rpc/
1 change: 1 addition & 0 deletions README.md
@@ -0,0 +1 @@
RPC
Empty file added base/__init__.py
Empty file.
11 changes: 11 additions & 0 deletions base/exc.py
@@ -0,0 +1,11 @@
class Error(Exception):
def __init__(self, message, code=None):
self.message = message
self.code = code

def __str__(self):
return "error_message(%s), error_code(%s)" % (self.message, self.code)


class AccessError(Exception):
pass
Empty file added config/__init__.py
Empty file.
9 changes: 9 additions & 0 deletions config/main.py
@@ -0,0 +1,9 @@
import os

# Default logger
DEFAULT_LOGGER = "fm-rpc"

APP_PATH = os.path.dirname(os.path.dirname(__file__))
DB_FILE = os.getenv("FM_RPC_SETTINGS_DB_PATH", os.path.join(APP_PATH, 'fm.db'))
ROOT_MOUNT = os.getenv("FM_RPC_ROOT_MOUNT_POINT", '/')
TMP_DIR = os.getenv("FM_RPC_TMP_DIR", '/tmp/fm')
13 changes: 13 additions & 0 deletions config/msgpack.py
@@ -0,0 +1,13 @@
TYPE_FCGI = 'fcgi'
TYPE_MSGPACK = 'msgpack'

MSGPACK_CONTROLLERS = 'controllers'

servers = dict(
# используется по умолнчаению
default=dict(
type=TYPE_MSGPACK,
host="127.0.0.1",
port=8500
)
)
6 changes: 6 additions & 0 deletions config/redis.py
@@ -0,0 +1,6 @@
import os

# Redis settings
REDIS_DEFAULT_HOST = os.getenv("FM_REDIS_HOST", 'localhost')
REDIS_DEFAULT_PORT = os.getenv("FM_REDIS_PORT", 6379)
REDIS_DEFAULT_EXPIRE = os.getenv("FM_REDIS_EXPIRE", 86400)
3 changes: 3 additions & 0 deletions controllers/__init__.py
@@ -0,0 +1,3 @@
import os
import glob
__all__ = [os.path.basename(f)[:-3] for f in glob.glob(os.path.dirname(__file__)+"/*.py")]

0 comments on commit 76f6180

Please sign in to comment.