diff --git a/app/__init__.py b/app/__init__.py
index 281be40..1c5f55d 100644
--- a/app/__init__.py
+++ b/app/__init__.py
@@ -12,6 +12,10 @@ from flask_moment import Moment
from werkzeug.contrib.fixers import ProxyFix
from config import config
+import sys, os
+sys.stderr.write("My uid={}, gid={}, euid={}, egid={}".format(os.getuid(), os.getgid(), os.geteuid(), os.getegid()))
+sys.stderr.flush()
+
app = Flask(__name__)
app.config.from_object(config['dev'])
config['dev'].init_app(app)
diff --git a/app/models.py b/app/models.py
index 0a2cfbb..8a38999 100644
--- a/app/models.py
+++ b/app/models.py
@@ -221,8 +221,8 @@ def contact_proxmaster(data, method):
try:
db_result = requests.post( url, data=data_json, headers={"content-type": "application/json"}, timeout=30 )
proxjson = db_result.json()
- if current_app.config['DEBUG'] == 1:
- current_app.logger.info('API> {}'.format(str(proxjson)))
+ #if current_app.config['DEBUG'] == 1:
+ # current_app.logger.info('API> {}'.format(str(proxjson)))
return proxjson
except:
return { 'status': 'UNREACHABLE' }
diff --git a/app/vmanager/routes.py b/app/vmanager/routes.py
index 689ae74..b5aca5f 100644
--- a/app/vmanager/routes.py
+++ b/app/vmanager/routes.py
@@ -55,6 +55,7 @@ def slavetables():
def vmcreate(orderid):
from flask_wtf import FlaskForm
from wtforms import validators, RadioField, SubmitField
+ from sqlalchemy.sql.expression import func, select
order = Order.query.filter_by(pid=int(orderid)).first()
if order == None:
@@ -69,6 +70,11 @@ def vmcreate(orderid):
#happyslave = '2' #warrior in our case
happyslave = '1'
+ rand_pub_addr = Address.query.filter_by(region_id=int(order.region_id)).filter_by(reserved=False).filter_by(pubvlan_id=None).order_by(func.random()).first()
+ if rand_pub_addr == None:
+ flash('No free addresses in the selected region')
+ return redirect(url_for('admin.list_addresses'))
+
class SlaveForm(FlaskForm):
slaveswitcher = RadioField('Select Slave Server', [validators.Required()], choices=serverchoices, default=happyslave)
submit = SubmitField('Create')
@@ -104,6 +110,10 @@ def vmcreate(orderid):
db.session.add(new_vlan)
db.session.commit()
+ rand_pub_addr.pubvlan_id = new_vlan.pid
+ rand_pub_addr.user_id = order.user_id
+ db.session.commit()
+
order.status = 'accepted'
db.session.commit()
flash('A new deployment is created successfully in region "{}".'.format(str(order.region.description)))
diff --git a/docs/apache-example.com-le-ssl.conf b/docs/apache-example.com-le-ssl.conf
index d8286f7..cfade65 100644
--- a/docs/apache-example.com-le-ssl.conf
+++ b/docs/apache-example.com-le-ssl.conf
@@ -9,25 +9,20 @@
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^ https://www.example.com%{REQUEST_URI} [R=301,L]
- WSGIDaemonProcess proxadmin user=proxadmin group=proxadmin threads=5 home=/home/proxadmin/appserver/proxadmin/
+ WSGIDaemonProcess panel user=proxadmin group=proxadmin threads=10 home=/home/proxadmin/appserver/proxadmin/
+ WSGIProcessGroup panel
+ WSGIApplicationGroup %{GLOBAL}
+ WSGIScriptReloading On
+
WSGIScriptAlias / /home/proxadmin/appserver/proxadmin/start.wsgi
-
-
- Require all granted
-
-
-
-
- WSGIProcessGroup proxadmin
- WSGIApplicationGroup %{GLOBAL}
- WSGIScriptReloading On
+
Require all granted
-
+
-
+
Require all granted
-
+
Alias /static /home/proxadmin/appserver/proxadmin/app/static