March 29, 2018
Installing Emacs 26
Installing Emacs 26
Hmm Emacs 26 seems faster
I have set up my own Micropub server, in order to be able to post from the Micro.blog apps to a Hugo site. It isn’t very difficult to do, but the challenge was to find a overview of how to do it.
Let’s begin with the backend endpoints. The minimum is a micropub end-point, a media end-point and a “configuration” end-point.
I have set up mine to look as follows:
domain/micropub (POST) — Micropub
domain/media (POST) — Media
domain/ (GET) - CONFIG
When you log in with the Micro.blog apps, it will ask the configuration end-point to figure out where to post images. In other words: you have to log in and out if you change it. Then it will first post the image to the media end points, that hands back a URL to the file you uploaded, and it uses that to post that to the micropub endpoint.
Write the end-points to follow the MicroPub specification
Hook up all the correct meta tags.
Hook up IndieAuth
I have made a implementation of the micropub server, and some information about how to look it up.
Men last night while browsing pencils.com: what the fuck is the deal with shoes?
Back to 1Password
Bookmark: GitHub - hjertnes/just_another_cms
I try to keep my office setup as limited as possible. Because I don’t want too much stuff that might keep me from feeling productive when I don’t have them available.
My office at home and office at work have a few things in common.
Apple Magic Keyboard
Apple Magic Keyboard
LG 27” 4K USB-C screen
One USB-C charger
One Lightning charger cable, connected to a outlet
One Micro USB cable, connected to a outlet
One Apple Watch cable, connected to a outlet
And that’s it. I just connect my MacBook Pro to the USB-C cable to charge and connect the screen. And I have all the charger cables I need.
When I started to use Hugo, I told myself that I had to implement some kind of way to use existing apps in order to make it enjoyable. I really enjoy the Micro.blog apps and I really enjoy MarsEdit. The result is micropub and oldpub. Both of them are written in Python and Flask; they are also ready to be used in a public facing server.
The micropub server is really simple. It supports a few different contexts and uses IndieAuth for authentication. The way it works is that when you upload a image it uploads it to the appropriate location on your file system, and the micropub endpoint takes the data and turns it into a text file that Hugo uses to generate your website. I went with Python and Flask for this because it is very minimal and easy to use.
Oldpub is a implementation of the Wordpress XML-RPC API. I have only implemented the parts of it that I care about. How I ended up with Flask here is a result of a lot of Googling. There are some Ruby implementations of the MediaWeblog API, but none of them are complete enough to work in a production system. And I found a some example code for a implantation using Flask and Python. That code was the starting point. The big difference between this implementation and a typical database driven one is that it has to read files and folder structures instead of da SQL database. This means that the code is a little bit more complicated and slower. But thats fine, since the only purpose of these API’s are to publish to a blog.
The next step how I host and update my sites. All of my stuff are hosted on a Linode server, using docker. I’m not going to get too deep into the configuration of it, but NGINX hosts the static files for my Hugo sites, and runs in front of all my server software. And the way I update my Hugo sites is that all the content are in GitHub repositories, and I have a script that pulls changes, adds changes and pushes them up to GitHub before I rebuild the site. It is just a simple shell script that runs in cron every X minutes.
I’m not going to continue to use them myself however, because I’m working on my own CMS. But the current implementation works perfectly fine and I have used it for over a month.
Faster load time or a full JSON / RSS feed?