Pages

Bài đăng phổ biến

Friday, November 18, 2022

Create shortlink with custom domain with firebase dynamic link by curl

curl  'https://firebasedynamiclinks.googleapis.com/v1/shortLinks?key=xxxx' --header 'Content-Type: application/json' --data '
{
"dynamicLinkInfo": {
"domainUriPrefix":"https://yourdomain",
"link":"https://yourlinkyouwant_to_redirectto",
     "analyticsInfo": {
      "googlePlayAnalytics": {
        "utmSource": "nhannguyen",
        "utmMedium": "test",
        "utmCampaign": "smartpos"
      }
    },
},
  "suffix": {
    "option": "SHORT"
  }
}'

Monday, November 7, 2022

Solved: [ kubernetes ] client intended to send too large body

To set client_max_body_size in ingress-nginx-controller you must add more this line to yaml file like that: 

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/proxy-body-size: "20m"
.......



Note: 

1. 20m ~ 20MB and no need restart nginx pod .
2. some template yaml have added this line to annotations : ingress.kubernetes.io/proxy-body-size: "<valuem>" but it is not enough you must add this line : nginx.ingress.kubernetes.io/proxy-body-size there is nginx in the first line .

Sunday, October 9, 2022

Upgrade nginx on the fly - no downtime

          #first please check pid file by:

          cat /var/run/nginx.pid  

#copy new binary to /sbin/nginx and force overwrite if you don't use option "-f" you will see this error : 
cp: cannot create regular file ‘/sbin/nginx’: Text file busy
/bin/cp -f nginx /sbin/nginx 

#spawn a new nginx master/workers set

kill -s USR2 `cat /var/run/nginx.pid`

#check process

ps aux | grep nginx

# check pid 

tail -n +1 /var/run/nginx.pid*

#shut down the old master's worker

kill -s WINCH `cat /var/run/nginx.pid.oldbin`

#check 
ps aux | grep nginx

safely shut down the old master process

kill -s QUIT `cat /var/run/nginx.pid.oldbin`