Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- version: "3.8"
- ### VOLUMES
- ## I bind host folders to folders inside the container and therefore do not
- ## make use of docker volumes in this case. If you decide you want to do so
- ## though make sure you reference them here as well like so:
- #volumes:
- #ntfy-cache:
- # driver: overlay
- #ntfy-userdb:
- # driver: overlay
- ### NETWORKS
- # Define the docker network. I personally use Traefik for all my reverse #
- # proxying on Docker Swarm.
- networks:
- traefik-public:
- external: true
- ### SERVICES
- # Define the Ntfy-service. Note that the N is capitalized for a reason (it has # something to do with internal resolution of container names for those that
- # are curious)
- services:
- Ntfy:
- # Name the service:
- hostname: ntfy
- # I host my own registry so it becomes:
- image: registry.yourdomain.org/ntfy:armv7
- # However you could easily replace that, like:
- image: binwiederhier/ntfy:latest
- # Configure networking and ports:
- networks:
- traefik-public:
- aliases:
- - ntfy
- # Expose port 80 and 443 inside the container to 8008 and 4433 on the host
- ports:
- - target: 80
- published: 8008
- protocol: tcp
- mode: host
- - target: 443
- published: 4433
- protocol: tcp
- mode: host
- # Run the serve command once the container is up
- command:
- - serve
- # Mount some volumes for persistency. Note that while I use bindmounts to
- # directories on the host filesystem here, you are perfectly fine with
- # docker volumes as well
- volumes:
- - /mnt/docker/ntfy/cache:/var/cache/ntfy:rw
- - /mnt/docker/ntfy/lib:/var/lib/ntfy:rw
- - /mnt/docker/ntfy/etc:/etc/ntfy:rw
- - /mnt/docker/ntfy/etc/server.yml:/etc/ntfy/server.yml:ro
- deploy:
- # Deploy a single instance of the container
- mode: replicated
- replicas: 1
- # Decide where the container is placed by using docker labels.
- # I want it to be on one of my raspberry nodes so I use this:
- placement:
- # preferences:
- # - spread: node.labels.type == worker
- constraints:
- - node.labels.type == raspberry
- # Configure how the service should behave when updating
- update_config:
- parallelism: 1
- delay: 5s
- order: stop-first
- # Define the amount of system resources that the service can use
- resources:
- limits:
- cpus: '0.30'
- memory: 124
- reservations:
- cpus: '0.05'
- memory: 24M
- # Define the runtime labels (for example to instruct Traefik)
- labels:
- - 'traefik.enable=true'
- - 'traefik.docker.network=traefik-public'
- - 'traefik.constraint-label=traefik-public'
- - 'traefik.http.routers.ntfy.rule=Host(\`ntfy.yourdomain.org\`)'
- - 'traefik.http.routers.ntfy.service=ntfy@docker'
- - 'traefik.http.routers.ntfy.entrypoints=https'
- - 'traefik.http.routers.ntfy.tls=true'
- - 'traefik.http.routers.ntfy.tls.certresolver=cloudflare'
- - 'traefik.http.routers.ntfy.middlewares=authelia@docker'
- - 'traefik.http.services.ntfy.loadbalancer.server.port=80'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement