Override backend url from CLI for proxy to Host machine - traefik

Is possible to override backend URL for file provider from CLI?
For example:
docker rm -f traefik-cockpit; docker run -d -p 443:443 \
-v /var/run/docker.sock:/var/run/docker.sock \
--label 'traefik.enable=true' \
--label 'traefik.file.backend.url=127.0.0.1' \
--label 'traefik.docker.network=host' \
--label 'traefik.frontend.rule=Host:cockpit.myexample.com' \
--label 'traefik.port=9090' \
--label 'traefik.protocol=http' \
--name traefik-cockpit \
traefik:v1.6.6-alpine \
--file \
--defaultentrypoints="https" \
--entryPoints='Name:https Address::443 TLS' \
--docker.endpoint=unix:///var/run/docker.sock \
--docker.exposedbydefault=false \
--docker.watch=true
There are a lot of applications which are running on Host directly, this will enable autoconfig for File provider from CLI
Possible solutions:
--label 'traefik.file.backend.url=127.0.0.1' \
--label 'traefik.docker.network=host' \
or
--label 'traefik.file.backend.url=192.168.0.5' \
Thanks

It's not possible to do that:
labels are for the static configuration
backends and frontends are in the dynamic configuration
https://docs.traefik.io/basics/#configuration

Related

Error while write the acceptance test with newman Rest APi

I am new to docker and testing through newman
while running test cases the service of /services/c/d/docker/docker-compose.yml
getting following error
getaddrinfo ENOTFOUND
Error while write the acceptance test with newman
I am new to docker and testing through newman
while running test cases the service of /services/c/d/docker/docker-compose.yml
getting following error
getaddrinfo ENOTFOUND
Following is the Snippet
runAcceptanceTests.sh
#!/bin/bash
set -e
if [ "${ENVIRONMENT}" == 'localhost' ]; then
../gradlew --project-dir ../ --build-cache assemble
docker-compose -f docker-compose.yml \
-f docker-compose.localhost.yml \
-f ../services/a/b/docker/docker-compose.yml \
-f ../services/c/d/docker/docker-compose.yml \
build --force-rm api
docker-compose -f docker-compose.yml \
-f docker-compose.localhost.yml \
-f ../services/a/b/docker/docker-compose.yml \
-f ../services/c/d/docker/docker-compose.yml \
kill api
docker-compose -f docker-compose.yml \
-f docker-compose.localhost.yml \
-f ../services/a/b/docker/docker-compose.yml \
-f ../services/c/d/docker/docker-compose.yml \
run --rm \
-e a="${a}" \
-w /opt/code/api \
apibuild ./acceptance-tests/newman/wait-for-api.sh ./acceptance-tests/newman/a.sh
else
docker-compose -f docker-compose.yml \
run --rm \
-e a="${a}" \
-w /opt/code/api \
apibuild ./acceptance-tests/newman/a.sh
fi
a.sh
#!/bin/bash
set -e
readonly NEWMAN_COLLECTION_PATH=${ACCEPTANCE_TEST_PATH:-./acceptance-tests/newman}
readonly CI=${CI:-false}
if $CI && [[ "${ENVIRONMENT,,}" == "abc" ]]; then
echo "Acceptance tests are disabled ."
exit 0
fi
echo "Running :" && \
newman run "${NEWMAN_COLLECTION_PATH}/abc.postman_collection.json" \
--folder=ccc \
-e "${NEWMAN_COLLECTION_PATH}/zzz-${ENVIRONMENT}-acceptance-test.postman_environment.json" \
--global-var="config_key=${a}" -k
wait-for-api.sh
!/bin/sh
set -e
until curl -q -f --max-time 5 'http://localhost:8080/health/ping' &>/dev/null; do
>&2 echo "API is unavailable yet - sleep 5s"
sleep 5
done
>&2 echo " API is up - executing command $#"
exec "$#
docker-compose.yml
version: '3.2'
services:
apibuild:
build: ../ci-cd-pipeline/docker/build-agent
image: api-build-agent:develop
hostname: buildagent
container_name: apibuildagent
volumes:
# mount entire folder
- api/:/opt/code/api/:delegated
environment:
- a=${a:-int}
- JAVA_hostname=`hostname`
security_opt:
- apparmor:unconfined
docker-compose.localhost.yml
version: '3.2'
services:
apibuild:
depends_on:
- api
Trying to add newman test for 2nd service my component consist of two services as follow
1 https://localhost:8080
2 https://localhost:8081enter image description here
i am trying to write the test for 2nd service but getting the error
❏ flow
↳ CheckFlow
POST https://localhost:8081/key/check [errored]
getaddrinfo ENOTFOUND service
could any one help me out regarding it

Which API can I use to add my own logs to QEMU for debugging purpose

