PROJET AUTOBLOG


Chromic

Site original : Chromic

⇐ retour index

Git, Gogs, Jekyll and Auto-deployment

mercredi 13 mai 2015 à 02:00

Since yesterday, this blog deploys automatically when I push changes to its git repository. Before that, my workflow was something like:

  1. ssh into the server
  2. write something
  3. git add, git commit, git push (or forget about this step altogether)
  4. bundle exec jekyll build

Now, I do:

  1. Write something (from any machine where I have a copy of my blog's git repository)
  2. git add, git commit, git push

The best part for me is that I should now have a proper git history of my blog's modifications instead of a few giant commits spaced far apart in time due to skipping step 3 by mistake or laziness.

This isn't unique, has been done before, and a few automated deployment techniques are documented on the Jekyll site, but I wanted to jot down my configuration for a few reasons:

The Environment

This blog is hosted on a VPS (Linode) that runs a few other products, notably Gogs which I use to "self-host" my git projects.

One of those git projects is the source files for the blog.

Gogs lets you edit git hooks via its web interface under the git repository's "Settings > Git Hooks" section. The one we're interested in is "post-receive", which runs on the server-side after git is done receiving the changes you pushed to it via "git push" from the client-side.

Since both Gogs and the Jekyll blog are on the same server, the only thing I have to do is tell git to run the "jekyll build" command (along with some house-keeping details) after it got the new data:

#!/usr/bin/bash

mkdir -p /tmp/gogs-bundle               # Create directory where bundle will install required tools to build
export BUNDLE_BIN_PATH=/tmp/gogs-bundle # Set env. var used by bundle so it knows where to install stuff

cd /srv/http/chromic.org/public_html    # Change to the directory where the blog's source files are
unset GIT_DIR                           # Have git use $PWD instead of $GIT_DIR
git pull                                # Get latest changes

bundle install                          # Make sure we have all the required gems, etc. installed
bundle exec jekyll build                # Deploy!

And that's pretty much it. Make sure the user running your Gogs instance has access to the blog's files/directories and you should be good to go.

My Android Stack

dimanche 11 mai 2014 à 06:00

I have a Samsung Galaxy S5 currently running LineageOS (without Google Apps).

Apps

AndStatus
Social networking client. I use it with my GNU social instance.
AntennaPod
Podcast Player
Barcode Scanner
Barcode Scanner
Conversations
Jabber (XMPP) client.
To connect to my Prosody server.
DAVdroid
Contacts (CardDAV) and Calendar (CalDAV) sync.
I have it sync with my Nextcloud instance.
Document Viewer
Viewer for many document formats
F-Droid
Catalogue of FOSS applications for the Android platform
FreeOTP
Two-factor authenticator
HN
Hacker News client
IceCat
Browser (Gecko-based).
ICSdroid
Synchronize remote ICS calendars to the native Android calendar app
IR-Remote
Infra-red remote controller for my Tv and soundbar.
K-9 Mail
Email client
Supports PGP via APG or OpenKeychain.
KDE Connect
KDE Integration.
Kore
Remote control for Kodi — Open Source Home Theatre
I run Kodi on my Raspberry Pi.
NewPipe
Lightweight YouTube frontend. I like the fact that you can send videos to Kodi through Kore
OpenKeychain
Manage OpenPGP keys
Integrates with K-9 Mail
OpenTasks
TODO list.
It syncs to the ownCloud Tasks webapp via DAVDroid
OpenVPN for Android
Client to connect to my VPN server.
OsmAnd
Offline/online maps and navigation with OpenStreetMap
Nextcloud
View and upload files from/to my Nextcloud instance
Practice Hub
Tools for musicians, including a chromatic tuner, a metronome, and a pitch drone.
I mostly use it to help me tune my guitar.
RedReader
Reddit client
Revolution IRC
IRC client.
I use it with ZNC.
SatStat
GPS, sensor and network status
Simple Last.fm Scrobbler
A music scrobbler. Modified to submit to my GNU FM instance.
Transportr
Public Transport Companion.
Termux
Terminal and SSH client.
wallabag
Wallabag client.
Syncs with my wallabag instance.
Wi-Fi Privacy Police
Prevents your smartphone or tablet from leaking privacy sensitive information via Wi-Fi networks.
μlogger
Location tracker.
I use it with my instance of the μlogger server.

My Android Stack

dimanche 11 mai 2014 à 02:00

I have a Samsung Galaxy S5 currently running LineageOS (without Google Apps).

Apps

AndStatus
Social networking client. I use it with my GNU social instance.
AntennaPod
Podcast Player
Barcode Scanner
Barcode Scanner
Conversations
Jabber (XMPP) client.
To connect to my Prosody server.
DAVdroid
Contacts (CardDAV) and Calendar (CalDAV) sync.
I have it sync with my Nextcloud instance.
Document Viewer
Viewer for many document formats
F-Droid
Catalogue of FOSS applications for the Android platform
FreeOTP
Two-factor authenticator
HN
Hacker News client
IceCat
Browser (Gecko-based).
ICSdroid
Synchronize remote ICS calendars to the native Android calendar app
IR-Remote
Infra-red remote controller for my Tv and soundbar.
K-9 Mail
Email client
Supports PGP via APG or OpenKeychain.
KDE Connect
KDE Integration.
Kore
Remote control for Kodi — Open Source Home Theatre
I run Kodi on my Raspberry Pi.
NewPipe
Lightweight YouTube frontend. I like the fact that you can send videos to Kodi through Kore
OpenKeychain
Manage OpenPGP keys
Integrates with K-9 Mail
OpenTasks
TODO list.
It syncs to the ownCloud Tasks webapp via DAVDroid
OpenVPN for Android
Client to connect to my VPN server.
OsmAnd
Offline/online maps and navigation with OpenStreetMap
Nextcloud
View and upload files from/to my Nextcloud instance
Practice Hub
Tools for musicians, including a chromatic tuner, a metronome, and a pitch drone.
I mostly use it to help me tune my guitar.
RedReader
Reddit client
Revolution IRC
IRC client.
I use it with ZNC.
SatStat
GPS, sensor and network status
Simple Last.fm Scrobbler
A music scrobbler. Modified to submit to my GNU FM instance.
Transportr
Public Transport Companion.
Termux
Terminal and SSH client.
wallabag
Wallabag client.
Syncs with my wallabag instance.
Wi-Fi Privacy Police
Prevents your smartphone or tablet from leaking privacy sensitive information via Wi-Fi networks.
μlogger
Location tracker.
I use it with my instance of the μlogger server.

My Android Stack

dimanche 11 mai 2014 à 02:00

I have a Samsung Galaxy S5 currently running LineageOS (without Google Apps).

Apps

AndStatus
Social networking client. I use it with my GNU social instance.
AntennaPod
Podcast Player
Barcode Scanner
Barcode Scanner
Conversations
Jabber (XMPP) client.
To connect to my Prosody server.
DAVdroid
Contacts (CardDAV) and Calendar (CalDAV) sync.
I have it sync with my Nextcloud instance.
Document Viewer
Viewer for many document formats
F-Droid
Catalogue of FOSS applications for the Android platform
FreeOTP
Two-factor authenticator
HN
Hacker News client
IceCat
Browser (Gecko-based).
ICSdroid
Synchronize remote ICS calendars to the native Android calendar app
IR-Remote
Infra-red remote controller for my Tv and soundbar.
K-9 Mail
Email client
Supports PGP via APG or OpenKeychain.
KDE Connect
KDE Integration.
Kore
Remote control for Kodi — Open Source Home Theatre
I run Kodi on my Raspberry Pi.
NewPipe
Lightweight YouTube frontend. I like the fact that you can send videos to Kodi through Kore
OpenKeychain
Manage OpenPGP keys
Integrates with K-9 Mail
OpenTasks
TODO list.
It syncs to the ownCloud Tasks webapp via DAVDroid
OpenVPN for Android
Client to connect to my VPN server.
OsmAnd
Offline/online maps and navigation with OpenStreetMap
Nextcloud
View and upload files from/to my Nextcloud instance
Practice Hub
Tools for musicians, including a chromatic tuner, a metronome, and a pitch drone.
I mostly use it to help me tune my guitar.
RedReader
Reddit client
Revolution IRC
IRC client.
I use it with ZNC.
SatStat
GPS, sensor and network status
Simple Last.fm Scrobbler
A music scrobbler. Modified to submit to my GNU FM instance.
Transportr
Public Transport Companion.
Termux
Terminal and SSH client.
wallabag
Wallabag client.
Syncs with my wallabag instance.
Wi-Fi Privacy Police
Prevents your smartphone or tablet from leaking privacy sensitive information via Wi-Fi networks.
μlogger
Location tracker.
I use it with my instance of the μlogger server.

The Web and I

lundi 16 décembre 2013 à 06:00

And so it Begins

I've always been fascinated by electronics and computers.

I remember spending countless hours messing around with one of those "Electronic Project Kits" similar to the one pictured above.

I followed every instruction in the book, went off-course and tried new things.

HTML

Sometime around 1996 (at approximately 11 years old), my school organized a few different summer camps. One of them was computer related and, of course, piqued my interest.

During the summer, we worked on a few different projects. The one I remember best was creating websites, and if I recall correctly, this was my first introduction to HTML.

My website definitely looked like the classic Geocities site with <blink> and <marquee> tags, tacky .gifs, non-semantic <font> and tiled background patterns, and I was damn proud of it!

Once the camp was over, I went back home, built websites with Notepad and saved them on my C:\ drive since we didn't have home Internet at the time. I didn't have an audience — and probably still don't ;) — learned by trial and error, but I was learning and had fun doing it.

Online!

Once we got the Inter-tubes connected to our house, I started signing up for those "free hosting" sites that would give you a free subdomain.

More often than not, they would either announce that they're shutting down or going "paid only" after a while, forcing me to hop from host to host.

Some of them would display banner ads on your site, which I took as a challenge to come up with some "clever CSS" to hide them — unknowingly, but undoubtedly against their ToS.

One of the more vivid memories I have is how excited I was when I discovered Server-Side Includes (SHTML / SSI). I was browsing HTML Source; one of the first websites I remember using as a reference. Every time I go back on that site I get a big hit of nostalgia :)

