Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sdavids/sdavids.de-homepage

Sebastian Davids Homepage
https://github.com/sdavids/sdavids.de-homepage

Last synced: 3 days ago
JSON representation

Sebastian Davids Homepage

Awesome Lists containing this project

README

        

// SPDX-FileCopyrightText: © 2022 Sebastian Davids
// SPDX-License-Identifier: Apache-2.0
= sdavids.de Homepage
Sebastian Davids
// Metadata:
:description: Sebastian Davids' Homepage
// Settings:
:sectnums:
:sectanchors:
:sectlinks:
:toc: macro
:toclevels: 3
:toc-placement!:
:hide-uri-scheme:
:source-highlighter: rouge
:rouge-style: github
// Refs:
:uri-contributor-covenant: https://www.contributor-covenant.org
:uri-apache-license: https://www.apache.org/licenses/LICENSE-2.0
:uri-google-style: https://github.com/google/gts
:docker-install-url: https://docs.docker.com/install/
:easyrsa-install-url: https://easy-rsa.readthedocs.io/en/latest/#obtaining-and-using-easy-rsa
:nvm-install-url: https://github.com/nvm-sh/nvm#installing-and-updating
:fnm-install-url: https://github.com/Schniz/fnm#installation
:gh-actions-url: https://github.com/sdavids/sdavids.de-homepage/actions

ifdef::env-browser[:outfilesuffix: .adoc]

ifdef::env-github[]
:outfilesuffix: .adoc
:important-caption: :heavy_exclamation_mark:
:note-caption: :information_source:
:badges:
endif::[]

ifdef::badges[]
image:https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg[Contributor Covenant,Version 2.1,link={uri-contributor-covenant}]
image:https://img.shields.io/badge/code%20style-google-blueviolet.svg[Code Style: Google,link={uri-google-style}]
image:https://img.shields.io/osslifecycle/sdavids/sdavids.de-homepage[OSS Lifecycle]
image:https://img.shields.io/maintenance/yes/2024[Maintenance]
image:https://img.shields.io/github/last-commit/sdavids/sdavids.de-homepage[GitHub last commit]
endif::[]

toc::[]

== Development

[source,shell]
----
$ cd hp
$ npm install --no-ignore-scripts
----

==== Shell 1 - Tailwind CSS CLI build process

[source,shell]
----
$ cd hp
$ npm run dev:css
----

==== Shell 2 - Browsersync process

[source,shell]
----
$ cd hp
$ npm run dev
----

=> http://localhost:3000[http://localhost:3000]

=== Format Source Code

[source,shell]
----
$ cd hp
$ npm run format
----

=== Lint Source Code

[source,shell]
----
$ cd hp
$ npm run lint
----

== Deployment

=== Local Deployment

==== Create CA and Certificate

[source,shell]
----
$ cd hp
$ npm run cert:ca:create
$ npm run cert:create
----

==== Create Base Docker Image

[source,shell]
----
$ cd httpd
$ scripts/docker_build.sh
----

==== Build And Start Apache HTTPD

[source,shell]
----
$ cd hp
$ npm run docker:httpd:start:with-build
----

=> https://httpd.internal:8443[https://httpd.internal:8443]

==== Start Apache HTTPD Without a Build

[source,shell]
----
$ cd hp
$ npm run docker:httpd:start
----

=> https://httpd.internal:8443[https://httpd.internal:8443]

==== Stop Apache HTTPD

[source,shell]
----
$ cd hp
$ npm run docker:httpd:stop
----

=== Deployment to sdavids.de

Deployed website:: https://sdavids.de.

GitHub Action Workflow:: link:.github/workflows/ci.yaml[]

GitHub Action Runs:: {gh-actions-url}

== License

Apache License, Version 2.0 (link:LICENSES/Apache-2.0.txt[Apache-2.0.txt] or {uri-apache-license}).

== Contribution

See link:CONTRIBUTING{outfilesuffix}[].

== Code of Conduct

We abide by the {uri-contributor-covenant}[Contributor Covenant, Version 2.1] and ask that you do as well.

For more information, please see link:CODE_OF_CONDUCT.md[Code of Conduct].

== Development Environment Setup

[IMPORTANT]
====
After initializing this repository you need to configure the https://git-scm.com/docs/git-config#Documentation/git-config.txt-blameignoreRevsFile[ignore-revs-file]:

[source,shell]
----
$ git config blame.ignoreRevsFile .git-blame-ignore-revs
----
====

=== Installation

==== DNS

Add `httpd.internal` to your `/etc/hosts`:

./etc/hosts
[source,shell]
----
127.0.0.1 localhost httpd.internal
::1 localhost httpd.internal
----

[NOTE]
====
If you want to change this entry you need to also change:

.httpd/httpd.conf
[source]
----
ServerName httpd.internal:80
----

.httpd/httpd-ssl.conf
[source]
----
ServerName httpd.internal:443
----

.hp/scripts/docker_httpd_start.sh
[source,shell]
----
readonly host_name='httpd.internal'
----

.hp/package.json
[source,shell]
----

"scripts": {

"cert:copy": "scripts/copy_ca_based_cert.sh certs httpd.internal",
"cert:create": "scripts/create_ca_based_cert.sh certs 30 httpd.internal",
"cert:delete": "scripts/delete_ca_based_cert.sh certs httpd.internal",
"cert:renew": "scripts/renew_ca_based_cert.sh certs 30 httpd.internal",
"cert:verify": "scripts/verify_ca_based_cert.sh certs 30 httpd.internal",

},

----
====

==== Docker

Install {docker-install-url}[Docker].

==== Node Version Manager

Install {fnm-install-url}[fnm] or {nvm-install-url}[NVM].

[NOTE]
====
This repository uses https://typicode.github.io/husky/[husky] for Git hooks.

