Your cart is currently empty!
Author: Website Admin
Golang: GORM Association
Has Many Company has many Employees. Has Many – Belongs To You just need to add Company Company inside Employee struct. Has One Account has one Profile. Has One – Belongs To Unlike Has Many relationship, you can not just add Account Account inside the Profile struct. If you do, you will get an error…
Regex: Redirect from non-www to www
Input texts: Regex: Replace: Result: References: https://regex101.com/r/UnPetH/1
K3s: Cert Manager
Install cert-manager #1. Add Helm repository. #2. Update Helm repository. #3. (Option 1) Install Cert Manager CRD. At this moment, the latest version is v1.9.1. Click here to get the latest release. #4. (Option 2) Install Cert Manager via Helm. At this moment, the latest version is v1.9.1. Click here to get the latest release.…
K3s: Kubeconfig
K3s Kubernetes config file is located at: Kubernetes third-party applications will check the config file at: To make life easier, we link /etc/rancher/k3s/k3s.yaml to $HOME/.kube/config. References:
Kubernetes: Ingress
Ingress in one of the ways to expose HTTP and HTTPS routes of your internal services. Single rule: Multiple rules: This will froward /index.html, /about.html to svc1 and /some-dir/index.html, /some-dir/others.html to svc2. References:
Docker: Logs Output
Docker only logs STDOUT and STDERR from PID 1. Sending stuff to STDOUT and STDERR of PID n:
MySQL: Too Many Connections Error
Check status: Check config: Default max_connections config is 151. Check current process list: By the end of the line you will get the total connections. Set new max_connection value: References: MySQL – SHOW VARIABLES Statement (tutorialspoint.com) MySQL – SET Syntax for Variable Assignment (tutorialspoint.com)
Golang: String Format
%% prints a single % %b binary integer %c a character represented by the corresponding Unicode code point %d decimal integer %e scientific notation (mantissa/exponent), lowercase %E scientific notation (mantissa/exponent), uppercase %f decimal floating point, lowercase %F decimal floating point, uppercase %g the shortest representation of %e or %f %G the shortest representation of %E…
Kubernetes: Headless Service and Endpoints
Say you have Kubernetes node on 192.168.1.10 and a database node on 192.168.1.11. First, we create a dummy service: When you create a service you will also get an endpoint: To get my-db to point to 192.168.1.11. First, we need to edit the endpoint to point to 192.168.1.11. Add these lines to the end of…