Sergey Chulanov
My notes to remember

Send and recieve udp

Let’s start listening udp on port 2193 and host 172.16.4.105:

sudo tcpdump -i ens18 udp port 2193 -vv -X

Send messages to listener:

echo -n "HELLO FROM LINUX|c" | nc -w 1 -u -4 172.16.4.105 2193

The same step, but for windows (powershell):

Replace disk in raid-array

The post describes the steps to replace a mirror disk in a software raid array. In this example, we have 2 arrays: /dev/md0(system) and /dev/md1(data). Also we have boot partitions on each disk.

So, we have two disks:

lsblk -f /dev/sdb /dev/sdc
NAME                      FSTYPE            FSVER    LABEL  UUID                                   FSAVAIL FSUSE% MOUNTPOINTS
sdb
├─sdb1                    vfat              FAT16           D506-F28D
├─sdb2                    linux_raid_member 1.2      deer:0 32640a07-ad38-c48e-748f-c6ea53326299
│ └─md0                   LVM2_member       LVM2 001        kAqPYz-WS4d-EWpZ-2Cem-Hqsk-Y6Xo-f4GwAU
│   └─system_vg-system_lv ext4              1.0             d9be8abd-ed85-4696-b8f4-29f9005854c1     71.2G    17% /
└─sdb3                    linux_raid_member 1.2      deer:1 7269721b-d5b4-adbe-5cfc-549e38f88bf0
  └─md1                   LVM2_member       LVM2 001        6uUOiT-eKoG-mEUh-ukC0-Jvhf-p6Vf-tQCMJq
    └─data_vg-data_lv     ext4              1.0             9a0a39c1-faf3-4d86-bf18-766f887ebe14      1.1T    29% /data
sdc
├─sdc1                    vfat              FAT16           D506-F28D                               486.5M     0% /boot/efi
├─sdc2                    linux_raid_member 1.2      deer:0 32640a07-ad38-c48e-748f-c6ea53326299
│ └─md0                   LVM2_member       LVM2 001        kAqPYz-WS4d-EWpZ-2Cem-Hqsk-Y6Xo-f4GwAU
│   └─system_vg-system_lv ext4              1.0             d9be8abd-ed85-4696-b8f4-29f9005854c1     71.2G    17% /
└─sdc3                    linux_raid_member 1.2      deer:1 7269721b-d5b4-adbe-5cfc-549e38f88bf0
  └─md1                   LVM2_member       LVM2 001        6uUOiT-eKoG-mEUh-ukC0-Jvhf-p6Vf-tQCMJq
    └─data_vg-data_lv     ext4              1.0             9a0a39c1-faf3-4d86-bf18-766f887ebe14      1.1T    29% /data

And two raid arrays:

OpenConnect

| Ubuntu 22.04

Install certbot

sudo snap install certbot --classic

Example how to manual generate and revoke certificate

YOUR_DOMAIN=www.ubukubu.ru
sudo certbot certonly --manual --preferred-challenges=dns -d ${YOUR_DOMAIN} -d nonexistent.${YOUR_DOMAIN}
sudo certbot revoke --cert-path /etc/letsencrypt/live/${YOUR_DOMAIN}/fullchain.pem

Get the cert with key

gpg

| Ubuntu 22.04

  • we need to use /usr/share/keyrings to keep keys
  • for key managed local - /etc/apt/keyrings (need to create it by own with 755 permissions)
  • key should be in binary shape and have the name: repo-archive-keyring.gpg
  • also we should have deb [signed-by=/usr/share/keyrings/repo-archive-keyring.gpg] ... in the line of repo

Example for mongo with amd64,arm64:

deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse

Determinating the type of key:

file repo_signing.key
# - text format:	PGP public key block Public-Key (old)
# - binary format:	OpenPGP Public Key Version 4

Also we need to delete old key before install new:

Prometheus grafana

https://github.com/docker/awesome-compose/blob/master/prometheus-grafana/compose.yaml

You need to install docker with compose.

Install linux node exporter on nodes:

Download node_exporter:

curl -LO https://github.com/prometheus/node_exporter/releases/download/v1.6.1/node_exporter-1.6.1.linux-amd64.tar.gz
tar xvfz node_exporter-1.6.1.linux-amd64.tar.gz

Add user:

sudo groupadd node_exporter
sudo useradd -g node_exporter -m -s /sbin/nologin node_exporter

Put node_exporter file in PATH directory:

Git squash

Tested on: Ubuntu 22.04

Git squash

If it’s needed, can set the default editor: git config --global core.editor "vim --nofork"

Сделаем ребейз нашей ветки на основную ветку, в данном случае это develop. Before starting, it’s needed to rebase our branch feature/fea-37 to develop branch, for example.

Let’s look at- the commit to merge:

git cherry -v develop
	+ 428db8b30e4732b179bfc7d4663c6860214ea343 fea-37
	+ b41e7856dd5715e3dbff8fd62a6e4a49e46e96e5 fea-37 1
	+ 06e55320a2f6682277a9702e6a796ac84eab849c fea-37 Improved ansible scripts
	+ d8380d0e994a16c79211a0ec0007676d429d077f fea-37 Changed db URI
	+ 90bad559fa3c2d9d1e6afb9b5816609212e4b931 fea-37 Returned template.env
	+ 1006b0cde85165f19148b3e7a7cb72ca8bf524d9 fea-37 Removed unnecessary host
	+ 3d1d95d9146d3b0bae94016ebc45f4c1252338cb fea-37 Moved and improved ansible Dockerfile
	+ 64b7c1cb7a1f10d27a5611b5a96d407235c38e15 fea-37 Added gitlab-ci from app2
	+ 76b04f223e87fbf9eb39c0cd7f3b64994e64b72f fea-37 Added delivery for test
	+ 0c2ca7465a4f9977fbc4df83734e11b5e0da7f08 fea-37
	+ 0b0f6c1787211d61e72d8e5f307580dc79269a8d fea-37 Added dump app1

Count it: