A Conquista da Transparência: Proposta de Lei do Radioamadorismo em Portugal Finalmente Divulgada

É com grande satisfação que concluo esta série de artigos sobre a busca pela transparência na legislação do radioamadorismo em Portugal com uma notícia de grande importância: após uma jornada marcada por solicitações, resistência e perseverança, a proposta de lei tão esperada foi finalmente divulgada.

O Email que Marca uma Etapa Fundamental

Hoje, recebi um email crucial que representa uma vitória para todos os defensores da transparência governamental e do acesso à informação. Vindo do gabinete do Senhor Secretário de Estado das Infraestruturas, foi anunciado o envio do Anteprojeto requerido, em resposta ao Parecer n.º 54, datado de 21/02/2024, emitido pela Comissão de Acesso aos Documentos Administrativos (CADA).

Um Passo Importante Rumo à Transparência

A disponibilização do Anteprojeto é um passo importante rumo à transparência. Este documento não só concretiza o direito dos cidadãos à informação, mas também demonstra a eficácia dos mecanismos legais de acesso à informação, como a Lei de Acesso aos Documentos Administrativos (LADA), e o papel essencial da CADA nesse processo.

O Papel dos Cidadãos na Defesa da Transparência

Esta conquista não teria sido possível sem a persistência e determinação daqueles que acreditam na importância da transparência e da participação cívica. Cada solicitação feita, cada recurso interposto e cada espera paciente foram fundamentais para alcançar este resultado.

Chamado aos Políticos: Façam o Seu Dever

Agora, mais do que nunca, é crucial que os políticos façam o seu trabalho. Esta proposta de lei, uma vez publicada, pode atrair novos interessados para o hobby do radioamadorismo em Portugal.

Conclusão: Celebrando a Conquista e Olhando para o Futuro

À medida que celebramos esta conquista na busca pela transparência na legislação do radioamadorismo em Portugal, olhamos para o futuro com esperança e determinação. Esta é apenas uma etapa em direção a um governo mais transparente e responsável. Que esta conquista inspire mais ações em prol da transparência e do acesso à informação em nosso país.

Agora politicos, façam o vosso trabalho…

Para ler a proposta completa de alteração da lei, a mesma está disponivel aqui:

Leia mais sobre o processo de obtenção dessas informações e a jornada de transparência nos artigos anteriores:

Parte 1: O Processo de Acesso à Informação em Portugal: Alteração a lei do Radioamadorismo em Portugal

Parte 2: O Processo de Acesso à Informação em Portugal: Alteração a lei do Radioamadorismo em Portugal – Parte 2

Parte 3: O Processo de Acesso à Informação em Portugal: Alteração a lei do Radioamadorismo em Portugal – Parte 3

73, CR8ACT

O Processo de Acesso à Informação em Portugal: Alteração a lei do Radioamadorismo em Portugal – Parte 3

Nota/Note:
PT:
 Embora normalmente eu publique em inglês, devido à especificidade deste tema relacionado com o nosso país, optei por escrever este post em português.

EN: While I usually post in English, due to the country-specific nature of this topic, I’ve chosen to write this post in Portuguese.

🔴 Post em atualização: Este post está em atualização. À medida que novas informações forem disponibilizadas e os pedidos forem respondidos, este conteúdo será atualizado para refletir as informações mais recentes sobre o tema.


Desde o meu último post, intitulado “O Processo de Acesso à Informação em Portugal: Alteração a lei do Radioamadorismo em Portugal – Parte 2“, publicado em 22 de Janeiro de 2024, surgiram novos desenvolvimentos na questão da transparência governamental relacionada à legislação do radioamadorismo em Portugal. Este artigo visa relatar os últimos acontecimentos, refletindo sobre a jornada contínua por um governo mais transparente e responsável.

Ignorando a Solicitação: O Silêncio do Ministério das Infraestruturas

Após o encorajador Parecer n.º 1/2024 da CADA, que reafirmou o direito de acesso à informação sob a Lei de Acesso aos Documentos Administrativos (LADA), dirigi uma nova solicitação ao Ministério das Infraestruturas. Desapontadoramente, esta solicitação foi completamente ignorada, sem qualquer resposta fornecida até o momento. Tal atitude não apenas contraria os preceitos da LADA mas também desconsidera o direito constitucional dos cidadãos ao acesso à informação.

