Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ downloads
logs
var
ssl
wetty
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "rpc"]
path = rpc
url = git://github.com/LTD-Beget/sprutio-rpc.git
[submodule "wetty"]
path = wetty
url = https://github.com/rndviktor/wetty.git
14 changes: 10 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
.PHONY: all build push \
build-python build-cron build-bower build-rpc build-app build-nginx build-frontend \
push-python push-cron push-bower push-rpc push-app push-nginx push-frontend
build-python build-cron build-bower build-rpc build-app build-nginx build-wetty build-frontend \
push-python push-cron push-bower push-rpc push-app push-nginx push-frontend push-wetty

all: build

build: build-python build-cron build-bower build-rpc build-app build-nginx build-frontend
build: build-python build-cron build-bower build-rpc build-app build-nginx build-frontend build-wetty

build-python:
docker build -t beget/sprutio-python -f Dockerfile ./
Expand All @@ -24,11 +24,14 @@ build-app:
build-nginx:
docker build -t beget/sprutio-nginx -f Dockerfile.nginx ./

build-wetty:
docker build -t rndviktor/wetty -f wetty/Dockerfile wetty/

build-frontend:
docker run -v $(PWD)/app/public:/app -w /app beget/sprutio-bower bower install --allow-root
docker build -t beget/sprutio-frontend -f app/public/Dockerfile app/public/

push: push-cron push-rpc push-app push-nginx push-frontend
push: push-cron push-rpc push-app push-nginx push-frontend push-wetty

push-cron:
docker push beget/sprutio-cron
Expand All @@ -42,6 +45,9 @@ push-app:
push-nginx:
docker push beget/sprutio-nginx

push-wetty:
docker push rndviktor/wetty

push-frontend:
docker push beget/sprutio-frontend

Expand Down
4 changes: 4 additions & 0 deletions app/classes/core/FM.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ class Actions(object):
CREATE_ARCHIVE = 'actions.archive.create.CreateArchive'
EXTRACT_ARCHIVE = 'actions.archive.extract.ExtractArchive'

OPEN_TERMINAL = 'actions.main.open_terminal.OpenTerminal'


# Aliases for FM actions
class Action(object):
Expand Down Expand Up @@ -173,6 +175,8 @@ class Action(object):
HELP = 'FM.action.Help'
LOGOUT = 'FM.action.Logout'

TERMINAL = 'FM.action.Terminal'


class ActionsProvider:
@staticmethod
Expand Down
2 changes: 2 additions & 0 deletions app/config/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from handlers.actions.main import CancelOperationHandler
from handlers.actions.main import LoadSettingsHandler
from handlers.actions.main import SaveSettingsHandler
from handlers.actions.main import TerminalHandler
# from handlers.actions.main import LogoutHandler
from handlers.actions.files import ListFilesHandler
from handlers.actions.files import RemoveFilesHandler
Expand Down Expand Up @@ -62,6 +63,7 @@
(r"/actions/main/cancel_operation", CancelOperationHandler.CancelOperationHandler),
(r"/actions/main/save_settings", SaveSettingsHandler.SaveSettingsHandler),
(r"/actions/main/logout", LogoutHandler.LogoutHandler),
(r"/actions/main/terminal", TerminalHandler.TerminalHandler),
(r"/actions/files/list", ListFilesHandler.ListFilesHandler),
(r"/actions/files/remove", RemoveFilesHandler.RemoveFilesHandler),
(r"/actions/files/chmod", ChmodFilesHandler.ChmodFilesHandler),
Expand Down
27 changes: 27 additions & 0 deletions app/handlers/actions/main/TerminalHandler.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from tornado import web
from handlers.BaseHandler import BaseHandler, wrap_async_rpc, wrap_catch

from core import FM


class TerminalHandler(BaseHandler):
@wrap_async_rpc
@wrap_catch
@web.authenticated
def post(self):

session = self.get_post('session')

if session is None:
self.json({
'error': True,
'message': 'no session provided'
})
self.finish()
return

action = self.get_action(name=FM.Actions.OPEN_TERMINAL, session=session)
answer = action.run()

self.json(answer)
self.finish()
16 changes: 16 additions & 0 deletions app/modules/home/actions/main/open_terminal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from core import FM


class OpenTerminal(FM.BaseAction):
def __init__(self, session, **kwargs):
super(OpenTerminal, self).__init__(**kwargs)

self.session = session

def run(self):
request = self.get_rpc_request()
result = request.request('main/open_terminal', login=self.request.get_current_user(),
password=self.request.get_current_password(), session=self.session)
answer = self.process_result(result)

return answer
4 changes: 4 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ cron:
redis:
image: redis

wetty:
build: wetty
net: "host"

bower:
build: .
dockerfile: Dockerfile.bower
Expand Down
4 changes: 4 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,8 @@ cron:
redis:
image: redis:3.0

wetty:
image: rndviktor/wetty
net: "host"

# EOF
3 changes: 3 additions & 0 deletions travis/docker-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ docker build -t beget/sprutio-app -f app/Dockerfile app/
# nginx image
docker build -t beget/sprutio-nginx -f Dockerfile.nginx ./

# wetty image
docker build -t rndviktor/wetty -f wetty/Dockerfile wetty/

# frontend
docker build -t beget/sprutio-bower -f Dockerfile.bower ./
docker run -v $PWD/app/public:/app -w /app beget/sprutio-bower bower install --allow-root
Expand Down
1 change: 1 addition & 0 deletions wetty
Submodule wetty added at 3babfc