Exemplo n.º 1
0
def run_container(alconf):
    arch_img_name = DOCKER_BASE_IMAGE[util.dev_type()]

    util.ensute_custom_network_bridge("net_database")
    util.to_host(os.path.join(CONT_PATH, "telegraf.conf"))
    # util.to_host(os.path.join(CONT_PATH, "piholestats.sh"))
    run("cp telegraf.conf $HOME/")
    # run("chmod +x piholestats.sh ")

    util.ensure_cont_stopped(CONT_NAME)
    util.build_latest_image(CONT_NAME, arch_img_name)
    util.create_storage_container(CONT_NAME)

    run(' docker run ' + ' --restart always ' + ' -dt ' +
        ' --net=net_database ' +
        ' -h {0}-{1} '.format(str(run("hostname")), CONT_NAME) +
        # ' --network host ' +
        ' -v /var/run/docker.sock:/var/run/docker.sock:ro ' +
        ' -v $HOME/telegraf.conf:/etc/telegraf/telegraf.conf:ro  ' +
        # ' -v $HOME/piholestats.sh:/piholestats.sh  ' +
        # ' -p 127.0.0.1:{0}:{0} '.format() +
        # ' --expose ' +
        '-v {0}-storage:/var/lib/{0} '.format(CONT_NAME) +
        # ' -v $CURRENT_PATH/../{0}:/{0}:ro '.format(CONT_NAME) +
        # ' -e OH_PORT_TO_PATH="000:template" ' +
        ' --log-opt max-size=250k --log-opt max-file=4 ' +
        ' --name {} '.format(CONT_NAME) + arch_img_name)

    # run('docker cp piholestats.sh telegraf:/piholestats.sh ')

    # time.sleep(5)
    # run("docker exec ##### ")
    # run("docker restart ######### ")

    util.print_cont_status(CONT_NAME)
Exemplo n.º 2
0
def run_container(alconf):
    arch_img_name = DOCKER_BASE_IMAGE[util.dev_type()]

    util.ensute_custom_network_bridge("net_database")
    util.to_host(os.path.join(CONT_PATH, "kapacitor.conf"))
    run("cp kapacitor.conf $HOME/")

    util.ensure_cont_stopped(CONT_NAME)
    util.build_latest_image(CONT_NAME, arch_img_name)
    util.create_storage_container(CONT_NAME)

    run(' docker run ' + ' --restart always ' + ' --net=net_database ' +
        ' -dt ' +
        # ' --network host ' +
        # ' -e KAPACITOR_INFLUXDB_0_URLS_0=http://localhost:8086 ' +
        ' -v $HOME/kapacitor.conf:/etc/kapacitor/kapacitor.conf:ro  ' +
        ' -p {0}:{0} '.format(CONT_PORT) +
        # ' --expose $CONT_PORT ' +
        '-v {0}-storage:/var/lib/{0} '.format(CONT_NAME) +
        # ' -v $CURRENT_PATH/../{0}:/{0}:ro '.format(CONT_NAME) +
        # ' -e OH_PORT_TO_PATH="000:template" ' +
        ' --log-opt max-size=250k --log-opt max-file=4 ' +
        ' --name {} '.format(CONT_NAME) + arch_img_name)

    # time.sleep(5)
    # run("docker exec ##### ")
    # run("docker restart ######### ")

    util.print_cont_status(CONT_NAME)
Exemplo n.º 3
0
def run_container(alconf):
    util.ensute_custom_network_bridge("net_database")
    arch_img_name = DOCKER_BASE_IMAGE[util.dev_type()]

    util.ensure_cont_stopped(CONT_NAME)
    util.build_latest_image(CONT_NAME, arch_img_name)
    util.create_storage_container(CONT_NAME)

    run("mkdir -p $HOME/" + CONT_NAME)

    run(' docker run ' + ' --restart always ' + ' -td ' +
        # ' --network=host ' +
        ' --net=net_database ' + ' -v /etc/localtime:/etc/localtime:ro ' +
        ' -v /etc/timezone:/etc/timezone:ro ' +

        # ' -e OPENHAB_HTTP_PORT="7123" ' +
        ' -p 7123:8080 ' + ' -v $HOME/openhab/addons:/openhab/addons ' +
        ' -v $HOME/openhab/conf:/openhab/conf ' +
        ' -v $HOME/openhab/userdata:/openhab/userdata ' +
        ' --log-opt max-size=250k --log-opt max-file=4 ' +
        ' --name {} '.format(CONT_NAME) + arch_img_name)

    # time.sleep(5)
    # run("docker exec ##### ")
    # run("docker restart ######### ")

    util.print_cont_status(CONT_NAME)
