Configuring Ubuntu Server 20.04 LTS gateway

Posted on Wed 20 October 2021 in Ubuntu • Tagged with Ubuntu

The current version of Ubuntu Server 20.04 LTS uses netplan in order to configure the network. If it doesn't use cloud-init to provision the network, the network configuration will be in a YAML file in /etc/netplan. There you can change the network parameters, such as the default gateway if you have a fixed connection.

After changing them, run this command to apply them (remember that you may disconnect from the network, so don't run it from a remote connection!):

sudo netplan apply

A more detailed explanation can be found in this very helpful post at linuxize.


Upgrading to dash 2.0

Posted on Tue 05 October 2021 in Python • Tagged with Python, Dash

I had some dashboards built in Python with Dash. They were using version 1.13.4 and I updated it to version 2.0.0. In addition to converting the imports, as explained in the migration guide, I also had to change state variables because I was getting the error:

ValueError: The state keyword argument may not be provided without the input keyword argument

I didn't understand the explanation in the migration guide. After reading the new documentation about callbacks, I've found that I had to change my app_callbacks. Previously, I had something like this:

@app.callback(
    Output(component_id='wl-plot', component_property='src'),
    [
        Input(component_id='sol-select', component_property='value'),
        Input(component_id='button-apply', component_property='n_clicks'),
    ],
    state=
    [
        State(component_id='base-dir', component_property='value'),
    ]
)

And I had to change it to this:

@app.callback(
    Output(component_id='wl-plot', component_property='src'),
    Input(component_id='sol-select', component_property='value'),
    Input(component_id='button-apply', component_property='n_clicks'),
    State(component_id='base-dir', component_property='value'),
)

So, basically, now you only have a list of Output, Input and State instances and you don need the state=....


Meltdown and spectre checker

Posted on Mon 04 October 2021 in Security • Tagged with Meltdown, Spectre, Security, CPU Architecture

I've found this script which is very handy to analyze if you Linux-based system is vulnerable to Spectre and Meltdown. I found this through this talk.


Changing the Pelican theme to Flex

Posted on Thu 30 September 2021 in Blogging • Tagged with Pelican, GitHub pages, Blog

In a previous post I explained how to use Pelican with GitHub pages but didn't explain how to change the theme. I've changed it now to use Flex and it was harder than expected.

Most of the guides I've found talked about cloning pelican-themes in a folder on your system and changing the variable THEME to that folder. However, that doesn't work when you are using GitHub actions to build your site because it won't find that folder.

My solution was cloning the theme I wanted, Flex, to a folder inside the root folder of the blog:

git clone https://github.com/alexandrevicenzi/Flex

Then I set in pelicanconf.py the variable THEME as follows:

THEME = 'Flex'

In order to make it work with GitHub actions, I had to add in the file publi.sh, before calling pelican, this line:

git clone https://github.com/alexandrevicenzi/Flex

After commiting and pushing, it worked.


Integrating Prometheus, InfluxDB and Grafana

Posted on Wed 29 September 2021 in Kubernetes • Tagged with Kubernetes, Prometheus, Telegraf, InfluxDB, Grafana

I've got a Kubernetes cluster prepared to be be integrated with Prometheus, i.e., all relevant information is exposed with /metrics and scraped by a Prometheus instance. I want to save the information long term and I've decided that Influx DB is the best option for that. In addition, I want to create dashboards using Grafana.

This would require moving the information from Prometheus to Influx DB. According to this, for Influx DB v1, this would be accomplished by using directly remote writes in Prometheus. However, Influx DB v2 doesn't allow this way of working. Instead, Telegraf has to be inserted in the middle. Therefore, the whole pipeline would be Prometheus 🠮 Telegraf 🠮 Influx DB 🠮 Grafana.

I'm using EKS to deploy the cluster, but these instructions should work with any other Kubernetes cluster. I'll only assume that kubectl is already configured to work with your cluster. We are going to deploy many services, so you may require new nodes in your cluster.

Helm

We'are going to use Helm for installing all the components, so first we …


Continue reading