How to configure Jaeger agent to send traces to collector on another server - jaeger

I'm trying to use Jaeger to manage tracing system. Docker is running locally "all-in-one" image with application (on the same host) without any issues. My question is how to configure jaeger agent on host1 that would send traces jaeger collector on another host2. Host2 is configured with "all-in-one". I can see Jaeger UI on host2 but it doesn't seem getting any traces from host1.
Configure tracer:
var configuration = new Configuration("service-name")
.withSampler(Configuration.SamplerConfiguration.fromEnv())
.withReporter(Configuration.ReporterConfiguration.fromEnv());
GlobalTracer.registerIfAbsent(configuration.getTracer());
return openTracer;
Added environment variables in yaml file on host1:
-e JAEGER_AGENT_HOST=jaeger.hostname.com \
-e JAEGER_AGENT_PORT=6831 \
Added jaeger image in yaml file on host2:
$ docker run -d --name jaeger \
-p 5775:5775/udp \
-p 6831:6831/udp \
-p 6832:6832/udp \
-p 5778:5778 \
-p 16686:16686 \
-p 14268:14268 \
-p 9411:9411 \
jaegertracing/all-in-one:latest
Any suggestions will be appreciated.

In my case.
Host2
version: '2'
services:
hotrod:
image: jaegertracing/example-hotrod:1.28
ports:
- '8080:8080'
- '8083:8083'
command: ["-m","prometheus","all"]
environment:
- JAEGER_AGENT_HOST=jaeger-agent
- JAEGER_AGENT_PORT=6831
- JAEGER_SAMPLER_TYPE=remote
- JAEGER_SAMPLING_ENDPOINT=http://jaeger-agent:5778/sampling
depends_on:
- jaeger-agent
jaeger-collector:
image: jaegertracing/jaeger-collector:1.28
command:
- "--cassandra.keyspace=jaeger_v1_dc1"
- "--cassandra.servers=cassandra"
- "--collector.zipkin.host-port=9411"
- "--sampling.initial-sampling-probability=.5"
- "--sampling.target-samples-per-second=.01"
environment:
- SAMPLING_CONFIG_TYPE=adaptive
ports:
- "14269:14269"
- "14268:14268"
- "14250:14250"
- "9411:9411"
restart: on-failure
depends_on:
- cassandra-schema
jaeger-query:
image: jaegertracing/jaeger-query:1.28
command: ["--cassandra.keyspace=jaeger_v1_dc1", "--cassandra.servers=cassandra"]
ports:
- "16686:16686"
- "16687"
restart: on-failure
depends_on:
- cassandra-schema
jaeger-agent:
image: jaegertracing/jaeger-agent:1.28
command: ["--reporter.grpc.host-port=jaeger-collector:14250"]
ports:
- "5775:5775/udp"
- "6831:6831/udp"
- "6832:6832/udp"
- "5778:5778"
restart: on-failure
depends_on:
- jaeger-collector
cassandra:
image: cassandra:4.0
cassandra-schema:
image: jaegertracing/jaeger-cassandra-schema:1.28
depends_on:
- cassandra
host1 is
version: '2'
services:
jaeger-agent:
image: jaegertracing/jaeger-agent:1.28
command: ["--reporter.grpc.host-port=host2:14250"]
ports:
- "5775:5775/udp"
- "6831:6831/udp"
- "6832:6832/udp"
- "5778:5778"
restart: on-failure
it works well for me

Related

Variable substitution in docker-compose command

I need to pass env variable from file to a command in a docker-compose but it seems impossible.
So I try first with environment var but it doesn't work again. How can I do that?
version: '3'
services:
nginx-service-xxx:
image: service-xxx-nginx:latest
ports:
- 80:80
restart: always
service-xxx:
image: service-xxx:latest
# env_file:
# - db-settings.env
environment:
- PORT=80
- PG-HOST=192.168.0.101
- PG-DATABASE=xxx
- PG-USER=postgres
- PG-PASSWORD=postgres
restart: always
command: python xxx/main.py --port=$$PORT --pg-host=$$PG-HOST --pg-database=$$PG-DATABASE --pg-user=$$PG-USER --pg-password=$$PG-PASSWORD
try to move the complexity of the command to a docker entry point.
First, you need to add the following entry point to your project (make it executable)
#!/bin/bash -e
case $1 in
web)
python xxx/main.py --port=$PORT --pg-host=$PG-HOST --pg-database=$PG-DATABASE --pg-user=$PG-USER --pg-password=$PG-PASSWORD
;;
*)
exec "$#"
;;
esac
exit 0
update the docker file for your service
From base-image
COPY ./docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]
update compose
version: '3'
services:
nginx-service-xxx:
image: service-xxx-nginx:latest
ports:
- 80:80
restart: always
service-xxx:
image: service-xxx:latest
environment:
- PORT=80
- PG-HOST=192.168.0.101
- PG-DATABASE=xxx
- PG-USER=postgres
- PG-PASSWORD=postgres
restart: always
command: web

