Wednesday, November 28, 2018

Postgres SQL


To get the 12HH with AM/PM

select to_char(create_date at time zone 'utc', 'HH12:MI:SS AM') as "createdate", proc_type, state, * from vb_proc_queue where proc_type='Email1SubsqSignUpNotify' order by create_date desc

04:18:19 PM

Sunday, November 25, 2018

Installing Kubernetes

1. Install kubectl
Install with snap on Ubuntu
sudo snap install kubectl --classic
kubectl version

1.1 Install virtualbox
https://tecadmin.net/install-oracle-virtualbox-on-ubuntu/

2. Install minikube
https://github.com/kubernetes/minikube/blob/v0.29.0/README.md
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 \ && sudo install minikube-linux-amd64 /usr/local/bin/minikube

minikube start

and then ... can't allocate memory :(


2nd attempt
https://kubernetes.io/docs/setup/independent/install-kubeadm/

cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
exclude=kube*
EOF

# Set SELinux in permissive mode (effectively disabling it)
setenforce 0
sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config

yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes

systemctl enable kubelet && systemctl start kubelet


Installing a pod network add-on ???

kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"
before kubeadm init, run below
sudo cp /etc/kubernetes/admin.conf $HOME/
sudo chown $(id -u):$(id -g) $HOME/admin.conf
export KUBECONFIG=$HOME/admin.conf

Install docker
yum install -y docker
systemctl enable docker
systemctl start docker




Wednesday, November 14, 2018

Odoo Warning - Validation Error


Problem:
































Solution: None
it turns out that the problem was the trigger. our DB admin created trigger :(

Sunday, November 4, 2018

curl example

In my freelance job, I have tasked which I need to call the API using curl. I don't have any much knowledge of it but I think I got some idea.

Basically, the API is called by a PDA mobile device where a user can enter the information and will send through JSON format and call the API.

But the API call will not always return success. The first task which I want to do is to store that raw json into the server, which I already finish implemented.

The second one is to call the API through curl and passing the failed raw JSON. So before will run the curl, a user who only has SSH access to a server can able to edit the raw JSON and run curl to call API with edited raw JSON.

here's the curl syntax:

curl -vX POST http://206.189.159.4:8080/chicken/api/order/create -d @json/20181008-180947_PDA_1.json --header "Content-Type: application/json"


let me explain more:
-v = verbose
X = request
-d = data json file (i don't know why there is @ at the beginning)
--header "Content-Type: application/json" = i think its understandable as we pass json file here



Eureka!

free online comma separating tool

https://delim.co/#