Third-party Services

LiveJournal, Blogger, Wordpress(.com), Xanga, Flickr, you-name-it… I signed-up for all of them.

I did so mostly out of curiosity to see how they worked and keep up with the new things appearing on the web.

Most of those allowed you to create custom themes with your own CSS stylesheets and sometimes even include your own JavaScript!

Open Source

This isn't directly related to the web, but it plays an important role in what follows.

While I was in university, I was introduced to Linux and the whole concept of Free, Libre Open Source software (FLOSS).

I really liked the idea and soon thereafter all my machines were running some sort of Linux distro.

My experiments with Linux could be a little story on its own, and I might just write about it someday.

Legit Hosting

In 2009, I was 2 years out of university, had a job and a bit of money to invest into a host that was a bit more reliable than those free ones.

After thinking way too much about a domain name, I settled on "chromic" mostly because my online nickname, Chimo, is part of it (genius, I know, right?).

Since this was my first shot at paying for hosting, I looked for something inexpensive and chose Dreamhost Shared Hosting.

One of the first things I did was to setup a Wordpress instance on there to move off Wordpress.com, "customize ALL the things!" and dive into the source code.

Identicaaaargh!

Because of my obsession with Linux, I started listening to the Linux Outlaws podcast.

After hearing them talk about this "identi.ca" thing a couple of times, I decided to check it out. My limited understanding was that it was an open source version of Twitter. It sounded fun & intriguing and was eager to look through the source code as a learning exercise.