A Resposta Parcial da ANACOM e a Intervenção da CADA

Em contrapartida, a ANACOM adotou uma postura parcialmente diferente. Embora tenha rejeitado inicialmente o pedido, decidiu solicitar um parecer da CADA antes de tomar uma decisão final. Este movimento, apesar de não ser o ideal, demonstra uma abertura para a revisão de posturas anteriormente intransigentes.

A decisão da CADA, agora contida no Parecer n.º 54/2024 , veio a favor da divulgação da informação solicitada. Este parecer representa mais um passo em direção à transparência, sublinhando a importância do acesso público a documentos administrativos, conforme garantido pela LADA.

A ANACOM, ao receber este novo parecer da CADA, encontra-se agora sob a obrigação legal de reavaliar a sua decisão inicial e, idealmente, publicar as informações solicitadas sobre a proposta de alteração da legislação do radioamadorismo, que haviam anteriormente negado pendente deste novo parecer da CADA, com a seguinte resposta:

Aguardando Novas Decisões

Nos próximos 10 dias, aguarda-se então uma nova decisão da ANACOM, desta vez esperando que esteja alinhada com o recente parecer da CADA (que apesar de ser o regulador da LADA, os seus pareceres não são vinculativos, vamos la saber porque). Esta espera não é apenas um exercício de paciência, mas um momento crucial na reivindicação do direito público de entender e participar dos processos legislativos que nos afetam diretamente.

Conclusão: A Perseverança no Direito de Saber

A saga em torno da transparência no radioamadorismo em Portugal destaca uma luta mais ampla pelo direito de acesso à informação – um direito que é, segundo a CADA no parecer anterior, praticamente um direito constitucional. A resistência encontrada no caminho reforça a necessidade de persistência na defesa dos nossos direitos como cidadãos e na promoção de um governo aberto e responsável.

Enquanto aguardo a resposta final da ANACOM, é crucial reconhecer os avanços obtidos até agora e continuar a pressionar por uma administração pública que respeite e promova o direito de acesso à informação.

73, CR8ACT

O Processo de Acesso à Informação em Portugal: Alteração a lei do Radioamadorismo em Portugal – Parte 2

Nota/Note:
PT:
Embora normalmente eu publique em inglês, devido à especificidade deste tema relacionado com o nosso país, optei por escrever este post em português.

EN: While I usually post in English, due to the country-specific nature of this topic, I’ve chosen to write this post in Portuguese.

🔴 Post em atualização: Este post está em atualização. À medida que novas informações forem disponibilizadas e os pedidos forem respondidos, este conteúdo será atualizado para refletir as informações mais recentes sobre o tema.


Após a publicação do meu post anterior de 08 de agosto de 2023, “O Processo de Acesso à Informação em Portugal: Alteração a lei do Radioamadorismo em Portugal“, houve um desenvolvimento na questão da transparência governamental relacionada à legislação do radioamadorismo em Portugal.

Decisão da CADA

A resposta da CADA, contida no Parecer n.º 1/2024 do Processo n.º 868/2023, trouxe uma interpretação esclarecedora sobre o acesso a documentos administrativos em Portugal. A CADA determinou que os documentos referentes à proposta de alteração legislativa da ANACOM, inicialmente negados com base em confidencialidade, são de fato acessíveis sob a LADA. Este parecer representa um avanço significativo na luta pelo direito de acesso à informação, reafirmando o compromisso com a transparência e a responsabilidade governamental, contanto com a seguinte conclusão:

Novo Pedido de Informação à ANACOM


Com base nesta decisão, submeti um pedido de acesso à informação à ANACOM. Este pedido busca obter mais esclarecimentos sobre a proposta de alteração.

Pedido Adicional ao Ministério das Infraestruturas


Da mesma forma, fiz um pedido ao Ministério das Infraestruturas. Este passo visa aprofundar o entendimento das intenções e implicações da proposta de alteração legislativa, garantindo uma análise completa e detalhada da situação.

Antecipação e Implicações Futuras

