简体   繁体   中英

Jira & Docker & Traefik Setup

I'm first time Traefik user and I successfully configured this docker compose setup for Jira with Traefik and Let's Encrypt Cert.

My problem is that Jira must be able to connect to his self . Their are some Jira Services like Gadgets that loads it's data via JavaScript from via his own address over http. This typ of service does not work for me. Their is a support documents that describes this problems and also shows solutions for this. But I don't know how to setup this up correctly with Traefik/Docker. https://confluence.atlassian.com/jirakb/how-to-fix-gadget-titles-showing-as-__msg_gadget-813697086.html

Your help would be great. Thanks a lot!

version: '3'

services:

  reverse-proxy:
    image: traefik # The official Traefik docker image
    command: --docker # Enables the web UI and tells Traefik to listen to docker --api
    ports:
      - "80:80"     # The HTTP port
      - "443:443"   # The HTTPS port
      - "8081:8080" # The Web UI (enabled by --api)
    hostname: traefik
    restart: unless-stopped
    domainname: ${DOMAINNAME}
    networks:
      - frontend
      - backend
    labels:
      - "traefik.enable=false"
      - "traefik.frontend.rule=Host:traefik.${DOMAINNAME}"  
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock # So that Traefik can listen to the Docker events
      - /etc/compose/traefik:/etc/traefik
      - /etc/compose/shared:/shared

  jira:
    image: dchevell/jira-software:${JIRAVERSION}
    ports:
      - 8080:8080
    networks:
      - backend
    restart: unless-stopped    
    volumes:
      - /data/files/jira/data:/var/atlassian/application-data/jira
    environment:
      - JVM_MAXIMUM_MEMORY=2048m
      - JVM_MINIMUM_MEMORY=768m
      - CATALINA_CONNECTOR_PROXYNAME=jira.${DOMAINNAME}
      - CATALINA_CONNECTOR_PROXYPORT=443
      - CATALINA_CONNECTOR_SCHEME=https
      - CATALINA_CONNECTOR_SECURE=true
    depends_on:
      - jira-postgresql
    links:
      - "jira-postgresql:database"      
    labels:
      - "traefik.enable=true"
      - "traefik.backend=jira"
      - "traefik.frontend.rule=Host:jira.${DOMAINNAME}"
      - "traefik.port=8080"

  jira-postgresql:
    image: postgres:9.6.11-alpine
    networks:
      - backend
    ports:
      - 5432:5432
    restart: unless-stopped     
    volumes:
      - /data/index/postgresql/data/:/var/lib/postgresql/data
    environment:
      - POSTGRES_PASSWORD=jira
      - POSTGRES_USER=jira
      - POSTGRES_DB=jira
    labels:
      - "traefik.enable=false"      

  # Portainer
  portainer:
    image: portainer/portainer
    container_name: portainer
    restart: always
    ports:
      - 9000:9000    
    command: -H unix:///var/run/docker.sock
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./etc-portainer/data:/data
    environment:
      TZ: ${TZ}
    labels:
      - "traefik.enable=false"       

networks:
  frontend:
    external:
      name: frontend
  backend:
    driver: bridge

Configuration I got working with apps over secure - not super intuitive, but it looks like it accepts redirects secure traffic properly. I've got mine using acme on godaddy for certs, and it appears to be functioning properly over https with a forced recirect:

Forced redirect for reference:

[entryPoints]
  [entryPoints.http]
  address = ":80"
    [entryPoints.http.redirect]
    entryPoint = "https"
  [entryPoints.https]
  address = ":443"
    [entryPoints.https.tls]

And the dockerfile that I made to get things deployed properly:

version: '3'

services:
  jira:
    image: dchevell/jira-software:8.1.0
    deploy:
      restart_policy:
        condition: on-failure
      labels:
        - traefik.frontend.rule=Host:jira.mydomain.com
        - traefik.enable=true
        - traefik.port=8080
    ports:
      - "8080"
    networks:
      - traefik-pub
      - jiranet
    environment:
      - CATALINA_CONNECTOR_PROXYNAME=jira.mydomain.com
      - CATALINA_CONNECTOR_PROXYPORT=443
      - CATALINA_CONNECTOR_SCHEME=https
      - CATALINA_CONNECTOR_SECURE=true 

  jira-postgresql:
    image: postgres:11.2-alpine
    networks:
      - jiranet
    ports:
      - "5432"  
    volumes:
      - jira-postgres-data:/var/lib/postgresql/data
    environment:
      - POSTGRES_PASSWORD=supersecret
      - POSTGRES_USER=secret_user
      - POSTGRES_DB=jira_db
    labels:
      - "traefik.enable=false"      

volumes:
  jira-postgres-data:

networks:
  traefik-pub:
    external: true
  jiranet:
    driver: overlay

This still required manual configuration of the database - I may one day take the time to build my own jira dockerfile that accepts the database config already, but with this one working, I don't see much point in pre-configuring the database connection when it's 20 seconds of extra work vs. rebuilding a dockerfile that I haven't written myself.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM