YouTrack Docker Swarm and Kubernetes manifests

Deploy YouTrack to docker swarm or kubernetes

Fri, 02 Feb 2024

This is the first post in a series where I’ll be dropping manifests and configs to set up some of my favorite services that I currently or use to host in my homelab. I’ll start off with what I use it for, how to set it up on Docker Swarm and how to set it up on Kubernetes

Usage

I primarily used YouTrack for issue tracking, I liked it a lot because it integrated into TeamCity nicely which I was using already and I could easily attach commits from Git and Perforce. It is a bit bulkier than I like for an application thats only used by me (2-3GB). It is my most memory intensive application for myself minus TeamCity which idles at around 4GB.

I was using YouTrack for hosting my documentation as well. As of now I moved my documentation to Wiki.js instance which I like and moved my issue tracking to Linear. YouTrack was nice, stable and feature rich, that being said it felt too bulky for what I wanted and reminded me of an easier to use Jira. Linear is lean, beautiful and offers a setup that I feel as though was made for developers and not for product managers such as YouTrack and Jira

Docker Swarm

I am a firm believer that CPU should be left to unlimited on every service that is meant to run 24/7 and that you should limit your memory to prevent OOM issues. Your memory limit should never exceed your requests limit. This is set up with traefik on a traefik network I named “traefik-public”. My certresolver is a lets encrypt resolver I named le. I also use loki for logging. If you want to deploy just the image without traefik and loki, you can delete all of those lines as well as update the volumes section.

version: "3.9"
services:
  youtrack:
    image: jetbrains/youtrack:2023.2.19783 # Update this to the latest image
    volumes:
    - /shares/docker/youtrack/data:/opt/youtrack/data
    - /shares/docker/youtrack/conf:/opt/youtrack/conf
    - /shares/docker/youtrack/logs:/opt/youtrack/logs
    - /shares/docker/youtrack/backups:/opt/youtrack/backups
    networks:
    - traefik-public
    environment:
      TZ: America/New_York
      PUID: 1026 # user id of my nas user
      PGID: 100 # group id of my nas user
    deploy:
      resources:
        reservations:
          memory: 4000M
        limits:
          memory: 4000M
      labels:
      # Traefik Config
      - traefik.enable=true
      - traefik.docker.network=traefik-public
      - traefik.constraint-label=traefik-public
      # HTTPS Rules
      - traefik.http.routers.youtrack.rule=Host(`youtrack.mydomain.com`)
      - traefik.http.routers.youtrack.entrypoints=https
      - traefik.http.routers.youtrack.tls=true
      - traefik.http.routers.youtrack.tls.certresolver=le
      # Services
      - traefik.http.services.youtrack.loadbalancer.server.port=8080
    logging:
      driver: loki
      options:
        loki-url: http://192.168.50.95:3100/loki/api/v1/push

Kubernetes

Very similar to my docker swarm setup. This uses traefik, and exposes my service to all ip’s on my local subnet. The shared storage is still on my nas

apiVersion: apps/v1
kind: Deployment
metadata:
name: youtrack
namespace: tds
labels:
  app: youtrack
  app.kubernetes.io/name: youtrack
spec:
replicas: 1
selector:
  matchLabels:
    app: youtrack
template:
  metadata:
    labels:
      app: youtrack
  spec:
    containers:
    - name: youtrack
      image: jetbrains/youtrack:2023.3.2226
      env:
      - name: TZ
        value: America/New_York
      - name: PUID
        value: "1026"
      - name: PGID
        value: "100"
      ports:
      - containerPort: 8080
        name: web
      resources:
        limits:
          memory: 4Gi
        requests:
          memory: 4Gi
      volumeMounts:
      - name: nfs-youtrack-vol
        mountPath: /opt/youtrack/data
        subPath: data
      - name: nfs-youtrack-vol
        mountPath: /opt/youtrack/conf
        subPath: conf
      - name: nfs-youtrack-vol
        mountPath: /opt/youtrack/logs
        subPath: logs
      - name: nfs-youtrack-vol
        mountPath: /opt/youtrack/backups
        subPath: backups
    volumes:
    - name: nfs-youtrack-vol
      nfs:
        server: 192.168.50.227
        path: /volume1/docker/youtrack
---
apiVersion: v1
kind: Service
metadata:
name: youtrack
namespace: tds
labels:
  app: youtrack
  app.kubernetes.io/name: youtrack
spec:
ports:
  - port: 8080
    targetPort: web
    name: web
selector:
  app: youtrack
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: youtrack
namespace: tds
annotations:
  cert-manager.io/cluster-issuer: le-prod
  kubernetes.io/ingress.class: traefik
  traefik.ingress.kubernetes.io/router.entrypoints: websecure
  traefik.ingress.kubernetes.io/router.tls: "true"
  traefik.ingress.kubernetes.io/router.middlewares: network-internal-whitelist@kubernetescrd
spec:
tls:
  - hosts:
      - youtrack.mydomain.com
    secretName: youtrack-tls
rules:
  - host: youtrack.mydomain.com
    http:
      paths:
        - path: /
          pathType: Prefix
          backend:
            service:
              name: youtrack
              port:
                name: web

Traefik and Loki

If you search my website for traefik and loki you should find posts that go through a basic setup for Traefik in Kubernetes and Docker Swarm as well as Loki with Docker Swarm

Buy Me A CoffeeDigitalOcean Referral Badge
Loading...
Edward Beazer

Edward Beazer - I just like to build shit. Sometimes I get stuck for hours, even days while trying to figure out how to solve an issue or implement a new feature. Hope my tips and tutorials can save you some time.

DigitalOcean Referral Badge