Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
79529a4aac |
@@ -1,6 +1,29 @@
|
|||||||
from mailu import manager, db
|
from mailu import manager, db
|
||||||
from mailu.admin import models
|
from mailu.admin import models
|
||||||
|
|
||||||
|
import os
|
||||||
|
import socket
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
|
||||||
|
@manager.command
|
||||||
|
def advertise():
|
||||||
|
""" Advertise this server against statistic services.
|
||||||
|
"""
|
||||||
|
filepath = "/data/instance"
|
||||||
|
endpoint = "14.{}.stats.mailu.io"
|
||||||
|
if os.path.isfile(filepath):
|
||||||
|
with open(filepath, "r") as handle:
|
||||||
|
instance_id = handle.read()
|
||||||
|
else:
|
||||||
|
instance_id = str(uuid.uuid4())
|
||||||
|
with open(filepath, "w") as handle:
|
||||||
|
handle.write(instance_id)
|
||||||
|
try:
|
||||||
|
socket.gethostbyname(endpoint.format(instance_id))
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
@manager.command
|
@manager.command
|
||||||
def flushdb():
|
def flushdb():
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
python manage.py advertise
|
||||||
python manage.py db upgrade
|
python manage.py db upgrade
|
||||||
gunicorn -w 4 -b 0.0.0.0:80 --access-logfile - --error-logfile - --preload mailu:app
|
gunicorn -w 4 -b 0.0.0.0:80 --access-logfile - --error-logfile - --preload mailu:app
|
||||||
|
|||||||
Reference in New Issue
Block a user