So I do a lot of self-hosting these days. I've always been keen on trying out new stuff that turns up but most of the services I just set up, keep for a couple of weeks and never use.
There are two exceptions which makes up most of my self-hosting "base": Huginn and Dokku. They are brilliant!
I'll start with dokku since it's what powers most of my apps today. Huginn for example I run through dokku.
A docker-powered PaaS that helps you build and manage the lifecycle of applications
It's your own Heroku. I've mostly been using it for
node applications but with all the options available chances are your app could be deployed this way.
Today I wanted to move an old rails app, the first I set up on my server, to dokku because.. well why not. This is what I had to do:
# On my server dokku apps:create kombo dokku config:set kombo SECRET_TOKEN=mysecrettoken SOME_OTHER_ENV=value # Postgres dokku postgres:create kombo-db dokku postgres:link kombo-db kombo # I had a dump of the old pg data dokku postgres:import kombo-db < mydata.dump # Redis dokku redis:create kombo-redis dokku redis:link kombo-redis kombo # Domain/https dokku domains:add kombo example.com dokku config:set --no-restart kombo DOKKU_LETSENCRYPT_EMAILfirstname.lastname@example.org dokku letsencrypt kombo # On my local machine git remote add dokku dokku@myserver:kombo git push dokku master
So far so good. Except my ruby version wasn't supported (I was on
2.1.0 so I think that's pretty fair...).
rbenv to the rescue. That came with its own set of problems but I won't go into that now.
I also had to update my
Procfile to look like this:
web: bundle exec puma -C config/puma.rb
Let's push again:
=====> Application deployed
Success! Now I have a
rails app with
postgres containers attached and a nice little Let's Encrypt certificate.
Note: The postgres, redis and Let's Encrypt plugins need to be installed separately.
Update: You can install
dokku on Digital Ocean with a one-click app. If you want to try it out you could use my referral link to get $10 for your server 😊
Huginn is a system for building agents that perform automated tasks for you online. They can read the web, watch for events, and take actions on your behalf. [..] Think of it as a hackable version of IFTTT or Zapier on your own server.
I've had Huginn installed for a pretty long time but to be honest I wasn't really sure what to use it for.
Earlier this year I created an app called Öppen Förskola that checks the web pages of "open preschools" in my hometown to get me the latest updates for hours, activities and such. Huginn scrapes the pages and posts the changes back to my app which are then published. This took me probably less than an hour to set up, the hardest part was to find the perfect CSS selector of each page to look for, since I wasn't interested in all the changes.
A few weeks ago me and my friends moved our chat from Slack to matrix.org. That's when I really started using Huginn. A few examples of scenarios I have today:
- Fetching news from at least 5 different RSS feeds, check their social share count, remove duplicates, format and post to Matrix
- In the evening, check the weather for tomorrow and notify if there is gonna be rain|snow|storm
- In the morning, check todays weather and post
- Both previous scenarios run for 2 different cities and based on my current location (blogpost on that coming up!)
- Notifications from my HTPC
- Alarms from Grafana, sentry.io and updown.io for my server and apps
I'll be writing more detailed posts on how to set up these things and any other fun stuff I might come up with!