refined autoremove support
This commit is contained in:
@@ -1,11 +1,34 @@
|
||||
import subprocess,json
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
config = json.load(open('data/config.json','rt'))
|
||||
config = json.load(open(os.environ['FLEES_CONFIG'],'rt'))
|
||||
|
||||
subprocess.call([
|
||||
'gunicorn',
|
||||
'-b','0.0.0.0:80',
|
||||
'--timeout',str(config['timeout']),
|
||||
'-w',str(config['workers']),
|
||||
'app:app'
|
||||
])
|
||||
TZ = "Etc/UTC"
|
||||
if 'timezone' in config:
|
||||
TZ = config['timezone']
|
||||
assert os.path.exists('/usr/share/zoneinfo/' + TZ), "Invalid timezone '%s'. See /usr/share/zoneinfo/*"%( TZ, )
|
||||
|
||||
with open('/etc/timezone', 'wt') as fp:
|
||||
fp.write(TZ)
|
||||
fp.close()
|
||||
if os.path.exists('/etc/localtime'):
|
||||
os.remove('/etc/localtime')
|
||||
os.symlink(
|
||||
'/usr/share/zoneinfo/' + TZ,
|
||||
'/etc/localtime'
|
||||
)
|
||||
|
||||
env = os.environ.copy()
|
||||
env['TZ'] = TZ
|
||||
|
||||
subprocess.call(
|
||||
[
|
||||
'gunicorn',
|
||||
'-b','0.0.0.0:80',
|
||||
'--timeout',str(config['timeout']),
|
||||
'-w',str(config['workers']),
|
||||
'app:app'
|
||||
],
|
||||
env = env
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user