From 96c2cbe1850f95806cccb6f47a7739eb9c2ac860 Mon Sep 17 00:00:00 2001 From: "Gabriel A. Giovanini" Date: Sat, 11 Jun 2022 00:18:54 +0200 Subject: fix: Fix blog post timestamps For some the timestamp got messed up. Now they should be restored properly as well the `locustfile.py` pointing to the right endpoints. --- 2020-08-22Moving_from_Github_to_Gitlab_pages.md | 31 ------- ...ating_desktop_setup_with_ansible-pull_part-1.md | 97 ++++++++++++++++++++++ ...ating_desktop_setup_with_ansible-pull_part-1.md | 97 ---------------------- content/posts/2020-07-12Road_to_local_K3S.md | 73 ++++++++++++++++ content/posts/2020-07-13Road_to_local_K8S.md | 73 ---------------- ...2-28K8S_private_gitlab_registry_using_podman.md | 49 ----------- ...2-28K8S_private_gitlab_registry_using_podman.md | 49 +++++++++++ contrib/locust/locustfile.py | 3 +- src/blog.rs | 4 +- src/router.rs | 2 - 10 files changed, 223 insertions(+), 255 deletions(-) delete mode 100644 2020-08-22Moving_from_Github_to_Gitlab_pages.md create mode 100644 content/posts/2019-03-07Automating_desktop_setup_with_ansible-pull_part-1.md delete mode 100644 content/posts/2019-04-22Automating_desktop_setup_with_ansible-pull_part-1.md create mode 100644 content/posts/2020-07-12Road_to_local_K3S.md delete mode 100644 content/posts/2020-07-13Road_to_local_K8S.md delete mode 100644 content/posts/2020-12-28K8S_private_gitlab_registry_using_podman.md create mode 100644 content/posts/2021-12-28K8S_private_gitlab_registry_using_podman.md diff --git a/2020-08-22Moving_from_Github_to_Gitlab_pages.md b/2020-08-22Moving_from_Github_to_Gitlab_pages.md deleted file mode 100644 index 5bfa788..0000000 --- a/2020-08-22Moving_from_Github_to_Gitlab_pages.md +++ /dev/null @@ -1,31 +0,0 @@ -This was quite simple, I had just to create a simple Gitlab pipeline job -and publish to pages this is done by: - - image: clojure:lein-2.7.0 - - before_script: - - lein deps - - test: - script: - - lein test - - pages: - stage: deploy - script: - - lein package - artifacts: - paths: - - public - only: - - master - -before~script~ -: will download all the dependencies with `lein deps`. - -test -: is self explanatory. - -pages -: will compile the cljs into js with `lein package` and publish it - into pages. diff --git a/content/posts/2019-03-07Automating_desktop_setup_with_ansible-pull_part-1.md b/content/posts/2019-03-07Automating_desktop_setup_with_ansible-pull_part-1.md new file mode 100644 index 0000000..58ecb0d --- /dev/null +++ b/content/posts/2019-03-07Automating_desktop_setup_with_ansible-pull_part-1.md @@ -0,0 +1,97 @@ +Every time that I do a clean install on my machine it takes a few hours +till I get to point where I was before formatting it, install all +packages, select themes, icons, fonts, install IDEs, extensions and so +on. After doing it a few times I came to the conclusion that I would +save time by spending time automating this chore, and as a result, I +could tinker a little more with my system and not worry about spending a +weekend re-installing everything (which have happened more time that + I\'d like to remember). + +So after a few attempts using python and bash I ended with many files +and keep everything organized and concise turned out to be more tedious +than the setup itself. So there comes +[Ansible](https://www.ansible.com/). It is an enterprise-graded software +used to automate tasks. It has A LOT OF features and it can be really +helpful if you\'re a sysadmin but for now we\'re going to focus on +[Ansible +Pull](https://docs.ansible.com/ansible/latest/user_guide/playbooks_intro.html#ansible-pull) +and +[Playbooks](https://docs.ansible.com/ansible/latest/user_guide/playbooks.html). +As better described: + +> \[Ansible-Pull\] is used to up a remote copy of ansible on each +> managed node, each set to run via cron and update playbook source via +> a source repository. This inverts the default push architecture of +> Ansible into a pull architecture, which has near-limitless scaling +> potential. +> +> Playbooks are Ansible's configuration, deployment, and orchestration +> language. They can describe a policy you want your remote systems to +> enforce, or a set of steps in a general IT process. +> +> [source](https://docs.ansible.com/ansible/latest/cli/ansible-pull.html) + +The goal is to pull and run a playbook remotely using a git repository. +The playbook will describe the tasks needed to setup our machine from +scratch. + +But first lets tinker a bit a with playbooks locally with +`ansible-playbook`, to do so we need to add `localhost` to ansible\'s +hosts list. Add it to `/etc/ansible/hosts`: + +``` service +[all] +localhost +``` + +As an experiment we\'re going to write a asks to install vim. Currently, + I\'m using [Fedora](https://getfedora.org/) thus we going to use [dnf + modeule](https://docs.ansible.com/ansible/latest/modules/dnf_module.html) + to install packages, but if you\'re using another distribution look for + a equivalent module like [apt + module](https://docs.ansible.com/ansible/latest/modules/apt_module.html) + for [Ubuntu](https://ubuntu.com/). + + The playbook to install is quite simple: + + ``` yaml +# main.yaml + - hosts: all + tasks: + - name: install vim + dnf: +name: vim +state: latest +``` + +`hosts:` is required and it has to match our hosts otherwise the +playbook won\'t run. + +`tasks:` is the list of tasks that the playbook will perform, in this +case will be `dnf install vim`. + +To run a playbook use the command `ansible-playbook` commando to run +`main.yml` direct from disk, do to so just run the following command: + + +``` bash +sudo ansible-playbook --connection=local main.yml +``` + +After a few seconds, vim will be installed on your machine. + +``` bash +PLAY [all] ************************************************************* + +TASK [Gathering Facts] ************************************************* +ok: [localhost] + +TASK [install vim] ***************************************************** +ok: [localhost] + +PLAY RECAP ************************************************************* +localhost : ok=2 changed=0 unreachable=0 failed=0 +``` + +This is the first step, next part we shall create a more complex +playbook and setup repository to run it remotely using `ansible-pull`. diff --git a/content/posts/2019-04-22Automating_desktop_setup_with_ansible-pull_part-1.md b/content/posts/2019-04-22Automating_desktop_setup_with_ansible-pull_part-1.md deleted file mode 100644 index 58ecb0d..0000000 --- a/content/posts/2019-04-22Automating_desktop_setup_with_ansible-pull_part-1.md +++ /dev/null @@ -1,97 +0,0 @@ -Every time that I do a clean install on my machine it takes a few hours -till I get to point where I was before formatting it, install all -packages, select themes, icons, fonts, install IDEs, extensions and so -on. After doing it a few times I came to the conclusion that I would -save time by spending time automating this chore, and as a result, I -could tinker a little more with my system and not worry about spending a -weekend re-installing everything (which have happened more time that - I\'d like to remember). - -So after a few attempts using python and bash I ended with many files -and keep everything organized and concise turned out to be more tedious -than the setup itself. So there comes -[Ansible](https://www.ansible.com/). It is an enterprise-graded software -used to automate tasks. It has A LOT OF features and it can be really -helpful if you\'re a sysadmin but for now we\'re going to focus on -[Ansible -Pull](https://docs.ansible.com/ansible/latest/user_guide/playbooks_intro.html#ansible-pull) -and -[Playbooks](https://docs.ansible.com/ansible/latest/user_guide/playbooks.html). -As better described: - -> \[Ansible-Pull\] is used to up a remote copy of ansible on each -> managed node, each set to run via cron and update playbook source via -> a source repository. This inverts the default push architecture of -> Ansible into a pull architecture, which has near-limitless scaling -> potential. -> -> Playbooks are Ansible's configuration, deployment, and orchestration -> language. They can describe a policy you want your remote systems to -> enforce, or a set of steps in a general IT process. -> -> [source](https://docs.ansible.com/ansible/latest/cli/ansible-pull.html) - -The goal is to pull and run a playbook remotely using a git repository. -The playbook will describe the tasks needed to setup our machine from -scratch. - -But first lets tinker a bit a with playbooks locally with -`ansible-playbook`, to do so we need to add `localhost` to ansible\'s -hosts list. Add it to `/etc/ansible/hosts`: - -``` service -[all] -localhost -``` - -As an experiment we\'re going to write a asks to install vim. Currently, - I\'m using [Fedora](https://getfedora.org/) thus we going to use [dnf - modeule](https://docs.ansible.com/ansible/latest/modules/dnf_module.html) - to install packages, but if you\'re using another distribution look for - a equivalent module like [apt - module](https://docs.ansible.com/ansible/latest/modules/apt_module.html) - for [Ubuntu](https://ubuntu.com/). - - The playbook to install is quite simple: - - ``` yaml -# main.yaml - - hosts: all - tasks: - - name: install vim - dnf: -name: vim -state: latest -``` - -`hosts:` is required and it has to match our hosts otherwise the -playbook won\'t run. - -`tasks:` is the list of tasks that the playbook will perform, in this -case will be `dnf install vim`. - -To run a playbook use the command `ansible-playbook` commando to run -`main.yml` direct from disk, do to so just run the following command: - - -``` bash -sudo ansible-playbook --connection=local main.yml -``` - -After a few seconds, vim will be installed on your machine. - -``` bash -PLAY [all] ************************************************************* - -TASK [Gathering Facts] ************************************************* -ok: [localhost] - -TASK [install vim] ***************************************************** -ok: [localhost] - -PLAY RECAP ************************************************************* -localhost : ok=2 changed=0 unreachable=0 failed=0 -``` - -This is the first step, next part we shall create a more complex -playbook and setup repository to run it remotely using `ansible-pull`. diff --git a/content/posts/2020-07-12Road_to_local_K3S.md b/content/posts/2020-07-12Road_to_local_K3S.md new file mode 100644 index 0000000..a3ca530 --- /dev/null +++ b/content/posts/2020-07-12Road_to_local_K3S.md @@ -0,0 +1,73 @@ +# Goal + +The goal is to deploy kubernetes on my local networks, and keep +everything as reproducible as possible. + +# Stack + +I\'ll use Fedora Core OS, Matchbox and Terraform [^1], a match the +requirements for Tectonic [^2] + +## Steps + +- Network Setup DHCP/TFTP/DNS [^3] +- Matchbox [^4] +- PXE network boot environment +- Terraform Tectonic [^5] + +## Network Setup DHCP/TFTP/DNS + +First learning the basics again: + +- +- + +To check open ports + +``` {.bash org-language="sh"} +lsof -Pni | grep LISTEN +``` + +Run the provided [^6] image with `dnsmasq` and PXE toolkit + +``` {.bash org-language="sh"} +docker run --rm --cap-add=NET_ADMIN --net=host quay.io/coreos/dnsmasq \ + -d -q \ + --dhcp-range=192.168.1.3,192.168.1.254 \ + --enable-tftp --tftp-root=/var/lib/tftpboot \ + --dhcp-match=set:bios,option:client-arch,0 \ + --dhcp-boot=tag:bios,undionly.kpxe \ + --dhcp-match=set:efi32,option:client-arch,6 \ + --dhcp-boot=tag:efi32,ipxe.efi \ + --dhcp-match=set:efibc,option:client-arch,7 \ + --dhcp-boot=tag:efibc,ipxe.efi \ + --dhcp-match=set:efi64,option:client-arch,9 \ + --dhcp-boot=tag:efi64,ipxe.efi \ + --dhcp-userclass=set:ipxe,iPXE \ + --dhcp-boot=tag:ipxe,http://matchbox.example.com:8080/boot.ipxe \ + --address=/matchbox.example/192.168.1.2 \ + --log-queries \ + --log-dhcp +``` + +## Matchbox + +## PXE network boot environment + +## Terraform Tectonic + +------------------------------------------------------------------------ + +# Links + +[^1]: + +[^2]: + +[^3]: + +[^4]: + +[^5]: + +[^6]: diff --git a/content/posts/2020-07-13Road_to_local_K8S.md b/content/posts/2020-07-13Road_to_local_K8S.md deleted file mode 100644 index a3ca530..0000000 --- a/content/posts/2020-07-13Road_to_local_K8S.md +++ /dev/null @@ -1,73 +0,0 @@ -# Goal - -The goal is to deploy kubernetes on my local networks, and keep -everything as reproducible as possible. - -# Stack - -I\'ll use Fedora Core OS, Matchbox and Terraform [^1], a match the -requirements for Tectonic [^2] - -## Steps - -- Network Setup DHCP/TFTP/DNS [^3] -- Matchbox [^4] -- PXE network boot environment -- Terraform Tectonic [^5] - -## Network Setup DHCP/TFTP/DNS - -First learning the basics again: - -- -- - -To check open ports - -``` {.bash org-language="sh"} -lsof -Pni | grep LISTEN -``` - -Run the provided [^6] image with `dnsmasq` and PXE toolkit - -``` {.bash org-language="sh"} -docker run --rm --cap-add=NET_ADMIN --net=host quay.io/coreos/dnsmasq \ - -d -q \ - --dhcp-range=192.168.1.3,192.168.1.254 \ - --enable-tftp --tftp-root=/var/lib/tftpboot \ - --dhcp-match=set:bios,option:client-arch,0 \ - --dhcp-boot=tag:bios,undionly.kpxe \ - --dhcp-match=set:efi32,option:client-arch,6 \ - --dhcp-boot=tag:efi32,ipxe.efi \ - --dhcp-match=set:efibc,option:client-arch,7 \ - --dhcp-boot=tag:efibc,ipxe.efi \ - --dhcp-match=set:efi64,option:client-arch,9 \ - --dhcp-boot=tag:efi64,ipxe.efi \ - --dhcp-userclass=set:ipxe,iPXE \ - --dhcp-boot=tag:ipxe,http://matchbox.example.com:8080/boot.ipxe \ - --address=/matchbox.example/192.168.1.2 \ - --log-queries \ - --log-dhcp -``` - -## Matchbox - -## PXE network boot environment - -## Terraform Tectonic - ------------------------------------------------------------------------- - -# Links - -[^1]: - -[^2]: - -[^3]: - -[^4]: - -[^5]: - -[^6]: diff --git a/content/posts/2020-12-28K8S_private_gitlab_registry_using_podman.md b/content/posts/2020-12-28K8S_private_gitlab_registry_using_podman.md deleted file mode 100644 index c72e9ac..0000000 --- a/content/posts/2020-12-28K8S_private_gitlab_registry_using_podman.md +++ /dev/null @@ -1,49 +0,0 @@ -This is based on [Log in to Docker -Hub](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/). -It is just a bit different to use podman - -First we should take a look at podman-login man page: - -``` bash -man podman login -``` - -It will give some valueable information like the location of auth.json -file. Now we can login using podman: - -``` bash -podman login registry.gitlab.com -``` - -Then check the `auth.json` file located at -`${XDG_RUNTIME_DIR}/containers/auth.json` (as described by the manual). - -``` bash -cat "${XDG_RUNTIME_DIR}/containers/auth.json" -``` - -It will print your auth config: - -``` json -{ - "auths": { - "registry.gitlab.com": { - "auth": "..." - } - } -} -``` - -Now copy that file over to the server and register it in k8s with the -following command: - -``` bash -kubectl create secret generic regcred \ - --from-file=.dockerconfigjson=auth.json \ - --type=kubernetes.io/dockerconfigjson -``` - -Once you have created you can list by `kubectl get secret`: - - NAME TYPE DATA AGE - regcred kubernetes.io/dockerconfigjson 1 53s diff --git a/content/posts/2021-12-28K8S_private_gitlab_registry_using_podman.md b/content/posts/2021-12-28K8S_private_gitlab_registry_using_podman.md new file mode 100644 index 0000000..c72e9ac --- /dev/null +++ b/content/posts/2021-12-28K8S_private_gitlab_registry_using_podman.md @@ -0,0 +1,49 @@ +This is based on [Log in to Docker +Hub](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/). +It is just a bit different to use podman + +First we should take a look at podman-login man page: + +``` bash +man podman login +``` + +It will give some valueable information like the location of auth.json +file. Now we can login using podman: + +``` bash +podman login registry.gitlab.com +``` + +Then check the `auth.json` file located at +`${XDG_RUNTIME_DIR}/containers/auth.json` (as described by the manual). + +``` bash +cat "${XDG_RUNTIME_DIR}/containers/auth.json" +``` + +It will print your auth config: + +``` json +{ + "auths": { + "registry.gitlab.com": { + "auth": "..." + } + } +} +``` + +Now copy that file over to the server and register it in k8s with the +following command: + +``` bash +kubectl create secret generic regcred \ + --from-file=.dockerconfigjson=auth.json \ + --type=kubernetes.io/dockerconfigjson +``` + +Once you have created you can list by `kubectl get secret`: + + NAME TYPE DATA AGE + regcred kubernetes.io/dockerconfigjson 1 53s diff --git a/contrib/locust/locustfile.py b/contrib/locust/locustfile.py index fd22508..ca4e4d9 100644 --- a/contrib/locust/locustfile.py +++ b/contrib/locust/locustfile.py @@ -11,8 +11,7 @@ class HelloWorldUser(HttpUser): self.client.get("/posts/2021-12-26Enable_NFS_on_K3S.md") self.client.get("/posts/2020-08-22Moving_from_Github_to_Gilab_pages.md") self.client.get("/posts/2020-07-14Friz_box_turned_off_DHCP.md") - self.client.get("/posts/2020-07-12Road_to_local_K8S.md") + self.client.get("/posts/2020-07-12Road_to_local_K3S.md") self.client.get("/posts/2019-11-16Compiling_emacs_from_source_code_on_fedora.md") self.client.get("/posts/2019-04-22Automating_desktop_setup_with_ansible-pull_part-2.md") self.client.get("/posts/2019-03-07Automating_desktop_setup_with_ansible-pull_part-1.md") - self.client.get("/posts/2019-04-22Ansible_part_2.md") diff --git a/src/blog.rs b/src/blog.rs index eaa314a..a1586f8 100644 --- a/src/blog.rs +++ b/src/blog.rs @@ -18,7 +18,9 @@ pub fn read_assets() -> Vec { fn get_file_content(path: &str) -> String { let buffer = PostAsset::get(path).unwrap().data.into_owned(); let md = String::from_utf8(buffer).unwrap(); - let parser = Parser::new_ext(&md, Options::empty()); + let mut options = Options::empty(); + options.insert(Options::ENABLE_FOOTNOTES); + let parser = Parser::new_ext(&md, options); let mut html_output = &mut String::new(); html::push_html(&mut html_output, parser); return html_output.to_string(); diff --git a/src/router.rs b/src/router.rs index c196ab8..3227d66 100644 --- a/src/router.rs +++ b/src/router.rs @@ -1,5 +1,3 @@ -use std::borrow::Borrow; - use crate::assets::PostAsset; use regex::Regex; -- cgit v1.2.3