Aguardando as respostas a estes pedidos, este momento marca uma fase crucial na busca por uma legislação mais transparente e justa no radioamadorismo em Portugal.

O Processo de Acesso à Informação em Portugal: Alteração a lei do Radioamadorismo em Portugal

Nota/Note:
PT:
Embora normalmente eu publique em inglês, devido à especificidade deste tema relacionado com o nosso país, optei por escrever este post em português.

EN: While I usually post in English, due to the country-specific nature of this topic, I’ve chosen to write this post in Portuguese.

🔴 Continuação Disponivel: Existe um update a este post disponivel em https://blog.facha.dev/o-processo-de-acesso-a-informacao-em-portugal-alteracao-a-lei-do-radioamadorismo-em-portugal-parte-2/


Em tempos de crescente necessidade de transparência e responsabilidade governamental, o acesso à informação tornou-se não apenas um direito, mas uma ferramenta vital para a cidadania ativa. Em Portugal, a Lei de Acesso aos Documentos Administrativos (LADA) n.º 26/2016 garante esse direito, permitindo que os cidadãos solicitem e obtenham informações de entidades públicas. Contudo, como muitos direitos, por vezes, enfrentamos obstáculos no seu exercício. Esta é a minha história pessoal, navegando pelo sistema de acesso à informação em Portugal.

O Contexto: A Proposta de Alteração da ANACOM

O radioamadorismo em Portugal é uma atividade de relevância, enquadrada pela lei 53/2009, que regula os serviços de amador e de amador por satélite. Estes serviços são parte integrante das radiocomunicações, cujo enquadramento internacional é definido pelo Regulamento das Radiocomunicações da União Internacional das Telecomunicações (UIT). A UIT é uma agência especializada das Nações Unidas responsável por questões de tecnologias de informação e comunicação. Em Portugal, a ANACOM é a entidade reguladora que supervisiona e garante a implementação das normas e regulamentos relacionados com o radioamadorismo, conforme estipulado pela lei 53/2009.

Recentemente, a ANACOM propôs uma alteração ao Decreto-Lei que define as regras aplicáveis aos serviços de radiocomunicações de amador e de amador por satélite. Esta proposta visa consolidar e modernizar alguns procedimentos, tendo sido desenvolvida em colaboração com amadores e associações de amadores. O anúncio oficial da proposta foi publicado no site da ANACOM em 03.01.2022 e, desde então, não houve atualizações.

O atual quadro legal do radioamadorismo em Portugal é considerado desatualizado por muitos e prejudica a comunidade de radioamadores. Um dos maiores pontos de controvérsia é o fato de que os radioamadores da categoria 3 (CAT3) não podem transmitir autonomamente e estão limitados apenas a escutar. Esta limitação é vista por como redundante, uma vez que a mesma atividade de escuta pode ser realizada sem qualquer licença.

Comparativamente, em países como os EUA, o sistema de licenciamento é muito mais flexível. Um indivíduo pode passar de não ter licença para obter a licença de nível máximo em um único dia, fazendo e passando em todos os exames em sequência. Além disso, é importante notar que as leis de radioamadorismo são supostamente harmonizadas entre os países membros da CEPT (Conferência Europeia das Administrações de Correios e Telecomunicações), mas Portugal parece estar desalinhado com esta norma.

A Solicitação Original

Neste contexto, movido por uma busca de clareza e transparência sobre a questão, decidi solicitar informações relacionadas à proposta de alteração da ANACOM sobre a legislação do radioamadorismo. Para tal, fiz um pedido formal ao abrigo da LADA.

A Resposta do Ministério

A resposta que recebi não foi a esperada. O Ministério das Infraestruturas, ao invés de fornecer a informação solicitada, rejeitou o meu pedido. A justificação apresentada não se alinhou com os preceitos da LADA.

Recurso à CADA

Não conformado com a resposta e confiante no meu direito de acesso à informação, recorri à Comissão de Acesso aos Documentos Administrativos (CADA). Elaborei uma queixa detalhada, expondo os fundamentos da minha discordância e pedindo a intervenção da Comissão.

A Aceitação da Queixa pela CADA

A CADA reconheceu prontamente a minha queixa, atribuindo-lhe um número de processo e informando-me oficialmente sobre o início da sua análise.

