10 Feb 2019, 00:00

About me

My day job is Technical Team Lead at Safespring. I’m also a co-organiser of Devopsdays Oslo and Devopsdays Stockholm. Sometimes I go to other conferences.

I live in Norway.

23 Sep 2022, 00:00

Managing dotfiles in git

How to manage dotfiles in a bare git-repo

How to set up:

Initialize an empty git repo in a folder in $HOME:

1
git init --bare $HOME/.cfg

Now we want to set up an alias for git to work on this repo:

1
alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME' 

We want to hide untraced files, so we explicitly choose which files to track:

1
config config --local status.showUntrackedFiles no

Make config persistent, I use zsh, so I add the alias to .zshrc

1
echo "alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'" >> $HOME/.zshrc

now its time to add a few existing config files to the repo:

1
2
3
config add .zshrc
config add .vimrc
config commit

I created a github repo and pushed my config to github:

1
2
config remote add origin <github-repo-url>
config push

Now, time to check out my config on another machine. First, checkout the repo using the --bare option

1
git clone --bare <git-repo-url> $HOME/.cfg

Define the config-alias

1
alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'

And last: Check out the repo

1
config checkout

24 Sep 2020, 00:00

Running pihole in a docker-container

Getting ipv6 to work with rpi, docker and pihole

This is how I made pihole run in a docker container with ipv6 support.

Step one: Configure docker for ipv›6:

1
2
3
4
5
$ cat /etc/docker/daemon.json
{
        "ipv6": true,
        "fixed-cidr-v6": <your-ipvc-cidr>
}

then we need to create a ipv6 network for docker:

1
docker network create --ipv6 --driver bridge --subnet "fd01::/64" ipv6

restart docker

1
systemctl restart docker

I use docker-compose to manage the container, so I added the following to docker-compose.yml

1
2
      ServerIPv6: <this is the ip of your rpi host>
      IPv6: "true"

and choose the ipv6 network:

1
2
3
4
networks:
  default:
    external:
      name: ipv6

rebuild the docker container:

1
$ docker-compose up -d --no-deps --build pihole

And voila! The pihole instance should now come up with an valid ipv6 address - and should respond to DNS queries on the ipv6 interface.