Skip to content

Instantly share code, notes, and snippets.

@emcniece
Last active June 19, 2018 19:41
Show Gist options
  • Save emcniece/11824488f7a4d7ef9e51e4ff1217025a to your computer and use it in GitHub Desktop.
Save emcniece/11824488f7a4d7ef9e51e4ff1217025a to your computer and use it in GitHub Desktop.
Testing Concourse + Traefik for a text/event-stream log reading problem

For debugging traefik/traefik#2576

Includes 2 docker-compose files: one outdated (Concourse 3.9.0, Traefik 1.5.4), the other updated (Concourse 3.14.0, Traefik 1.6.4). Both appear to work fine and not exhibit the "text/event-stream" network request problem where logs can't be displayed.

# Copy files into a directory.
# For this demo, we'll assume `contraef`.
# This directory name affects the access URL because docker-compose creates
# the stack with this name. You can change it, but watch for reoccurrences.
mkdir contraef
cd contraef

# Copy files from gist into directory:
#   docker-compose-updated.yml
#   docker-compose-outdated.yml
#   pipeline.yml
#   traefik.toml

# Bring stack online: choose either -outdated or -updated
docker-compose -f docker-compose-updated.yml up -d
# docker-compose -f docker-compose-outdated.yml up -d

# Ensure this prints out the Concourse landing page HTML
# NOTE THE DIRECTORY NAME HERE (contraef)
curl --header 'Host: concourse.contraef.docker.localhost' 'http://localhost:80/'

# Set local target.
# This target will NOT use Traefik for communication.
fly --target local login --concourse-url http://127.0.0.1:8090

# Ensure fly CLI has right version
fly -t local sync

# Check to see if worker is active
fly -t local workers

# Load new pipeline
fly -t local set-pipeline -p test -c pipeline.yml

# Activate pipe
fly -t local unpause-pipeline -p test

# Run dummy job
fly -t local trigger-job -j test/test-event-stream

# Visit in browser, log in:
chrome http://concourse.contraef.docker.localhost/

version: '3'
services:
concourse-db:
image: postgres
environment:
- POSTGRES_DB=concourse
- POSTGRES_PASSWORD=concourse_pass
- POSTGRES_USER=concourse_user
- PGDATA=/database
concourse:
image: concourse/concourse:3.9.0
command: web
privileged: true
depends_on: [concourse-db]
ports: ["8090:8080"]
environment:
- CONCOURSE_POSTGRES_HOST=concourse-db
- CONCOURSE_POSTGRES_USER=concourse_user
- CONCOURSE_POSTGRES_PASSWORD=concourse_pass
- CONCOURSE_POSTGRES_DATABASE=concourse
- CONCOURSE_EXTERNAL_URL
- CONCOURSE_BASIC_AUTH_USERNAME
- CONCOURSE_BASIC_AUTH_PASSWORD
- CONCOURSE_NO_REALLY_I_DONT_WANT_ANY_AUTH=true
- CONCOURSE_WORKER_GARDEN_NETWORK
volumes:
- ./concourse-keys/keys/web:/concourse-keys
labels:
traefik.enable: 'true'
traefik.port: '8080'
concourse-worker:
privileged: true
image: eugenmayer/concourse-worker-solid:3.9.0
environment:
CONCOURSE_TSA_HOST: concourse
CONCOURSE_GARDEN_DNS_SERVER: 8.8.8.8
stdin_open: true
tty: true
links:
- concourse:concourse
volumes:
- ./concourse-keys/keys/worker:/concourse-keys
concourse-keygen:
image: emcniece/concourse-keygen
volumes:
- ./concourse-keys:/concourse-keys
command:
- tail
- -f
- /dev/null
traefik:
image: traefik:1.5.4
volumes:
- ./traefik.toml:/etc/traefik/traefik.toml
- /var/run/docker.sock:/var/run/docker.sock
ports:
- 8000:8000/tcp
- 80:80/tcp
- 443:443/tcp
version: '3'
services:
concourse-db:
image: postgres
environment:
- POSTGRES_DB=concourse
- POSTGRES_PASSWORD=concourse_pass
- POSTGRES_USER=concourse_user
- PGDATA=/database
concourse:
image: concourse/concourse:3.14.0
command: quickstart
privileged: true
depends_on: [concourse-db]
ports: ["8090:8080"]
environment:
- CONCOURSE_POSTGRES_HOST=concourse-db
- CONCOURSE_POSTGRES_USER=concourse_user
- CONCOURSE_POSTGRES_PASSWORD=concourse_pass
- CONCOURSE_POSTGRES_DATABASE=concourse
- CONCOURSE_EXTERNAL_URL
- CONCOURSE_BASIC_AUTH_USERNAME
- CONCOURSE_BASIC_AUTH_PASSWORD
- CONCOURSE_NO_REALLY_I_DONT_WANT_ANY_AUTH=true
- CONCOURSE_WORKER_GARDEN_NETWORK
labels:
traefik.enable: 'true'
traefik.port: '8080'
traefik:
image: traefik:1.6.4
volumes:
- ./traefik.toml:/etc/traefik/traefik.toml
- /var/run/docker.sock:/var/run/docker.sock
ports:
- 8000:8000/tcp
- 80:80/tcp
- 443:443/tcp
---
jobs:
- name: test-event-stream
plan:
- task: test
config:
platform: linux
image_resource:
type: docker-image
source: {repository: busybox}
run:
path: sh
args:
- -exc
- |
counter=0
while [ $counter -lt 10 ]; do
echo $((counter++))
sleep 2
done
################################################################
# Global configuration
################################################################
debug = true
logLevel = "DEBUG"
################################################################
# Entrypoints configuration
################################################################
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.traefik]
address = ":8000"
################################################################
# Traefik logs configuration
################################################################
[traefikLog]
################################################################
# Access logs configuration
################################################################
[accessLog]
################################################################
# API and dashboard configuration
################################################################
[api]
entryPoint = "traefik"
dashboard = true
################################################################
# Ping configuration
################################################################
[ping]
################################################################
# Docker configuration backend
################################################################
[docker]
domain = "docker.localhost"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment