#version: '3'

# run container over podman
#podman compose up -d --build

#run container over docker
# docker compose up -d --build
# docker compose --compatibility up -d --build

services:
    de_blueth-server:
      
        # default
        runtime: io.containerd.runc.v2
        
        #backend
        #runtime: containerd-shim-runc-v2
        #blkio_config:
        #    weight: 100
        environment:
            
            - VLAN=30
            
            # Time Zone Berlin
            - TZ=CET-1
            #- DRINODE=/dev/dri/renderD128 
            - DISABLE_IPV6=true 
            - NTP_SERVER=2.rhel.pool.ntp.org
            
            
            # wan over ip
            # set adapte to 
            # ip addr add 217.160.255.254/32 dev virbr0
            # ip addr del 192.168.122.0/24 dev virbr0
            #5: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
            #    link/ether 52:54:00:bc:e2:12 brd ff:ff:ff:ff:ff:ff
            #    inet 217.160.255.255/32 brd 217.160.255.255 scope global virbr0
            #    valid_lft forever preferred_lft forever

            - NETWORK_IF=virbr0
            
            
            # bridge network
            #- NETWORK_BRIDGE=vtap0
            #- NETWORK=macvtap
            - WORKER_TYPE=qemu
            #- QEMU_PORTS='22'
            - QEMU_CPU=2
            - QEMU_RAM=1024
            #- QEMU_RAM=24576
            #- QEMU_CDROM=/dev/dvd/OracleLinux-R8-U8-x86_64-dvd.iso
            #- QEMU_ARCH=${QEMU_ARCH:-SPARC64}
            - QEMU_ARCH=${QEMU_ARCH:-SPARC32PLUS}
            #- QEMU_ARCH=${UltraSparc-IV-plus}
            #- QEMU_ARCH=${Sun-UltraSparc-IIIi-plus}
            #Sun-UltraSparc-IIIi-plus
            #Sun-UltraSparc-IV-plus
            - QEMU_DISPLAY=bochs-display
            #- QEMU_VGA=cirrus-vga
            #- QEMU_VGA=ati-vga
            - PIN=123321
            - NAME=demogitjava_bt
            - DEVICE=40:EF:4C:C3:9C:CE
            - DEVICE_PIN=0000
            - enable-kvm 
            - kernel 'bzImage' 
        #extra_hosts:
        #    - demogitjava.ddns.net:217.160.255.254
        extra_hosts:
            - "host.docker.internal:host-gateway"
        platform: linux/amd64
        deploy:
            mode: global
            #resources:
            #    reservations:
            #        memory: 0m
            #    limits:
            ###        memory: 24577m
        #memswap_limit: 25G
       
       
        #network_mode: host
          # in swarm mode
          # create docker network in swarm mode with 
          # docker network create -d overlay landingpage
        network_mode: none
        # in swarm mode
        #network_mode: docker_gwbridge
        hostname: demogitjava.ddns.net
        shm_size: "2gb" 
        #cpu_quota: "900"
        #cpu_period: "2000"
        #cpu_shares: 512
        cap_add:
            - NET_ADMIN
            - SYS_ADMIN
            - SYS_TIME
        devices:
            # spac maschine
            # machine sun4m
            # maschine niagara
            # maschine rtl8139
            - /dev/kvm
            - /dev/net/tun
            - sandbox on
            - /dev/bus/usb/002/001
             # qemu dns
            - nic user,dns=95.85.95.85
            - nic user,dns=2.56.220.2
            
          
            # optional vga
            - vga qxl 
            
            - enable-kvm 
            - cpu host 
            
           
            
            # ssd
            #- scsi-hd,drive=hd,drive=hd,device.scsi0-0-0-0.rotation_rate=1,cpu host
            #- machine sun4m=kvm:tcg
            
             # nvme
            - nvme,drive=nvme0,serial=deadbeaf1,num_queues=8
            #- machine sun4m=kvm:tcg
            
            # memory 
            #- nvdimm,memdev=md1,id=nvdimm1
            - nvme,serial=deadbeef1,drive=nvm,nvme-subsys,id=nvme-subsys-0,nqn=subsys0,num_queues=8
           
            #- m 2G,maxmem=8G,slots=4 -object memory-backend-ram
            - nvdimm -m 0.5120G,maxmem=2.048G,slots=4 -object memory-backend-ram
            - object memory-backend-ram,size=0.5120G,id=ram0 
            - object memory-backend-ram,size=0.5120G,id=ram1 
            - object memory-backend-ram,size=0.5120G,id=ram2 
            - object memory-backend-ram,size=0.5120G,id=ram3 
            # Accelerator
            - accel kvm
            
            - net nic,vlan=virbr0
            
            - monitor stdio
            - console=ttyS0
        privileged: true
        #isolation: hyperv
        isolation: default
        tty: true
        stdin_open: true
        #command: sh
        image: jgsoftwares/pulseaudio-bluetooth:latest
        security_opt:
            #- apparmor=docker-default
            - no-new-privileges=true
            - apparmor:unconfined
          
            # se linux
            - label=type:container_runtime_t
        depends_on:
            - openwrt23docker
        deploy:
            # 
            #replicas: 2
            mode: global
            resources:
                limits:
                  #cpus: '2'
                  memory: 2048M
                reservations:
                  #cpus: '0.25'
                  memory: 512M

networks:
  # remote 
  vlan30: 
    
    name: wan
    driver: ipvlan
    # vlan name 
    driver_opts:
      parent: virbr0
      ipvlan_mode: l3
    ipam:
      config:
        - subnet: 217.160.255.254/32
          gateway: 217.160.255.254 
          