A Resposta da CADA

Aguarda-se com expectativa a resposta final da CADA sobre este importante assunto.

Nova Solicitação à ANACOM

Enquanto aguardamos uma resposta da CADA sobre o nosso pedido inicial, decidi dar um passo adicional. Desta vez, dirigi um pedido formal ao abrigo da LADA diretamente à ANACOM, a entidade reguladora responsável pela gestão do espectro e pela regulação do radioamadorismo em Portugal.

A ANACOM, enquanto autoridade reguladora, possui informações detalhadas e atualizadas sobre a proposta de alteração da legislação do radioamadorismo. Assim, solicitei acesso a todos os documentos e informações relacionadas à proposta que eles têm em sua posse. Esta ação tem como objetivo obter uma visão mais clara e completa do assunto, diretamente da fonte reguladora.

Aguardo agora uma resposta da ANACOM e estou esperançoso de que possamos obter informações mais detalhadas e esclarecedoras sobre esta importante questão.

Esta jornada pessoal reforçou a importância de estar informado sobre os nossos direitos e de ser perseverante na sua defesa. Em tempos em que a informação é poder, garantir o acesso transparente e imparcial a documentos e decisões administrativas é crucial para uma democracia saudável. Encorajo todos a exercerem os seus direitos e a participarem ativamente nos processos democráticos do nosso país.

73 CR8ACT

Navigating Firmware Updates on Legacy Dell PowerEdge R410 Servers: A Homelab Odyssey

In the realm of homelabbing, managing and maintaining legacy hardware can often turn into an adventurous challenge. Such was my recent experience with a Dell PowerEdge R410 server. The task at hand was updating its firmware, a task that became an odyssey, especially as Dell had discontinued support and removed update packages for the server. Here is a detailed account of the journey.

The Challenge: iDRAC, TLS Protocols, and Browser Compatibility

Our adventure begins with iDRAC (Integrated Dell Remote Access Controller), an integral tool for remote server management. The stumbling block: the iDRAC firmware on the R410 does not support modern Transport Layer Security (TLS) protocols. The workaround: using Mozilla Firefox with TLS1 enabled.

Despite modern browsers shunning TLS1 due to known security vulnerabilities, the legacy iDRAC firmware necessitated its usage.

The Roadblock: “Non-Dell Authorized” Updates

After navigating through the quagmire of outdated security protocols, I hit a roadblock during the firmware update installation. Each attempt was met with the message, “The updates you are trying to install are not Dell authorized,” due to expired Dell certificates. Dell’s decision not to renew these certificates for legacy systems meant the only path forward was patient experimentation, made arduous due to the server’s slow boot times.

The Silver Lining: Self-Updating iDRAC and Lifecycle Controller

As I ventured deeper into the server’s firmware labyrinth, a pivotal revelation surfaced: the iDRAC could update itself and the Lifecycle Controller. These self-updates included new certificates, indispensable for the proper functioning of the Unified Server Configurator (USC), thereby laying the groundwork for the remaining firmware updates.

Achieving this required a detailed sequence of steps:

  1. Download the iDRAC6 Image Executable: The first order of business was to download the iDRAC6 image executable. This executable, named “iDRAC6_1.92_A00_FW_IMG.exe“, is crucial for the update and could be downloaded from the official Dell support website.
  2. Extract the iDRAC6 Executable: After obtaining the executable, the next step was to extract its contents. Operating within a Linux environment, I used the ‘unzip’ command. This action produced a file named “firmimg.d6”. The extraction process may differ depending on your operating system.
  3. Log into the iDRAC Firmware Update Tool: Armed with the “firmimg.d6” file, I logged into the iDRAC Firmware Update tool. This web-based interface manages iDRAC settings and updates.
  4. Initiate the iDRAC Update: Inside the Firmware Update tool, I navigated to the update section and uploaded the “firmimg.d6” file. Confirming the update initiated the process. This stage required patience as the iDRAC system updated itself and rebooted.
  5. Download and Unpack the “BDF_1.5.5_BIN-12.usc” file: While the iDRAC was updating, I concurrently downloaded another key file, “BDF_1.5.5_BIN-12.usc”, from the Dell support website. After downloading, I unpacked this file in preparation for the subsequent update.
  6. Run the Firmware Update: Once the iDRAC update completed, I returned to the Firmware Update tool and input the unpacked .usc file. This action updated the Lifecycle Controller and installed the new certificates, rendering the USC functional once more.
  7. Reboot the Server: The final step was to reboot the Dell PowerEdge R410 server. This reboot enabled the server to integrate the updates properly, and subsequently, I gained access to a fully functional USC.

The realisation that iDRAC could self-update and update the Lifecycle Controller marked a vital breakthrough amidst the challenges. This experience reaffirmed that in the world of homelabbing, there’s always a way to overcome seemingly insurmountable obstacles.

The Home Stretch: Updating the Remaining Firmware

With the USC operational again, it was time to update the remaining firmware. Since Dell had removed the update packages from its repositories, I turned to ‘updateyodell.net‘, a reliable third-party firmware repository for Dell’s legacy systems. Here’s the streamlined process:

  1. Boot the Dell PowerEdge R410 server and press F10 to access the Unified Server Configurator (USC).
  2. Within the USC, navigate to Platform Update.
  3. Choose ‘FTP Server’ as your repository location.
  4. When asked for the FTP Server details, enter the ones on ‘updateyodell.net‘.
  5. Proceed with the connection. The USC will now connect to the third-party repository and identify all applicable updates for your Dell R410 server.
  6. Once the updates are listed, select all that apply, and initiate the download and installation process.
  7. Reboot the server after the updates have been installed.

Following these steps, your legacy Dell PowerEdge R410 server should be fully updated, humming along smoothly in your homelab setup.

While firmware updates on legacy systems can feel like a Homeric odyssey, perseverance, patience, and a bit of ingenuity can lead to success. As we navigate our individual tech journeys, let’s remember to share our experiences and learnings along the way.

Sources:

  1. “The updates you are trying to apply are not Dell-authorized updates.” Frednotes. https://frednotes.wordpress.com/2012/11/21/the-updates-you-are-trying-to-apply-are-not-dell-authorized-updates/
  2. “iDRAC6 1.92 A00 Firmware Image.” Dell. https://www.dell.com/support/home/pt-pt/drivers/driversdetails?driverid=kg43r
  3. “BDF 1.5.5 BIN-12 USC File.” Dell. https://www.dell.com/support/home/pt-pt/drivers/driversdetails?driverid=g3g5f
  4. “Dell R410 BIOS Update.” Reddit. https://www.reddit.com/r/homelab/comments/yh75bk/dell_r410_bios_update/
  5. “Dell Firmware and BIOS Update Repository.” UpdateYoDell. https://updateyodell.net/

Self-Hosting Sentry? Here’s How to Deal with Disk Space Issues

If you’re hosting your own Sentry server for your side projects, you know the advantages it brings in terms of cost and control. However, with the control also comes the responsibility of maintaining the server and keeping an eye on the disk usage.

Here’s a simple solution to tackle disk space issues in Sentry:

Step 1: Cleanup Old Events

As time goes by, the events logged in Sentry accumulate, which may lead to an increase in disk usage. To deal with this, you can run the following command within the Sentry “worker” container:

sentry cleanup --days 30

This command will delete all the events that are older than 30 days, which will free up some space on your disk.

Step 2: Vacuum PostgreSQL

Sentry uses PostgreSQL as its database, and over time, the database can become fragmented, leading to disk space issues. To deal with this, you can vacuum PostgreSQL to reclaim some space.

To vacuum PostgreSQL, you’ll need to enter the PostgreSQL container by running:

docker exec -it <your-postgres-container-name> psql -U postgres

Once inside the container, run the following command to vacuum PostgreSQL:





VACUUM FULL;

This command will remove dead rows from the PostgreSQL database, which will free up some disk space. However, keep in mind that the database will be blocked while the vacuum is running.

By following these two simple steps, you can free up some disk space on your Sentry server and keep it running smoothly.

Self-hosting Sentry comes with its own set of challenges, but with the right solutions, you can keep your server up and running with ease. By following the steps outlined in this article, you can tackle disk space issues in Sentry and keep your server running smoothly.

