<div dir="ltr">Thank you :)</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 10, 2018 at 11:53 AM, Seb via Digitalmars-d <span dir="ltr"><<a href="mailto:digitalmars-d@puremagic.com" target="_blank">digitalmars-d@puremagic.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Wednesday, 10 January 2018 at 10:36:57 UTC, Daniel Kozak wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I am able to provide my VPS for mirroring too. Is there a tutorial how to do it?<br>
</blockquote>
<br></span>
The dub-registry binary can be started with `--mirror=<a href="https://code.dlang.org" rel="noreferrer" target="_blank">https://code.dlang.o<wbr>rg</a>`<br>
Martin even an Ansible script for <a href="http://dub-mirror.dlang.io" rel="noreferrer" target="_blank">dub-mirror.dlang.io</a>:<br>
<br>
<a href="https://github.com/dlang/ci/blob/master/ansible/roles/dub_registry_mirror/tasks/main.yml" rel="noreferrer" target="_blank">https://github.com/dlang/ci/bl<wbr>ob/master/ansible/roles/dub_re<wbr>gistry_mirror/tasks/main.yml</a><br>
<br>
It boils down to these tasks:<br>
<br>
1) git clone <a href="https://github.com/dlang/dub-registry" rel="noreferrer" target="_blank">https://github.com/dlang/dub-r<wbr>egistry</a><br>
2) dub #  <- maybe -b release<br>
3) Install mongo and start<br>
<br>
sudo apt-get install mongodb && sudo systemctl enable mongodb && sudo systemctl start mongodb<br>
<br>
4) Configure a systemd service<br>
<br>
Here's my systemd service:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
/etc/systemd/system/dub-regist<wbr>ry.service<br>
</blockquote>
<br>
-----<br>
[Unit]<br>
Description=DUB registry<br>
OnFailure=unit-status-mail@%n.<wbr>service<br>
<br>
[Service]<br>
Environment="PORT=9001"<br>
ExecStart=/opt/projects/dub-re<wbr>gistry/dub-registry --port 8005 --mirror=<a href="https://code.dlang.org" rel="noreferrer" target="_blank">https://code.dlang.or<wbr>g</a> --hostname=<a href="http://code-mirror2.dlang.org" rel="noreferrer" target="_blank">code-mirror2.dlang.<wbr>org</a> --vv<br>
WorkingDirectory=/opt/projects<wbr>/dub-registry<br>
Restart=always<br>
RestartSec=30<br>
User=dub-registry<br>
<br>
[Install]<br>
WantedBy=multi-user.target<br>
------<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
[Unit]<br>
</blockquote>
Description=Unit Status Mailer Service<br>
After=network.target<br>
<br>
[Service]<br>
Type=simple<br>
ExecStart=/opt/bin/unit-status<wbr>-mail.sh "%I" "Hostname: %H" "Machine ID: %m" "Boot ID: %b"<br>
----<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
/opt/bin/unit-status-mail.sh<br>
</blockquote>
<br>
----<br>
#!/bin/bash<br>
MAILTO="root"<br>
MAILFROM="unit-status-mailer"<br>
UNIT=$1<br>
<br>
EXTRA=""<br>
for e in "${@:2}"; do<br>
  EXTRA+="$e"$'\n'<br>
done<br>
<br>
UNITSTATUS=$(systemctl status $UNIT)<br>
UNITLOG=$(journalctl -u $UNIT -r | head -n 100)<br>
<br>
sendmail $MAILTO <<EOF<br>
From:$MAILFROM<br>
To:$MAILTO<br>
Subject:Status of: $UNIT<br>
<br>
Status report for unit: $UNIT<br>
$EXTRA<br>
<br>
$UNITSTATUS<br>
<br>
$UNITLOG<br>
EOF<br>
<br>
echo -e "Status mail sent to: $MAILTO for unit: $UNIT"<br>
---<br>
<br>
5) Configure Nginx<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
/etc/nginx/sites-available/dub<wbr>-mirror<br>
</blockquote>
---<br>
<br>
server {<br>
        listen 80;<br>
        listen [::]:80;<br>
        server_name <a href="http://code-mirror2.dlang.io" rel="noreferrer" target="_blank">code-mirror2.dlang.io</a>;<br>
<br>
        location / {<br>
                proxy_pass <a href="http://localhost:8005" rel="noreferrer" target="_blank">http://localhost:8005</a>;<br>
        }<br>
}<br>
---<br>
<br>
6) Configure Letsencrypt for SSL (optional)<br>
7) Add yourself to this list:<br>
<br>
<a href="https://github.com/dlang/dub/blob/master/source/dub/dub.d#L64" rel="noreferrer" target="_blank">https://github.com/dlang/dub/b<wbr>lob/master/source/dub/dub.d#L6<wbr>4</a><br>
<br>
Note that with a few tweaks it's possible to run the dub-registry on Heroku:<br>
<br>
<a href="https://github.com/dlang/dub-registry/pull/231" rel="noreferrer" target="_blank">https://github.com/dlang/dub-r<wbr>egistry/pull/231</a><br>
</blockquote></div><br></div>