Category Archives: Administration
Docker and Kubernetes basics for developers
Docker Docker containers are much more lightweight compared to classic VMs as they leverage host OS instead of starting their own OS. Containers are using 2 features of Linux-based OS: Namespaces and Cgroups (Control Groups). Namespace Lets you allocate resources in an isolated environment (like a sandbox). On a container start, docker daemon generates a …
How to install Outline VPN on a random VPS server
In Ountline Manager, when you add a new server, select an option called «Set up Outline everywhere».
How to reinstall MacOS on M1 MacBook wiping previous admin
I’ve run into an issue when I gave my older MacBook with M1 chip to my wife. Even after reinstalling MacOS with a proper user for her and restoring from Time Machine, her admin account was not really the admin of that laptop. She was unable to create new users (MacOs failed to set a …
DataDog: use events in dashboards
Using events as datasource is pretty straightforward, and described here — https://docs.datadoghq.com/events/. To use it as a graph overlay (for instance, to show app deployments), you can edit your graph, Event Overlays, and add something like below:
1 |
tags:tool:morty,dd_env:$env [something like order-history-*] |
Fixing docker does not want to update images
If you run docker pull, and you see an error like failed to register layer: Error processing tar file(exit status 2): fatal error: runtime: out of memory, there could be 2 reasons. Obvious one — not enough disk space for docker. You can fix it with
1 2 |
docker system prune -af docker volume ls -qf dangling=true |
WARNING: It will remove your unused resources like …
How to add and increase swap on CentOS
Adding a swap file without reboot If you are having a dedicated server somewhere with not that much memory, you could decide to add a swap without rebooting your server. To do so, you need to follow the routine:
1 2 3 4 |
sudo dd if=/dev/zero of=/swapfile count=1024 bs=1MiB sudo mkswap /swapfile sudo chmod 0600 /swapfile sudo swapon /swapfile |
Increasing a swap size If something goes wrong with your system, and you see that …
How to install multiple versions of go on mac m1
For instance, I want to try a new beta, go1.18beta2 (I check if it’s available on the download page). And I already have a regular go1.17, that I want to use as a default one. To do so, I need to do this:
1 2 |
go install golang.org/dl/go1.18beta2@latest go1.18beta2 download |
Then I can check if it’s okay — go1.18beta2 version #go …
Create SQS queues on localstack container start
Put this file to your filesystem as ←anyname.sh→:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
#!/usr/bin/env bash set -euo pipefail # enable debug # set -x echo "configuring sqs" echo "===================" LOCALSTACK_HOST=localhost AWS_REGION=eu-central-1 # https://docs.aws.amazon.com/cli/latest/reference/sqs/create-queue.html create_queue() { local QUEUE_NAME_TO_CREATE=$1 awslocal --endpoint-url=http://${LOCALSTACK_HOST}:4566 sqs create-queue --queue-name ${QUEUE_NAME_TO_CREATE} --region ${AWS_REGION} --attributes VisibilityTimeout=30 } create_queue "queue2" create_queue "queue1" |
For instance, ./localstack_bootstrap/sqs_bootstrap.sh. Don’t forget to run chmod +x ./localstack_bootstrap/sqs_bootstrap.sh. Add this line to your docker-compose.yml: — ./localstack_bootstrap:/docker-entrypoint-initaws.d/. So it could look like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
services: localstack: container_name: aws_sqs hostname: sqs image: localstack/localstack:latest environment: - AWS_DEFAULT_REGION=ap-southeast-1 - EDGE_PORT=4566 - SERVICES=sqs ports: - '4566:4566' volumes: - "${TMPDIR:-/tmp/localstack}:/tmp/localstack" - "/var/run/docker.sock:/var/run/docker.sock" - ./localstack_bootstrap:/docker-entrypoint-initaws.d/ |
Then your queues can be reached by URLs http://localhost:4566/000000000000/queue1 and http://localhost:4566/000000000000/queue2. Further reading: https://docs.aws.amazon.com/cli/latest/reference/sqs/create-queue.html https://joerg-pfruender.github.io/software/docker/microservices/testing/2020/01/25/Localstack_in_Docker.html
Parental control for Linux Mint
Time limiter with UI — Timekpr (https://www.linuxuprising.com/2019/11/timekpr-next-is-linux-parental-control.html) Domain blocker — Mintnanny (https://www.reallinuxuser.com/how-to-setup-parental-control-in-linux-mint/), too simple.
Shell: repeat a task multiple time
All shells (bash/zsh):
1 |
watch -n 3 "curl --location --request GET 'http://...'" |
will run curl every 3 seconds until you break it. zsh specific:
1 |
repeat 5 { curl --location --request GET 'http://...' } |
will repeat it 5 times without any delay