Compare commits

1 Commits
master ... 1.4

Author SHA1 Message Date
kaiyou
79529a4aac Add the dns tracking to the stable branch for the update to 1.5 2017-11-10 09:47:16 +01:00
2 changed files with 24 additions and 0 deletions

View File

@@ -1,6 +1,29 @@
from mailu import manager, db
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
def flushdb():

View File

@@ -1,4 +1,5 @@
#!/bin/sh
python manage.py advertise
python manage.py db upgrade
gunicorn -w 4 -b 0.0.0.0:80 --access-logfile - --error-logfile - --preload mailu:app