Friday, January 22, 2016

Hugo single page index: _index.md

Hugo by default lists all posts or contents of pages with name _index.md on the mainpage.

When you have multiple _index.md files in various folders, it tries to list them all.

When you just want to display single _index.md on the content/_index.md root, use the following code on layouts/index.html.


          {{ range where .Site.Pages "RelPermalink" "/_index/" }}
                  {{.Content}}
          {{ end }}

Wednesday, January 6, 2016

Let's Encrypt SSL certificate for HAProxy

See https://letsencrypt.readthedocs.org/en/latest/using.html#letsencrypt-auto

    git clone https://github.com/letsencrypt/letsencrypt
    cd letsencrypt
    ./letsencrypt-auto --help

Make sure you allow access anywhere inbound and outbound.

    sudo /home/ubuntu/.local/share/letsencrypt/bin/letsencrypt certonly --standalone-supported-challenges http-01 -d mysite.com -d www.mysite.com

It will check if you own the domain. Make sure you have correct CNAME records for your domains.

Output:

    IMPORTANT NOTES:
     - Congratulations! Your certificate and chain have been saved at
       /etc/letsencrypt/live/mysite.com/fullchain.pem. Your cert
       will expire on 2016-XX-XX. To obtain a new version of the
       certificate in the future, simply run Let's Encrypt again.
     - If you like Let's Encrypt, please consider supporting our work by:

       Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
       Donating to EFF:                    https://eff.org/donate-le

Combine the pem files and copy them to /etc/haproxy:

    sudo cat /etc/letsencrypt/live/mysite.com/privkey.pem /etc/letsencrypt/live/mysite.com/fullchain.pem > certificate.pem
    sudo cp certificate.pem /etc/haproxy/certificate.pem