I was dreaming of this for years!

Now I finally was able to start it: Setting up my own webspace!

This blog is hosted on uberspace.de,
generated using Jekyll and works automagically thanks to
git.

Since I found out, that some articles I've read while creating this blog were
vanished, I decided to document the procedure another time. Just in case ;-)

Prerequisites

I expect you to have basic knowledge on a terminal, know what a prompt is, how
environment variables are used, are familiar with using git and know how to
read things up on StackOverflow in case you don't.

Getting webspace

That's easy. Just go to
their registration space and pick an username.

The prices are really affordable!

Shortly after registration you should
generate SSH keys (explained on the Internet. Use ssh-keygen.) and
upload the public one on uberspace, so
you don't have to remember the password when logging in.

Logging in

That's easy if you have uploaded SSH keys and use a terminal on GNU/Linux or
Mac: $ ssh <username>@<host>.uberspace.de. username equals hereby the user
you entered for registration. After the sign up, you can figure out your host
in the data sheet
of your uberspace account.

Installing Jekyll

Uberspace lists cool articles, were I found how to
install Jekyll on Uberspace.

In order to preserve what was written their here a short version:

  1. Log in into Uberspace via SSH.
  2. Create a directory (I named my jekyll) in order to be safe, that you don't
    open a vulnerability if a bug comes up in Jekyll, that is, the directory
    should be different from $HOME/html.
  3. cd into that directory and run gem install jekyll bundler as described
    on the
    installation guide of jekyll.
    bundler manages Ruby Gems for you. Jekyll makes heavy
    use of them.
  4. In order to create a jekyll blog, run jekyll new <blog-name>.git.
    That will create a new directory and install dependencies there.
    Mine is named andre-blog.git.

Setting up git

Now that you have a jekyll blog on your webspace, make it a git repository, so
you can version any changes and sync it with different work stations like your
laptop or mobile. That's as easy as running git init --bare from inside the
blog directory, here $HOME/jekyll/andre-blog.git.

Cloning your blog on a local machine

In order to have a copy of your blog locally switch to your machine and run

git clone ssh://<username>@<host>.uberspace.de/home/<username>/jekyll/andre-blog.git
cd andre-blog.git
git remote add deployer <username>@<host>.uberspace.de:/home/<username>/jekyll/andre-blog.git

Configuring git post-receive hook

Before you make changes on your local machine and push them up to the webspace,
configure a post-receive hook so the jekyll will happily build your blog and
push it to a web root.

I found the instructions for
deployment methods
on the official website of jekyll.

Therefore create a new file
$HOME/jekyll/andre-blog.git/hooks/post-receive and save it with the
following content:

GIT_REPO=$HOME/jekyll/andre-blog.git
TMP_GIT_CLONE=$HOME/tmp/myrepo
PUBLIC_WWW=$HOME/html

git clone $GIT_REPO $TMP_GIT_CLONE
bundle exec jekyll build -s $TMP_GIT_CLONE -d $PUBLIC_WWW
rm -Rf $TMP_GIT_CLONE
exit

As you can see, we need to create a TMP_GIT_CLONE directory before we can
try it: mkdir $HOME/tmp.
In order to let git run the hook, we need to make it executable:
chmod u+x hooks/post-receive.

Now you should be able to make changes locally, create a git commit and push it
to your webspace, where jekyll will build it for you and push it online soon
after:

git add .
git commit
git push -u deployer master  # -u and master are only needed first time

Next steps

I plan to buy a domain, create subdomains and put everything online.

Then I want to migrate my content from WordPress to here and translate it while
I am at it. So there will be a German and an English version of articles.

Once I am done with that, I have many, many ideas on what to do with my
webspace. Stay tuned!