More information:
https://typicode.github.io/husky/troubleshooting.html#command-not-found[Husky - Command not found]
====

===== fnm

.~/.zprofile
[source,shell]
----
if command -v fnm >/dev/null 2>&1; then
eval "$(fnm env --use-on-cd)"
fi
----

.~/.config/husky/init.sh
[source,shell]
----
#!/usr/bin/env sh

# vim:ft=zsh

# shellcheck shell=sh disable=SC1091

set -eu

[ -e /etc/zshenv ] && . /etc/zshenv
[ -e "${ZDOTDIR:=${HOME}}/.zshenv" ] && . "${ZDOTDIR:=${HOME}}/.zshenv"
[ -e /etc/zprofile ] && . /etc/zprofile
[ -e "${ZDOTDIR:=${HOME}}/.zprofile" ] && . "${ZDOTDIR:=${HOME}}/.zprofile"
[ -e /etc/zlogin ] && . /etc/zlogin
[ -e "${ZDOTDIR:=${HOME}}/.zlogin" ] && . "${ZDOTDIR:=${HOME}}/.zlogin"
----

===== nvm

.~/.zshrc
[source,shell]
----
export NVM_DIR="${HOME}/.nvm"

[ -s "${NVM_DIR}/nvm.sh" ] && . "${NVM_DIR}/nvm.sh"
[ -s "${NVM_DIR}/bash_completion" ] && . "${NVM_DIR}/bash_completion"

if command -v nvm >/dev/null 2>&1; then
autoload -U add-zsh-hook
load-nvmrc() {
local nvmrc_path="$(nvm_find_nvmrc)"
if [ -n "${nvmrc_path}" ]; then
local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")
if [ "${nvmrc_node_version}" = "N/A" ]; then
nvm install
elif [ "${nvmrc_node_version}" != "$(nvm version)" ]; then
nvm use
fi
elif [ -n "$(PWD=$OLDPWD nvm_find_nvmrc)" ] && [ "$(nvm version)" != "$(nvm version default)" ]; then
echo 'Reverting to nvm default version'
nvm use default
fi
}

add-zsh-hook chpwd load-nvmrc
load-nvmrc
fi
----

.~/.config/husky/init.sh
[source,shell]
----
#!/usr/bin/env sh

# vim:ft=zsh

# shellcheck shell=sh disable=SC1091

set -eu

[ -e /etc/zshenv ] && . /etc/zshenv
[ -e "${ZDOTDIR:=${HOME}}/.zshenv" ] && . "${ZDOTDIR:=${HOME}}/.zshenv"
[ -e /etc/zprofile ] && . /etc/zprofile
[ -e "${ZDOTDIR:=${HOME}}/.zprofile" ] && . "${ZDOTDIR:=${HOME}}/.zprofile"
[ -e /etc/zlogin ] && . /etc/zlogin
[ -e "${ZDOTDIR:=${HOME}}/.zlogin" ] && . "${ZDOTDIR:=${HOME}}/.zlogin"

export NVM_DIR="${HOME}/.nvm"

if [ -f "${NVM_DIR}/nvm.sh" ]; then
. "${NVM_DIR}/nvm.sh"

if [ -f '.nvmrc' ]; then
nvm use
fi
fi
----

==== Certificates

===== New Certificate

[source,shell]
----
$ cd hp
$ node --run cert:ca:create
$ node --run cert:create
----

===== Existing Certificate

[source,shell]
----
$ cd hp
$ node --run cert:copy
----

==== jq

===== Linux

[source,shell]
----
$ sudo apt-get install jq
----

===== Mac

[source,shell]
----
$ brew install jq
----

==== brotli

===== Linux

[source,shell]
----
$ sudo apt-get install brotli
----

===== Mac

[source,shell]
----
$ brew install brotli
----

==== zstd

===== Linux

[source,shell]
----
$ sudo apt-get install zstd
----

===== Mac

[source,shell]
----
$ brew install zstd
----

==== shellcheck

===== Linux

[source,shell]
----
$ sudo apt-get install shellcheck
----

===== Mac

[source,shell]
----
$ brew install shellcheck
----

==== shfmt

===== Linux

[source,shell]
----
$ sudo apt-get install shfmt
----

===== Mac

[source,shell]
----
$ brew install shfmt
----

==== yamllint

===== Linux

[source,shell]
----
$ sudo apt-get install yamllint
----

===== Mac

[source,shell]
----
$ brew install yamllint
----

==== hadolint

===== Linux

Install https://github.com/hadolint/hadolint?tab=readme-ov-file#install[hadolint].

===== Mac

[source,shell]
----
$ brew install hadolint
----

==== gpg

===== Linux

[source,shell]
----
$ sudo apt-get install gpg
----

===== Mac

Install https://gpgtools.org[GPG Suite].

==== easyrsa

[IMPORTANT]
====
Ensure that you install version `3.1.7` and not `3.2.0`!

Version `3.2.0` is an incompatible https://github.com/OpenVPN/easy-rsa/releases/tag/v3.2.0[development snapshot release].
====

===== Linux

Install {easyrsa-install-url}[easyrsa].

===== Mac

[WARNING]
====
Unfortunately, homebrew provides `easy-rsa` version `3.2.0` at this point in time (August 2024).
====

[source,shell]
----
$ curl -L https://github.com/OpenVPN/easy-rsa/releases/download/v3.1.7/EasyRSA-3.1.7.tgz -o ~/Downloads/easy-rsa.tgz
$ tar -xzf ~/Downloads/easy-rsa.tgz -C ~/.local/share
$ mv ~/.local/share/EasyRSA-3.1.7 ~/.local/share/easyrsa
$ ln -s ~/.local/share/easyrsa/easyrsa ~/.local/bin/easyrsa
----