New service example
xor2003 opened this issue · 0 comments
I think to popularise the ygg it should be easy instructions to
- Install and configure. User don't need to enter starting peers and DNS by hand (it should be predefined IPs supplied) At least for quick start
- Create user own web server.
See instruction example below:
How to launch a site on the Yggdrasil network
In general, launching a site on the Yggdrasil network is no more difficult than on any other network (eg the Internet).
Recommendations for choosing a web server software, as well as for configuring it, can be easily found on the Internet, and in the case of Yggdrasil there is nothing on which it would make sense to focus attention here.
Below is an example of the simplest nginx web server configuration file for a simple static site.
server {
listen [200:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx]:80; # address and port on which the site will be available
root /var/www/html; # path to the root directory of the site
index index.html; # the name of the file that will be issued by the server when accessing the directory
}
The same for Apache:
<VirtualHost [200:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx]:80> # Address and port on which the site will be available
DocumentRoot /var/www/html # Path to the site root directory.
# Default home page index.html
</VirtualHost>
If the autorun of the systemd webserver unit is used, then a race condition is possible, due to which the webserver will try to start before Yggdrasil, and as a result will not be able to bind to the internal address port.
The solution in this case is to manually assign a dependency on the Yggdrasil unit to the webserver unit along with a slight start delay.
An example of a modified unit for nginx, applied via systemctl edit nginx.service:
[Unit]
Wants=yggdrasil.service
After=yggdrasil.service
[Service]
ExecStartPre=
ExecStartPre=/bin/sleep 5
ExecStartPre=/usr/sbin/nginx -t -q -g 'daemon on; master_process on;'
Here, the last ExecStartPre is the initial value from the main unit, which probably varies between distributions, and which can be obtained with systemctl cat nginx.service.
Register a domain name for your site on the Yggdrasil network.
How do I add my domain to these servers? Easy! Just add the required DNS records to the Nodeinfo zone in the Yggdrasil config file as follows:
Single domain:
NodeInfo: {
dns: {
domains: [
{
domain: example.ygg
ip: 200:1111:2222:3333:4444:5555:6666:7777
}
]
}
}