Category Archives: Administration
docker simple starter
Build and run (on linux do not forget sudo):
1 2 |
docker image build -t <image-name> . docker container run --env "DOCKER=true" --env "NODE_ENV=test" --env "NODE_PORT=8000" --mount "type=bind,source=/etc/nginx/sites-enabled,target=/sites-enabled" --env "PATH_CONF=/sites-enabled" -p 8000:8000 --rm --name <container-name> --network=host <image-name> |
Login into container
1 |
docker container exec -it <container-name> bash |
Pipeline view in shell
1 |
tail -f /var/log/nginx/access.log | pv --line-mode --rate > /dev/null |
https://serverfault.com/questions/473905/is-there-a-unix-linux-command-to-count-lines-per-second-from-stdin
grep, zgrep, less and zless regexp examples
Grep all files with mask:
1 |
grep "regex to find" /var/log/lb-*.net/nginx/error.log |
Grep all zipped files with mask:
1 |
zgrep "regex to find" /var/remote-log/nodejs-1*.net/node/error.log.* |
Less all files with mask:
1 |
less /var/log/lb-*.net/nginx/error.log |
Grep all zipped files with mask:
1 |
zless /var/remote-log/nodejs-1*.net/node/error.log.* |
Tail all files with mask:
1 |
tail -f /var/log/lb-*.net/nginx/error.log |
Search for occurencies in directory with grep
1 |
grep -rnw '/path/to/somewhere/' -e 'pattern' |
https://stackoverflow.com/questions/16956810/how-do-i-find-all-files-containing-specific-text-on-linux
git squash variants
If you just want to squash all commits into one. 1. The simplest way:
1 2 3 4 |
git checkout -b <temp-branch> origin/master git merge --squash origin/<branch-with-changes-you-need> git commit -m 'commit message' git push origin refs/heads/<temp-branch>:<new-branch> |
https://stackoverflow.com/a/5309051 If you have a message like ‘error: failed to push some refs to’, add —force to the last command.
Check ssl certificates on a host
1 |
openssl s_client -connect your-host:443 |
If it says something like gethostbyname failure then try following. It needs socat, which can be installed on macOs like this — brew install socat. Then in one terminal open
1 |
socat TCP4-LISTEN:10443,fork TCP6:your-host:443 |
and in another terminal:
1 |
openssl s_client -crlf -connect 127.0.0.1:10443 |
Check availability and version of a package in Ubuntu
1 2 |
apt-cache search <name> apt-cache policy <name> |
SRE: SLA vs SLO vs SLI
SLA — Service Level Agreement. It’s more about contracts. SLI — Service Level Indicator. It’s some parameters that should be measured and which should be kept in some range. SLO — Service Level Objective. It says how often SLI could fail. Like SLI should be true for 99.9% of the time. Video from Google’s engineer …
What is a Service Mesh? Introductory article from NginX
The original is here — https://www.nginx.com/blog/what-is-a-service-mesh/ Another small introductory article on Istio you can find here. A service mesh is a configurable infrastructure layer for a microservices application. It makes communication between service instances flexible, reliable, and fast. The mesh provides service discovery, load balancing, encryption, authentication and authorization, support for the circuit breaker pattern, and other …
Istio — platform for managing and connecting your microservices. Service mesh
https://istio.io/docs/concepts/what-is-istio/overview.html It’s flexible and modular service mesh made by Google, IBM and Lyft. It is a platform for managing your kubernetes system. It’s responsible traffic management, observability, policy enforcement, service identity and security. It provides features like service discovery, load balancing, A/B experiments, canary deployments, circuit breaking and health checks.