#!/bin/bash

##################################################
# Adjust the tag in the IMAGENAME to pull either 
# the latest version or a specific version
# of the replicator
##################################################

IMAGENAME=stelodata/stelo-full:latest
CONTAINERNAME=stelo-full

timezone=$(timedatectl show --property=Timezone | awk -F= '{print $2}')

docker run --name $CONTAINERNAME \
    --detach --privileged=true \
    --network host \
    --restart=unless-stopped \
    -e TZ="$timezone" \
    --sysctl net.ipv4.tcp_keepalive_time=30 \
    --sysctl net.ipv4.tcp_keepalive_intvl=1 \
    --sysctl net.ipv4.tcp_keepalive_probes=10 \
    --sysctl net.ipv4.ip_local_port_range="51000 60999" \
    -v sq-config:/var/sqdr \
    -v sqplus-config:/var/sqdrplus \
    -v backups:/backups \
    -v db2-home:/home/db2inst1 \
    -v db2-data:/data/db2 \
    -v db2-logs:/logs/db2 \
    -v /etc/localtime:/etc/localtime:ro \
    $IMAGENAME