Category Archives: Administration
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): watch -n 3 «curl —location —request GET ‘http://…'» will run curl every 3 seconds until you break it. zsh specific: repeat 5 { curl —location —request GET ‘http://…’ } will repeat it 5 times without any delay
Using tcpdump for k8s pods
You need wireshark to be installed on your local machine — download (more on this below). If you don’t have tcpdump installed inside the pod, you can install it with # get pod name kubectl get po -Lversion,cfg,infra-cfg -lapp= kubectl exec -it sh # inside the pod, alpine apk add tcpdump Then, on your local …
Forward multiple kubernetes pods for local development
kubefwd is a great tool that can forward a lot of pods at once to your local machine. The only downside for me is that it touches your local `/etc/hosts`. That’s how I use it: sudo KUBECONFIG=<path to your k8s config> kubefwd svc -l «app in (first-api, second-api, third-service)» It does not have huge documentation, …
Using DataDog on your CentOs
DD_AGENT_MAJOR_VERSION=7 DD_API_KEY=<your-key> DD_SITE=»datadoghq.eu» bash -c «$(curl -L https://s3.amazonaws.com/dd-agent/scripts/install_script.sh)» sudo nano /etc/datadog-agent/datadog.yaml # uncomment logs_enabled: true sudo systemctl restart datadog-agent sudo mkdir /etc/datadog-agent/conf.d/go.d sudo nano /etc/datadog-agent/conf.d/go.d/conf.yaml # and add contents from the url below https://app.datadoghq.eu/logs/onboarding/server https://docs.datadoghq.com/agent/faq/error-restarting-agent-already-listening-on-a-configured-port/ Or, if you want a dockerized version of DataDog agent, and you want to listen to docker logs, you can …
Add all lines from a .env file to environment
zsh: zsh ./configs/dev/dev.env|sed ‘s/#1.*$//g’|grep ‘^[^#]’|grep -v ‘^$’|sed ‘s/^/export /g’ bash: bash ./configs/dev/dev.env|sed ‘s/#1.*$//g’|grep ‘^[^#]’|grep -v ‘^$’|sed ‘s/^/export /g’ to output to stdout cat ./configs/dev/dev.env|sed ‘s/#1.*$//g’|grep ‘^[^#]’|grep -v ‘^$’|sed ‘s/^/export /g’ prepend running a command (did not try it, but something similar): env $(cat ./configs/dev/dev.env|sed ‘s/#.*$//g’|grep ‘^[^#]’|grep -v ‘^$’|xargs)
Integration tests with testcontainers-go
Here is the go library that simplifies integration tests with docker containers — https://github.com/testcontainers/testcontainers-go. That’s how you can use it to test sql — https://github.com/testcontainers/testcontainers-go/blob/master/docs/examples/cockroachdb.md. Project documentation — https://golang.testcontainers.org/features/docker_compose/ The idea is to prepare the environment, build your app, then make requests and check the DB state.
How to update your k8s pod limits
kubectl edit deployment ←name-of-your-app→ Then search for memory (for instance) and update request/limit for it. When you quit, it will be saved automatically for you.
Load testing tools
https://yandex.ru/dev/tank/ [Tool | Free] https://jmeter.apache.org/ [Tool | Free] http://tsung.erlang-projects.org/ [Tool | Free] https://gatling.io/ [Tool | Free/$] https://k6.io/ [Tool | Free/SaaS] https://locust.io/ [Tool | Free] https://loader.io/ [SaaS | Free/$] https://artillery.io [Tool | Free/$] https://github.com/wg/wrk [Tool | Free]
Read logs from docker container
tail -f `docker inspect —format='{{.LogPath}}’ [containername]`