Recv failure when I use docker-compose for set up redisDB

sorry but I'm new to redis and dockers and I'm getting stuck.
I want to connect redis to my localhost with docker-compose. When I use docker-compose my web and my redis shows that they are ON but when i try to make curl -L http://localhost:8081/ping for test it I get this message "curl: (56) Recv failure:"
I tryed to change my docker-compose.yaml but is not working
docker-compose:
version: '3'
services:
redis:
image: "redis:latest"
ports:
- "6379:6379"
web:
build: .
ports:
- "8081:6379"
environment:
REDIS_HOST: 0.0.0.0
REDIS_PORT: 6379
REDIS_PASSWORD: ""
depends_on:
- redis
Dockerfile
FROM python:3-onbuild
COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt
CMD ["python", "main.py"]
My expected results are this:
curl -L http://localhost:8081/ping
pong
curl -L http://localhost:8081/redis-status
{"redis_connectivity": "OK"}

gitlab-runner, stuck jobs in creating mode (500 internal server error)

I have a problem that I can not solve alone.
I spent the day on it and I tried to find a solution by myself before creating this ticket.
Context:
I use the latest version of Gitlab proposed: sameersbn / gitlab: 11.5.1
I have a runner launched into a docker container: gitlab / gitlab-runner: alpine
I use Traefik
Everything is started thanks to docker-compose.
Steps:
I launch all of my containers
I record a runner (command visible below)
I notice in the admin that my runners are well recorded in the gitlab: / admin / runners
I run a pipeline, and the job is blocked: /
I have tried everything:
  - update the gitlab
  - update the runner and use a previous version
  - remove the runner from the gitlab network
  - ...
