kopia lustrzana https://github.com/piku/piku
commit
6b65e637ce
|
@ -20,6 +20,7 @@ You can configure deployment settings by placing special variables in an `ENV` f
|
||||||
|
|
||||||
* `BIND_ADDRESS`: IP address to which your app will bind (typically `127.0.0.1`)
|
* `BIND_ADDRESS`: IP address to which your app will bind (typically `127.0.0.1`)
|
||||||
* `PORT`: TCP port for your app to listen in (if deploying your own web listener).
|
* `PORT`: TCP port for your app to listen in (if deploying your own web listener).
|
||||||
|
* `DISABLE_IPV6` (boolean): if set to `true`, it will remove IPv6-specific items from the `nginx` config, which will accept only IPv4 connections
|
||||||
|
|
||||||
## uWSGI Settings
|
## uWSGI Settings
|
||||||
|
|
||||||
|
@ -45,4 +46,4 @@ You can configure deployment settings by placing special variables in an `ENV` f
|
||||||
|
|
||||||
## Acme Settings
|
## Acme Settings
|
||||||
|
|
||||||
* `ACME_ROOT_CA`: set the certificate authority that Acme should use to generate public ssl certificates (string, default: `letsencrypt.org`)
|
* `ACME_ROOT_CA`: set the certificate authority that Acme should use to generate public ssl certificates (string, default: `letsencrypt.org`)
|
||||||
|
|
21
piku.py
21
piku.py
|
@ -684,11 +684,15 @@ def spawn_app(app, deltas={}):
|
||||||
if 'PORT' not in env:
|
if 'PORT' not in env:
|
||||||
env['PORT'] = str(get_free_port())
|
env['PORT'] = str(get_free_port())
|
||||||
echo("-----> picking free port {PORT}".format(**env))
|
echo("-----> picking free port {PORT}".format(**env))
|
||||||
|
|
||||||
|
if env.get('DISABLE_IPV6', 'false').lower() == 'true':
|
||||||
|
safe_defaults.pop('NGINX_IPV6_ADDRESS', None)
|
||||||
|
echo("-----> nginx will NOT use IPv6".format(**locals()))
|
||||||
|
|
||||||
# Safe defaults for addressing
|
# Safe defaults for addressing
|
||||||
for k, v in safe_defaults.items():
|
for k, v in safe_defaults.items():
|
||||||
if k not in env:
|
if k not in env:
|
||||||
echo("-----> nginx {k:s} set to {v}".format(**locals()))
|
echo("-----> nginx {k:s} will be set to {v}".format(**locals()))
|
||||||
env[k] = v
|
env[k] = v
|
||||||
|
|
||||||
# Set up nginx if we have NGINX_SERVER_NAME set
|
# Set up nginx if we have NGINX_SERVER_NAME set
|
||||||
|
@ -764,8 +768,9 @@ def spawn_app(app, deltas={}):
|
||||||
if cf['success'] is True:
|
if cf['success'] is True:
|
||||||
for i in cf['result']['ipv4_cidrs']:
|
for i in cf['result']['ipv4_cidrs']:
|
||||||
acl.append("allow {};".format(i))
|
acl.append("allow {};".format(i))
|
||||||
for i in cf['result']['ipv6_cidrs']:
|
if env.get('DISABLE_IPV6', 'false').lower() == 'false':
|
||||||
acl.append("allow {};".format(i))
|
for i in cf['result']['ipv6_cidrs']:
|
||||||
|
acl.append("allow {};".format(i))
|
||||||
# allow access from controlling machine
|
# allow access from controlling machine
|
||||||
if 'SSH_CLIENT' in environ:
|
if 'SSH_CLIENT' in environ:
|
||||||
remote_ip = environ['SSH_CLIENT'].split()[0]
|
remote_ip = environ['SSH_CLIENT'].split()[0]
|
||||||
|
@ -813,6 +818,11 @@ def spawn_app(app, deltas={}):
|
||||||
echo("-----> nginx will redirect all requests to hostname(s) '{}' to HTTPS".format(env['NGINX_SERVER_NAME']))
|
echo("-----> nginx will redirect all requests to hostname(s) '{}' to HTTPS".format(env['NGINX_SERVER_NAME']))
|
||||||
else:
|
else:
|
||||||
buffer = expandvars(NGINX_TEMPLATE, env)
|
buffer = expandvars(NGINX_TEMPLATE, env)
|
||||||
|
|
||||||
|
# remove all references to IPv6 listeners (for enviroments where it's disabled)
|
||||||
|
if env.get('DISABLE_IPV6', 'false').lower() == 'true':
|
||||||
|
buffer = '\n'.join([line for line in buffer.split('\n') if 'NGINX_IPV6' not in line])
|
||||||
|
|
||||||
with open(nginx_conf, "w") as h:
|
with open(nginx_conf, "w") as h:
|
||||||
h.write(buffer)
|
h.write(buffer)
|
||||||
# prevent broken config from breaking other deploys
|
# prevent broken config from breaking other deploys
|
||||||
|
@ -1110,16 +1120,13 @@ def piku():
|
||||||
"""The smallest PaaS you've ever seen"""
|
"""The smallest PaaS you've ever seen"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
piku.rc = getattr(piku, "result_callback", None) or getattr(piku, "resultcallback", None)
|
||||||
piku.rc = getattr(piku, "resultcallback", None) or getattr(piku, "result_callback", None)
|
|
||||||
|
|
||||||
|
|
||||||
@piku.rc()
|
@piku.rc()
|
||||||
def cleanup(ctx):
|
def cleanup(ctx):
|
||||||
"""Callback from command execution -- add debugging to taste"""
|
"""Callback from command execution -- add debugging to taste"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
# --- User commands ---
|
# --- User commands ---
|
||||||
|
|
||||||
@piku.command("apps")
|
@piku.command("apps")
|
||||||
|
|
Ładowanie…
Reference in New Issue