Merge pull request #3 from avatao-content/project_restructure

Project restructure
This commit is contained in:
Bokros Bálint 2018-01-31 16:42:58 +01:00 committed by GitHub
commit fde26fb0c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 29 additions and 30 deletions

View File

@ -59,7 +59,7 @@ ENV TFW_LIB_DIR="/usr/local/lib/"
ENV TFW_SUPERVISORD_CONF="/etc/supervisor/supervisord.conf" ENV TFW_SUPERVISORD_CONF="/etc/supervisor/supervisord.conf"
ENV PYTHONPATH=${TFW_LIB_DIR} ENV PYTHONPATH=${TFW_LIB_DIR}
COPY src/nginx /etc/nginx COPY nginx /etc/nginx
RUN chown -R ${AVATAO_USER}: /var/log/nginx /var/lib/nginx && \ RUN chown -R ${AVATAO_USER}: /var/log/nginx /var/lib/nginx && \
# nginx runs as a regular user, and can't write to /run # nginx runs as a regular user, and can't write to /run
sed -i 's#pid /run/nginx.pid;#pid /tmp/nginx.pid;#g' /etc/nginx/nginx.conf && \ sed -i 's#pid /run/nginx.pid;#pid /tmp/nginx.pid;#g' /etc/nginx/nginx.conf && \
@ -70,7 +70,7 @@ RUN chown -R ${AVATAO_USER}: /var/log/nginx /var/lib/nginx && \
USER ${AVATAO_USER} USER ${AVATAO_USER}
WORKDIR /home/${AVATAO_USER} WORKDIR /home/${AVATAO_USER}
COPY lib ${TFW_LIB_DIR} COPY lib ${TFW_LIB_DIR}
COPY supervisord.conf ${TFW_SUPERVISORD_CONF} COPY supervisor/supervisord.conf ${TFW_SUPERVISORD_CONF}
COPY src/app ${TFW_APP_DIR} COPY src/app ${TFW_APP_DIR}
COPY src/event_handlers ${TFW_EVENT_HANDLERS_DIR} COPY src/event_handlers ${TFW_EVENT_HANDLERS_DIR}

View File

@ -1,6 +1,6 @@
import json import json
from server_connector import ServerConnector from .networking.server_connector import ServerConnector
class EventHandlerBase: class EventHandlerBase:

View File

@ -1,7 +1,7 @@
import json import json
from datetime import datetime from datetime import datetime
from server_connector import ServerUplinkConnector from .networking.server_connector import ServerUplinkConnector
class MessageSender: class MessageSender:

View File

@ -2,10 +2,10 @@ import zmq
from zmq.eventloop import ioloop from zmq.eventloop import ioloop
from zmq.eventloop.zmqstream import ZMQStream from zmq.eventloop.zmqstream import ZMQStream
from config import PUBLISHER_PORT, RECEIVER_PORT from ..config import PUBLISHER_PORT, RECEIVER_PORT
from config.logs import logging from ..config.logs import logging
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
from util import parse_anchor_from_message, ZMQConnectorBase from ..util import parse_anchor_from_message, ZMQConnectorBase
ioloop.install() ioloop.install()

View File

@ -1,11 +1,11 @@
from functools import partial
import zmq import zmq
from functools import partial
from zmq.eventloop import ioloop from zmq.eventloop import ioloop
from zmq.eventloop.zmqstream import ZMQStream from zmq.eventloop.zmqstream import ZMQStream
from config import PUBLISHER_PORT, RECEIVER_PORT from ..config import PUBLISHER_PORT, RECEIVER_PORT
from util import ZMQConnectorBase from ..util import ZMQConnectorBase
ioloop.install() ioloop.install()

View File

@ -1,9 +1,9 @@
import json import json
from tornado.websocket import WebSocketHandler from tornado.websocket import WebSocketHandler
from util import parse_anchor_from_message
from event_handler_connector import EventHandlerConnector from ..util import parse_anchor_from_message
from config.logs import logging from .event_handler_connector import EventHandlerConnector
from ..config.logs import logging
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

View File

@ -1,6 +1,6 @@
import json, xmlrpc.client, zmq import json, xmlrpc.client, zmq
from config.envvars import SUPERVISOR_HTTP_URI from .config.envvars import SUPERVISOR_HTTP_URI
def parse_anchor_from_message(message): def parse_anchor_from_message(message):

View File

@ -4,10 +4,10 @@ import zmq
from tornado.web import Application from tornado.web import Application
from tornado.ioloop import IOLoop from tornado.ioloop import IOLoop
from config import WEB_PORT from tfw.config import WEB_PORT
from config.logs import logging from tfw.config.logs import logging
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
from handlers import FSMManagingSocketHandler from tfw.networking.zmq_websocket_handler import FSMManagingSocketHandler
from sql_injection_fsm import SQLInjectionFSM from sql_injection_fsm import SQLInjectionFSM

View File

@ -1 +0,0 @@
from .zmq_websocket_handler import FSMManagingSocketHandler

View File

@ -1,4 +1,4 @@
from fsm_base import FSMBase from tfw.fsm_base import FSMBase
class SQLInjectionFSM(FSMBase): class SQLInjectionFSM(FSMBase):

View File

@ -3,9 +3,9 @@ from os.path import splitext
from contextlib import suppress from contextlib import suppress
from xmlrpc.client import Fault as SupervisorFault from xmlrpc.client import Fault as SupervisorFault
from util import SupervisorMixin from tfw.util import SupervisorMixin
from config import LOGIN_APP_DIR from tfw.config import LOGIN_APP_DIR
from event_handler_base import EventHandlerBase from tfw.event_handler_base import EventHandlerBase
class SourceCodeEventHandler(EventHandlerBase, SupervisorMixin): class SourceCodeEventHandler(EventHandlerBase, SupervisorMixin):

View File

@ -3,7 +3,7 @@ import json
from tornado.ioloop import IOLoop from tornado.ioloop import IOLoop
from tornado.web import RequestHandler, Application from tornado.web import RequestHandler, Application
from config import LOGIN_APP_PORT from tfw.config import LOGIN_APP_PORT
from login_component import authorize_login from login_component import authorize_login

View File

@ -1,9 +1,9 @@
from shutil import rmtree, copytree from shutil import rmtree, copytree
from event_handler_base import EventHandlerBase from tfw.event_handler_base import EventHandlerBase
from util import SupervisorMixin from tfw.util import SupervisorMixin
from config import TERMINADO_DIR from tfw.config import TERMINADO_DIR
from config.logs import logging from tfw.config.logs import logging
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

View File

@ -2,8 +2,8 @@ from tornado.ioloop import IOLoop
from tornado.web import Application from tornado.web import Application
from terminado import TermSocket, UniqueTermManager from terminado import TermSocket, UniqueTermManager
from config import TERMINADO_PORT, TERMINADO_WD from tfw.config import TERMINADO_PORT, TERMINADO_WD
from config.logs import logging from tfw.config.logs import logging
log = logging.getLogger(__name__) log = logging.getLogger(__name__)