Details:
My Traefik docker-compose.yml:
version: '2'
services:
proxy:
image: traefik:alpine
container_name: traefik
networks:
- traefik
ports:
- "80:80"
- "8080:8080"
- "443:443"
volumes:
- /data/traefik/traefik.toml:/etc/traefik/traefik.toml
- /data/traefik/acme:/etc/traefik/acme
- /var/run/docker.sock:/var/run/docker.sock
restart: unless-stopped
labels:
- "traefik.frontend.rule=Host:traefik.mydomain.com"
- "traefik.port=8080"
- "traefik.backend=traefik"
- "traefik.frontend.entryPoints=http,https"
portainer:
image: portainer/portainer
container_name: portainer
networks:
- traefik
labels:
- "traefik.frontend.rule=Host:portainer.mydomain.com"
- "traefik.port=9000"
- "traefik.backend=portainer"
- "traefik.frontend.entryPoints=http,https"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
restart: unless-stopped
networks:
traefik:
external:
name: traefik
My Gitlab docker-compose.yml:
version: '2'
services:
redis:
restart: always
image: sameersbn/redis:4.0.9-1
container_name: gitlab-redis
command:
- --loglevel warning
networks:
- gitlab
volumes:
- /data/gitlab/redis:/var/lib/redis:Z
labels:
- "traefik.enable=false"
postgresql:
restart: always
image: sameersbn/postgresql:10
container_name: gitlab-postgresql
networks:
- gitlab
volumes:
- /data/gitlab/postgresql:/var/lib/postgresql:Z
environment:
- DB_USER=gitlab
- DB_PASS=password
- DB_NAME=gitlabhq_production
- DB_EXTENSION=pg_trgm
labels:
- "traefik.enable=false"
registry:
image: registry:2
container_name: gitlab-registry
restart: always
expose:
- "5000"
ports:
- "5000:5000"
networks:
- gitlab
- traefik
volumes:
- /data/gitlab/registry:/registry
- /data/gitlab/certs:/certs
labels:
- traefik.port=5000
- traefik.frontend.rule=Host:registry.mydomain.com
- traefik.frontend.auth.basic=mydomain:fd9ef338f7de0f196c5409a668102b9a
environment:
- REGISTRY_LOG_LEVEL=error
- REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY=/registry
- REGISTRY_AUTH_TOKEN_REALM=https://gitlab.mydomain.com/jwt/auth
- REGISTRY_AUTH_TOKEN_SERVICE=container_registry
- REGISTRY_AUTH_TOKEN_ISSUER=gitlab-issuer
- REGISTRY_AUTH_TOKEN_ROOTCERTBUNDLE=/certs/registry.crt
- REGISTRY_STORAGE_DELETE_ENABLED=true
gitlab-runner:
image: gitlab/gitlab-runner:alpine
container_name: gitlab-runner
restart: always
depends_on:
- gitlab
networks:
- gitlab
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /data/gitlab-runner:/etc/gitlab-runner:Z
environment:
- CI_SERVER_URL=https://gitlab.mydomain.com/
- REGISTRATION_TOKEN=FzZtgyN1cAMzoYne89ts
labels:
- "traefik.enable=false"
gitlab:
restart: always
image: sameersbn/gitlab:11.5.1
container_name: gitlab-ce
depends_on:
- redis
- postgresql
- registry
ports:
- "10080:80"
- "10022:22"
networks:
- gitlab
- traefik
volumes:
- /data/gitlab/gitlab:/home/git/data:Z
- /data/gitlab/certs:/certs
environment:
- DEBUG=false
- DB_ADAPTER=postgresql
- DB_HOST=postgresql
- DB_PORT=5432
- DB_USER=gitlab
- DB_PASS=password
- DB_NAME=gitlabhq_production
- REDIS_HOST=redis
- REDIS_PORT=6379
- TZ=Europe/Paris
- GITLAB_TIMEZONE=Paris
- GITLAB_HTTPS=true
- SSL_SELF_SIGNED=false
- GITLAB_HOST=gitlab.mydomain.com
- GITLAB_PORT=
- GITLAB_SSH_PORT=10022
- GITLAB_RELATIVE_URL_ROOT=
- GITLAB_SECRETS_DB_KEY_BASE=w58HODDUerP7YOuAbt9heD9j6s80P5A8POUdsd4wHeh7tLU8wdSG0noq2LsRnvqsff9btHJDovejeTMWflg78tvKqT7y9omqVTvh
- GITLAB_SECRETS_SECRET_KEY_BASE=w58HODDUerP7YOuAbt9heD9j6s80P5A8POUdsd4wHeh7tLU8wdSG0noq2LsRnvqsff9btHJDovejeTMWflg78tvKqT7y9omqVTvh
- GITLAB_SECRETS_OTP_KEY_BASE=w58HODDUerP7YOuAbt9heD9j6s80P5A8POUdsd4wHeh7tLU8wdSG0noq2LsRnvqsff9btHJDovejeTMWflg78tvKqT7y9omqVTvh
- GITLAB_ROOT_PASSWORD=
- GITLAB_ROOT_EMAIL=
- GITLAB_NOTIFY_ON_BROKEN_BUILDS=true
- GITLAB_NOTIFY_PUSHER=false
- GITLAB_EMAIL=notifications#example.com
- GITLAB_EMAIL_REPLY_TO=noreply#example.com
- GITLAB_INCOMING_EMAIL_ADDRESS=reply#example.com
- GITLAB_BACKUP_SCHEDULE=daily
- GITLAB_BACKUP_TIME=01:00
- SMTP_ENABLED=false
- SMTP_DOMAIN=www.example.com
- SMTP_HOST=smtp.gmail.com
- SMTP_PORT=587
- SMTP_USER=mailer#example.com
- SMTP_PASS=password
- SMTP_STARTTLS=true
- SMTP_AUTHENTICATION=login
- IMAP_ENABLED=false
- IMAP_HOST=imap.gmail.com
- IMAP_PORT=993
- IMAP_USER=mailer#example.com
- IMAP_PASS=password
- IMAP_SSL=true
- IMAP_STARTTLS=false
- OAUTH_ENABLED=false
- OAUTH_AUTO_SIGN_IN_WITH_PROVIDER=
- OAUTH_ALLOW_SSO=
- OAUTH_BLOCK_AUTO_CREATED_USERS=true
- OAUTH_AUTO_LINK_LDAP_USER=false
- OAUTH_AUTO_LINK_SAML_USER=false
- OAUTH_EXTERNAL_PROVIDERS=
- OAUTH_CAS3_LABEL=cas3
- OAUTH_CAS3_SERVER=
- OAUTH_CAS3_DISABLE_SSL_VERIFICATION=false
- OAUTH_CAS3_LOGIN_URL=/cas/login
- OAUTH_CAS3_VALIDATE_URL=/cas/p3/serviceValidate
- OAUTH_CAS3_LOGOUT_URL=/cas/logout
- OAUTH_GOOGLE_API_KEY=
- OAUTH_GOOGLE_APP_SECRET=
- OAUTH_GOOGLE_RESTRICT_DOMAIN=
- OAUTH_FACEBOOK_API_KEY=
- OAUTH_FACEBOOK_APP_SECRET=
- OAUTH_TWITTER_API_KEY=
- OAUTH_TWITTER_APP_SECRET=
- OAUTH_GITHUB_API_KEY=
- OAUTH_GITHUB_APP_SECRET=
- OAUTH_GITHUB_URL=
- OAUTH_GITHUB_VERIFY_SSL=
- OAUTH_GITLAB_API_KEY=
- OAUTH_GITLAB_APP_SECRET=
- OAUTH_BITBUCKET_API_KEY=
- OAUTH_BITBUCKET_APP_SECRET=
- OAUTH_SAML_ASSERTION_CONSUMER_SERVICE_URL=
- OAUTH_SAML_IDP_CERT_FINGERPRINT=
- OAUTH_SAML_IDP_SSO_TARGET_URL=
- OAUTH_SAML_ISSUER=
- OAUTH_SAML_LABEL="Our SAML Provider"
- OAUTH_SAML_NAME_IDENTIFIER_FORMAT=urn:oasis:names:tc:SAML:2.0:nameid-format:transient
- OAUTH_SAML_GROUPS_ATTRIBUTE=
- OAUTH_SAML_EXTERNAL_GROUPS=
- OAUTH_SAML_ATTRIBUTE_STATEMENTS_EMAIL=
- OAUTH_SAML_ATTRIBUTE_STATEMENTS_NAME=
- OAUTH_SAML_ATTRIBUTE_STATEMENTS_FIRST_NAME=
- OAUTH_SAML_ATTRIBUTE_STATEMENTS_LAST_NAME=
- OAUTH_CROWD_SERVER_URL=
- OAUTH_CROWD_APP_NAME=
- OAUTH_CROWD_APP_PASSWORD=
- OAUTH_AUTH0_CLIENT_ID=
- OAUTH_AUTH0_CLIENT_SECRET=
- OAUTH_AUTH0_DOMAIN=
- OAUTH_AZURE_API_KEY=
- OAUTH_AZURE_API_SECRET=
- OAUTH_AZURE_TENANT_ID=
- GITLAB_REGISTRY_ENABLED=true
- GITLAB_REGISTRY_HOST=registry.mydomain.com
- GITLAB_REGISTRY_API_URL=http://localhost:5000
- GITLAB_REGISTRY_KEY_PATH=/certs/registry.key
- GITLAB_REGISTRY_ISSUER=gitlab-issuer
labels:
- "traefik.frontend.rule=Host:gitlab.mydomain.com"
- "traefik.port=80"
- "traefik.backend=gitlab"
- "traefik.frontend.entryPoints=http,https"
- "traefik.docker.network=traefik"
networks:
gitlab:
driver: bridge
traefik:
external:
name: traefik
Command for register my runner:
docker exec -it gitlab-runner gitlab-runner register \
--non-interactive \
--name "Doker runner dind 1" \
--url "https://gitlab.mydomain.com/" \
--registration-token "FzZtgyN1cAMzoYne89ts" \
--env "COMPOSER_CACHE_DIR=/cache" \
--env "GIT_SSL_NO_VERIFY=true" \
--env "DOCKER_DRIVER=overlay2" \
--executor "docker" \
--docker-image docker:stable-dind \
--docker-privileged="true" \
--docker-volumes /var/run/docker.sock:/var/run/docker.sock \
--docker-volumes /cache \
--tag-list "docker,dind" \
--run-untagged \
--locked="false"
According to my notes a 500 appearing in the Gitlab-Runner doesn't indicate much. It simply echoes the error it receives from workhorse which mangles the real message, some variant of 4XX from either gitaly or linguist into a 500. The first log to check is ones production.log but this seems to only log the 500 errors emitted by workhorse, so you have to got a level deeper and scan your workhorse.log.
Gitaly
Check the workhorse.log for a version mismatch between gitaly and workhorse. As I recall it was critical that both applications have comparable version numbers, there was a table one could check, as this dictated which protocols they understood.
Linguist
This was a really obscure issue I encountered. Essentially the version of Ruby used to run Gitaly and the version of Ruby used by Gitaly to run gitaly-ruby, the sub-processes it spawns internally, were different. This is apparently indicated by the cryptic messages
time="2017-12-04T18:11:34+02:00" level=fatal msg="load config" config_path=/etc/gitaly/config.toml error="load linguist colors: exit status 1; stderr: \"/usr/lib64/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/definition.rb:179:in `rescue in specs': Your bundle is locked to rake (12.1.0), but that version could not be found in any of the sources listed in your Gemfile. If you haven't changed sources, that means the author of rake (12.1.0) has removed it. You'll need to update your bundle to a different version of rake (12.1.0) that hasn't been removed in order to install. (Bundler::GemNotFound)\\n\\tfrom /usr/lib64/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/definition.rb:173:in `specs'\\n\\tfrom /usr/lib64/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/definition.rb:233:in `specs_for'\\n\\tfrom /usr/lib64/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/definition.rb:222:in `requested_specs'\\n\\tfrom /usr/lib64/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:118:in `block in definition_method'\\n\\tfrom /usr/lib64/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:19:in `setup'\\n\\tfrom /usr/lib64/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler.rb:99:in `setup'\\n\\tfrom /usr/lib64/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/setup.rb:20:in `<top (required)>'\\n\\tfrom /usr/lib64/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'\\n\\tfrom /usr/lib64/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'\\n\""
time="2017-12-04T18:17:54+02:00" level=info msg="Starting Gitaly" version="Gitaly, version 0.52.0, built 20171204.135804"
Note :
Please bear in mind that my notes are particular to Gentoo, a different version of GitlabHQ and may or may not be applicable to your situation accordingly. Please update your question as you find out more information since my notes may have further information that is relevant to your problem

