Commit 9aa9bad1 by Bach Dániel

first commit

parents
*.pyc
*.swp
.ropeproject
from os import getenv
import subprocess
from kombu import Queue, Exchange
from socket import gethostname
from celery import Celery
HOSTNAME = gethostname()
AMQP_URI = getenv('AMQP_URI')
celery = Celery('dnsdriver', backend='amqp', broker=AMQP_URI)
celery.conf.update(
CELERY_TASK_RESULT_EXPIRES=300,
CELERY_QUEUES=(
Queue(HOSTNAME + '.dns', Exchange(
'dnsdriver', type='direct'), routing_key='dnsdriver'),
)
)
@celery.task(name='firewall.reload_dns')
def t(data):
with open('/etc/sv/tinydns/root/data', 'w') as f:
f.write('\n'.join(data))
process = subprocess.Popen(['make', '-C', '/etc/sv/tinydns/root'],
shell=False, stdin=subprocess.PIPE)
process.communicate('\n'.join(data) + '\n')
apt-get install install djbdns daemontools-run make
initctl start svscan
adduser --system --no-create-home --disabled-login --group tinydns
adduser --system --no-create-home --disabled-login --group dnslog
mkdir -p /etc/sv
tinydns-conf tinydns dnslog /etc/sv/tinydns <server-ip>
cd /etc/sv/tinydns/root
make
update-service --add /etc/sv/tinydns
chown -R cloud:cloud /etc/sv/tinydns/root
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment