Skip to content

Instantly share code, notes, and snippets.

View XIIIVI's full-sized avatar

Fabrice TX XIIIVI

View GitHub Profile
@XIIIVI
XIIIVI / gist:a127c4c3dab42d4ca5c27732d7d91e72
Last active July 25, 2025 08:28
create_env_var_from_file.sh
# Path to the file containing key-value pairs
ENV_FILE="..."
# Check if the file exists and is not empty
if [[ -f "$ENV_FILE" && -s "$ENV_FILE" ]]; then
echo "Loading environment variables from $ENV_FILE..."
# Read the file line by line
while IFS='=' read -r key value; do
sudo docker service create --name=mosquitto \
--replicas=5 \
--publish published=1883,target=3881 \
--restart-condition=on-failure \
--limit-memory=100M \
--limit-cpu=1 \
--constraint=node.labels.mqtt==true \
eclipse-mosquitto:2.0.22-openssl
echo "+-----------------------------+"
sudo docker service create --name=mosquitto \
--replicas=5 \
--publish published=1883,target=3881 \
--restart-condition=on-failure \
--limit-memory=100M \
--limit-cpu=1 \
eclipse-mosquitto:2.0.22-openssl
echo "+-----------------------------+"
echo "| Checking installed services |"
sudo docker service create --name=hivemq-edge \
--replicas=5 \
--publish published=5001,target=5100 \
--restart-condition=on-failure \
--limit-memory=100M \
--limit-cpu=1 \
--constraint=node.labels.mqtt==true \
hivemq/hivemq-edge:2025.8
echo "+-----------------------------+"
sudo docker service create --name hivemq-edge \
--replicas 5 \
--publish published=5001,target=5100 \
--restart-condition=on-failure \
--limit-memory 100M \
--limit-cpu 1 \
hivemq/hivemq-edge:2025.8
echo "+-----------------------------+"
echo "| Checking installed services |"
version: '3.8'
services:
registry-server:
image: registry:2
container_name: registry-server
restart: always
ports:
- "5555:5000"
@XIIIVI
XIIIVI / install-docker.sh
Last active June 12, 2025 11:51
Docker installation
#!/bin/bash
curl -sL https://raw.githubusercontent.com/ezekeal/scripts/main/docker-pi.sh | bash
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
chmod a+r /etc/apt/keyrings/docker.asc
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update -y
#!/bin/bash
kas-docker build kas/poky.yml:kas/tftp.yml
#!/bin/bash
# In case of issue running Docker, please add your user to the docker's group
#
# sudo usermod -aG docker ${USER}
#
# then, logout and log in
git clone https://github.com/siemens/kas
#
# check_if_file_contains_string
# - param1: file containing the text
# - param2: string to find
# - param3: message for success
# - param4: message for failure
#
check_if_file_contains_string() {