RSSAmplifier

Blog

selivan.github.io

Just another IT blog

selivan.github.ioRSS feed ↗10 posts

Latest posts

Execute script before starting service in docker-compose

Sometimes you need to execute shell commands before starting service in docker compose. You can create oneshot service using the image you need for those commands, entrypoint /bin/sh and shell commands in command option. YAML multi-line syntax allows to conviniently place the script inside docker-compose.yml . Use set -x to get verbose logs of script execution. Don’t forget that the last command…

Simple bash debugger using trap DEBUG

Inspired by this post by @tminnigaliev . Besides traps(handlers) for signals, bash have 4 special traps: EXIT to run on exit from the shell. RETURN to run each time a function or a sources script finishes. ERR to run each time command failure would cause the shell to exit if set -e is used. DEBUG to execute before every command. The last one allows to create a simple debugger inside a bash script:…

WSL fix using random private subnets

WSL is a nice way to work with Linux development environment from Windows. It works pretty decently after version 2, that switched to using proper virtualization instead of translating syscalls and other weird magic. Unfortunately, it has one serious problem: subnet for WSL is selected randomly from all available private subnets, preferably from 172.16.0.0/12 range. So you turn on your notebook,…

Change TLS/SSL version and cypher parameters for Linux service using openssl library

Sometimes you need to change TLS/SSL parameters for a service using libssl library from openssl , but the service config does not accept that parameters. In this example, I had to change rsyslog forwarder parameters to send logs to the target that wasn’t playing nice with TLS 1.3 and modern encryption protocols. libssl and applications using it take configuration parameters from configuration file…

Systemd broken network.online target workaround

man systemd.special says: Units that strictly require a configured network connection should pull in network-online.target (via a Wants= type dependency) and order themselves after it. Despite that, I ran into a problem: service that requires outside network to be immediately available fails to start with configuration like described in manual: [Unit] Wants = network-online.target After =…

Syncronize time by NTP before starting any services in Linux

Servers often have wrong clock on startup. NTP services, like ntp , chrony and systemd-timesyncd try to correct clock gradually to avoid weird bugs in software. Therefore, if server has a large clock offset on startup, it works with incorrect clock for several minutes. In my experience, AWS instances may have clock error up to 5 minutes on startup. Server writing log timestamps 5 minutes in the…

Letsencrypt: auto generate bundle certificates for Haproxy

I was surprised to not get instant answer googling “letsencrypt automatically generate bundle certificates for haproxy”. So here it is, to save 5 minutes of your time. Generates bundle(fullchain + privkey) certificates for everything in /etc/letserncrypt/live/*/fullchain_and_privkey.pem , does not update generated files if not necessary. NOTE : renew hooks are not triggered when you run certbot…

Using Ansible with bastion or jump host with variables

Sometimes due to network configuration or security reasons you can’t access a host directly, but should use intermediate host, so-called bastion or jump host. My presious article on this topic, using ssh config file: Using Ansible with bastion host . Another option is using variables. This approach is more flexible: it is easier to define different bastion hosts for different hosts and groups with…

Smooth deploy of a loaded PHP web application with php-fpm and nginx, without downtime or errors

UPDATE 2020-05-10 Added the cachetool option, thanks to reddit users ds11 and SevereHeight for mentioning it. Generally, the smoothest way to deploy a loaded web app without downtime or erros is by adding instances(hosts, containers) with the new version to balancer and then removing old ones, when they have served all running requests. But sometimes it is easier to switch app versions on…

Removing all unnecessary bloatware from Xiaomi MIUI 11/12 (Android 9/10) without root

TLDR: If you just want the list of bloatware app package names for Xiaomi MIUI - scroll to the end of the artice. UPDATE 2020-05-09 : Added SIM Toolkit description. UPDATE 2020-07-04 Added some apps, thanks to @thecrazyblack. UPDATE 2020-11-23 Updated list of apps, thanks to new comments by @toast254, @swiesmann, @MarcelloDM, @satnited. Xiaomi phones have impressive parameters for given price, but…