# 2023-09-25 # Stack: ipfs --- ipfs: name: "ipfs" tasks: - ipfs.yml ipv6: true traefik: true notice: | # Container console (ash) # To access the WebUI type in http://yourIP:5005/webui in the browser # # ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["http://yourIP:5005", "http://localhost:3000", "http://127.0.0.1:5005", "https://webui.ipfs.io"]' # ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "POST"]' # Restart IPFS Container # # Traefik Auth # cd /tmp && htpasswd -c -B ipfs.pwd username directories: - "{{ stack_folder_datas }}/ipfs/datas" - "{{ stack_folder_datas }}/ipfs/ipfs/datas" - "{{ stack_folder_datas }}/ipfs/ipns/datas" services: - name: "ipfs" extends: "host" image: "ipfs/kubo:latest" capabilities: - DAC_OVERRIDE restart: "unless-stopped" ports: - { exposed: "${VM_PORT_IPFS_RPC}", container: "5001", comments: " # RPC API - includes admin operations - never open to the public internet" } - { exposed: "${VM_PORT_IPFS_GATEWAY}", container: "8080", comments: " # Gateway" } - { exposed: "${VM_PORT_IPFS_P2P}", container: "4001", comments: " # P2P TCP/QUIC transports" } - { exposed: "${VM_PORT_IPFS_P2P}", container: "4001", mode: "udp", comments: " # P2P TCP/QUIC transports" } healthcheck: 'wget --no-verbose --tries=1 --spider http://0.0.0.0:5001/webui || exit 1' environment: - { name: "IPFS_PATH", value: "/data/ipfs" } tmpfs: 512M ressources: memory: 1G volumes: - { local: './{{ stack_folder_datas }}/ipfs/datas', container: '/data/ipfs', mode: 'rw' } - { local: './{{ stack_folder_datas }}/ipfs/ipfs/datas', container: '/ipfs', mode: 'rw' } - { local: './{{ stack_folder_datas }}/ipfs/ipns/datas', container: '/ipns', mode: 'rw' } traefik: routers: - { name: "ipfs-redir", rule: "Host(`{{ vm_subdomain_ipfs }}.{{ vm_internet_domain }}`) && Path(`/`)", middlewares: "default@file, ipfs-webui@docker", service: "ipfs@docker" } - { name: "ipfs", rule: "Host(`{{ vm_subdomain_ipfs }}.{{ vm_internet_domain }}`) && PathPrefix(`/webui`)", middlewares: "default@file, services-auth@file", service: "ipfs@docker" } - { name: "ipfs-ipfs", rule: "Host(`{{ vm_subdomain_ipfs }}.{{ vm_internet_domain }}`) && (PathPrefix(`/ipfs/`) || PathPrefix(`/api/`))", middlewares: "default@file, services-auth@file", service: "ipfs@docker" } services: - { name: "ipfs", port: "5001" } middlewares: - { name: "ipfs-webui", content: "addPrefix.prefix: '/webui'" }