66 API
This commit is contained in:
parent
5e5cd17880
commit
60d06b257f
10 changed files with 33 additions and 19 deletions
|
@ -6,7 +6,7 @@ from SWSCloudCore.controllers.users import ControllerAPI
|
||||||
from SWSCloudCore.controllers.users import ControllerUsers
|
from SWSCloudCore.controllers.users import ControllerUsers
|
||||||
|
|
||||||
|
|
||||||
api = Blueprint('api', __name__, url_prefix='')
|
api = Blueprint('api', __name__, url_prefix='/api/v1')
|
||||||
auth = HTTPBasicAuth()
|
auth = HTTPBasicAuth()
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -13,7 +13,7 @@ from SWSCloudCore.controllers.tasks import ControllerTasks
|
||||||
from SWSCloudCore.controllers.containers import (
|
from SWSCloudCore.controllers.containers import (
|
||||||
ControllerContainers, ControllerContainersStatistics, ControllerContainersStatisticsState)
|
ControllerContainers, ControllerContainersStatistics, ControllerContainersStatisticsState)
|
||||||
|
|
||||||
api_v1_containers = Blueprint('containers', __name__, url_prefix='/containers')
|
api_v1_containers = Blueprint('containers', __name__, url_prefix='/api/v1/containers')
|
||||||
|
|
||||||
|
|
||||||
@api_v1_containers.route('/', methods=['GET'])
|
@api_v1_containers.route('/', methods=['GET'])
|
||||||
|
|
|
@ -5,7 +5,7 @@ from SWSCloudAPI.API import auth
|
||||||
from SWSCloudCore.controllers.datacenters import ControllerDataCenters
|
from SWSCloudCore.controllers.datacenters import ControllerDataCenters
|
||||||
|
|
||||||
|
|
||||||
api_v1_datacenters = Blueprint('datacenters', __name__, url_prefix='/datacenters')
|
api_v1_datacenters = Blueprint('datacenters', __name__, url_prefix='/api/v1/datacenters')
|
||||||
|
|
||||||
|
|
||||||
@api_v1_datacenters.route('/', methods=['GET'])
|
@api_v1_datacenters.route('/', methods=['GET'])
|
||||||
|
|
|
@ -4,7 +4,7 @@ from flask import Blueprint, jsonify
|
||||||
from SWSCloudAPI.API import auth
|
from SWSCloudAPI.API import auth
|
||||||
from SWSCloudCore.controllers.plans import ControllerPlans
|
from SWSCloudCore.controllers.plans import ControllerPlans
|
||||||
|
|
||||||
api_v1_pricing = Blueprint('pricing', __name__, url_prefix='/pricing')
|
api_v1_pricing = Blueprint('pricing', __name__, url_prefix='/api/v1/pricing')
|
||||||
|
|
||||||
|
|
||||||
@api_v1_pricing.route('/pricing/vms/')
|
@api_v1_pricing.route('/pricing/vms/')
|
||||||
|
|
|
@ -12,7 +12,7 @@ from SWSCloudCore.controllers.common import ControllerCommon, ControllerMessages
|
||||||
from SWSCloudCore.controllers.tasks import ControllerTasks
|
from SWSCloudCore.controllers.tasks import ControllerTasks
|
||||||
from SWSCloudCore.controllers.vms import ControllerVMS
|
from SWSCloudCore.controllers.vms import ControllerVMS
|
||||||
|
|
||||||
api_v1_vms = Blueprint('vms', __name__, url_prefix='/vms')
|
api_v1_vms = Blueprint('vms', __name__, url_prefix='/api/v1/vms')
|
||||||
|
|
||||||
|
|
||||||
@api_v1_vms.route('/', methods=['GET'])
|
@api_v1_vms.route('/', methods=['GET'])
|
||||||
|
|
|
@ -11,7 +11,8 @@ from SWSCloudCore.models import database
|
||||||
from SWSCloudCore.config import config
|
from SWSCloudCore.config import config
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
app.config["APPLICATION_ROOT"] = "/api/v1"
|
# Думал, что получится сделать автопрефик для всего приложения, но это не сработало
|
||||||
|
# app.config["APPLICATION_ROOT"] = "/api/v1"
|
||||||
# app.config['SERVER_NAME'] = settings.get('Application', 'SERVER_NAME')
|
# app.config['SERVER_NAME'] = settings.get('Application', 'SERVER_NAME')
|
||||||
app.config['DEBUG'] = config.getboolean('Application', 'DEBUG')
|
app.config['DEBUG'] = config.getboolean('Application', 'DEBUG')
|
||||||
app.config['SECRET_KEY'] = config.get("Application", "SECRET_KEY")
|
app.config['SECRET_KEY'] = config.get("Application", "SECRET_KEY")
|
||||||
|
@ -67,6 +68,7 @@ def before_first_request():
|
||||||
@app.after_request
|
@app.after_request
|
||||||
def after_request(response):
|
def after_request(response):
|
||||||
# TODO: report about access
|
# TODO: report about access
|
||||||
|
app.logger.info('')
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
|
||||||
from SWSCloudCore import app
|
from SWSCloudWeb import app
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app.run(host='0.0.0.0', port=5000, debug=True)
|
app.run(host='0.0.0.0', port=5000, debug=True)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
server_name gocloud.ru www.gocloud.ru;
|
server_name gocloud.ru www.gocloud.ru;
|
||||||
rewrite ^(.*)$ https://$server_name$1 permanent;
|
rewrite ^(.*)$ https://gocloud.ru$1 permanent;
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
|
@ -12,23 +12,35 @@ server {
|
||||||
error_log /var/log/nginx/gocloud.ru_error.log;
|
error_log /var/log/nginx/gocloud.ru_error.log;
|
||||||
|
|
||||||
ssl on;
|
ssl on;
|
||||||
ssl_certificate /var/lib/gocloud.ru/control/ssl/1_gocloud.ru_bundle.crt;
|
ssl_certificate /etc/nginx/ssl/gocloud/1_gocloud.ru_bundle.crt;
|
||||||
ssl_certificate_key /var/lib/gocloud.ru/control/ssl/2_gocloud.ru.key;
|
ssl_certificate_key /etc/nginx/ssl/gocloud/2_gocloud.ru.key;
|
||||||
|
|
||||||
ssl_protocols SSLv2 SSLv3 TLSv1;
|
#ssl_protocols SSLv2 SSLv3 TLSv1 TLSv1.1 TLSv1.2;
|
||||||
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
|
ssl_protocols SSLv2 TLSv1 TLSv1.1 TLSv1.2;
|
||||||
|
ssl_ciphers 'ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4';
|
||||||
|
ssl_session_cache builtin:1000 shared:SSL:10m;
|
||||||
|
ssl_stapling on;
|
||||||
|
ssl_stapling_verify on;
|
||||||
ssl_prefer_server_ciphers on;
|
ssl_prefer_server_ciphers on;
|
||||||
|
|
||||||
|
location /api/ {
|
||||||
|
#proxy_pass http://127.0.0.1:5001;
|
||||||
|
include uwsgi_params;
|
||||||
|
uwsgi_pass unix:/var/run/sws/gocloud_api.sock;
|
||||||
|
}
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
#proxy_pass http://127.0.0.1:5001;
|
#proxy_pass http://127.0.0.1:5001;
|
||||||
include uwsgi_params;
|
include uwsgi_params;
|
||||||
uwsgi_pass unix:/var/run/gocloudru_control.sock;
|
uwsgi_pass unix:/var/run/sws/gocloud.sock;
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~* ^.+\.(jpg|jpeg|gif|css|png|js|ico|bmp)$ {
|
location ~* ^.+\.(jpg|jpeg|gif|css|png|js|ico|bmp|txt|xml|woff|woff2)$ {
|
||||||
root /var/lib/gocloud.ru/control/app;
|
# root /var/lib/gocloud/control/app/static;
|
||||||
access_log off;
|
access_log off;
|
||||||
expires 10d;
|
expires 10d;
|
||||||
break;
|
|
||||||
|
include uwsgi_params;
|
||||||
|
uwsgi_pass unix:/var/run/sws/gocloud.sock;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ virtualenv = /home/gocloud/env
|
||||||
socket = /var/run/sws/gocloud.sock
|
socket = /var/run/sws/gocloud.sock
|
||||||
chmod-socket = 777
|
chmod-socket = 777
|
||||||
|
|
||||||
module = SWSCloudCore:app
|
module = SWSCloudWeb:app
|
||||||
|
|
||||||
master = true
|
master = true
|
||||||
processes = 2
|
processes = 2
|
4
setup.py
4
setup.py
|
@ -23,7 +23,7 @@ setup(
|
||||||
'SWSCloudCore.controllers.kb',
|
'SWSCloudCore.controllers.kb',
|
||||||
'SWSCloudCore.controllers.payments',
|
'SWSCloudCore.controllers.payments',
|
||||||
'SWSCloudCore.controllers.plans',
|
'SWSCloudCore.controllers.plans',
|
||||||
'SWSCloudCore.controllers.server_api',
|
'SWSCloudCore.controllers.ServerAPI',
|
||||||
'SWSCloudCore.controllers.servers',
|
'SWSCloudCore.controllers.servers',
|
||||||
'SWSCloudCore.controllers.settings',
|
'SWSCloudCore.controllers.settings',
|
||||||
'SWSCloudCore.controllers.tasks',
|
'SWSCloudCore.controllers.tasks',
|
||||||
|
@ -38,7 +38,7 @@ setup(
|
||||||
'SWSCloudCore.views.documents',
|
'SWSCloudCore.views.documents',
|
||||||
'SWSCloudCore.views.kb',
|
'SWSCloudCore.views.kb',
|
||||||
'SWSCloudCore.views.payments',
|
'SWSCloudCore.views.payments',
|
||||||
'SWSCloudCore.views.server_api',
|
'SWSCloudCore.views.ServerAPI',
|
||||||
'SWSCloudCore.views.settings',
|
'SWSCloudCore.views.settings',
|
||||||
'SWSCloudCore.views.support',
|
'SWSCloudCore.views.support',
|
||||||
'SWSCloudCore.views.tasks',
|
'SWSCloudCore.views.tasks',
|
||||||
|
|
Loading…
Add table
Reference in a new issue