Docker-The scale command is deprecated. Use the up command with the --scale flag instead

i want to launch 5 chrome and 5 firefox in docker container. I am using the below command but its giving the following error
The scale command is deprecated. Use the up command with the --scale flag instead.
ERROR: No such service: nodechrome
docker-compose scale nodechrome=5 nodefirefox=5
My docker-compose.yml file
version: '2'
services:
firefoxnode:
image: selenium/node-firefox-debug
volumes:
- /dev/shm:/dev/shm
depends_on:
- hub
environment:
HUB_HOST: hub
ports:
- "32772:5900"
chromenode:
image: selenium/node-chrome-debug
volumes:
- /dev/shm:/dev/shm
depends_on:
- hub
environment:
HUB_HOST: hub
ports:
- "32773:5900"
hub:
image: selenium/hub
ports:
- "4444:4444"
From where these names came? nodechrome and nodefirefox
Correct your command instead:
from:
docker-compose scale nodechrome=5 nodefirefox=5
to:
docker-compose scale chromenode=5 firefoxnode=5
Try this command:
docker-compose up --scale chrome=5
Verify the Grid by visiting: http://localhost:4444/ui/index.html#/
Refer: Documentation

How to setup maxSession in selenium docker

docker run -d -p 4444:4444 --name selenium-hub selenium/hub
docker run -d --link selenium-hub:hub -v /dev/shm:/dev/shm selenium/node-chrome
Ubuntu 16.04
after these 2 commands, I have successfully setup a selenium hub and a selenium node. however current maxSession of this node is set to 1, I need increase to 5. How can I do that?
Thanks.
I highly recommend you use a docker compose file.
Below is a simple example you can use.
Just change the MAX_SESSION and MAX_INSTANCES to what you need.
version: "3.1"
services:
hub:
image: selenium/hub
container_name: "hub"
ports:
- "4444:4444"
chrome:
image: selenium/node-chrome
volumes:
- /dev/shm:/dev/shm
shm_size: 2gb
depends_on:
- hub
environment:
- HUB_HOST=hub
- HUB_PORT=4444
- SCREEN_WIDTH=1920
- SCREEN_HEIGHT=1080
- NODE_MAX_INSTANCES=2
- NODE_MAX_SESSION=2