I tried to add my own logs to qemu by using fprintf(stdout, "my own log") and qemu_log("my own log"), and then compiled the qemu from source code and started a VM by the following command:
/usr/bin/qemu-system-x86_64 \
-D /home/VM1-qemu-log.txt \
-d cpu_reset \
-enable-kvm \
-m 4096 \
-nic user,model=virtio \
-drive file=/var/lib/libvirt/images/VM1.qcow2,media=disk,if=virtio \
-nographic
There are CPU-related logs in VM1-qemu-log.txt, however, I cannot find where "my own log" is. Can anyone advise? Thanks!
qemu_log("my own log") works, I added it to the wrong place(i.e., beginning of the 'main()' in 'qemu/vl.c', where the logging has not been setup yet). By adding it to another place(e.g. in virtio_blk_get_request() under qemu/hw/block/virtio-blk.c), I will be able to see "my own log" in /home/VM1-qemu-log.txt. The VM is created by:
/usr/bin/qemu-system-x86_64 \
-D /home/VM1-qemu-log.txt \
-enable-kvm \
-m 4096 \
-nic user,model=virtio \
-drive file=/var/lib/libvirt/images/VM1.qcow2,media=disk,if=virtio \
-nographic

How to convert configure options for use with cmake

I have a script for building a project that I need to upgrade from using configure to cmake. The original configure command is
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
--with-clang \
--prefix=$PREFIX \
--libdir=$PREFIX/lib${LIBDIRSUFFIX} \
--incdir=$PREFIX/include \
--mandir=$PREFIX/man/man1 \
--etcdir=$PREFIX/etc/root \
--docdir=/usr/doc/$PRGNAM-$VERSION \
--enable-roofit \
--enable-unuran \
--disable-builtin-freetype \
--disable-builtin-ftgl \
--disable-builtin-glew \
--disable-builtin-pcre \
--disable-builtin-zlib \
--disable-builtin-lzma \
$GSL_FLAGS \
$FFTW_FLAGS \
$QT_FLAGS \
--enable-shared \
--build=$ARCH-slackware-linux
I am not familiar enough with cmake to know how to do the equivalent. I would prefer a command line option but am open to modifying the CMakeLists.txt file as well.

REST call in vb.net: how to pass the data in cURL

How I can convert the below code in VB.net. Thank you in advance.
$ curl -X POST https://www.drillster.com/daas/oauth/token \
-d 'client_id=874a16d4ac764ce4a545f0cca4584c63' \
-d 'client_secret=5782b2e7532b48b5a0798f2ad6644614' \
-d 'grant_type=authorization_code' \
-d 'code=cIEL8h'

multiple KVM guests script using virt-install

I would like install 3 KVM guests automatically using kickstart.
I have no problem installing it manually using virt-install command.
virt-install \
-n dal \
-r 2048 \
--vcpus=1 \
--os-variant=rhel6 \
--accelerate \
--network bridge:br1,model=virtio \
--disk path=/home/dal_internal,size=128 --force \
--location="/home/kvm.iso" \
--nographics \
--extra-args="ks=file:/dal_kick.cfg console=tty0 console=ttyS0,115200n8 serial" \
--initrd-inject=/opt/dal_kick.cfg \
--virt-type kvm
I have 3 scripts like the one above - i would like to install all 3 at the same time, how can i disable the console? or running it in the background?
Based on virt-install man page:
http://www.tin.org/bin/man.cgi?section=1&topic=virt-install
--noautoconsole
Don't automatically try to connect to the guest console. The
default behaviour is to launch virt-viewer(1) to display the
graphical console, or to run the "virsh" "console" command to
display the text console. Use of this parameter will disable this
behaviour.
virt-install will connect console automatically. If you don't want,
just simply add --noautoconsole in your cmd like
virt-install \
-n dal \
-r 2048 \
--vcpus=1 \
--quiet \
--noautoconsole \
...... other options
We faced the same problem and at the end the only way we found was to create new threads with the &.
We also include the quiet option, not mandatory.
---quiet option (Only print fatal error messages).
virt-install \
-n dal \
-r 2048 \
--vcpus=1 \
--quiet \
--os-variant=rhel6 \
--accelerate \
--network bridge:br1,model=virtio \
--disk path=/home/dal_internal,size=128 --force \
--location="/home/kvm.iso" \
--nographics \
--extra-args="ks=file:/dal_kick.cfg console=tty0 console=ttyS0,115200n8 serial" \
--initrd-inject=/opt/dal_kick.cfg \
--virt-type kvm &
I know this is kind of old, but I wanted to share my thoughts.
I ran into the same problem, but due to the environment we work in, we need to use sudo with a password (compliance reasons). The solution I came up with was to use timeout instead of &. When we fork it right away, it would hang due to the sudo prompt never appearing. So using timeout with your example above: (we obviously did timeout 10 sudo virt-instal...)
timeout 15 virt-install \
-n dal \
-r 2048 \
--vcpus=1 \
--quiet \
--os-variant=rhel6 \
--accelerate \
--network bridge:br1,model=virtio \
--disk path=/home/dal_internal,size=128 --force \
--location="/home/kvm.iso" \
--nographics \
--extra-args="ks=file:/dal_kick.cfg console=tty0 console=ttyS0,115200n8 serial" \
--initrd-inject=/opt/dal_kick.cfg \
--virt-type kvm
This allowed us to interact with our sudo prompt and send the password over, and then start the build. The timeout doesnt kill the process, it will continue on and so can your script.