Playing with SDR, ADS-B (Plane Tracking), and what is next

What even is SDR?

SDR stands for Software Defined Radio. In short, it is a piece of software that runs on your computer and enables you to use your computer’s sound card as a receiver.

If you’re unfamiliar with SDR, then you may not know that it has been around since the 1980’s, and was originally known as direct conversion receivers (DCR). An example of what a modern SDR “kit” looks like is below:

SDRs are commonly used as a hobbyist application. Most people have at least heard of them, and know they do what their name suggests – define radios!

What can you do with an SDR?

You can do various different things using an SDR as follows:

  • Receive broadcast radio
  • Amateur radio
  • Radio astronomy
  • Track ships via AIS transmissions
  • Track aircraft via Mode S transponder (And this will be today’s project)
  • Listen in in “walkie talkies”

Project 1: ADS-B – Tracking Planes

Back in January, I started to play around with SDR, mostly in order to be able to track aircraft using their Mode-S Transponder signals.

Hardware

My ADS-B station is currently running the following hardware:

SDR Dongle: AirNav RadarBox FlightStick

Antenna: AirNav ADS-B 1090MHz External Antenna

Board: Raspberry Pi 3 Model B+

Enclosure: Random box bought at the local supermarket, and some DIY hot-glue stuff

Network connection is currently done via Wi-Fi

Software

