From f3711a93832df46dc245075df08b9ebfc05266e9 Mon Sep 17 00:00:00 2001 From: Jasper Ras Date: Wed, 21 Aug 2024 16:22:08 +0200 Subject: forgot to commit for a while --- .obsidian/core-plugins-migration.json | 3 +- .obsidian/graph.json | 6 +- .obsidian/workspace.json | 86 ++++++++++++---------- 2024-08-21.md | 23 ++++++ Buffer/2024-01-08.md | 16 ++++ Buffer/2024-01-09.md | 24 ++++++ Buffer/2024-01-10.md | 5 ++ Buffer/2024-02-20.md | 12 +++ Buffer/2024-06-13.md | 2 + Buffer/2024-06-17.md | 10 +++ Buffer/2024-06-26.md | 0 Buffer/Blkio errors.md | 14 ++++ Buffer/ELF (files).md | 0 Buffer/Group.ONE Backup Service.md | 6 ++ Buffer/Issues met TC oplossen.md | 25 +++++++ Buffer/Neutron DNS & Designate.md | 3 + Buffer/Nix Flakes.md | 21 ++++++ Buffer/Nixpkgs Overlays.md | 0 Buffer/Nova Scheduler.md | 2 + Buffer/Ruby gems nixpkgs.md | 0 Buffer/Shell.nix python.md | 15 ++++ Buffer/Timings VPS.md | 4 + Buffer/Updates ansible ad-hoc.md | 19 +++++ Buffer/Zoner Migration.md | 1 + Nix.md | 16 ++++ ...Running programs in the background with tmux.md | 8 -- .../280620231200 - Direct Attach Cable -DAC.md | 9 --- The Kast/280620231201 - Transceiver.md | 5 -- The Kast/280620231556 - Svelte.md | 9 --- The Kast/280620231557 - SvelteKit.md | 7 -- .../280620231621 - Knowledge vs Information.md | 8 -- ...1634 - Using Zettelkasten as a thinking tool.md | 11 --- Zettelkast/Index/Computer Networking.md | 3 + Zettelkast/Index/Domain Driven Design.md | 2 + Zettelkast/Index/Golang.md | 3 + Zettelkast/Index/Nix.md | 1 + Zettelkast/Index/Python3.md | 3 + Zettelkast/Index/Software Architecture.md | 2 + Zettelkast/Index/_Index.md | 7 ++ Zettelkast/Notes/010420240957 - spf13 cobra.md | 13 ++++ Zettelkast/Notes/010720231037 - With function.md | 18 +++++ Zettelkast/Notes/010920231133 - OpenFlow.md | 2 + Zettelkast/Notes/010920231434 - (UNIX) Watch.md | 1 + .../Notes/022920240849 - Layered Architecture.md | 7 ++ .../Notes/022920240901 - Repository Pattern.md | 1 + .../032220240826 - Python3 Escape Sequences.md | 21 ++++++ Zettelkast/Notes/060620241559 - Adjacency Lists.md | 3 + ...13112 - Aggregates should protect invariants.md | 5 ++ Zettelkast/Notes/202406131159 - Invariant.md | 5 ++ .../280620231200 - Direct Attach Cable -DAC.md | 9 +++ Zettelkast/Notes/280620231201 - Transceiver.md | 5 ++ Zettelkast/Notes/280620231556 - Svelte.md | 9 +++ Zettelkast/Notes/280620231557 - SvelteKit.md | 7 ++ .../280620231621 - Knowledge vs Information.md | 8 ++ ...1634 - Using Zettelkasten as a thinking tool.md | 11 +++ Zettelkast/Notes/290220240839 - Domain Modeling.md | 5 ++ Zettelkast/Notes/290220240842 - Entity.md | 1 + Zettelkast/Notes/290220240843 - Value Object.md | 15 ++++ .../Notes/290220241409 - TDD High and Low Gear.md | 3 + Zettelkast/Notes/290220241412 - Service Layer.md | 3 + .../Notes/290220241458 - Unit of Work pattern.md | 40 ++++++++++ Zettelkast/Notes/290220241543 - Aggregates.md | 5 ++ ...Running programs in the background with tmux.md | 8 ++ Zettelkast/Notes/300820231007 - OVN.md | 32 ++++++++ Zettelkast/Notes/310820231448 - Neutron OVN.md | 1 + .../Notes/310820231618 - Open VSwitch (OVS).md | 3 + .../310820231706 - Networking One Giant Compute.md | 3 + 67 files changed, 536 insertions(+), 99 deletions(-) create mode 100644 2024-08-21.md create mode 100644 Buffer/2024-01-08.md create mode 100644 Buffer/2024-01-09.md create mode 100644 Buffer/2024-01-10.md create mode 100644 Buffer/2024-02-20.md create mode 100644 Buffer/2024-06-13.md create mode 100644 Buffer/2024-06-17.md create mode 100644 Buffer/2024-06-26.md create mode 100644 Buffer/Blkio errors.md create mode 100644 Buffer/ELF (files).md create mode 100644 Buffer/Group.ONE Backup Service.md create mode 100644 Buffer/Issues met TC oplossen.md create mode 100644 Buffer/Neutron DNS & Designate.md create mode 100644 Buffer/Nix Flakes.md create mode 100644 Buffer/Nixpkgs Overlays.md create mode 100644 Buffer/Nova Scheduler.md create mode 100644 Buffer/Ruby gems nixpkgs.md create mode 100644 Buffer/Shell.nix python.md create mode 100644 Buffer/Timings VPS.md create mode 100644 Buffer/Updates ansible ad-hoc.md create mode 100644 Buffer/Zoner Migration.md create mode 100644 Nix.md delete mode 100644 Staging/300620231000 - Running programs in the background with tmux.md delete mode 100644 The Kast/280620231200 - Direct Attach Cable -DAC.md delete mode 100644 The Kast/280620231201 - Transceiver.md delete mode 100644 The Kast/280620231556 - Svelte.md delete mode 100644 The Kast/280620231557 - SvelteKit.md delete mode 100644 The Kast/280620231621 - Knowledge vs Information.md delete mode 100644 The Kast/280620231634 - Using Zettelkasten as a thinking tool.md create mode 100644 Zettelkast/Index/Computer Networking.md create mode 100644 Zettelkast/Index/Domain Driven Design.md create mode 100644 Zettelkast/Index/Golang.md create mode 100644 Zettelkast/Index/Nix.md create mode 100644 Zettelkast/Index/Python3.md create mode 100644 Zettelkast/Index/Software Architecture.md create mode 100644 Zettelkast/Index/_Index.md create mode 100644 Zettelkast/Notes/010420240957 - spf13 cobra.md create mode 100644 Zettelkast/Notes/010720231037 - With function.md create mode 100644 Zettelkast/Notes/010920231133 - OpenFlow.md create mode 100644 Zettelkast/Notes/010920231434 - (UNIX) Watch.md create mode 100644 Zettelkast/Notes/022920240849 - Layered Architecture.md create mode 100644 Zettelkast/Notes/022920240901 - Repository Pattern.md create mode 100644 Zettelkast/Notes/032220240826 - Python3 Escape Sequences.md create mode 100644 Zettelkast/Notes/060620241559 - Adjacency Lists.md create mode 100644 Zettelkast/Notes/20240613112 - Aggregates should protect invariants.md create mode 100644 Zettelkast/Notes/202406131159 - Invariant.md create mode 100644 Zettelkast/Notes/280620231200 - Direct Attach Cable -DAC.md create mode 100644 Zettelkast/Notes/280620231201 - Transceiver.md create mode 100644 Zettelkast/Notes/280620231556 - Svelte.md create mode 100644 Zettelkast/Notes/280620231557 - SvelteKit.md create mode 100644 Zettelkast/Notes/280620231621 - Knowledge vs Information.md create mode 100644 Zettelkast/Notes/280620231634 - Using Zettelkasten as a thinking tool.md create mode 100644 Zettelkast/Notes/290220240839 - Domain Modeling.md create mode 100644 Zettelkast/Notes/290220240842 - Entity.md create mode 100644 Zettelkast/Notes/290220240843 - Value Object.md create mode 100644 Zettelkast/Notes/290220241409 - TDD High and Low Gear.md create mode 100644 Zettelkast/Notes/290220241412 - Service Layer.md create mode 100644 Zettelkast/Notes/290220241458 - Unit of Work pattern.md create mode 100644 Zettelkast/Notes/290220241543 - Aggregates.md create mode 100644 Zettelkast/Notes/300620231000 - Running programs in the background with tmux.md create mode 100644 Zettelkast/Notes/300820231007 - OVN.md create mode 100644 Zettelkast/Notes/310820231448 - Neutron OVN.md create mode 100644 Zettelkast/Notes/310820231618 - Open VSwitch (OVS).md create mode 100644 Zettelkast/Notes/310820231706 - Networking One Giant Compute.md diff --git a/.obsidian/core-plugins-migration.json b/.obsidian/core-plugins-migration.json index 5c13490..773c718 100644 --- a/.obsidian/core-plugins-migration.json +++ b/.obsidian/core-plugins-migration.json @@ -25,5 +25,6 @@ "workspaces": false, "file-recovery": true, "publish": false, - "sync": false + "sync": false, + "properties": false } \ No newline at end of file diff --git a/.obsidian/graph.json b/.obsidian/graph.json index 917a32a..1e854ab 100644 --- a/.obsidian/graph.json +++ b/.obsidian/graph.json @@ -4,7 +4,7 @@ "showTags": true, "showAttachments": false, "hideUnresolved": false, - "showOrphans": true, + "showOrphans": false, "collapse-color-groups": true, "colorGroups": [], "collapse-display": true, @@ -14,9 +14,9 @@ "lineSizeMultiplier": 1, "collapse-forces": false, "centerStrength": 0.307291666666667, - "repelStrength": 7.39583333333333, + "repelStrength": 7.60416666666667, "linkStrength": 1, "linkDistance": 77, - "scale": 4.852477396350719, + "scale": 0.7235574382398348, "close": false } \ No newline at end of file diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json index def4eac..b028daa 100644 --- a/.obsidian/workspace.json +++ b/.obsidian/workspace.json @@ -4,35 +4,22 @@ "type": "split", "children": [ { - "id": "8d5cedb809e07481", + "id": "7d88ea66e5554b07", "type": "tabs", "children": [ { - "id": "19d7e026926f7ec9", + "id": "b4f55b03d2399001", "type": "leaf", "state": { "type": "markdown", "state": { - "file": "The Kast/280620231557 - SvelteKit.md", - "mode": "source", - "source": false - } - } - }, - { - "id": "ebfb5ee240225d71", - "type": "leaf", - "state": { - "type": "markdown", - "state": { - "file": "Staging/300620231000 - Running programs in the background with tmux.md", + "file": "2024-08-21.md", "mode": "source", "source": false } } } - ], - "currentTab": 1 + ] } ], "direction": "vertical" @@ -82,7 +69,7 @@ } ], "direction": "horizontal", - "width": 300 + "width": 538.5 }, "right": { "id": "e9d5dc9be44f8587", @@ -98,7 +85,7 @@ "state": { "type": "backlink", "state": { - "file": "Staging/300620231000 - Running programs in the background with tmux.md", + "file": "2024-08-21.md", "collapseAll": false, "extraContext": false, "sortOrder": "alphabetical", @@ -115,7 +102,7 @@ "state": { "type": "outgoing-link", "state": { - "file": "Staging/300620231000 - Running programs in the background with tmux.md", + "file": "2024-08-21.md", "linksCollapsed": false, "unlinkedCollapsed": true } @@ -138,11 +125,12 @@ "state": { "type": "outline", "state": { - "file": "Staging/300620231000 - Running programs in the background with tmux.md" + "file": "2024-08-21.md" } } } - ] + ], + "currentTab": 3 } ], "direction": "horizontal", @@ -158,22 +146,44 @@ "command-palette:Open command palette": false } }, - "active": "ebfb5ee240225d71", + "active": "b4f55b03d2399001", "lastOpenFiles": [ - "The Kast/280620231557 - SvelteKit.md", - "Staging/300620231000 - Running programs in the background with tmux.md", - "The Kast/280620231556 - Svelte.md", - "Staging", - "The Kast", - "The Kast/280620231634 - Using Zettelkasten as a thinking tool.md", - "2023-06-28.md", - "The Kast/280620231621 - Knowledge vs Information.md", - "Web Development.md", - "Networking.md", - "The Kast/280620231200 - Direct Attach Cable -DAC.md", - "The Kast/280620231201 - Transceiver.md", - "280620231202 - Top of rack.md", - "280620231555 - Routing (TODO).md", - "Untitled.canvas" + "Refined/Untitled.md", + "2024-08-21.md", + "Nix.md", + "Refined", + "Daily", + "Buffer/Issues met TC oplossen.md", + "2024-07-17.md", + "2024-08-07.md", + "OVN Logical Network.md", + "Untitled.canvas", + "Buffer/2024-01-08.md", + "Buffer/2024-01-09.md", + "Buffer/2024-01-10.md", + "Buffer/2024-02-20.md", + "Buffer/2024-06-13.md", + "Buffer/2024-06-17.md", + "Buffer/2024-06-26.md", + "Zettelkast/Notes/010420240957 - spf13 cobra.md", + "Zettelkast/Notes/010720231037 - With function.md", + "Zettelkast/Notes/060620241559 - Adjacency Lists.md", + "Zettelkast/Notes/032220240826 - Python3 Escape Sequences.md", + "Zettelkast/Notes/280620231634 - Using Zettelkasten as a thinking tool.md", + "Zettelkast/Notes/290220240839 - Domain Modeling.md", + "Zettelkast/Notes/310820231706 - Networking One Giant Compute.md", + "Buffer/Ruby gems nixpkgs.md", + "Buffer/Nova Scheduler.md", + "Buffer/Nix Flakes.md", + "Buffer/Nixpkgs Overlays.md", + "Buffer/Neutron DNS & Designate.md", + "Zettelkast/Notes", + "Zettelkast/Index", + "What happened to me/2024/Week 2", + "What happened to me/2024", + "Buffer", + "Other stuff", + "Informational notes", + "Staging" ] } \ No newline at end of file diff --git a/2024-08-21.md b/2024-08-21.md new file mode 100644 index 0000000..3a76eab --- /dev/null +++ b/2024-08-21.md @@ -0,0 +1,23 @@ +Need to start learning to take notes consistently. My idea now, to kick-off this process, is to open a daily note in obsidian every day at the start of the day in which I will keep crude, quick notes. +Then at the end of the day I shall take some time to go over the notes and refine them. Not yet sure if that refinement will already be the end result or if i should go over refined notes again at maybe the end of each week to see if they really stick. +I should commit notes to git to save them. + +Use taskwarrior to keep track of todo's. +`task [ | ]` +commands can be abbreviated as long as they dont become ambigious. +Tasks can be recurring. +See `man task`, specially the CONTEXT section, because i'm always confused about the context, `task context none` to unset the damn thing. +Annotate tasks that are critical with the critical tag, `task annotate +critical` or `task add +critical blaat` +Upgraded to taskwarrior3. Should set-up a task server to synchronize tasks to so I don't lose all of them if my laptop dies. + +Don't forget to always read man pages. Maybe I should create a detailed note about how to use man pages. + +I will start going to the office full-time from now on. +I should make sure my Obsidian notes and taskwarrior tasks are kept safely in a git repo in case i lose my laptop.l + +Today I learned that we can influence the output of `rabbitmqctl list_queues` , we can append it with keywords of columns that it should show, this also allows us to reorder them to set those pesky names on the end to have nicer formatting. +`rabbitmqctl list_queues messages consumers name` shows messages accumulated in Q and the number of consumers it has and then ends with the name. Of course this is explained in the manpage which I should read more often as noted before. + +I should ask for a diagram of the current systems and take note of it, e.g what is OneCRM / OneHOP / OneHome and all that. + +To upgrade a single package using apt we can use `apt-get install --only-upgrade `. \ No newline at end of file diff --git a/Buffer/2024-01-08.md b/Buffer/2024-01-08.md new file mode 100644 index 0000000..13eee22 --- /dev/null +++ b/Buffer/2024-01-08.md @@ -0,0 +1,16 @@ +--- +tags: + - qemu + - qemu-guest-agent + - backups +--- +Got QEMU Guest agent working via booting a VM with an image after setting `hw_qemu_guest_agent='yes'` on that image. + +Put a script under `/etc/qemu/fsfreeze-hook.d/` with the executable flag set that echo's 'yo' when it is run. + +Tried Cinder backup: script not called +Tried Cinder snapshot: script not called +Tried Nova snapshot: script not called. + +--- +10.40 - 16.00 \ No newline at end of file diff --git a/Buffer/2024-01-09.md b/Buffer/2024-01-09.md new file mode 100644 index 0000000..e0d0937 --- /dev/null +++ b/Buffer/2024-01-09.md @@ -0,0 +1,24 @@ +--- +tags: + - idea + - oslo_messaging + - tuning + - maintenance + - issue +--- +Had an idea to develop a tool to parse openstack release pages to see what's new from the CLI. + +Continued maintenance after making sure cold migrations do work on running VMs and make sure they are started again after migrating. + +Messaging timeouts occurred during maintenance. Found some settings to tune the neutron and nova oslo messaging library. +https://docs.mirantis.com/mcp/q4-18/mcp-deployment-guide/advanced-config/tune-rabbitmq-perf.html + +Learned about the HAProxy ansible module: +https://docs.ansible.com/ansible/latest/collections/community/general/haproxy_module.html + +We decided to add ansible playbooks for enabling and disabling services. So we can disable the neutron controller in haproxy before restarting it. This prevents an issue where it is being flooded with requests while starting up and causing it to process SSL requests before even having loaded the SSL certificates. + +Forgot that I had to visit the mortgage advisor at the end of the afternoon. + +--- +9.30 - 16.00 diff --git a/Buffer/2024-01-10.md b/Buffer/2024-01-10.md new file mode 100644 index 0000000..6a91cdb --- /dev/null +++ b/Buffer/2024-01-10.md @@ -0,0 +1,5 @@ +Maintenance had been stopped due to an hanging apt-lock on n40 vps2 compute. Killed the hanging process and resumed maintenance. + + +--- +9.30 \ No newline at end of file diff --git a/Buffer/2024-02-20.md b/Buffer/2024-02-20.md new file mode 100644 index 0000000..2359685 --- /dev/null +++ b/Buffer/2024-02-20.md @@ -0,0 +1,12 @@ +Building an OpenStack service. + +**Things to look into** +- Tox (testing I think) +- Project structure +- Conventions +- Deployment considerations +- https://opendev.org/openstack/requirements/ + +**Tox** +https://tox.wiki/en/4.13.0/ +Test automation and standardization. \ No newline at end of file diff --git a/Buffer/2024-06-13.md b/Buffer/2024-06-13.md new file mode 100644 index 0000000..61a16ac --- /dev/null +++ b/Buffer/2024-06-13.md @@ -0,0 +1,2 @@ +Tests: +- \ No newline at end of file diff --git a/Buffer/2024-06-17.md b/Buffer/2024-06-17.md new file mode 100644 index 0000000..144e133 --- /dev/null +++ b/Buffer/2024-06-17.md @@ -0,0 +1,10 @@ +Investigated the last remaining error with a missing reply queue which was the likely suspect of some alerts of compute service down etc. After some digging in Kibana i noticed a compute node that was logging MessagingTimeouts. I restarted the compute service on this node and it seems to have resolved the errors. + +Both system test in CPH8 and LEJ1 were failing. CPH8 likely due to me restarting neutron-server earlier that morning in an attempt to fix the reply queue error. +LEJ1 had been failing since 14th of June. My guess is due to some maintenance related issue. Both system tests are running smoothly again after cleaning up their artifacts. + +Meanwhile, maintenance on VPS1-LEJ1 is still on-going and causing headaches. Another password refresh of the access node caused a migration to fail during post-cleanup and I had to set the host and node of the instance to the correct node directly via MySQL. I should apply Rutgers' suggestion of saving some variables in the OS_\* env vars, rather sooner than later. + +Tested retention backups being scheduled, and deployed it to prod. + +Investigate whether we can listen for notifications by Nova so that we can listen for server deletions and remove them from periodic backups. There should be no need to delete backups for the server, as the retention policy will have them deleted after a while. \ No newline at end of file diff --git a/Buffer/2024-06-26.md b/Buffer/2024-06-26.md new file mode 100644 index 0000000..e69de29 diff --git a/Buffer/Blkio errors.md b/Buffer/Blkio errors.md new file mode 100644 index 0000000..2b666a3 --- /dev/null +++ b/Buffer/Blkio errors.md @@ -0,0 +1,14 @@ +Dmesg is spewing blkio errors + +Find out which device: e.g dm-4, then: +``` +sudo virsh list --all --name | while read dom; do sudo virsh dumpxml $dom | grep dm-4 && echo $dom; done +``` +To find which domain +After which: +``` +sudo virsh dumpxml $domain +``` +to find the hostname + +reboot it hard. \ No newline at end of file diff --git a/Buffer/ELF (files).md b/Buffer/ELF (files).md new file mode 100644 index 0000000..e69de29 diff --git a/Buffer/Group.ONE Backup Service.md b/Buffer/Group.ONE Backup Service.md new file mode 100644 index 0000000..ebb2c92 --- /dev/null +++ b/Buffer/Group.ONE Backup Service.md @@ -0,0 +1,6 @@ +# Ubiquitous language +**Project** The customer or tenant that owns the servers, backups and periodic backups. +**Server** Is the subject of a backup or periodic backup. It has one or more disks assigned. +**Disk** Can either be a local storage disk or shared storage volume. It is attached to a server and can be referenced by its name. +**Backup** Is a snapshot in time of a server. It can be used to restore a server to how it was exactly at that moment in time. +**PeriodicBackup** Is a group of servers that will be backed up periodically. \ No newline at end of file diff --git a/Buffer/Issues met TC oplossen.md b/Buffer/Issues met TC oplossen.md new file mode 100644 index 0000000..4ad3bf8 --- /dev/null +++ b/Buffer/Issues met TC oplossen.md @@ -0,0 +1,25 @@ +Probleem: referenties in ovs naar devices die niet meer bestaan. Hij probeert vervolgens een nieuw device aan te maken met een qdisc op zo'n niet bestaande device. + +``` +sudo grep -r 'could not open network device' /var/log/openvswitch/ | grep -oi 'tap[a-z0-9\-]*' | uniq > ports_no_device +``` +``` +sudo ip l l | grep ports_no_device | grep -oi 'tap[a-z0-9\-]*' > ports_with_device +``` +``` +for P in $(cat ports_no_device | grep -v -f ports_with_device); do sudo ovs-vsctl del-port $P; done +``` +``` +sudo systemctl restart ovn-controller +``` + + +Rutger versie: +``` +sudo grep 'could not open network device' /var/log/openvswitch/ovs-vswitchd.log | grep -oi 'tap[a-z0-9\-]*' | sort | uniq | while read dev; do ip l l $dev || sudo ovs-vsctl del-port $dev; done; sudo systemctl restart ovn-controller +``` + + +Dus: ovs-vsctl del-port is nice. + +Niet vergeten ovn-controller te herstarten. diff --git a/Buffer/Neutron DNS & Designate.md b/Buffer/Neutron DNS & Designate.md new file mode 100644 index 0000000..48785ab --- /dev/null +++ b/Buffer/Neutron DNS & Designate.md @@ -0,0 +1,3 @@ +https://docs.openstack.org/neutron/latest/admin/config-dns-int.html#config-dns-int + +Lijkt er op dat dns_domain overruled kan worden op port niveau. \ No newline at end of file diff --git a/Buffer/Nix Flakes.md b/Buffer/Nix Flakes.md new file mode 100644 index 0000000..cb7f69b --- /dev/null +++ b/Buffer/Nix Flakes.md @@ -0,0 +1,21 @@ +#nix + +Nix flakes are source trees containing a file `flake.nix` at their root. The file `flake.nix` provides a standardized way to provide [[Zettelkast/Index/Nix]] artifacts. It's like a package manager for [[Zettelkast/Index/Nix]]. A flake can be dependent on other Flakes and it's possible to pin dependencies to exact revisions by using a `flake.lock` file. + +Nix flake evaluation is hermetic, meaning that it produces the same result wherever it's built.k + +The feature can be enabled in `~/.config/nix/nix.conf`: + +``` +experimental-features = nix-command flakes +``` + +To initialize in a repo: `nix flake init`. + +In flakes dependencies have to be specified explicitly and MUST be locked to specific versions therefore it's no longer allowed to use the nixpkgs found in `NIX_PATH` by referencing it like ``. + +Output of a Flake is an arbitrary [[Zettelkast/Index/Nix]] value such as a package, [[NixOS]] module or library function. +Commands `nix build` and `nix shell` will build the output `packages..default` unless we specify another output, for example: `nix shell .#checks.aarch64-linux.build`. + +--- +[Flakes Wiki](https://nixos.wiki/wiki/Flakes) \ No newline at end of file diff --git a/Buffer/Nixpkgs Overlays.md b/Buffer/Nixpkgs Overlays.md new file mode 100644 index 0000000..e69de29 diff --git a/Buffer/Nova Scheduler.md b/Buffer/Nova Scheduler.md new file mode 100644 index 0000000..1f58400 --- /dev/null +++ b/Buffer/Nova Scheduler.md @@ -0,0 +1,2 @@ +Applies Filters to filters compute hosts that are not usable until a list remains of usable compute hosts. +Filters have different costs, thus it's a good idea to put lightweight filters first as to reduce the load on the heavyweight ones. \ No newline at end of file diff --git a/Buffer/Ruby gems nixpkgs.md b/Buffer/Ruby gems nixpkgs.md new file mode 100644 index 0000000..e69de29 diff --git a/Buffer/Shell.nix python.md b/Buffer/Shell.nix python.md new file mode 100644 index 0000000..7dabd4d --- /dev/null +++ b/Buffer/Shell.nix python.md @@ -0,0 +1,15 @@ +https://nixos.org/manual/nixpkgs/stable/#python + +```nix +{ pkgs ? import {}}: + +pkgs.mkShell { + packages = [ pkgs.virtualenv ]; +} +``` + +```nix +with import {}; +( +let my_toolz = python311.pkgs.buildPythonPackage rec { pname = "toolz"; version = "0.10.0"; pyproject = true; src = fetchPypi { inherit pname version; hash = "sha256-CP3V73yWSArRHBLUct4hrNMjWZlvaaUlkpm1QP66RWA="; }; nativeBuildInputs = [ python311.pkgs.setuptools python311.pkgs.wheel ]; # has no tests doCheck = false; meta = { homepage = "https://github.com/pytoolz/toolz/"; description = "List processing tools and functional utilities"; # [...] }; }; in python311.withPackages (ps: with ps; [ numpy my_toolz ]) ).env +``` \ No newline at end of file diff --git a/Buffer/Timings VPS.md b/Buffer/Timings VPS.md new file mode 100644 index 0000000..51857df --- /dev/null +++ b/Buffer/Timings VPS.md @@ -0,0 +1,4 @@ +10 VPS: avg ms over 100 reqs: 225 ms +20 VPS: first request: 247 ms. avg ms over 100 reqs: 203 ms +50 VPS: first request: 259 ms. avg ms over 100 reqs: 220 ms +101 VPS: first request: 264 ms. avg ms over 100 reqs: 221 ms diff --git a/Buffer/Updates ansible ad-hoc.md b/Buffer/Updates ansible ad-hoc.md new file mode 100644 index 0000000..2b8514c --- /dev/null +++ b/Buffer/Updates ansible ad-hoc.md @@ -0,0 +1,19 @@ +update apt cache: +``` +ansible -m ansible.builtin.apt -a "update_cache=true cache_valid_time=3600" +``` + +update packages: +``` +ansible -m ansible.builtin.apt -a "name=* state=latest" +``` + +run puppet: +``` +ansible -a "/opt/puppetlabs/bin/puppet agent --test" +``` + +reboot: +``` +ansible -m ansible.builtin.reboot -f 1 +``` diff --git a/Buffer/Zoner Migration.md b/Buffer/Zoner Migration.md new file mode 100644 index 0000000..dc61370 --- /dev/null +++ b/Buffer/Zoner Migration.md @@ -0,0 +1 @@ +* Kernel installation \ No newline at end of file diff --git a/Nix.md b/Nix.md new file mode 100644 index 0000000..fca31a8 --- /dev/null +++ b/Nix.md @@ -0,0 +1,16 @@ + `nix repl` to interactively evaluate Nix expressions. `:p` if output is not full. + `nix-instantiate --eval .nix` to evaluate a Nix expression from a file. `--strict`. + +Nix is like JSON, but with functions. +Recursive attribute sets can reference values declared earlier in the same set. +```nix +rec { + one = 1; + two = one + 1; +} +``` + +A `let` binding is used to assign names to values just as attribute sets, they can then be used in expressions. Let bindings have a local scope. + +A `with` allows referencing attributes of attribute sets without referencing the set. + diff --git a/Staging/300620231000 - Running programs in the background with tmux.md b/Staging/300620231000 - Running programs in the background with tmux.md deleted file mode 100644 index b338da5..0000000 --- a/Staging/300620231000 - Running programs in the background with tmux.md +++ /dev/null @@ -1,8 +0,0 @@ -#tmux - -Tmux can be used to run programs in the background by opening a tmux session and starting the program. It is then possible to detach from that session while the program keeps running. - -It's also possible to directly start a program in its own session: - tmux new-session obsidian or leader+A $ and then new-session obsidian. - ---- diff --git a/The Kast/280620231200 - Direct Attach Cable -DAC.md b/The Kast/280620231200 - Direct Attach Cable -DAC.md deleted file mode 100644 index fb1bf77..0000000 --- a/The Kast/280620231200 - Direct Attach Cable -DAC.md +++ /dev/null @@ -1,9 +0,0 @@ -#datacenter - -A direct attach cable is used in data center environments to connect hardware such as servers, routers and switches. -Has a [[280620231201 - Transceiver]] on both ends. -Used most commonly to connect hardware in a rack to a switch in the top of a rack. -Can be up to 7 meter. -They are a lot cheaper than fiber. - ---- diff --git a/The Kast/280620231201 - Transceiver.md b/The Kast/280620231201 - Transceiver.md deleted file mode 100644 index 7bba020..0000000 --- a/The Kast/280620231201 - Transceiver.md +++ /dev/null @@ -1,5 +0,0 @@ -#datacenter - -A transceiver is an electronic device which can both transmit and receive signals. - ---- diff --git a/The Kast/280620231556 - Svelte.md b/The Kast/280620231556 - Svelte.md deleted file mode 100644 index 0e9d077..0000000 --- a/The Kast/280620231556 - Svelte.md +++ /dev/null @@ -1,9 +0,0 @@ -#web-development #svelte - -Svelte is a way to write UI components. It is a compiled language and compiles into JavaScript that can be run to render HTML for the page and CSS to style it. -It's not a full framework and thus would require additional components to build a complete application. -Therefore it can be used as a nice way to quickly build a simple web page using reusable components but with additional tools like [[280620231557 - SvelteKit]] it can be used to build an entire application. - ---- -[SvelteKit Documentation](https://kit.svelte.dev/docs/introduction#what-is-svelte) - diff --git a/The Kast/280620231557 - SvelteKit.md b/The Kast/280620231557 - SvelteKit.md deleted file mode 100644 index fd2f36a..0000000 --- a/The Kast/280620231557 - SvelteKit.md +++ /dev/null @@ -1,7 +0,0 @@ -#web-development #svelte - -SvelteKit is a framework for developing applications using [[280620231556 - Svelte]]. -It provides features like routing, server-side rendering and enables us to conform to best practices, like specific build optimizations, offline support, preloading pages, - ---- -[SvelteKit Documentation](https://kit.svelte.dev/docs/introduction) \ No newline at end of file diff --git a/The Kast/280620231621 - Knowledge vs Information.md b/The Kast/280620231621 - Knowledge vs Information.md deleted file mode 100644 index 183eb35..0000000 --- a/The Kast/280620231621 - Knowledge vs Information.md +++ /dev/null @@ -1,8 +0,0 @@ -#zettelkasten #note-taking - -The body of a Zettel [[280620231634 - Using Zettelkasten as a thinking tool]] should contain knowledge. -Information is just static lifeless data ready to be interpreted. Knowledge is information with added context and relevance. -It should still be relevant in the same context 10 years from now as it was when writing it. If we just capture some information. Without the context our later selves will probably look at it and wonder WTF it was for. - ---- -[Zettelkasten Introduction](https://zettelkasten.de/introduction/#the-body-of-the-zettel) \ No newline at end of file diff --git a/The Kast/280620231634 - Using Zettelkasten as a thinking tool.md b/The Kast/280620231634 - Using Zettelkasten as a thinking tool.md deleted file mode 100644 index ec7454d..0000000 --- a/The Kast/280620231634 - Using Zettelkasten as a thinking tool.md +++ /dev/null @@ -1,11 +0,0 @@ -#zettelkasten #note-taking - -Zettelkasten is a method of note taking that can be seen as a thinking tool. The idea is that thoughts are captured in atomic notes (Zettel) and reference other such notes creating a graph. The graph may later reveal connections between topics that weren't visible before. - -The main important things are that: -- A zettel has a unique identifier -- A piece of knowledge -- Some references to whatever this knowledge came from ( or none if it's just a thought of our own ) - ---- -[Zettelkasten introduction](https://zettelkasten.de/introduction/) \ No newline at end of file diff --git a/Zettelkast/Index/Computer Networking.md b/Zettelkast/Index/Computer Networking.md new file mode 100644 index 0000000..0993b44 --- /dev/null +++ b/Zettelkast/Index/Computer Networking.md @@ -0,0 +1,3 @@ +[[300820231007 - OVN]] +[[310820231706 - Networking One Giant Compute]] +[[310820231618 - Open VSwitch (OVS)]] diff --git a/Zettelkast/Index/Domain Driven Design.md b/Zettelkast/Index/Domain Driven Design.md new file mode 100644 index 0000000..f926e78 --- /dev/null +++ b/Zettelkast/Index/Domain Driven Design.md @@ -0,0 +1,2 @@ +[[290220240839 - Domain Modeling]] +[[290220241543 - Aggregates]] diff --git a/Zettelkast/Index/Golang.md b/Zettelkast/Index/Golang.md new file mode 100644 index 0000000..2da2043 --- /dev/null +++ b/Zettelkast/Index/Golang.md @@ -0,0 +1,3 @@ +The Go programming language + +[[010420240957 - spf13 cobra]] \ No newline at end of file diff --git a/Zettelkast/Index/Nix.md b/Zettelkast/Index/Nix.md new file mode 100644 index 0000000..f107402 --- /dev/null +++ b/Zettelkast/Index/Nix.md @@ -0,0 +1 @@ +[[010720231037 - With function]] \ No newline at end of file diff --git a/Zettelkast/Index/Python3.md b/Zettelkast/Index/Python3.md new file mode 100644 index 0000000..6a8c99a --- /dev/null +++ b/Zettelkast/Index/Python3.md @@ -0,0 +1,3 @@ +The python3 programming language notes.' + +[[032220240826 - Python3 Escape Sequences]] \ No newline at end of file diff --git a/Zettelkast/Index/Software Architecture.md b/Zettelkast/Index/Software Architecture.md new file mode 100644 index 0000000..590757e --- /dev/null +++ b/Zettelkast/Index/Software Architecture.md @@ -0,0 +1,2 @@ +[[Domain Driven Design]] +[[022920240849 - Layered Architecture]] \ No newline at end of file diff --git a/Zettelkast/Index/_Index.md b/Zettelkast/Index/_Index.md new file mode 100644 index 0000000..05d5d74 --- /dev/null +++ b/Zettelkast/Index/_Index.md @@ -0,0 +1,7 @@ +[[Software Architecture]] +[[Python3]] +[[Golang]] +[[Zettelkast/Index/Nix]] + +[[300820231007 - OVN]] +[[280620231634 - Using Zettelkasten as a thinking tool]] \ No newline at end of file diff --git a/Zettelkast/Notes/010420240957 - spf13 cobra.md b/Zettelkast/Notes/010420240957 - spf13 cobra.md new file mode 100644 index 0000000..e867fe6 --- /dev/null +++ b/Zettelkast/Notes/010420240957 - spf13 cobra.md @@ -0,0 +1,13 @@ +Cobra is a [[Golang]] library for creating command-line interfaces. + +CLI for generating stuff: +``` +go install github.com/spf13/cobra-cli@latest +``` + +The library itself: +``` +go get -u github.com/spf13/cobra@latest + +import "github.com/spf13/cobra" +``` diff --git a/Zettelkast/Notes/010720231037 - With function.md b/Zettelkast/Notes/010720231037 - With function.md new file mode 100644 index 0000000..d646a8f --- /dev/null +++ b/Zettelkast/Notes/010720231037 - With function.md @@ -0,0 +1,18 @@ +#nix-lang + +The `with` function brings all attributes from a given set, e.g nixpkgs, into the local scope. Making them accessible as if they were declared in the same file. + +An example, bringing everything from nixpkgs into scope: +``` +with import ; +with python310Packages; <-- declared in nixpkgs + +buildPythonPackage <-- declared in python310Packages +``` + +The import statement is required here because imports a nix expression from another source, in this case nixpkgs. +It is not required at line two, because python310Packages itself is already in the local scope. + + +--- +[Nix Manual](https://nixos.org/manual/nix/stable/language/index.html) diff --git a/Zettelkast/Notes/010920231133 - OpenFlow.md b/Zettelkast/Notes/010920231133 - OpenFlow.md new file mode 100644 index 0000000..4e0bd08 --- /dev/null +++ b/Zettelkast/Notes/010920231133 - OpenFlow.md @@ -0,0 +1,2 @@ +`man ovs-fields (7)` explains more about OpenFlow matches. +`man ovs-ofctl (8)` explains more about OpenFlow actions. diff --git a/Zettelkast/Notes/010920231434 - (UNIX) Watch.md b/Zettelkast/Notes/010920231434 - (UNIX) Watch.md new file mode 100644 index 0000000..dafeb80 --- /dev/null +++ b/Zettelkast/Notes/010920231434 - (UNIX) Watch.md @@ -0,0 +1 @@ +`watch (1)` periodically executes the executable on argv. It can be used to reload the output of a command, like `sudo watch ovs-dpctl dump-flows` . \ No newline at end of file diff --git a/Zettelkast/Notes/022920240849 - Layered Architecture.md b/Zettelkast/Notes/022920240849 - Layered Architecture.md new file mode 100644 index 0000000..d551132 --- /dev/null +++ b/Zettelkast/Notes/022920240849 - Layered Architecture.md @@ -0,0 +1,7 @@ +Layered architecture is the art of dividing an application into different layers and applying rules to decide which code goes to which layer. +Examples of layered architecture are MVC. + +Another example is: +- Business layer ([[290220240839 - Domain Modeling]]): Encapsulates all business logic +- [[290220241412 - Service Layer]]: Encapsulate all application use-cases and manages orchestration before handing over to the domain layer. +- Interface layer: E.g Flask controllers, CLI, etc. They depend on the service layer. \ No newline at end of file diff --git a/Zettelkast/Notes/022920240901 - Repository Pattern.md b/Zettelkast/Notes/022920240901 - Repository Pattern.md new file mode 100644 index 0000000..ef6a879 --- /dev/null +++ b/Zettelkast/Notes/022920240901 - Repository Pattern.md @@ -0,0 +1 @@ +A simplifying abstraction over data storage allowing to decouple the business layer from the data layer in a [[022920240849 - Layered Architecture]] and making it easier to test as well. \ No newline at end of file diff --git a/Zettelkast/Notes/032220240826 - Python3 Escape Sequences.md b/Zettelkast/Notes/032220240826 - Python3 Escape Sequences.md new file mode 100644 index 0000000..f63c208 --- /dev/null +++ b/Zettelkast/Notes/032220240826 - Python3 Escape Sequences.md @@ -0,0 +1,21 @@ +Escape sequences encode hard to type characters, e.g a tab \\t. + +Table of escape sequences: + +| Escape | What it does | +| ---------- | ----------------------------------------------------------- | +| \\\ | Backslash (\\) | +| \\' | Single-quote (') | +| \\" | Double-quote (") | +| \a | ASCII bell (BEL) | +| \b | ASCII backspace (BS) | +| \f | ASCII formfeed (FF) | +| \n | ASCII linefeed (LF) | +| \N{name} | Character named name in the Unicode database (Unicode only) | +| \r | Carriage return (CR) | +| \t | Horizontal tab (TAB) | +| \uxxxx | Character with 16-bit hex value xxxx | +| \Uxxxxxxxx | Character with 32-bit hex value xxxxxxxx | +| \v | ASCII vertical tab (VT) | +| \ooo | Character with octal value ooo | +| \xhh | Character with hex value hh | diff --git a/Zettelkast/Notes/060620241559 - Adjacency Lists.md b/Zettelkast/Notes/060620241559 - Adjacency Lists.md new file mode 100644 index 0000000..c2e9003 --- /dev/null +++ b/Zettelkast/Notes/060620241559 - Adjacency Lists.md @@ -0,0 +1,3 @@ +Adjacency list is a self-referential relationship. In SQLAlchemy we can achieve this by creating a ForeignKey on the table to itself. In the mapper we can add a relationship property and specify remote_side=[table.c.id]. + +This is what I used to give backups a "base" reference. \ No newline at end of file diff --git a/Zettelkast/Notes/20240613112 - Aggregates should protect invariants.md b/Zettelkast/Notes/20240613112 - Aggregates should protect invariants.md new file mode 100644 index 0000000..7e4d67c --- /dev/null +++ b/Zettelkast/Notes/20240613112 - Aggregates should protect invariants.md @@ -0,0 +1,5 @@ +An invariant should be designed in such a way that it can enforce an invariant. This means even if they require another aggregate to do so, therefore it's allowed to reference other aggregates. + +--- +Related: +- [[290220241543 - Aggregates]] \ No newline at end of file diff --git a/Zettelkast/Notes/202406131159 - Invariant.md b/Zettelkast/Notes/202406131159 - Invariant.md new file mode 100644 index 0000000..0109c04 --- /dev/null +++ b/Zettelkast/Notes/202406131159 - Invariant.md @@ -0,0 +1,5 @@ +An invariant is a condition that simply must always be true. + +--- +Related: +- [[20240613112 - Aggregates should protect invariants]] \ No newline at end of file diff --git a/Zettelkast/Notes/280620231200 - Direct Attach Cable -DAC.md b/Zettelkast/Notes/280620231200 - Direct Attach Cable -DAC.md new file mode 100644 index 0000000..fb1bf77 --- /dev/null +++ b/Zettelkast/Notes/280620231200 - Direct Attach Cable -DAC.md @@ -0,0 +1,9 @@ +#datacenter + +A direct attach cable is used in data center environments to connect hardware such as servers, routers and switches. +Has a [[280620231201 - Transceiver]] on both ends. +Used most commonly to connect hardware in a rack to a switch in the top of a rack. +Can be up to 7 meter. +They are a lot cheaper than fiber. + +--- diff --git a/Zettelkast/Notes/280620231201 - Transceiver.md b/Zettelkast/Notes/280620231201 - Transceiver.md new file mode 100644 index 0000000..7bba020 --- /dev/null +++ b/Zettelkast/Notes/280620231201 - Transceiver.md @@ -0,0 +1,5 @@ +#datacenter + +A transceiver is an electronic device which can both transmit and receive signals. + +--- diff --git a/Zettelkast/Notes/280620231556 - Svelte.md b/Zettelkast/Notes/280620231556 - Svelte.md new file mode 100644 index 0000000..0e9d077 --- /dev/null +++ b/Zettelkast/Notes/280620231556 - Svelte.md @@ -0,0 +1,9 @@ +#web-development #svelte + +Svelte is a way to write UI components. It is a compiled language and compiles into JavaScript that can be run to render HTML for the page and CSS to style it. +It's not a full framework and thus would require additional components to build a complete application. +Therefore it can be used as a nice way to quickly build a simple web page using reusable components but with additional tools like [[280620231557 - SvelteKit]] it can be used to build an entire application. + +--- +[SvelteKit Documentation](https://kit.svelte.dev/docs/introduction#what-is-svelte) + diff --git a/Zettelkast/Notes/280620231557 - SvelteKit.md b/Zettelkast/Notes/280620231557 - SvelteKit.md new file mode 100644 index 0000000..fd2f36a --- /dev/null +++ b/Zettelkast/Notes/280620231557 - SvelteKit.md @@ -0,0 +1,7 @@ +#web-development #svelte + +SvelteKit is a framework for developing applications using [[280620231556 - Svelte]]. +It provides features like routing, server-side rendering and enables us to conform to best practices, like specific build optimizations, offline support, preloading pages, + +--- +[SvelteKit Documentation](https://kit.svelte.dev/docs/introduction) \ No newline at end of file diff --git a/Zettelkast/Notes/280620231621 - Knowledge vs Information.md b/Zettelkast/Notes/280620231621 - Knowledge vs Information.md new file mode 100644 index 0000000..183eb35 --- /dev/null +++ b/Zettelkast/Notes/280620231621 - Knowledge vs Information.md @@ -0,0 +1,8 @@ +#zettelkasten #note-taking + +The body of a Zettel [[280620231634 - Using Zettelkasten as a thinking tool]] should contain knowledge. +Information is just static lifeless data ready to be interpreted. Knowledge is information with added context and relevance. +It should still be relevant in the same context 10 years from now as it was when writing it. If we just capture some information. Without the context our later selves will probably look at it and wonder WTF it was for. + +--- +[Zettelkasten Introduction](https://zettelkasten.de/introduction/#the-body-of-the-zettel) \ No newline at end of file diff --git a/Zettelkast/Notes/280620231634 - Using Zettelkasten as a thinking tool.md b/Zettelkast/Notes/280620231634 - Using Zettelkasten as a thinking tool.md new file mode 100644 index 0000000..ec7454d --- /dev/null +++ b/Zettelkast/Notes/280620231634 - Using Zettelkasten as a thinking tool.md @@ -0,0 +1,11 @@ +#zettelkasten #note-taking + +Zettelkasten is a method of note taking that can be seen as a thinking tool. The idea is that thoughts are captured in atomic notes (Zettel) and reference other such notes creating a graph. The graph may later reveal connections between topics that weren't visible before. + +The main important things are that: +- A zettel has a unique identifier +- A piece of knowledge +- Some references to whatever this knowledge came from ( or none if it's just a thought of our own ) + +--- +[Zettelkasten introduction](https://zettelkasten.de/introduction/) \ No newline at end of file diff --git a/Zettelkast/Notes/290220240839 - Domain Modeling.md b/Zettelkast/Notes/290220240839 - Domain Modeling.md new file mode 100644 index 0000000..9fe7f7f --- /dev/null +++ b/Zettelkast/Notes/290220240839 - Domain Modeling.md @@ -0,0 +1,5 @@ +Domain modeling can be used to define the business layer in a [[022920240849 - Layered Architecture]]. This is all the business logic. It should be easy to understand and easy to change as this is the code that changes the most frequently. + +A domain model can be comprised out of [[290220240843 - Value Object]], [[290220240842 - Entity]], Aggregates and functions that encompass domain procedures that do not necessarily fit in an object. +It is also fine to include Exceptions in the domain, e.g stock can go out of stock and thus when we would allocate an order it would raise an OutOfStock exception. + diff --git a/Zettelkast/Notes/290220240842 - Entity.md b/Zettelkast/Notes/290220240842 - Entity.md new file mode 100644 index 0000000..41879da --- /dev/null +++ b/Zettelkast/Notes/290220240842 - Entity.md @@ -0,0 +1 @@ +An Entity is an object with a unique identity. E.g a Person has a unique identity (for example his name). \ No newline at end of file diff --git a/Zettelkast/Notes/290220240843 - Value Object.md b/Zettelkast/Notes/290220240843 - Value Object.md new file mode 100644 index 0000000..10a9afa --- /dev/null +++ b/Zettelkast/Notes/290220240843 - Value Object.md @@ -0,0 +1,15 @@ +A Value Object is a domain object that has no unique identity but if any of its properties change it is no longer the same. An example can be made with money. + +```py +from dataclasses import dataclass + +@dataclass(frozen=True) +class Money: + type: str + value: int + +Money("Euro", 10) != Money("Euro", 9) +Money("GBP", 10) != Money("Euro", 10) +``` + +Thus such an object is a perfect candidate for immutability. With python we can add @dataclass(frozen=True). Frozen=true makes it immutable. \ No newline at end of file diff --git a/Zettelkast/Notes/290220241409 - TDD High and Low Gear.md b/Zettelkast/Notes/290220241409 - TDD High and Low Gear.md new file mode 100644 index 0000000..218ad00 --- /dev/null +++ b/Zettelkast/Notes/290220241409 - TDD High and Low Gear.md @@ -0,0 +1,3 @@ +A nice idea of TDD is that of High and Low Gear. What they mean is that when you're just starting out you will write a lot of fine grained unit tests to get going, e.g against the domain layer. +Once you're at the point that you have encapsulated all use cases in a nice service layer, you can move all the specific domain tests to the service layer. This makes it easier to make modifications to the domain model. +If then you really need to make big changes, you write fine grained unit tests for those again, until you've encapsulated them in the service layer. \ No newline at end of file diff --git a/Zettelkast/Notes/290220241412 - Service Layer.md b/Zettelkast/Notes/290220241412 - Service Layer.md new file mode 100644 index 0000000..08e9782 --- /dev/null +++ b/Zettelkast/Notes/290220241412 - Service Layer.md @@ -0,0 +1,3 @@ +The idea of the service layer is that it handles most orchestration concerns for a use case of the application such as wiring together repositories and fetching required domain models. Basically it sets everything up so that we have everything needed to have the domain do its work properly and then persist the changes. + +This takes away this kind of logic from the entrypoints like API controllers making those easier to test as they only be concerned with doing web stuff, e.g fetching the data from the request and making sure we form a correct response. That allows us to just run an end to end test for the happy an all unhappy paths on the controller, the rest of the application functionality is covered by the service layer. \ No newline at end of file diff --git a/Zettelkast/Notes/290220241458 - Unit of Work pattern.md b/Zettelkast/Notes/290220241458 - Unit of Work pattern.md new file mode 100644 index 0000000..3ba00cb --- /dev/null +++ b/Zettelkast/Notes/290220241458 - Unit of Work pattern.md @@ -0,0 +1,40 @@ +#needs-clarification + +The Unit of Work is an abstraction of the concept of atomic operations. We can have a clear boundary on what work is grouped together and should be committed only if everything succeeded. + +We can use the UoW to remove dependency on storage layer from entrypoints by having the UoW manage the set-up. This makes tests easier. + +For example an SqlAlchemyUoW can wrap an SqlAlchemy Session object and expose only its most thin API: commit and rollback. It can work together as well with a [[022920240901 - Repository Pattern|Repository]]. Using a ContextManager we can make the operations safe by only explicitly having the user of the UoW commit and otherwise when exiting do a rollback: +```py +import abc + +class AbstractUnitOfWork(abc.ABC): + products: AbstractRepository + + def __init__(self, products: AbstractRepository): + self.products = products + + def __exit__(self): + self.rollback() + + @abc.abstractmethod + def commit(self): + pass + + @abc.abstractmethod + def rollback(self): + pass + + +class SqlAlchemyUnitOfWork(AbstractUnitOfWork): + def __init__(self, products: AbstractRepository, sessionmaker): + self._session = sessionmaker() + super().__init__(some_repo) + + def commit(self): + self._session.commit() + + def rollback(self): + self._session.rollback() +``` + diff --git a/Zettelkast/Notes/290220241543 - Aggregates.md b/Zettelkast/Notes/290220241543 - Aggregates.md new file mode 100644 index 0000000..2001826 --- /dev/null +++ b/Zettelkast/Notes/290220241543 - Aggregates.md @@ -0,0 +1,5 @@ +An Aggregate is a single cohesive collection of domain objects. An aggregate must be consistent within a single transaction. + +--- +Related: +- [[20240613112 - Aggregates should protect invariants]] \ No newline at end of file diff --git a/Zettelkast/Notes/300620231000 - Running programs in the background with tmux.md b/Zettelkast/Notes/300620231000 - Running programs in the background with tmux.md new file mode 100644 index 0000000..b338da5 --- /dev/null +++ b/Zettelkast/Notes/300620231000 - Running programs in the background with tmux.md @@ -0,0 +1,8 @@ +#tmux + +Tmux can be used to run programs in the background by opening a tmux session and starting the program. It is then possible to detach from that session while the program keeps running. + +It's also possible to directly start a program in its own session: + tmux new-session obsidian or leader+A $ and then new-session obsidian. + +--- diff --git a/Zettelkast/Notes/300820231007 - OVN.md b/Zettelkast/Notes/300820231007 - OVN.md new file mode 100644 index 0000000..b0ca07a --- /dev/null +++ b/Zettelkast/Notes/300820231007 - OVN.md @@ -0,0 +1,32 @@ +#network #networking #ovn #virtual #cloud #dc #engineering #software #emulation #gateway #tunnel #tunneling #router #routing #switch #switching #ovs + +--- + +OVN is a software that enables the creation of virtual networks. Under the hood it uses OVS (virtual switch) and a tunneling protocol to emulate networking devices. These virtual networks run on top of the normal physical infrastructure. It is useful in a cloud environment with virtual machines because it is easy to scale because we can use the singular physical infrastructure and create many seperate virtual networks with string of simple commands or managed by a configuration management system. + +OVN complements features provided by [[OVS]] to enable defining networks entirely in software on top of and unaware of the underlaying physical network. +This is achieved by using tunnels or other encapsulations. Therefore IP addresses and other addresses can overlap with the physical network as they are unaware of each other. + +A software defined network as described above is called an [[OVN Logical Network]]. + +A [[OVN Gateway]] extends a tunnel-based [[OVN Logical Network]] into the physical network by forwarding packets bi-directionally. This allows non-virtualized devices to participate in the logical network as well. + +--- + +OVN has two databases which act as interfaces for components. The NorthBound DB handles translation from higher level CMS concepts into intermediary OVN concepts with similar naming that are used to be translated to lower level flows stored in the SouthBound DB. Those flows + +**Why the NorthBound DB?** +Probably it exists to make it easy to integrate OVN into cloud management systems such as OpenStack because the tables and structures match those of higher level cloud components. OVN is then responsible for doing the complicated work of translating those into the lower level flows. + +**There is more than one table in each of the databases, how can we show which ones are there and what they contain?** +E.g the logical_switch_port table in nb db (nbctl list logical_switch_port) +From `man ovn-nbctl` : "For a list of tables and their columns, see ovn-nb(5) or see the table listing from the --help option." + +**What are dhcpv4_options on a logical switch port?** + +A Logical Datapath is the lower level concept in the SB DB, which matches the higher level Logical Switch. It is implemented by flows dictacting how packets should flow. We can see the given datapaths via `ovn-sbctl list datapath_binding`. + +`ovs-dpctl` is the interface to OVS datapaths. With `ovs-dpctl dump-flows` we can get a glimpse of the in-kernel flow cache, e.g see what's going on. + +**What is the TTL (Time To Live) on an IP packet? Why is it decreased by a router?** + diff --git a/Zettelkast/Notes/310820231448 - Neutron OVN.md b/Zettelkast/Notes/310820231448 - Neutron OVN.md new file mode 100644 index 0000000..7df0888 --- /dev/null +++ b/Zettelkast/Notes/310820231448 - Neutron OVN.md @@ -0,0 +1 @@ +An OpenStack Network is a logical switch, it corresponds to an [[OVN Logical Switch]] \ No newline at end of file diff --git a/Zettelkast/Notes/310820231618 - Open VSwitch (OVS).md b/Zettelkast/Notes/310820231618 - Open VSwitch (OVS).md new file mode 100644 index 0000000..d4664d4 --- /dev/null +++ b/Zettelkast/Notes/310820231618 - Open VSwitch (OVS).md @@ -0,0 +1,3 @@ +OVS is a direct replacement for [[LinuxBridge]] an L2 switch. Linux bridge was not designed with a fast changing landscape of many VMs that need to communicate with each other from many different hosts. OVS is designed with that in mind.. + +OVS makes it possible to migrate configuration and live network state between two hypervisors by tracking current network state in OVSDB. The OVSDB supports triggers which make it possible to respond to changes of various aspects of the network. \ No newline at end of file diff --git a/Zettelkast/Notes/310820231706 - Networking One Giant Compute.md b/Zettelkast/Notes/310820231706 - Networking One Giant Compute.md new file mode 100644 index 0000000..31fd127 --- /dev/null +++ b/Zettelkast/Notes/310820231706 - Networking One Giant Compute.md @@ -0,0 +1,3 @@ +Using a [[TCP/IP]] network makes it almost as if two connected computers are working as one. +Like a giant botnet, all hosts working together as a single giant machine trying to bring down a company or network. +Or all our smartphones running hypervisor software creating the biggest cloud ever. \ No newline at end of file -- cgit v1.2.3