Exemplo n.º 4
0
def run_container(alconf):
    arch_img_name = DOCKER_BASE_IMAGE[util.dev_type()]

    # excluded = [".git", "lib", ".gitignore", "README.md", ".vscode"]
    # util.to_host(os.path.join(CONT_PATH, "DATA"),rename="data", exclude=excluded)

    util.ensure_cont_stopped(CONT_NAME)
    util.build_latest_image(CONT_NAME, arch_img_name)
    util.create_storage_container(CONT_NAME)

    run(' docker run ' + ' --restart always ' + ' -dt ' +
        ' --net=net_database ' +
        # ' --network host ' +
        # '--link influxdb ' +
        # '--link kapacitor ' +
        # ' -p 127.0.0.1:{0}:{0} '.format(CONT_PORT) +
        ' -p {0}:{0} '.format(CONT_PORT) +
        # ' --expose $CONT_PORT ' +
        '-v {0}-storage:/var/lib/{0} '.format(CONT_NAME) +
        # ' -v $CURRENT_PATH/../{0}:/{0}:ro '.format(CONT_NAME) +
        # ' -e OH_PORT_TO_PATH="000:template" ' +
        ' --log-opt max-size=250k --log-opt max-file=4 ' +
        ' --name {} '.format(CONT_NAME) + arch_img_name +
        ' --host 0.0.0.0 --port {} '.format(CONT_PORT) +
        # ' --basepath /chronograf --prefix-routes ' +
        ' --influxdb-url=http://influxdb:8086 ' +
        ' --kapacitor-url=http://kapacitor:9092 ')

    # time.sleep(5)
    # run("docker exec ##### ")
    # run("docker restart ######### ")

    util.print_cont_status(CONT_NAME)
Exemplo n.º 5
0
def run_container(alconf):
    util.ensute_custom_network_bridge("net_database")
    arch_img_name = DOCKER_BASE_IMAGE[util.dev_type()]

    # util.to_host(os.path.join(CONT_PATH, "influxdb.conf"))
    # run("cp influxdb.conf $HOME/")

    util.ensure_cont_stopped(CONT_NAME)
    util.build_latest_image(CONT_NAME, arch_img_name)
    util.create_storage_container(CONT_NAME)

    run('docker run ' + '-dt  ' + ' --net=net_database ' +
        # '--network host ' +
        # " --network {} ".format(alconf.var.docker_network_name) +
        # '--ip "192.168.59.86"  ' +
        ' -p {0}:{0} '.format(CONT_PORT) +
        # ' -p 127.0.0.1:{0}:{0} '.format(CONT_PORT) +
        '--restart always ' +
        '--log-opt max-size=250k --log-opt max-file=4  ' + '' +
        # ' -e INFLUXDB_REPORTING_DISABLED=true' +
        # ' -e INFLUXDB_META_DIR=/var/lib/influxdb/metadir' +
        # ' -e INFLUXDB_DATA_QUERY_LOG_ENABLED=false' +
        # ' -e INFLUXDB_ADMIN_USER='******' -e INFLUXDB_ADMIN_PASSWORD='******' -e INFLUXDB_REPORTING_DISABLED="true" ' +
        ' -e INFLUXDB_META_DIR="/var/lib/influxdb/meta" ' +
        ' -e INFLUXDB_DATA_DIR="/var/lib/influxdb/data" ' +
        ' -e INFLUXDB_DATA_WAL_DIR="/var/lib/influxdb/wal" ' +
        ' -e INFLUXDB_COORDINATOR_WRITE_TIMEOUT="40s" ' +
        ' -e INFLUXDB_COORDINATOR_MAX_CONCURRENT_QUERIES="0" ' +
        ' -e INFLUXDB_DATA_MAX_VALUES_PER_TAG="0" ' +
        ' -e INFLUXDB_DATA_MAX_SERIES_PER_DATABASE="0" ' +
        ' -e INFLUXDB_DATA_WAL_FSYNC_DELAY="50ms" ' + '' +
        # '-v $HOME/backup:/backup ' +
        '-v /etc/localtime:/etc/localtime:ro   ' +
        '-v {}-storage:/var/lib/influxdb '.format(CONT_NAME) +
        # ' -v $HOME/influxdb.conf:/etc/influxdb/influxdb.conf:ro  ' +
        '' + '--name {} '.format(CONT_NAME) + arch_img_name)
    # "  -config /etc/influxdb/influxdb.conf ")

    util.print_cont_status(CONT_NAME)

    # TODO Function to wait until .... use :8086/ping to check state
    time.sleep(15)
    run('docker exec influxdb influx -execute "CREATE DATABASE \"hass\"" ')

    run("docker restart influxdb ")

    util.print_cont_status(CONT_NAME)
