Infrastructure Docs Startpage
Infrastructure repository with configs and docs for my local workstations, my homelab with tool server and RasPi nodes and my public cloud-hosted website.
-
Github Repository → https://github.com/sebastian-sommerfeld-io/infrastructure
-
Documentation → https://www.sommerfeld.io/docs/docker-images/infrastructure-docs/main
-
Where to file issues → https://github.com/sebastian-sommerfeld-io/infrastructure/issues
Quality Goals
-
Run test, scans and validations automatically with Github Actions
-
Everything inside this repo is linted and validated
-
Docker builds are tested regularly
-
Container images are scanned for vulerabilities
-
-
Encapsulate as much as possible inside Docker Containers and/or Vagrantboxes to ensure (broken) updates can easily be rolled back and the setup is portable in case I have to reset my workstation or have to switch to another workstation.
-
Add or update packages without any risk → avoid having to repair broken installations (dumping the broken setup and reverting to a working one is preferred).
-
Instead of using e.g.
apt-get install
, use Docker Containers and create a Symlink in/usr/bin
to a wrapper-script which delegates commands to a Docker container.
-
Technologies used in this project
The following technologies are the big building blocks of this project. Other technologies and helpers like several linters although being useful and essential as well don’t qualify as building block technologies and are not listed here.
Technology | Purpose | Website |
---|---|---|
Ansible |
Provisioning and configuration for server nodes (physical, virtual and RasPi) on my homelab |
|
Asciidoc & Antora |
Docs as Code for this project |
|
Bash scripts |
Automate installations, wrap commands into repeatable scripts, utilities, etc. |
- |
Docker & Docker Compose |
Run containers on on my local workstation and in Vagrantboxes |
|
Terraform |
Provision Cloud Infrastructure and local services on my toolserver |
|
Vagrant & Virtualbox |
Virtual machines |
Github Settings
Protect main
branch by checking "Require status checks to pass before merging" and "Require branches to be up to date before merging" in Settings > Branches > main for each repo.
Gitpod Settings
Configure envorinment variables for all Gitpod worpspaces at https://gitpod.io/variables.
Variable | Value | Scope | Info |
---|---|---|---|
LOG_DONE |
[\e[32mDONE\e[0m] |
/*/ |
Log level (used for console outputs) |
LOG_ERROR |
[\e[1;31mERROR\e[0m] |
/*/ |
Log level (used for console outputs) |
LOG_INFO |
[\e[34mINFO\e[0m] |
/*/ |
Log level (used for console outputs) |
LOG_WARN |
[\e[93mWARN\e[0m] |
/*/ |
Log level (used for console outputs) |
Y |
\e[93m |
/*/ |
Yellow text |
P |
\e[35m |
/*/ |
Pink text |
D |
\e[0m |
/*/ |
Text in default color (white) |
DockerHub Settings
-
Go to "hub.docker.com → Account Settings → Security" and set up an Access Token to use with Github Actions.
-
Go to "repository "infrastructure" on github.com → Settings → Secrets → Actions and add two secrets to log in to DockerHub from a Github Actions pipeline
-
DOCKERHUB_USER =
sommerfeldio
-
DOCKERHUB_USER =
<THE_TOKEN_FROM_DOCKERHUB>
-
Container Scanning with Snyk
In order to use the Snyk Action you will need to have a Snyk API token. More details in https://github.com/snyk/actions#getting-your-snyk-token or you can signup for free at https://snyk.io/login.
-
Create a
SNYK_TOKEN
secret in Github the same way you created the DockerHub secrets.
Snyk can be used to break the build when it detects vulnerabilities. In this case we want to continue-on-error: true
to upload the issues to GitHub Code Scanning.
Integrate Slack with Github Actions
Some pipelines send their build status and sometimes other messages to slack.
-
For custom messsages use action
slack-send
→ Technique 2: Slack App.This creates (among other things) theSLACK_BOT_TOKEN
secret.-
Direct Link to Slack App Management Console = https://api.slack.com/apps
-
-
For build status messages use https://github.com/marketplace/actions/post-workflow-status-to-slack.