Virtual Machine Setup

VM Virtual Box

Debian 11

  1. Graphical Install without much to add
  2. GNOME Desktop Environment
  3. Change Screen to 1920×1200 & Timezone
  4. Add user “wolfgang” to sudoers
su -
usermod -aG sudo wolfgang
getent group sudo
su - wolfgang

Restart

Working Environment

… install the HTTPS support for apt to get packages from Microsoft and other repositories:

sudo apt install -y curl apt-transport-https

Surface

… make a folder for the themes:

mkdir ~/.themes

… enable user themes in the tweak tool:

Owncloud-Client

… download and add the repositories key:

wget -nv https://download.owncloud.com/desktop/ownCloud/stable/latest/linux/Debian_11/Release.key -O - | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/owncloud.gpg > /dev/null

… add repository:

echo 'deb https://download.owncloud.com/desktop/ownCloud/stable/latest/linux/Debian_11/ /' | sudo tee -a /etc/apt/sources.list.d/owncloud.list

… update the repository list and install:

sudo apt update && sudo apt install owncloud-client

Chrome

… download and add the repositories key:

curl -sSL https://dl.google.com/linux/linux_signing_key.pub | sudo gpg --dearmor -o /usr/share/keyrings/googlechrome-linux-keyring.gpg

… add repository:

echo "deb [arch=amd64 signed-by=/usr/share/keyrings/googlechrome-linux-keyring.gpg] http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee /etc/apt/sources.list.d/google-chrome.list

… update the repository list and install:

sudo apt update && sudo apt install -y google-chrome-stable

Visual Code

… download and import the Microsoft signing GPG key:

curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo gpg --dearmor -o /usr/share/keyrings/ms-vscode-keyring.gpg

… add repository:

echo "deb [arch=amd64 signed-by=/usr/share/keyrings/ms-vscode-keyring.gpg] https://packages.microsoft.com/repos/vscode stable main" | sudo tee /etc/apt/sources.list.d/vscode.list

… update the repository list and install:

sudo apt update && sudo apt install -y code

MySQL Workbench

… unfortunately only with snap:

sudo apt install snapd && snap install mysql-workbench-community

… connect the snap-sandbox and the password-manager-service to store the passwords:

sudo snap connect mysql-workbench-community:password-manager-service :password-manager-service

… connect the snap-sandbox and the ssh-keys to store the ssh connections:

sudo snap connect mysql-workbench-community:ssh-keys :ssh-keys

Container Environment

… install required Docker dependencies:

sudo apt -y install apt-transport-https ca-certificates curl gnupg2 software-properties-common

… download and import the Docker signing GPG key:

curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

… add repository:

echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list

… install the latest version of the Docker engine and container:

sudo apt update && sudo apt install docker-ce docker-ce-cli containerd.io

… check version:

docker –version

… check service:

sudo systemctl status docker

… add the docker user with a docker-home directory:

sudo useradd -m -g docker docker

Loose or tight coupling experience

The target is to get some time series data in any currency, multiply it with an FX and store it in EUR. First approach was something like:

  1. “crawl time series and write in table a”.py everyhour
  2. “crawl fx time series and write in table b”.py everyhour
  3. “read table a & read table b, multiply and write in table c”.py everyhour

Everything went well and I came up with the idea: “Could the third step not be done by the MySQL-db itself?”

  1. “crawl time series and write in table a”.py everyhour
  2. “crawl fx time series and write in table b”.py everyhour
  3. table a uses the AFTER INSERT & AFTER UPDATE function to trigger the transformation and storage in table c. As example added the following code to table a:

CREATE DEFINER=wolfgang@localhost TRIGGER raw_cps_AFTER_INSERT AFTER INSERT ON raw_cps FOR EACH ROW BEGIN
IF NEW.currency = 'USD' THEN
SELECT USD FROM investment_db.ts_pivot_currency WHERE date=NEW.date INTO @FX;
SET @value_fx = NEW.value/@FX;
INSERT INTO investment_db.fun_cps (pk, date, value,currency)
VALUES(NEW.pk, NEW.date, @value_fx, 'EUR')
ON DUPLICATE KEY UPDATE value=@value_fx, currency='EUR';
END IF;
END

… and then i noticed that i get an error in my “crawl time series and write in table a”.py. There was data in table a. Conclusion step (1) = ok. Also there was a lot of data in table b and table c. So was step (2) and step (3) = ok. No!

Tight coupling introduced by mistake!

Because of one missing FX entry, the multiplication failed and due to that the error was transferred to the python script. Because the script was running in an container and some quick and dirty programming, it was permanently restarted 😉

Links

Investment

TitleContentDateStarsLink
FREDEconomic Data Source2021/07/155Link
multpl.comEconomic Data Source, especially S&P 500 Time Series on PER, PBR, …2021/07/155Link

Software

TitleContentDateStarsLink

BIND DNS Server

Based on Ubuntu Server, Bind9 & Webmin.

Solving the “127.0.0.53” isse:

sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf

Solving issue on “NDC command failed : rndc: connect failed: 127.0.0.1#953: connection refused” by just installing it on BIND with “Setup RNDC”.