Danger Computer

The danger computer

Articles tagged: indieweb

Artifice

posted by: Gar
filed under: code meta indieweb

One of the places it's very very easy to own your own data is in the realm of pastebin. Even though the data you share via these services is public, you still are throwing it onto someone else's silo to host. You don't control how long they'll keep it.

Thankfully there is a super easy pastebin server called hastebin. It is dokku-ready (I forked, pushed, and had it instantly working). In my opinion though, it was not exactly what I wanted out of the box. For one, there was an outstanding pull request to add os-x hotkeys that I would have like to seen merged in. The other piece missing is any sort of authentication. It's one thing to provide pastebin services for yourself, it's another thing to just have an open pastebin service running where anyone can dump unlimited data onto your server.

What I ended up doing was forking hastebin, merging the os-x hotkey pull request, and writing a simple auth plugin schema. With the auth schema I added you can decide if you want to lock down reads or writes. I chose to lock down writes only, so that you would need a valid login to post new content, but any content posted could be read by anyone w/ the link. Perfect for my setup, only I can add content, but I can share it with anyone, and the data is still mine.

If you want to check out my fork you can find it here, and you can see an example of one of my pastebins here.

How I set this site up

posted by: Gar
filed under: code meta indieweb

Update: Sept 2014

The experiment is over, and this dokku setup was too fragile to succeed. Links have been updated where possible to point to the code that remains (I'm still using bumble).

Original article

I've had a few people ask me to document how I set this site up so that they can spin up their own little slice of the internet. Here goes.

Write something

You'll need content first. Check out bumble and fireball for a dead-simple place to start. You'll want to keep your content in a git repo, it doesn't have to be on github but it's nice for a backup.

Get a server

Doi. Duh. You're gonna need a server out there on the internet to host your site at. I went with Digital Ocean because they came highly recommended to me by some coworkers, and they had a vm that had Dokku (and by extension Docker) on it by default.

So, go to Digital Ocean, and spin up a new droplet. I went with the smallest one due to the low traffic I expect here but choose what you think you'll need (For instance if you plan on running gitlab definitely go for at least 1GB of memory). One of the options is Select Image and this is where you click the Applications tab and choose the one that says Dokku

Make sure you add an ssh key for this (if you don't know how to make an ssh key I plan on covering that in another post).

Congratulations you now run a server on the Internet! Your droplet should have an IP, point your domain at it.

About Dokku

If you've ever used Heroku you already know how to use Dokku (mostly). It says it is a "Docker powered mini-Heroku" right in the readme, and it is! One requirement is that your site will needs to be in a git repo. One of the less well documented things in dokku is how to push to the main domain in a site instead of a subdomain. In the instructions it shows you how to add a remote to dokku@progriumapp.com:node-js-app which would respond to node-js-app.progriumapp.com. If you want your site to be at your root domain (i.e. no node-js-app) simply set the remote as dokku@yourdomain.com:yourdomain.com. If dokku sees a . in the remote path it treats it as a full domain rather than a subdomain. It may also help to set your remote to something easy to remember like blog. In my case I named my remote danger which means that to redeploy my site I simply have to type. Don't forget the Procfile!

$ git push danger master

Install dokku-apt

One of the requirements of fireball is a library called graphicsmagick. This is not on your droplet by default so you'll need a way to tell dokku to install it for your site. dokku-apt Is how you do that. Follow the instructions to install dokku-apt on your new droplet, then add an apt-packages file to the root of your site's folder with the word graphicsmagick in it.

Post post post

If you set things up right, you should be able to post

Example

If you want to check out a working example, you can check out the github repo for this very site here.

Extra credit

Technically there is no reason you should have to rebuild your dokku instance every time you push a new blog post. If you want you could try learning a few docker commands to point your dokku instance at a shared folder with your posts. Then you would simply need to update that folder w/ your new posts (maybe they're in a separate repo? maybe you scp them up?) and bumble/fireball's file watchers would automagically see them and add them to your site.

Follow up

Are you using bumble? Did this help? Did you get stuck cause I left some super crucial step out? Mash your keyboard and shout at @wraithgar.

Thanks

A huge hanks to bear for his help this weekend ironing out the kinks in this whole setup when I got stuck. And boy did I get stuck.

Also a big thanks to eric and philip for actually trying to follow the instructions in this post out. If it looks completely different now than the first time you read it, it's thanks to those two finding all the things I omitted.

Introducing Fireball

posted by: Gar

When I decided to start writing again I knew I wanted to use bumble for hosting my posts. Bumble is great, it's one of those projects that is genius in its simplicity. It was started from one thought: I should just be able to have my posts in a folder in a sane format and the app should just do the rest. For a personal site like this that's all you really need. No fancy admin interface, just put the files where the app can get them and go. It runs locally very easily too, just edit, refresh, edit, and repeat until you're happy with the post.

I was greatly inspired by the talk Amber Case gave last year at Realtime Conf. You can watch it here and I highly recommend it. So, when it came time to break out the old keyboard and get this site going I knew I would ultimately want to host my own images as well as posts. Unfortunately the landscape seems pretty barren right now as far as hosting images goes.

Since my requirements were so little, it made sense to write a plugin that worked exactly like bumble, except for hosting images. That is, you point your code at a folder and they'd be hosted for you, at predictable urls for both the original and for thumbnailed versions of the file.

With those very simple, very specific requirements in mind, I sat down this weekend and wrote fireball. It's still a little rough around the edges, but it works well enough to use already. If you're using bumble, why not give it a try?* Lemme know what you think.


* And if you're not using bumble, why not give that a try?