msokk / electron-render-service

Microservice for rendering PDF/PNG/JPEG from HTML with Electron
MIT License
102 stars 28 forks source link

Docker Swarm mode misc. points #50

Closed sbrown345 closed 7 years ago

sbrown345 commented 7 years ago

I'm not sure if these are things to fix but it might help someone else and/or be useful in the readme.

To get this working with swarm mode I had to set HOSTNAME to nothing and use /dev/shm instead of setting shm_size.

docker service create --name ers --mount type=tmpfs,dst=/dev/shm,tmpfs-size=134217728 -e RENDERER_ACCESS_KEY=changeme -e HOSTNAME= --publish 3000:3000 msokk/electron-render-service

Or the compose file:

version: '3'
services:  
    electronrenderservice:
        image: msokk/electron-render-service
        ports:        
            - "3000:3000"
        environment: 
            - RENDERER_ACCESS_KEY=changeme
            - HOSTNAME=
        volumes:
            - /dev/shm:/dev/shm

To test: http://localhost:3000/pdf?accessKey=changeme&url=http%3A%2F%2Fgoogle.com

msokk commented 7 years ago

A bit of googling shows that --shm-size is not yet implented - https://github.com/moby/moby/issues/26714, but I wonder why the HOSTNAME needs to be blank...

msokk commented 7 years ago

Added a note to README under Docker.