Exemplo n.º 6
0
def run_container(alconf):
    util.ensute_custom_network_bridge("net_database")
    arch_img_name = DOCKER_BASE_IMAGE[util.dev_type()]

    util.ensure_cont_stopped(CONT_NAME)
    util.build_latest_image(CONT_NAME, arch_img_name)
    util.create_storage_container(CONT_NAME)

    run(' docker run ' + ' -dt ' + ' --net=net_database ' +
        # ' --network host ' +
        # '--link influxdb ' +
        # ' -p 127.0.0.1:{0}:{0} '.format(CONT_PORT) +
        ' -p 3000:3000 ' +
        # ' --expose 3000 ' +
        ' --restart always ' + ' --name=grafana ' +
        # ' -v $HOME/backup:/backup   ' +
        ' -v grafana-storage:/var/lib/grafana ' +
        ' --log-opt max-size=250k --log-opt max-file=4 ' +
        ' -e "GF_INSTALL_PLUGINS=grafana-clock-panel" ' +
        ' -e GF_ANALYTICS_CHECK_FOR_UPDATES="false" ' +
        ' -e GF_ANALYTICS_REPORTING_ENABLED="false" ' +
        ' -e GF_SECURITY_ADMIN_USER={} '.format(alconf.var.GRAFANA_ADMIN_NAME)
        + ' -e GF_SECURITY_ADMIN_PASSWORD={} '.format(
            alconf.var.GRAFANA_ADMIN_PASS) +
        ' -e GF_SECURITY_USERS_ALLOW_ORG_CREATE="false" ' +
        ' -e GF_SECURITY_USERS_VERIFY_EMAIL_ENABLED="false" ' +
        ' -e GF_AUTH_ANONYMOUS_ENABLED="true" ' +
        ' -e GF_AUTH_ANNONYMUS_ORG_NAME="ORGANIZATION" ' +
        ' -e GF_AUTH_ANNONYMUS_ORG_ROLE="Viewer" ' +
        ' -e GF_AUTH_DISABLE_LOGIN_FORM="false" ' +
        ' -e GF_USERS_ALLOW_SIGN_UP="true" ' + ' -e GF_AUTH_PROXY="false" ' +

        # ' -e GF_SERVER_ROOT_URL="%(protocol)s://%(domain)s:%(http_port)s/grafana" ' +
        # ' -e GF_SERVER_ROOT_URL="%(protocol)s://%(domain)s:%(http_port)s/grafana" ' +
        # ' -e OH_PORT_TO_PATH="3000:grafana" ' +
        # ' -e VIRTUAL_HOST="grafana.192.168.2.111"  ' +
        arch_img_name)

    # TODO Function to wait until .... maybe an API call

    # time.sleep(10)
    # run("docker exec grafana grafana-cli plugins install grafana-clock-panel")
    # run("docker exec grafana grafana-cli plugins install grafana-worldmap-panel")
    # run("docker exec grafana grafana-cli plugins install natel-influx-admin-panel")
    # run("docker exec grafana grafana-cli plugins install grafana-piechart-panel")
    # run("docker exec grafana grafana-cli plugins update-all")
    # run("docker restart grafana")

    util.print_cont_status(CONT_NAME)
Exemplo n.º 7
0
def run_container(alconf):
    # util.ensute_custom_network_bridge()
    arch_img_name = DOCKER_BASE_IMAGE[util.dev_type()]

    # excluded = [".git", "lib", ".gitignore", "README.md", ".vscode"]
    # util.to_host(os.path.join(CONT_PATH, "DATA"),rename="data", exclude=excluded)

    util.ensure_cont_stopped(CONT_NAME)
    util.build_latest_image(CONT_NAME, arch_img_name)
    util.create_storage_container(CONT_NAME)
    util.create_storage_container(CONT_NAME_DNS)

    # ipv6ip = run("ip -6 route get 2001:4860:4860::8888 | awk '{for(i=1;i<=NF;i++) if ($i==\"src\") print $(i+1)}'")
    # docker ipv6 needs to be activated : https://docs.docker.com/config/daemon/ipv6/

    sudo('fuser -k -n tcp 53')
    sudo('fuser -k -n udp 53')
    sudo('fuser -k -n udp 67')

    run(' docker run ' +
        # ' --restart always ' +
        ' -dt ' + ' -v {}-storage:/etc/pihole '.format(CONT_NAME) +
        ' -v {}-storage:/etc/dnsmasq.d '.format(CONT_NAME_DNS) +
        ' --restart=unless-stopped ' +
        # ' --cap-add=NET_ADMIN ' +
        # ' --cap-add=CAP_NET_BIND_SERVICE ' +
        # ' --cap-add=CAP_NET_RAW ' +
        # ' --cap-add=CAP_NET_ADMIN ' +
        ' --net=host ' + ' -p 53:53/tcp ' + ' -p 53:53/udp ' +
        ' -p 67:67/udp ' + ' -p 80:80/tcp ' + ' -p 443:443/tcp ' +
        # ' -p 443:443 ' +
        ' --dns=127.0.0.1 ' + ' --dns=1.1.1.1 ' +
        # ' -p 8765:8765 ' +
        # ' -e WEB_PORT="8765" ' +
        ' -e WEBPASSWORD="******" ' +
        ' -e ServerIP="$(ip route get 8.8.8.8 | awk \'{ print $NF; exit }\')" '
        +
        # ' -e ServerIPv6="{}" '.format(ipv6ip) +
        ' --log-opt max-size=250k --log-opt max-file=4 ' +
        ' --name {} '.format(CONT_NAME) + arch_img_name)

    util.print_cont_status(CONT_NAME)