2013-06-14 17:17:04 +02:00
|
|
|
YunoHost DynDNS Server
|
2013-08-07 12:40:49 +02:00
|
|
|
======================
|
|
|
|
|
|
|
|
|
|
|
|
**Note: Tested on Debian wheezy (should work on Ubuntu)**
|
|
|
|
|
|
|
|
```
|
|
|
|
git clone https://github.com/YunoHost/dynette
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
Web subscribe server deployment
|
|
|
|
-------------------------------
|
2016-11-28 20:05:06 +01:00
|
|
|
|
|
|
|
Install required stuff
|
2013-08-07 12:40:49 +02:00
|
|
|
```
|
2016-11-28 20:05:06 +01:00
|
|
|
$ apt-get install postgresql postgresql-server-dev-9.4 ruby thin libpq-dev bundler apache2 bind9 python
|
2013-08-07 12:40:49 +02:00
|
|
|
```
|
|
|
|
|
2016-11-28 20:05:06 +01:00
|
|
|
Prepare user dynette
|
|
|
|
```
|
|
|
|
$ useradd dynette
|
|
|
|
$ passwd dynette
|
|
|
|
$ mkdir /home/dynette
|
|
|
|
$ chown -R dynette:dynette /home/dynette
|
2013-08-07 12:40:49 +02:00
|
|
|
```
|
2016-11-28 20:05:06 +01:00
|
|
|
|
|
|
|
Prepare PostgreSQL database
|
|
|
|
```
|
|
|
|
$ su - postgres
|
|
|
|
$ psql template1
|
|
|
|
template1=# CREATE USER dynette WITH PASSWORD 'verySecurePassword';
|
|
|
|
template1=# CREATE DATABASE dynette;
|
|
|
|
template1=# GRANT ALL PRIVILEGES ON DATABASE dynette to dynette;
|
|
|
|
template1=# \q
|
2013-08-07 12:40:49 +02:00
|
|
|
```
|
|
|
|
|
2016-11-28 20:05:06 +01:00
|
|
|
Install dynette
|
2013-08-07 12:40:49 +02:00
|
|
|
```
|
2016-11-28 20:05:06 +01:00
|
|
|
$ cd /home/dynette
|
|
|
|
$ git clone https://github.com/YunoHost/dynette
|
|
|
|
$ cd dynette
|
|
|
|
$ bundle install
|
2013-08-07 12:40:49 +02:00
|
|
|
```
|
|
|
|
|
2016-11-28 20:05:06 +01:00
|
|
|
Edit dynette.rb, change PostgreSQL password and domains handled, line 11-12:
|
|
|
|
```
|
|
|
|
DataMapper.setup(:default, ENV['DATABASE_URL'] || "postgres://dynette:myPassword@localhost/dynette")
|
|
|
|
DOMAINS = ["nohost.me", "noho.st"]
|
|
|
|
```
|
|
|
|
|
|
|
|
Configure and launch thin
|
|
|
|
```
|
|
|
|
thin config -C /etc/thin2.1/dynette.yml -c /home/dynette/dynette/ --servers 3 -p 5000 -e production
|
|
|
|
service thin restart
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
Apache configuration
|
|
|
|
--------------------
|
|
|
|
|
2013-08-07 12:40:49 +02:00
|
|
|
```
|
|
|
|
vim /etc/apache2/sites-available/dynette
|
|
|
|
```
|
|
|
|
|
|
|
|
Paste & change server name in below configuration:
|
|
|
|
```
|
|
|
|
<VirtualHost *:80>
|
|
|
|
ServerName dyndns.yunohost.org
|
|
|
|
|
|
|
|
RewriteEngine On
|
|
|
|
|
|
|
|
<Proxy balancer://thinservers>
|
|
|
|
BalancerMember http://127.0.0.1:5000
|
|
|
|
BalancerMember http://127.0.0.1:5001
|
|
|
|
BalancerMember http://127.0.0.1:5002
|
|
|
|
</Proxy>
|
|
|
|
|
|
|
|
# Redirect all non-static requests to thin
|
|
|
|
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
|
|
|
|
RewriteRule ^/(.*)$ balancer://thinservers%{REQUEST_URI} [P,QSA,L]
|
|
|
|
|
|
|
|
ProxyPass / balancer://thinservers/
|
|
|
|
ProxyPassReverse / balancer://thinservers/
|
|
|
|
ProxyPreserveHost on
|
|
|
|
|
|
|
|
<Proxy *>
|
|
|
|
Order deny,allow
|
|
|
|
Allow from all
|
|
|
|
</Proxy>
|
|
|
|
|
|
|
|
# Custom log file locations
|
|
|
|
ErrorLog /var/log/apache2/dynette-error.log
|
|
|
|
CustomLog /var/log/apache2/dynette-access.log combined
|
|
|
|
|
|
|
|
</VirtualHost>
|
|
|
|
```
|
|
|
|
|
|
|
|
Enable apache2 sites & modules:
|
|
|
|
```
|
|
|
|
a2enmod proxy
|
|
|
|
a2enmod rewrite
|
|
|
|
a2ensite dynette
|
|
|
|
service apache2 restart
|
|
|
|
```
|
|
|
|
|
|
|
|
|
2016-11-28 20:05:06 +01:00
|
|
|
Cron job configuration
|
|
|
|
----------------------
|
2013-08-07 12:40:49 +02:00
|
|
|
|
|
|
|
Edit dynette.cron.py and change settings:
|
|
|
|
```
|
2016-11-28 20:05:06 +01:00
|
|
|
# If you want to simply do test in local, use "http://127.0.0.1:5000/"
|
2016-04-26 12:38:35 +02:00
|
|
|
subs_urls = ['https://dyndns.yunohost.org']
|
|
|
|
ns0 = 'ns0.yunohost.org'
|
|
|
|
ns1 = 'ns1.yunohost.org'
|
|
|
|
```
|
|
|
|
|
|
|
|
Create and edit master.key file is Dynette directory
|
|
|
|
```
|
|
|
|
echo "MyMasterKey" > master.key
|
2013-08-07 12:40:49 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
Create dynette log file
|
|
|
|
```
|
|
|
|
touch /var/log/dynette.log
|
|
|
|
```
|
|
|
|
|
|
|
|
Enable cronjob for dynette (crontab -e)
|
|
|
|
```
|
|
|
|
* * * * * /path/to/dynette/dynette.cron.py >> /var/log/dynette.log 2>&1
|
|
|
|
```
|
2016-11-28 20:05:06 +01:00
|
|
|
Test it's working
|
|
|
|
-----------------
|
2013-08-07 12:40:49 +02:00
|
|
|
|
2016-11-28 20:05:06 +01:00
|
|
|
`wget -q -O - http://127.0.0.1:5000/test/someDomain.nohost.me`
|
2013-08-07 12:40:49 +02:00
|
|
|
|
|
|
|
Troobleshooting
|
|
|
|
---------------
|
|
|
|
|
2016-04-26 12:38:35 +02:00
|
|
|
If you run into troubles running the DNS server, try to check permissions on
|
|
|
|
`/var/lib/bind` and check if bind listens on 0.0.0.0 in
|
|
|
|
`/etc/bind/bind.conf.options`.
|