Install docker
curl -fsSL https://get.docker.com/ | sh
start, and enable to start after rebooting:
systemctl start docker systemctl enable docker
optionally you can add permissions you yourself:
usermod -aG docker jaqb
in my case my user is jaqb.
Install docker-compose
curl -L "https://github.com/docker/compose/releases/download/\ 1.23.1/docker-compose-$(uname -s)-$(uname -m)" \ -o /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose
you have to check if there is newer version than 1.23.1.
You can get System Workbench for STM32 from STM32 Community download area.
You can get STM32CubeMX form ST site.
STM32 CubeMX
I've tried to run SetupSTM32CubeMX-5.0.0.linux, but I got:
/lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
so I need to install
yum install glibc.i686
because of missing /lib/ld-linux.so.2 file.
Now I've got:
[root@linux en.stm32cubemx5]# ./SetupSTM32CubeMX-5.0.0.linux chdir /tmp/en.stm32cubemx5/. current dir /tmp/en.stm32cubemx5 Nov 20, 2018 5:47:11 PM INFO: Logging initialized at level 'INFO' Nov 20, 2018 5:47:11 PM INFO: Commandline arguments: Nov 20, 2018 5:47:13 PM INFO: Detected platform: linux,version=3.10.0-693.21.1.e l7.x86_64,arch=x64,symbolicName=null,javaVersion=1.8.0_161 Nov 20, 2018 5:47:14 PM WARNING: No console implementation of panel: \ com.st.microxplorer.install.MXAnalyticsPanel Console installation is not supported by this installer [ Console installation FAILED! ]
If you have installed 4.x version you can get error when you try to run:
2018-11-20 15:22:45,811 [INFO] STM32CubeMX:30 - Starting STM32CubeMX Exception in thread "AWT-EventQueue-0" java.awt.HeadlessException
I had to install:
yum groups install "GNOME" "X Window System" "Fonts" yum install xorg-x11-fonts-Type1 yum install java-1.8.0-openjdk
Java is important - java-1.8.0-openjdk-headless it's not enough.
Now I can install it without problems.
System Workbench for STM32
./install_sw4stm32_linux_64bits-v2.7.run -m -f
exit with error:
error: Failed dependencies: libusbx >= 1.0 is needed by st-stlink-server-1.1.0-2.amd64
so I've installed:
yum install libusbx
now it install without problems.
Install kubectl:
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 EOF yum install -y kubectl
Install Minikube:
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 install minikube-linux-amd64 /usr/local/bin/minikube
It copy file minikube-linux-amd64 to /usr/local/bin/minikube.
Install docker:
curl -fsSL https://get.docker.com -o get-docker.sh bash get-docker.sh
downgrade to supported version:
yum remove docker-ce docker-ce-cli yum install docker-ce-18.06.1.ce systemctl enable docker systemctl start docker
Set hostname
You have to have name minikube be resolved to your IP:
hostname minikube
Optional
Install conntrack:
yum install conntrack
Installing crictl:
VERSION="v1.12.0" curl -LO https://github.com/kubernetes-sigs/cri-tools/releases/download/$VERSION/crictl-$VERSION-linux-amd64.tar.gz tar zxvf crictl-$VERSION-linux-amd64.tar.gz -C /usr/local/bin rm -f crictl-$VERSION-linux-amd64.tar.gz
Recomended settings:
iptables -I INPUT -p tcp --dport 8443 -j ACCEPT iptables -I INPUT -p tcp --dport 10250 -j ACCEPT swapoff -av
The main command:
minikube --vm-driver=none start
you should get something like this:
Starting local Kubernetes v1.10.0 cluster... Starting VM... Getting VM IP address... Moving files into cluster... Downloading kubelet v1.10.0 Downloading kubeadm v1.10.0 Finished Downloading kubeadm v1.10.0 Finished Downloading kubelet v1.10.0 Setting up certs... Connecting to cluster... Setting up kubeconfig... Starting cluster components... Kubectl is now configured to use the cluster. =================== WARNING: IT IS RECOMMENDED NOT TO RUN THE NONE DRIVER ON PERSONAL WORKSTATIONS The 'none' driver will run an insecure kubernetes apiserver as root that may leave the host vulnerable to CSRF attacks When using the none driver, the kubectl config and credentials generated will be root owned and will appear in the root home directory. You will need to move the files to the appropriate location and then set the correct permissions. An example of this is below: sudo mv /root/.kube $HOME/.kube # this will write over any previous configuration sudo chown -R $USER $HOME/.kube sudo chgrp -R $USER $HOME/.kube sudo mv /root/.minikube $HOME/.minikube # this will write over any previous configuration sudo chown -R $USER $HOME/.minikube sudo chgrp -R $USER $HOME/.minikube This can also be done automatically by setting the env var CHANGE_MINIKUBE_NONE_USER=true Loading cached images from config file.
Launch first pod:
kubectl run hello-minikube --image=k8s.gcr.io/echoserver:1.10 --port=8080 kubectl run --generator=deployment/apps.v1beta1 is DEPRECATED and will be removed in a future version. Use kubectl create instead. deployment.apps/hello-minikube created kubectl expose deployment hello-minikube --type=NodePort service/hello-minikube exposed
check if it works:
kubectl get pod NAME READY STATUS RESTARTS AGE hello-minikube-7c77b68cff-677z8 1/1 Running 0 3m
you can also check ip or service url:
minikube ip minikube service hello-minikube --url
when you check that it works (using browser/wget/culr) you can cleanup:
kubectl delete services hello-minikube kubectl delete deployment hello-minikube
but what is it for...?
I've upgraded Pi-hole do 4.0 version:
docker run -d --name pihole-4.0.0-1 \ --dns 127.0.0.1 --dns 1.1.1.1 \ -e ServerIP=192.168.1.28 -e DNS1=192.168.1.4 \ -e WEBPASSWORD=secret \ -p 8018:80 -p 53:53 -p 53:53/udp \ --restart=unless-stopped \ pihole/pihole:4.0.0-1
as you can see I use new name (pihole/pihole), set power policy and additional --dns option - it's necessary.
Last time I've to manually edit /etc/resolve.conf inside container - this is simple workaround.
There is easy way to control lights using PIR (Passive Infra Red) it looks like this:
As usually message from MQTT broker is translated to JSON, then I use switch to filter-out message from PIR (in my case AA0446). I sent "On" and 5 minutes later "Off" to template
{ "idx" : 25, "command" : "switchlight", "switchcmd" : "{{payload}}" }
Finally full message is sent to domoticz/in topic.
Complete code.
Add comment