What is slow query? https://dev.mysql.com/doc/refman/8.0/en/slow-query-log.html
The definition “slow query” is “SQL statements that take more than long_query_time seconds to execute and require at least min_examined_row_limit rows to be examined”.
Configure Check current status SHOW VARIABLES LIKE "slow_query_log"; SHOW VARIABLES LIKE "slow_query_time"; SHOW VARIABLES LIKE "slow_query_log_file"; Enable to log slow queries Logging slow queries which take more than 10 seconds.
SET GLOBAL slow_query_log = 'ON'; SET GLOBAL long_query_time = 10; SET GLOBAL slow_query_log_file = '/path/filename'; A sample line in the log file:
This is my memo while learning OAuth 2.0.
RFC 6749 https://tools.ietf.org/html/rfc6749
1.1 (Entities and) Roles Client: An application making protected resource requests on behalf of the resource owner and with its authorization. Resource owner: An entity capable of granting access to a protected resource. When the resource owner is a person, it is referred to as an end-user. Resource server: The server hosting the protected resources, capable of accepting and responding to protected resource requests using access tokens.
Install (for test) I used Docker image for test purpose.
https://www.elastic.co/guide/en/elasticsearch/reference/current/starting-elasticsearch.html
docker run \ -d --rm \ -p 9200:9200 \ -p 9300:9300 \ -e "discovery.type=single-node" \ docker.elastic.co/elasticsearch/elasticsearch:7.12.1 Check the status
$ curl localhost:9200 { "name" : "cfd8f0ec08e2", "cluster_name" : "docker-cluster", "cluster_uuid" : "f5fi-57iSVWngx0slmijPA", "version" : { "number" : "7.12.1", "build_flavor" : "default", "build_type" : "docker", "build_hash" : "3186837139b9c6b6d23c3200870651f10d3343b7", "build_date" : "2021-04-20T20:56:39.040728659Z", "build_snapshot" : false, "lucene_version" : "8.8.0", "minimum_wire_compatibility_version" : "6.8.0", "minimum_index_compatibility_version" : "6.
Get API key (not used so far) Project erstellen. API & Services -> Anmeldedaten -> Anmeldendaten erstellen. Add IP restriction to the API key. Schränken: Google Cloud APIs. Install SDK Install Python on your local environment. Install Google Cloud SDK. Configure the SDK with gcloud init. <- need to check which credentials are used for SDK auth. Install Python Refer to the instructions (on pyenv.) I installed v3.8.6 at this time.
I wathed the following videos.
Unix system calls (1/2) - Brian Will Unix system calls (2/2) - Brian Will Here is my note about system call.
POSIX From Wikipedia:
The Portable Operating System Interface (POSIX) is a family of standards specified by the IEEE Computer Society for maintaining compatibility between operating systems. POSIX defines the application programming interface (API), along with command line shells and utility interfaces, for software compatibility with variants of Unix and other operating systems.
Motivation I want to mirror GitLab repository to a bare Git repository which was hosted by Gitosis. As of Dec. 2020, GitLab Community Edition support “Push” only. “Push” means “mirror a GitLab (CE) repository to other Git repositories.”
How to set up - GitLab Allow GitLab to access outbound Otherwise, you got an error Remote mirrors url is blocked: Requests to the local network are not allowed. “Admin” -> “Settings” -> “Network” -> “Outbound Requests” -> “Allow requests to the local network from hooks and services”
Install gitosis On Ubuntu20 Python 2!!
https://github.com/tv42/gitosis/blob/master/README.rst https://www.howtoforge.com/setting-up-gitosis-on-ubuntu
apt install -y python-setuptools git clone https://github.com/tv42/gitosis.git cd gitosis sudo python2 setup.py install sudo adduser \ --system \ --shell /bin/sh \ --gecos 'git version control' \ --group \ --disabled-password \ --home /srv/example.com/git \ git ssh-keygen -b 4096 sudo -H -u git gitosis-init < .ssh/id_rsa.pub sudo chmod 755 /srv/example.com/git/repositories/gitosis-admin.git//hooks/post-update client side
git clone git@serverdomain:gitosis-admin.git Create user Put pubkey to gitosis-admin/keydir
vim keydir/foo.pub edit gitosis.
Why I do this? I use GitLab for internal purpose (don’t face to the Internet.) In order to using CI/CD integration with Docker, I should use “valid” TLS certificate, so I created an self-sign certificate.
Instructions Create a private key. openssl ecparam -out mygitlab.com.key -name prime256v1 -genkey Create a config file mygitlab.cnf for crate self-sign certificate. [ req ] default_keyfile = /path/to/the/key/file/mygitlab.com.key default_md = sha256 prompt = no distinguished_name = gitlab_dn x509_extensions = gitlab_ext [ gitlab_dn ] commonName = mygitlab.
Motivation I want to mount Nginx configuration as ConfigMap.
The simplest example Original Here is the default /etc/nginx/conf.d/default.conf in Nginx Docker image (comment outs were removed.)
server { listen 80; listen [::]:80; server_name localhost; location / { root /usr/share/nginx/html; index index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } } Overwritte - return a message I’ve changed location / to return the message Have a nice day!
Install AWS CLI My environment WSL Python is installed wiht pyenv. Install aws-cli.
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" unzip awscliv2.zip sudo ./aws/install Check.
$ aws --version aws-cli/2.0.61 Python/3.7.3 Linux/4.19.104-microsoft-standard exe/x86_64.ubuntu.20 Issue AWS access key Log in to Dashboard. Navigate to IAM. In the left pane, “Access management” -> “Users” Click an user, and go to tab “Security credentials” Access keys -> Create access key. You can get credentials, and don’t forget to save “Secret access key,” or download CSV.