0

For a quick run down, I'm trying to have headless chrome run via supervisor, which will then be used by another script that will use it via puppeteer to do some processing.

There seems to be a lot of permission issues, and I've yet to find any helpful articles on how to run headless chrome in supervisor.

My setup:

Supervisor

[supervisord]
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid
childlogdir=/var/log/supervisorctl
nodaemon=true
user=root

[program:chrome]
command=google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222
user=www-data
autostart=true
autorestart=true
directory=/home/www-data
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

Docker

RUN touch /var/log/supervisor/supervisord.log
RUN chown -R www-data:www-data /var/log/supervisor/supervisord.log
RUN chown -R www-data:www-data /var/log/supervisorctl

CMD ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisor/supervisord.conf"]

The resulting errors

022-08-31 13:23:23,819 INFO Set uid to user 0 succeeded
2022-08-31 13:23:23,826 INFO supervisord started with pid 1
2022-08-31 13:23:24,831 INFO spawned: 'chrome' with pid 8
2022-08-31 13:23:25,834 INFO success: chrome entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
clone: Invalid argument
[0831/132326.095171:ERROR:scoped_ptrace_attach.cc(27)] ptrace: Function not implemented (38)
qemu: uncaught target signal 5 (Trace/breakpoint trap) - core dumped
2022-08-31 13:23:26,123 INFO reaped unknown pid 40 (exit status 1)
[0831/132326.127281:ERROR:exception_handler_server.cc(142)] tgkill: No such process (3)
qemu: uncaught target signal 5 (Trace/breakpoint trap) - core dumped
2022-08-31 13:23:26,379 INFO exited: chrome (terminated by SIGTRAP; not expected)
2022-08-31 13:23:26,379 INFO reaped unknown pid 32 (exit status 0)
Keith
  • 1
  • 1

1 Answers1

0

The reason this was happening was because I was building the Docker container on an M2 Mac using --platform=amd64 which apparently causes a lot of breaking issues in Chrome, and probably other things. I started building on an ubuntu machine without the architecture virtualization and these problems no longer exist.

Keith
  • 1
  • 1