diff options
author | Gabriel A. Giovanini <mail@gabrielgio.me> | 2022-06-10 22:20:13 +0200 |
---|---|---|
committer | Gabriel A. Giovanini <mail@gabrielgio.me> | 2022-06-10 22:20:13 +0200 |
commit | 0e147a780e74b54afbd56ff7438077d855d5c1c2 (patch) | |
tree | 25296b0370513c757416ea6d5e7258b4069b1307 | |
parent | 17d160e5f9cdd4e46b0ab08cf56eaedd8943d885 (diff) | |
download | macroblog.rs-0e147a780e74b54afbd56ff7438077d855d5c1c2.tar.gz macroblog.rs-0e147a780e74b54afbd56ff7438077d855d5c1c2.tar.bz2 macroblog.rs-0e147a780e74b54afbd56ff7438077d855d5c1c2.zip |
ref: Move from HTML to MD
Keep and write in html is pain, so I'm rendering md as html.
24 files changed, 506 insertions, 471 deletions
diff --git a/2020-08-22Moving_from_Github_to_Gitlab_pages.md b/2020-08-22Moving_from_Github_to_Gitlab_pages.md new file mode 100644 index 0000000..5bfa788 --- /dev/null +++ b/2020-08-22Moving_from_Github_to_Gitlab_pages.md @@ -0,0 +1,31 @@ +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. @@ -943,6 +943,15 @@ dependencies = [ ] [[package]] +name = "getopts" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" +dependencies = [ + "unicode-width", +] + +[[package]] name = "getrandom" version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1277,6 +1286,7 @@ dependencies = [ "cargo-watch", "chrono", "hyper", + "pulldown-cmark", "regex", "rust-embed", "sailfish", @@ -1726,6 +1736,18 @@ dependencies = [ ] [[package]] +name = "pulldown-cmark" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34f197a544b0c9ab3ae46c359a7ec9cbbb5c7bf97054266fecb7ead794a181d6" +dependencies = [ + "bitflags", + "getopts", + "memchr", + "unicase", +] + +[[package]] name = "quote" version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2402,6 +2424,15 @@ dependencies = [ ] [[package]] +name = "unicase" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" +dependencies = [ + "version_check", +] + +[[package]] name = "unicode-bidi" version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -11,6 +11,7 @@ regex = "1.5" rust-embed = "6.4.0" chrono = "0.4" actix-web = "4" +pulldown-cmark = "0.9.1" [dev-dependencies] cargo-watch = "8.1.1" diff --git a/content/posts/2019-03-03Welcome_to_my_blog.html b/content/posts/2019-03-03Welcome_to_my_blog.html deleted file mode 100644 index 10b1f05..0000000 --- a/content/posts/2019-03-03Welcome_to_my_blog.html +++ /dev/null @@ -1,6 +0,0 @@ -<section> - <p> - On this blog, I'll be posting some personal projects that I'm working on - or just logging stuff that I don't want to forget. - </p> -</section> diff --git a/content/posts/2019-03-03Welcome_to_my_blog.md b/content/posts/2019-03-03Welcome_to_my_blog.md new file mode 100644 index 0000000..a0ec118 --- /dev/null +++ b/content/posts/2019-03-03Welcome_to_my_blog.md @@ -0,0 +1,8 @@ +On this blog, I\'ll be posting some personal projects that I\'m working +on or just logging stuff that I don\'t want to forget. + +*Disclaimer*: English it\'s not my native language so if you find +something that you don\'t understand I\'d love you to open an +[issue](https://gitlab.com/gabrielgio/homestation/-/issuess), or if you +have something to add open a +[MR](phttps://gitlab.com/gabrielgio/homestation/-/merge_requests) diff --git a/content/posts/2019-03-07Automating_desktop_setup_with_ansible-pull_part-1.html b/content/posts/2019-03-07Automating_desktop_setup_with_ansible-pull_part-1.html deleted file mode 100644 index d06a648..0000000 --- a/content/posts/2019-03-07Automating_desktop_setup_with_ansible-pull_part-1.html +++ /dev/null @@ -1,94 +0,0 @@ -<section> - <p> - 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). - </p> - <p> - 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 <a href="https://www.ansible.com/">Ansible</a>. - 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 focuson - <a href="https://docs.ansible.com/ansible/latest/user_guide/playbooks_intro.html#ansible-pull"> - Ansible Pull - </a> - and - <a href="https://docs.ansible.com/ansible/latest/user_guide/playbooks.html"> - Playbooks - </a>. As better described: - <blockquote> - [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. - (<a href="https://docs.ansible.com/ansible/latest/cli/ansible-pull.html">source</a>) - </blockquote> - </p> - <p> - 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. - <br/> - 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: -<pre><code>[all] -localhost</code></pre> - </p> - <p> - As an experiment we're going to write a asks to install vim. Currently, I'm - using Fedora thus we going to use dnf modeule to install packages, but if - you're using another distribution look for a equivalent module like apt - module for Ubuntu. - - The playbook to install is quite simple: - -<pre><code># main.yaml -- hosts: all - tasks: - - name: install vim - dnf: - name: vim - state: latest</code></pre> - <dl> - <dt>host</dt> - <dd>it is required and it has to match our hosts otherwise the playbook won't run.</dd> - <dt>taks</dt> - <dd> - it is the list of tasks that the playbook will perform, in this case - will be dnf install vim. - </dd> - </dl> - </p> - <p> - 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: -<pre><code>sudo ansible-playbook --connection=local main.yml</code></pre> - </p> - <p> - After a few seconds, vim will be installed on your machine. -<pre><code>PLAY [all] ************************************************************* - -TASK [Gathering Facts] ************************************************* -ok: [localhost] - -TASK [install vim] ***************************************************** -ok: [localhost] - -PLAY RECAP ************************************************************* -localhost : ok=2 changed=0 unreachable=0 failed=0</code></pre> - </p> - <p> - This is the first step, next part we shall create a more complex playbook and - setup repository to run it remotely using ansible-pull. - </p> -</section> 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 new file mode 100644 index 0000000..58ecb0d --- /dev/null +++ b/content/posts/2019-04-22Automating_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-2.html b/content/posts/2019-04-22Automating_desktop_setup_with_ansible-pull_part-2.html deleted file mode 100644 index 707ba7d..0000000 --- a/content/posts/2019-04-22Automating_desktop_setup_with_ansible-pull_part-2.html +++ /dev/null @@ -1,70 +0,0 @@ -<section> - <a href="/posts/2019-03-07Automating_desktop_setup_with_ansible-pull_part-1.html">See part 1</a> - <p> - Now we're going to setup ansible to work with a git repository. The process is - quite similar to ansible-playbook, the only difference is that the source for - the playbook will be a remote repository and not a local file. Following the - previous example we'll get vim setup automated. - </p> - <p> - Create a git repository wherever you see - fit, <a href="https://about.gitlab.com/">gitlab</a> - and <a href="https://github.com/">github</a> offer free repositories. For - this task we need to add only two file: one for the yml file describing the - tasks and the .vimrc file. - </p> - <p> - In the .vimrc add your own configuration, you can see - mine - <a href="https://gitlab.com/gabrielgio/homestation/-/blob/debcf3458df511aef9f7dca0cb73f6cf6baddd5d/.vimrc"> - over here - </a>, it is pretty simple as I don't use it but for simple text editing - (like this post) so you can start with that if you don't have one. - </p> - <p> - The yml file will have two tasks, one is to install vim, just like we did in the part 1. -<pre><code># main.yml ---- -- name: install vim - dnf: - name: vim - state: latest</code></pre> - </p> - <p> - To copy .vimrc file to your $HOME we going to - use <a href="https://docs.ansible.com/ansible/latest/modules/copy_module.html">copy - module</a>: - </p> - <p> - After we've added those two files to repository you will have be something - <a href="https://gitlab.com/gabrielgio/homestation/-/tree/debcf3458df511aef9f7dca0cb73f6cf6baddd5d"> - like this. - </a> - <br/> - Parms: - <ul> - <li><strong>-i</strong> is a list of hosts</li> - <li><strong>-U</strong> is the get repository url</li> - </ul> - </p> - <p> - Remember man is your best friend, take a look at <code>man ansible-pull</code> to know - more about its parameters. - </p> - <p> - The best part you can quickly test and see the result by running my sample: -<pre><code>ansible-pull \ - -U https://gitlab.com/gabrielgio/homestation.git \ - -C debcf3458df511aef9f7dca0cb73f6cf6baddd5d \ - -i all \ - main.yml</code></pre> - </p> - <p> - The idea here is to keep your repository as a source of truth when comes to - configuration, you can add ansible-pull to a CRON tab, so you just need to - push something to your repository and after a few minutes not only your - machine but all the machines that have it setup will run the playbooks. You - can use this method as a simple way to install software, update machines or - even distribute tooling company-wise. - </p> -</section> diff --git a/content/posts/2019-04-22Automating_desktop_setup_with_ansible-pull_part-2.md b/content/posts/2019-04-22Automating_desktop_setup_with_ansible-pull_part-2.md new file mode 100644 index 0000000..2e56463 --- /dev/null +++ b/content/posts/2019-04-22Automating_desktop_setup_with_ansible-pull_part-2.md @@ -0,0 +1,68 @@ +Now we\'re going to setup ansible to work with a git repository. The +process is quite similar to `ansible-playbook`, the only difference is +that the source for the playbook will be a remote repository and not a +local file. Following the previous example we\'ll get vim setup +automated. + +Create a git repository wherever you see fit, +[gitlab](https://about.gitlab.com/) and [github](https://github.com/) offer +free repositories. For this task we need to add only two file: one for the +`yml` file describing the tasks and the `.vimrc` file. + +In the `.vimrc` add your own configuration, you can see mine [over +here](https://gitlab.com/gabrielgio/homestation/-/blob/debcf3458df511aef9f7dca0cb73f6cf6baddd5d/.vimrc), +it is pretty simple as I don\'t use it but for simple text editing (like this +post) so you can start with that if you don\'t have one. + +The `yml` file will have two tasks, one is to install vim, just like we did in +the part 1. + +```yaml # main.yml --- +- name: install vim dnf: name: vim state: latest +``` + +To copy `.vimrc` file to your `$HOME` we going to use [copy +module](https://docs.ansible.com/ansible/latest/modules/copy_module.html): + +``` yaml +# main.yml +--- +- name: copy vimrc file + copy: + src: config/.vimrc + dest: ~/ + mode: 0644 +``` + +After we\'ve added those two files to repository you will have be something +[like +this](https://gitlab.com/gabrielgio/homestation/-/tree/debcf3458df511aef9f7dca0cb73f6cf6baddd5d). + +And now we just need to run `ansible-pull` command + +``` shell +# you may need run it as a sudo +ansible-pull -U $YOUR_REPO -i all main.yml +``` + +Params: + +- **`-i`** is a list of hosts. +- **`-U`** is the git repository URL. + +Remember `man` is your best friend, take a look at `man ansible-pull` to +know more about its parameters. + +The best part you can quickly test and see the result by running my +sample: + +``` shell +ansible-pull -U https://gitlab.com/gabrielgio/homestation.git -C debcf3458df511aef9f7dca0cb73f6cf6baddd5d -i all main.yml +``` + +The idea here is to keep your repository as a source of truth when comes to +configuration, you can add `ansible-pull` to a CRON tab, so you just need to +push something to your repository and after a few minutes not only your machine +but all the machines that have it setup will run the playbooks. You can use +this method as a simple way to install software, update machines or even +distribute tooling company-wise. diff --git a/content/posts/2019-11-16Compiling_emacs_from_source_code_on_fedora.html b/content/posts/2019-11-16Compiling_emacs_from_source_code_on_fedora.html deleted file mode 100644 index f47040f..0000000 --- a/content/posts/2019-11-16Compiling_emacs_from_source_code_on_fedora.html +++ /dev/null @@ -1,31 +0,0 @@ -<section> -<p> - Compiling emacs from source and installing on fedora. -</p> -<h3>Installing packages</h3> -<p> - Install the following packages: -<pre><code>sudo dnf install git autoconf make gcc texinfo \ - gnutls-devel giflib-devel ncurses-devel \ - libjpeg-turbo-devel giflib-devel gtk3-devel \ - libXpm-devel libtiff-devel libxml2-devel -y</code></pre> -</p> -<h3>Cloning Repository</h3> -<p> - Clone repository - <a href="http://savannah.gnu.org/projects/emacs/">savannah.gnu.org</a> -<pre><code>git clone -b master git://git.sv.gnu.org/emacs.git</code></pre> -</p> -<h3>Compiling</h3> -<p> - Navigate to the emacs folder <code>cd emacs</code> and execute the following - steps: -<pre><code>./autogen.sh -./configure -make -j$(nproc) -sudo make install -</code></pre> - After verify version with <code>./emacs --version</code>, it - should be equal or higher than <strong>28.0.50</strong>. -</p> -</section> diff --git a/content/posts/2019-11-16Compiling_emacs_from_source_code_on_fedora.md b/content/posts/2019-11-16Compiling_emacs_from_source_code_on_fedora.md new file mode 100644 index 0000000..d316f40 --- /dev/null +++ b/content/posts/2019-11-16Compiling_emacs_from_source_code_on_fedora.md @@ -0,0 +1,31 @@ +Compiling emacs from source and installing on fedora. + +# Installing Packages + +Install the following packages: + + sudo dnf install git autoconf make gcc texinfo \ + gnutls-devel giflib-devel ncurses-devel \ + libjpeg-turbo-devel giflib-devel gtk3-devel \ + libXpm-devel libtiff-devel libxml2-devel -y + +# Cloning Repository + +Clone repository +[savannah.gnu.org](http://savannah.gnu.org/projects/emacs/): + + git clone -b master git://git.sv.gnu.org/emacs.git + +# Compiling + +Navigate to emacs folder (`cd emacs`) and execute the following steps + +```shell +./autogen.sh +./configure +make -j$(nproc) +sudo make install +``` + +After verify version with `emacs --version`, it should be equal or +higher than `28.0.50`{.verbatim}. diff --git a/content/posts/2020-07-12Road_to_local_K8S.html b/content/posts/2020-07-12Road_to_local_K8S.html deleted file mode 100644 index 52820b3..0000000 --- a/content/posts/2020-07-12Road_to_local_K8S.html +++ /dev/null @@ -1,101 +0,0 @@ -<section> - <h3>Goal</h3> - <p> - The goal is to deploy kubernetes on my local networks, and keep everything - as reproducible as possible. - </p> - <h3>Stack</h3> - <p> - I'll use Fedora Core OS, Matchbox and Terraform - <sup><a href="#footnotes">1</a></sup>, a match the requirements for - Tectonic<sup><a href="#footnotes">2</a></sup>.</p> - <h3>Steps</h3> - <ul> - <li>Network Setup DHCP/TFTP/DNS<sup><a href="#footnotes">3</a></sup></li> - <li>Matchbox<sup><a href="#footnotes">4</a></sup></li> - <li>PXE nextwork boot evnrionment</li> - <li>Terraform Tectonic<sup><a href="#footnotes">5</a></sup></li> - </ul> - <h3>Network Setup DHCP/TFTP/DNS</h3> - <p>First learning the basics</p> - <ul> - <li> - <a href="https://linuxhint.com/install_dhcp_server_ubuntu/"> - https://linuxhint.com/install_dhcp_server_ubuntu/ - </a> - </li> - <li> - <a href="https://www.youtube.com/watch?v=XQ3T14SIlV4"> - https://www.youtube.com/watch?v=XQ3T14SIlV4 - </a> - </li> - </ul> - <p> - To check open ports - <pre><code>lsof -Pni | grep LISTEN</code></pre> - </p> - <p> - Run the provided<sup><a href="#footnotes">6</a></sup> image with dnsmasq and - PXE toolkit - <pre><code>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</code></pre> - </p> - <h3>Matchbox</h3> - <p>...</p> - <h3>PXE network boot enviroment</h3> - <p>...</p> - <h3>Terraform Tectonic</h3> - <p>...</p> - <h3 id="footnotes">Links</h3> - <div > - <sup>1</sup> - <a href="https://coreos.com/tectonic/docs/latest/install/bare-metal/metal-terraform.html"> - https://coreos.com/tectonic/docs/latest/install/bare-metal/metal-terraform.html - </a> - <div> - <div> - <sup>2</sup> - <a href="https://coreos.com/tectonic/docs/latest/install/bare-metal/requirements.html"> - https://coreos.com/tectonic/docs/latest/install/bare-metal/requirements.html - </a> - <div> - <div> - <sup>3</sup> - <a href="https://coreos.com/matchbox/docs/latest/network-setup.html"> - https://coreos.com/matchbox/docs/latest/network-setup.html - </a> - <div> - <div> - <sup>4</sup> - <a href="https://coreos.com/matchbox/docs/latest/deployment.html"> - https://coreos.com/matchbox/docs/latest/deployment.html - </a> - <div> - <div> - <sup>5</sup> - <a href="https://coreos.com/tectonic/releases/"> - https://coreos.com/tectonic/releases/ - </a> - <div> - <div> - <sup>6</sup> - <a href="https://github.com/poseidon/matchbox/tree/v0.7.0/contrib/dnsmasq"> - https://github.com/poseidon/matchbox/tree/v0.7.0/contrib/dnsmasq - </a> - <div> -</section> diff --git a/content/posts/2020-07-13Road_to_local_K8S.md b/content/posts/2020-07-13Road_to_local_K8S.md new file mode 100644 index 0000000..a3ca530 --- /dev/null +++ b/content/posts/2020-07-13Road_to_local_K8S.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: + +- <https://linuxhint.com/install_dhcp_server_ubuntu/> +- <https://www.youtube.com/watch?v=XQ3T14SIlV4> + +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]: <https://coreos.com/tectonic/docs/latest/install/bare-metal/metal-terraform.html> + +[^2]: <https://coreos.com/tectonic/docs/latest/install/bare-metal/requirements.html> + +[^3]: <https://coreos.com/matchbox/docs/latest/network-setup.html> + +[^4]: <https://coreos.com/matchbox/docs/latest/deployment.html> + +[^5]: <https://coreos.com/tectonic/releases/> + +[^6]: <https://github.com/poseidon/matchbox/tree/v0.7.0/contrib/dnsmasq> diff --git a/content/posts/2020-07-14Friz_box_turned_off_DHCP.html b/content/posts/2020-07-14Friz_box_turned_off_DHCP.html deleted file mode 100644 index 3ee5daf..0000000 --- a/content/posts/2020-07-14Friz_box_turned_off_DHCP.html +++ /dev/null @@ -1,19 +0,0 @@ -<section> - <p> - If you turned off your DHCP server follow these steps to connect to - FritzBox settings. <br/> - <ul> - <li> - Set your computer IP to 170.254.1.2 and your mask to 255.255.0.0 - </li> - <li> Then go to 169.254.1.1, login and re-enable the DHCP server:</li> - </ul> - </p> - <p> - On gnome turn the wired connection off on again to apply the settings. - </p> - <p> - <strong>Note</strong>: why in the hell does FritzBox 7490 require a - land-line telephone to be physically factory reset? - </p> -</section> diff --git a/content/posts/2020-07-14Friz_box_turned_off_DHCP.md b/content/posts/2020-07-14Friz_box_turned_off_DHCP.md new file mode 100644 index 0000000..865067f --- /dev/null +++ b/content/posts/2020-07-14Friz_box_turned_off_DHCP.md @@ -0,0 +1,10 @@ +If you turned off your DHCP server follow these steps to connect to +FritzBox settings. + +- Set your computer IP to `169.254.1.2` and your mask to `255.255.0.0` +- Then go to `169.254.1.1`, login and re-enable the DHCP server. + +On gnome turn the wired connection off on again to apply the settings. + +Note: why in the hell does FritzBox 7490 require a land-line telephone +to be physically factory reset? diff --git a/content/posts/2020-08-22Moving_from_Github_to_Gilab_pages.html b/content/posts/2020-08-22Moving_from_Github_to_Gilab_pages.html deleted file mode 100644 index 5fb1d78..0000000 --- a/content/posts/2020-08-22Moving_from_Github_to_Gilab_pages.html +++ /dev/null @@ -1,38 +0,0 @@ -<section> - <p> - This was quite simple, I had just to create a simple Gitlab pipeline job and - publish to pages this is done by: - </p> - <pre><code>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</code></pre> - <dl> - <dt>before_script</dt> - <dd>will download all the dependencies with <code>lein deps.</code></dd> - <dt>test</dt> - <dd>it is self explanatory</dd> - <dt>pages</dt> - <dd> - it will compile cljs into js with <code>lein package</code> into - <code>public</code> folder to later be published into gitlab pages. Take a - look at the <code>artifacts</code> property, it is used to say wich will - will be collected. - </dd> - </dl> - -</section> diff --git a/content/posts/2020-08-22Moving_from_Github_to_Gilab_pages.md b/content/posts/2020-08-22Moving_from_Github_to_Gilab_pages.md new file mode 100644 index 0000000..f971a75 --- /dev/null +++ b/content/posts/2020-08-22Moving_from_Github_to_Gilab_pages.md @@ -0,0 +1,34 @@ +--- title: \"Moving from Github to Gitlab pages\" date: 2020-08-22 tags: +\[\'gitlab\'\] --- + +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/2020-12-28K8S_private_gitlab_registry_using_podman.md b/content/posts/2020-12-28K8S_private_gitlab_registry_using_podman.md new file mode 100644 index 0000000..c72e9ac --- /dev/null +++ b/content/posts/2020-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/content/posts/2021-12-26Enable_NFS_on_K3S.html b/content/posts/2021-12-26Enable_NFS_on_K3S.html deleted file mode 100644 index 22ddf33..0000000 --- a/content/posts/2021-12-26Enable_NFS_on_K3S.html +++ /dev/null @@ -1,61 +0,0 @@ -<section> - <p> - By default <a href="https://k3s.io/">K3S</a> comes only - with <a href="https://github.com/rancher/local-path-provisioner">local-path</a> - storage class, and if you are running with more than one node in your - cluster you may want to use a more “distributed” solution. - For may case I opted for NFS. - </p> - <p> - To check the current storage class you can run: - </p> - <pre><code>k3s kubectl get storageclasses</code></pre> - <p> - And it will print something like: - </p> - <pre><code>NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE -local-path (default) rancher.io/local-path Delete WaitForFirstConsumer false 154d</code></pre> - <p> - To start adding First you need to - install <a href="https://github.com/helm/helm">helm</a> on your server. - To do so you may run: - </p> - - <pre><code>curl -sSL https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash</code></pre> - <p> - Be careful when running scripts directly into bash always check the - source Sometimes is also recommended to do not pipe directly to bash - </p> - <p> - Once it is installed we need to add - the <a href="https://kubernetes.io/docs/concepts/storage/storage-classes/#nfs">NFS - storage classes</a>. It has two providers, I have - chose <a href="https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner">NFS - Subdir External Provisioner</a>. - </p> - <p> - Add the helm repo - </p> - - <pre><code>helm repo add nfs-subdir-external-provisioner https://kubernetes-sigs.github.io/nfs-subdir-external-provisioner/</code></pre> - <p> - Then we need to actually install the provider - </p> - <div class="org-src-container"> -<pre><code>helm install nfs-subdir-external-provisioner nfs-subdir-external-provisioner/nfs-subdir-external-provisioner ---set nfs.server=x.x.x.x ---set nfs.path=/exported/path</code></pre> - </div> - <p> - Set the <code>nfs.server</code> and <code>nfs.path</code> accordingly - with your setup. - </p> - <p> - After that if we run <code>k3s kubectl get storageclasses</code> it will - now print another NFS provider: - </p> - - <pre><code>NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE -local-path (default) rancher.io/local-path Delete WaitForFirstConsumer false 154d -nfs-client cluster.local/nfs-subdir-external-provisioner Delete Immediate true 76m</code></pre> -</section> diff --git a/content/posts/2021-12-26Enable_NFS_on_K3S.md b/content/posts/2021-12-26Enable_NFS_on_K3S.md new file mode 100644 index 0000000..426bf3d --- /dev/null +++ b/content/posts/2021-12-26Enable_NFS_on_K3S.md @@ -0,0 +1,56 @@ +By default [K3S](https://k3s.io/) comes only with +[local-path](https://github.com/rancher/local-path-provisioner) storage +class, and if you are running with more than one node in your cluster +you may want to use a more \"distributed\" solution. For may case I +opted for NFS. + +To check the current storage class you can run: + +``` bash +k3s kubectl get storageclasses +``` + +And it will print something like: + + NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE + local-path (default) rancher.io/local-path Delete WaitForFirstConsumer false 154d + +To start adding First you need to install +[helm](https://github.com/helm/helm) on your server. To do so you may +run: + +``` bash +curl -sSL https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash +``` + +**Be careful when running scripts directly into bash always check the +source** **Sometimes is also recommended to do not pipe directly to +bash** + +Once it is installed we need to add the [NFS storage +classes](https://kubernetes.io/docs/concepts/storage/storage-classes/#nfs). +It has two providers, I have chose [NFS Subdir External +Provisioner](https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner). + +Add the helm repo + +``` bash +helm repo add nfs-subdir-external-provisioner https://kubernetes-sigs.github.io/nfs-subdir-external-provisioner/ +``` + +Then we need to actually install the provider + +``` bash +helm install nfs-subdir-external-provisioner nfs-subdir-external-provisioner/nfs-subdir-external-provisioner \ + --set nfs.server=x.x.x.x \ + --set nfs.path=/exported/path +``` + +Set the `nfs.server` and `nfs.path` accordingly with your setup. + +After that if we run `k3s kubectl get storageclasses` it will now print +another NFS provider: + + NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE + local-path (default) rancher.io/local-path Delete WaitForFirstConsumer false 154d + nfs-client cluster.local/nfs-subdir-external-provisioner Delete Immediate true 76m diff --git a/content/posts/2021-12-28K8S_private_gitlab_registry_using_podman.html b/content/posts/2021-12-28K8S_private_gitlab_registry_using_podman.html deleted file mode 100644 index 470965c..0000000 --- a/content/posts/2021-12-28K8S_private_gitlab_registry_using_podman.html +++ /dev/null @@ -1,38 +0,0 @@ -<section> - <p> - This is based on <a - href="https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/">Log in to - Docker Hub</a>. It is just a bit different to use podman. - </p> - <p> - First we should take a look at podman-login man page: -<pre><code>man podman login</code></pre> - </p> - <p> - It will give some valueable information like the location of auth.json file. Now we can login using podman: -<pre><code>podman login registry.gitlab.com</code></pre> - </p> - <p>Then check the <code>auth.json</code> file located at <code>${XDG_RUNTIME_DIR}/containers/auth.json</code> (as described - by the manual). It will contain your auth config: -<pre><code>{ - "auths": { - "registry.gitlab.com": { - "auth": "..." - } - } -}</code></pre> - </p> - <p> - Now copy that file over to the server and register it in k8s with the following command: -<pre><code> -kubectl create secret generic regcred \ - --from-file=.dockerconfigjson=auth.json \ - --type=kubernetes.io/dockerconfigjson</code></pre> - </p> - <p> - Once you have created you can list by kubectl get secret: -<pre><code> -NAME TYPE DATA AGE -regcred kubernetes.io/dockerconfigjson 1 53s</code></pre> - </p> -</section> diff --git a/contrib/locust/locustfile.py b/contrib/locust/locustfile.py index ca7f8f3..fd22508 100644 --- a/contrib/locust/locustfile.py +++ b/contrib/locust/locustfile.py @@ -7,12 +7,12 @@ class HelloWorldUser(HttpUser): @task def posts(self): - self.client.get("/posts/2021-12-28K8S_private_gitlab_registry_using_podman.html") - self.client.get("/posts/2021-12-26Enable_NFS_on_K3S.html") - self.client.get("/posts/2020-08-22Moving_from_Github_to_Gilab_pages.html") - self.client.get("/posts/2020-07-14Friz_box_turned_off_DHCP.html") - self.client.get("/posts/2020-07-12Road_to_local_K8S.html") - self.client.get("/posts/2019-11-16Compiling_emacs_from_source_code_on_fedora.html") - self.client.get("/posts/2019-04-22Automating_desktop_setup_with_ansible-pull_part-2.html") - self.client.get("/posts/2019-03-07Automating_desktop_setup_with_ansible-pull_part-1.html") - self.client.get("/posts/2019-03-03Welcome_to_my_blog.html") + self.client.get("/posts/2021-12-28K8S_private_gitlab_registry_using_podman.md") + 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/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 0fa9543..c877303 100644 --- a/src/blog.rs +++ b/src/blog.rs @@ -1,4 +1,5 @@ use chrono::NaiveDate; +use pulldown_cmark::{html, Options, Parser}; use regex::Regex; use rust_embed::RustEmbed; use sailfish::TemplateOnce; @@ -60,8 +61,11 @@ impl BlogEntry { fn get_file_content(path: &str) -> String { let buffer = PostAsset::get(path).unwrap().data.into_owned(); - - return String::from_utf8(buffer).unwrap(); + let md = String::from_utf8(buffer).unwrap(); + let parser = Parser::new_ext(&md, Options::empty()); + let mut html_output = &mut String::new(); + html::push_html(&mut html_output, parser); + return html_output.to_string(); } pub fn render_post_page(path: &String) -> String { diff --git a/tests/test_blog.rs b/tests/test_blog.rs index 31d5725..b72f800 100644 --- a/tests/test_blog.rs +++ b/tests/test_blog.rs @@ -5,7 +5,7 @@ use chrono::NaiveDate; #[test] fn test_create_blog_entry() { - let asset_filename = String::from("2021-12-03Enable_NFS_on_K3S.html"); + let asset_filename = String::from("2021-12-03Enable_NFS_on_K3S.md"); let post_date = NaiveDate::from_ymd(2021, 12, 03); let blog_entry = BlogEntry::new(&asset_filename); @@ -23,7 +23,7 @@ fn test_read_assets() { #[test] fn test_render_post_page() { - let path = &String::from("2020-07-14Friz_box_turned_off_DHCP.html"); + let path = &String::from("2020-07-14Friz_box_turned_off_DHCP.md"); let page = render_post_page(path); assert!(!page.is_empty()); } |