Configuring Heiman ZigBee devices on Home Assistant

We’ll be using a Raspberry Pi 3 with pure Raspbian.

In /boot/config.txt, we add the following lines:

enable_uart=1
dtoverlay=pi3-disable-bt

remove the word phase “console=serial0,115200” or “console=ttyAMA0,115200” from /boot/cmdline.txt
r

Problems:

– The devices disconnected after few days.

Glass (2019)

Everyone’s talking about Avengers. I simply don’t give a damn. Glass is the type of Super Hero movie I like.

I wonder why the movie was titled as “Glass” rather than something else like Mr [insert a word here] or something. Hmmm. Maybe I now know the answer to this as I’m writing this blog post. I’m getting more mind-blown even now.

Not for the faint-heart/mind though. I’d give it a 9.5/10

Basic Security with Asterisk/Freeswitch

This post is not exhaustive. These are the minimum security measures.

  1. Block all access to port 5060 and 5080
    1. /sbin/iptables -A INPUT -p udp –destination-port 5080 -j DROP
    2. /sbin/iptables -A INPUT -p udp –destination-port 5080 -j DROP
  2. Allow only specific IPs to connect
    1. /sbin/iptables -I INPUT -p udp -s {IP} –destination-port 5060 -j ACCEPT
    2. /sbin/iptables -I INPUT -p udp -s {IP} –destination-port 5080 -j ACCEPT

Elasticsearch on Docker Swarm with NGINX

On all Hosts:

sudo sysctl -w vm.max_map_count=262144

On Host 1:

1. We initialize a docker swarm. Add `–advertise-addr X.X.X.X` if inside a private network

# docker swarm init

1. We create a network on docker

# docker network create --driver overlay --subnet 10.0.10.0/24   --opt encrypted elastics

“Overlay networks connect multiple Docker daemons together and enable swarm services to communicate with each other.” [2]

2. We initialize the docker containers with 3 copies

docker service create --name elasticsearch --network=elastics \
  --replicas 3 \
  --env SERVICE_NAME=elasticsearch \
  --env "ES_JAVA_OPTS=-Xms256m -Xmx256m -XX:-AssumeMP" \
  --publish 9200:9200 \
  --publish 9300:9300 \
  youngbe/docker-swarm-elasticsearch:5.5.0

3. We get the command to generate the joining link

# docker swarm join-token worker
To add a worker to this swarm, run the following command:

    docker swarm join \
    --token SWMTKN-TOKEN \
    X.X.X.X:2377

On Worker Host
1. Type the command from the last step from host 1

# docker swarm join \
    --token TOKEN \
    X.X.X.X:2377

On Master 1

1. We now setup nginx

docker service create --name meranginx --network=elastics  nginx
docker service create --name nginx --network=elastics --mount type=bind,source=/root/meradockernginx/elasticsearch.conf,destination=/etc/nginx/conf.d/elasticsearch.conf nginx

To be continued…
#TODO: make a conf file for nginx which listens on port 9200 and uses `elasticsearch` as backend server

References:

[1] https://github.com/imyoungyang/docker-swarm-elasticsearch
[2] https://docs.docker.com/network/#network-drivers