This station is currently running the PiAware image, including dump1090-fa (that will out of the box feed data to https://flightaware.com/), with some additional software installed to feed into some other sites:

Some other websites/services do it the other way around though, by connecting (while having the relevant firewall exceptions) my station to obtain data, instead of the other way around, these services are:

And some other additional software for metrics purposes:

  • ADSB Stats Logger, to generate some metrics about the station performance (more on this shortly)
  • graph1090, to generate signal and traffic metrics
  • timelapse1090, to generate air traffic timelapse

Results

I have been gathering aircraft tracking data since January 2022 with this setup, and these are some metrics of this data, but before sharing the numbers I’ll share my maximum theorical range (according to heywhatsthat.com) at my antenna location, taking terrain into consideration for airborne targets (where red represents the horizon visual range, orange for targets at 10k feet, and the blue line for targets at 30k feet):

Versus my actual range:

If you want to check the live feeds you can do so here:

ADSB Stats Logger:

Data range: 2022-03-08 13:14:53 - 2022-09-03 13:38:11
Unique Flights: 1600
Unique Operators: 522
Max Altitude: Flight SAT408 37.206644315757394 km at 2022-08-19 21:38:10
Max Speed: Flight MEDIC16 1836.0728000000001 kmh at 2022-05-29 22:10:01
Max Station Distance: Flight AFR457 664.5046626435085 km at 2022-07-21 03:33:57
Min Station Distance: Flight RYR2624 0.012642261112371317 km at 2022-05-15 19:38:21
Max Signal: Flight UAL216 -0.9 db at 2022-06-02 11:22:28
Min Signal: Flight AEA194 -28.6 db at 2022-08-04 07:52:23

graphs1090 (6 months period)

Whats next?

In the last few weeks I have been playing around with a couple new SDR things to make an upgrade to my SDR setup with a new project, these things are:

AIS Ship Tracking

AIS Ship Tracking

Listening to Air Traffic Control

Santa Maria ATIS
Ponta Delgada ATIS

I’m currently waiting for Amazon to deliver some adaptors and connectors, so I can connect further gear to my external antenna to develop both these two projects, so stay tuned for future posts about them 🙂

How to Self-Host Matrix and Element (Docker Compose)

This is a complete guide on setting up Matrix (Synapse) and Element on a fresh Ubuntu 22.04.

Need a server? Try one of this two 🙂
Scaleway
Hetzner (20€ Free Credits)

What is Matrix?

Matrix is an open standard and communication protocol for real-time communication. It aims to make real-time communication work seamlessly between different service providers, just like standard Simple Mail Transfer Protocol email does now for store-and-forward email service, by allowing users with accounts at one communications service provider to communicate with users of a different service provider via online chat, voice over IP, and videotelephony. Such protocols have been around before such as XMPP but Matrix is not based on that or another communication protocol. From a technical perspective, it is an application layer communication protocol for federated real-time communication. It provides HTTP APIs and open source reference implementations for securely distributing and persisting messages in JSON format over an open federation of servers. It can integrate with standard web services via WebRTC, facilitating browser-to-browser applications.

Server Setup

Update your OS and make sure everything is ready

sudo apt update && sudo apt upgrade

UFW Firewall

Lets make sure ports 80 and 443 are open on UFW

sudo ufw allow 80/tcp
sudo ufw allow 443/tcp

Install Docker & Docker-Compose

curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
apt-get install python3 python3-pip -y
pip3 install docker-compose

Prepare our compose file

Create a matrix folder, in this folder create a docker-compose.yml file with the following contents:

version: '2.3'
services:
  postgres:
    image: postgres:14
    restart: unless-stopped
    volumes:
     - ./postgresdata:/var/lib/postgresql/data

    # These will be used in homeserver.yaml later on
    environment:
     - POSTGRES_DB=synapse
     - POSTGRES_USER=synapse
     - POSTGRES_PASSWORD=STRONGPASSWORD
     
  element:
    image: vectorim/element-web:latest
    restart: unless-stopped
    volumes:
      - ./element-config.json:/app/config.json
        
  synapse:
    image: matrixdotorg/synapse:latest
    restart: unless-stopped
    volumes:
     - ./synapse:/data

Don’t forget to change the Postgres password on this file to a secure password.

Now on the same folder create a config file for the elements clients, named element-config.json.

Copy the example file from Elements.io into your own config file, and adjust the following settings:

Add our own homeserver at the top of the file:

"default_server_config": {
        "m.homeserver": {
            "base_url": "https://matrix.example.com",
            "server_name": "matrix.example.com"
        },
        "m.identity_server": {
            "base_url": "https://vector.im"
        }
    },

Generate Synapse config

Now its time to generate the initial config of our synapse server, run the following command to do so:

sudo docker run -it --rm \
    -v "$HOME/matrix/synapse:/data" \
    -e SYNAPSE_SERVER_NAME=matrix.example.com \
    -e SYNAPSE_REPORT_STATS=yes \
    matrixdotorg/synapse:latest generate

Configuring Synapse

Now lets adjust the freshly generated synapse config to our needs

Edit the synapse/homeserver.yaml file as follows:

Comment-out the SQLite database:

#database:
#  name: sqlite3
#  args:
#    database: /data/homeserver.db

And now add our Postgres database:

database:
  name: psycopg2
  args:
    user: synapse
    password: STRONGPASSWORD
    database: synapse
    host: postgres
    cp_min: 5
    cp_max: 10

Spin it up!

Time to get things moving, spin-up your docker stack:

sudo docker-compose up -d

Create our first (admin) user

sudo docker exec -it matrix_synapse_1 bash
register_new_matrix_user -c /data/homeserver.yaml http://localhost:8008

Follow the on-screen instructions to create your first user

Install Caddy Reverse Proxy

Caddy will be used for the reverse proxy. This will handle incomming HTTPS connections and forward them to the correct docker containers. It a simple setup process and Caddy will automatically fetch and renew Let’s Encrypt certificates for us!

First head over to our user directory

cd ~

Install Caddy:

sudo apt install caddy -y

Create a Caddy file:

sudo nano Caddyfile

Paste the following config:

matrix.example.com {
  reverse_proxy /_matrix/* 10.10.10.4:8008
  reverse_proxy /_synapse/client/* 10.10.10.4:8008
  
  header {
    X-Content-Type-Options nosniff
    Referrer-Policy  strict-origin-when-cross-origin
    Strict-Transport-Security "max-age=63072000; includeSubDomains;"
    Permissions-Policy "accelerometer=(), camera=(), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), payment=(), usb=(), interest-cohort=()"
    X-Frame-Options SAMEORIGIN
    X-XSS-Protection 1
    X-Robots-Tag none
    -server
  }
}

element.example.com {
  encode zstd gzip
  reverse_proxy 10.10.10.3:80

  header {
    X-Content-Type-Options nosniff
    Referrer-Policy  strict-origin-when-cross-origin
    Strict-Transport-Security "max-age=63072000; includeSubDomains;"
    Permissions-Policy "accelerometer=(), camera=(), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), payment=(), usb=(), interest-cohort=()"
    X-Frame-Options SAMEORIGIN
    X-XSS-Protection 1
    X-Robots-Tag none
    -server
  }
}

Don’t forget to adjust the IPs and the domain names!

Reload Caddy

caddy reload

You are done, were you looking for more?

Head to your element domain and login!

Install Kubernetes on Ubuntu

Step 1: Install Docker

curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh

Step 2: Make sure containerd dosen’t have CRI disabled

Edit the file /etc/containerd/config.toml and make sure that the disabled_plugins setting is blank

nano /etc/containerd/config.toml

Then restart the containerd service:

service containerd restart

Step 3: Install Kubernetes

You will start by installing the apt-transport-https package which enables working with http and https in Ubuntu’s repositories. Also, install curl as it will be necessary for the next steps. Execute the following command:

sudo apt install apt-transport-https curl

Then, add the Kubernetes signing key to both nodes by executing the command:

echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" >> ~/kubernetes.list
sudo mv ~/kubernetes.list /etc/apt/sources.list.d
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -

After that, update the nodes:

sudo apt update

Once the update completes, we will install Kubernetes. This involves installing the various tools that make up Kubernetes: kubeadm, kubelet, kubectl, and kubernetes-cni

sudo apt-get install -y kubelet kubeadm kubectl kubernetes-cni

Step 4: Disabling Swap Memory

Kubernetes fails to function in a system that is using swap memory. Hence, it must be disabled in the master node and all worker nodes. Execute the following command to disable swap memory:

sudo swapoff -a

Step 5: Setting Unique Hostnames

Your nodes must have unique hostnames for easier identification. If you are deploying a cluster with many nodes, you can set it to identify names for your worker nodes such as node-1, node-2, etc. As we had mentioned earlier, we have named our nodes as kubernetes-master and kubernetes-worker. We have set them at the time of creating the server. However, you can adjust or set yours if you had not already done so from the command line. To adjust the hostname on the master node, run the following command:

sudo hostnamectl set-hostname kubernetes-master

Step 6: Changing Docker Cgroup Driver

On both master and worker nodes, update the cgroupdriver with the following commands:

sudo mkdir /etc/docker
cat <<EOF | sudo tee /etc/docker/daemon.json
{ "exec-opts": ["native.cgroupdriver=systemd"],
"log-driver": "json-file",
"log-opts":
{ "max-size": "100m" },
"storage-driver": "overlay2"
}
EOF

Then, execute the following commands to restart and enable Docker on system boot-up:

sudo systemctl enable docker
sudo systemctl daemon-reload
sudo systemctl restart docker

Step 7: Initializing the Kubernetes Master Node

The first step in deploying a Kubernetes cluster is to fire up the master node. While on the terminal of your master node, execute the following command to initialize the kubernetes-master:

kubeadm init --pod-network-cidr=10.244.0.0/16 --control-plane-endpoint <EXTERNAL-IP>

In the output, Kubernetes also displays some additional commands that you should run as a regular user on the master node before you start to use the cluster. Let’s run these commands:

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

We have now initialized the master node. However, we also have to set up the pod network on the master node before we join the worker nodes.

Step 8: Deploying a Pod Network

A pod network facilitates communication between servers and it’s necessary for the proper functioning of the Kubernetes cluster. You can read more about Kubernetes Cluster Networking from the official docs. We will be using the Flannel pod network for this tutorial. Flannel is a simple overlay network that satisfies the Kubernetes requirements.

kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/k8s-manifests/kube-flannel-rbac.yml

Step 9: Joining Worker Nodes to the Kubernetes Cluster

First, log into your worker node on a separate terminal session. You will use your kubeadm join command that was shown in your terminal when we initialized the master node in Step 7, execute the command indicated there, it will look something like the following:

kubeadm join XXXX:6443 --token XXX \
	--discovery-token-ca-cert-hash sha256:XXXX

Once the joining process completes, switch the master node terminal and execute the following command to confirm that your worker node has joined the cluster:

kubectl get nodes