Open mikedoubintchik opened 4 years ago
Hi @mikedoubintchik , I have Browsersync on a separate container and it turns out that it will not proxy an nginx container using a port that's not 80. I installed sudo on my nginx image, because running as root for the container isn't recommended, and now problem solved.
@demyxco that's awesome! Could you please post your docker file and the browsersync config?
@mikedoubintchik here's an example of mine, using Traefik as the reverse proxy. It's setup to be accessible via subdirectory instead of subdomain so I'm not generating additional LE certs. No ports are open and BrowserSync is accessible with HTTPS. You can see my Dockerfile and entrypoint script in my repo.
docker run -dit --rm \
--network=demyx \
--volumes-from=nginx_container \
-e BS_PROXY=nginx_container \
-e BS_DOMAIN=domain.tld \
-e BS_FILES="[\"/var/www/html/wp-content/themes/**/*\", \"/var/www/html/wp-content/plugins/**/*\"]" \
-e BS_PATH=/demyx \
-e BS_PORT=3000 \
-l "traefik.enable=true" \
-l "traefik.http.routers.domaintld-bs-https.rule=(Host(\`domain.tld\`) && PathPrefix(\`/demyx/bs/\`))" \
-l "traefik.http.routers.domaintld-bs-https.middlewares=domaintld-bs-prefix" \
-l "traefik.http.routers.domaintld-bs-https.entrypoints=https" \
-l "traefik.http.routers.domaintld-bs-https.tls.certresolver=demyx" \
-l "traefik.http.routers.domaintld-bs-https.service=domaintld-bs" \
-l "traefik.http.middlewares.domaintld-bs-prefix.stripprefix.prefixes=/demyx/bs/" \
-l "traefik.http.services.domaintld-bs.loadbalancer.server.port=3000" \
-l "traefik.http.routers.domaintld-socket-https.rule=(Host(\`domain.tld\`) && PathPrefix(\`/browser-sync/socket.io/\`))" \
-l "traefik.http.routers.domaintld-socket-https.middlewares=domaintld-socket-prefix" \
-l "traefik.http.routers.domaintld-socket-https.entrypoints=https" \
-l "traefik.http.routers.domaintld-socket-https.tls.certresolver=demyx" \
-l "traefik.http.routers.domaintld-socket-https.service=domaintld-socket" \
-l "traefik.http.middlewares.domaintld-socket-prefix.stripprefix.prefixes=/demyx/bs/browser-sync/socket.io/" \
-l "traefik.http.services.domaintld-socket.loadbalancer.server.port=3000" \
demyx/browsersync
I'm unable to run BrowserSync with the Traefik reverse proxy. BrowserSync doesn't know what url to proxy and I'm not sure what to put there. I've tried every combination I can think of.
I've opened a similar ticket here with no response: https://github.com/BrowserSync/browser-sync/issues/1506
And I opened the issue here with no response: https://discourse.roots.io/t/sage-9-with-docker/13476
Codebase
Built-in vanilla WordPress
Host OS
e.g. macOS Sierra
Docker info output
Docker compose file
Make sure you remove all commented services.