This is when I became aware of the "federated social network" concept which, coupled with (FL)OSS, I thought sounded like an awesome idea.

It's one of the reasons why I got interested in Identi.ca and StatusNet.

Another reason was because the !fediverse community seemed like it matched my interests a lot closer than Twitter's or other social networks. Or at least those people were a lot easier to find, and usually more "approachable" in a sense. Conversations also seemed more interesting and "deeper", people more engaged.

Part of it is probably because Identi.ca's user-base was smaller compared to the bigger networks. Maybe the culture actually is different as well. I don't know. Either way, the !fediverse is where I felt the most "at home".

(Un)fortunately, identi.ca sometimes had problems with its uptime and general reliability, and after a while it started to happen too often for my taste.

This led me to look into hosting my own StatusNet instance, and I believe that while it might have been a minor annoyance at the time, it really was a good thing in the end.

I got lucky and StatusNet was one of Dreamhost's "one-click install" products. So I clicked. And it installed. And it was slow. And Realtime wasn't reliable (or not there at all, I can't quite remember now), but it was mine.

Graduating to a VPS

In 2011, I felt like being on a Shared Host was too limiting (I really wanted Realtime running on my SN instance, too!).

After a bit of research, I found that Linode had good reviews and within my budget, so I dove right in and got a shiny VPS.

Oh, the freedom! Suddenly I could do anything I wanted! Want to tinker with your Apache configurations and bring everything down? You can! And I did! Multiple times!

Want to run a persistent process and eat all of your RAM? Yep! Been there, done that!

Want to deal with MySQL logs and fine-tuning? No? Well you still have to!

Of course, these are all things I ultimately enjoy doing and really like learning from so I don't mind.

As you can imagine, I then went ahead and setup a StatusNet instance, this time taking care of all the fun things related to web servers, databases, etc.

Administering a VPS — even a small, personal one — is something I highly recommend to anyone interested in learning sysadmin-type material. The amount of things I learned while tinkering with mine is astounding.

Today

I work full-time with HTML, SASS/CSS, jQuery/JavaScript, WAI-ARIA and WCAG.

I tinker with a bunch of other languages.

I'm a big fan of owning your data (to a certain degree, I suppose; I don't own the hardware I'm hosted on… yet).

I'm continually working on my Project Autonomous which serves as both a way to own my data and also as a learning tool.

I'm still messing around with code and tech.

I'm still fascinated by electronics and computers (I <3 my RaspberryPi), still a (FL)OSS advocate, Linux-running (Arch FTW!), federation-supporting, rambling nerd.

The Future

Who knows!

I'm planning on tinkering with all this for a long time still.

Technology changes so often and so fast that I can't imagine getting bored of it.