runyonave
Cannot get chromic_pdf to run in prod environment
We have been stuck on this for a few days now and I am really not sure what could be missing. I can get chromic_pdf to work perfectly fine on my dev environment. I.e. it can render and store PDFs from HTML without any issue.In terms of setting it up:
mix.exs:
{:chromic_pdf, "~> 1.17"}
runtime.exs
config :tailboard, :pdf, url: System.fetch_env!("APP_URL")
config :chromic_pdf,
chrome_executable: System.get_env("CHROME_PATH"),
discard_stderr: false,
chrome_args: [
"--no-sandbox",
"--disable-dev-shm-usage",
"--disable-gpu",
"--disable-setuid-sandbox",
"--disable-software-rasterizer",
"--enable-logging=stderr",
"--headless"
],
log_level: :info,
temp_dir: "/tmp/app"
application.exs
def start(_type, _args) do
TailboardWeb.AllowedAddressList.start()
# Define workers and child supervisors to be supervised
children = [
...other modules
ChromicPDF
]
# See https://hexdocs.pm/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: Tailboard.Supervisor]
Supervisor.start_link(children, opts)
end
In Dockerfile I get these dependencies:
RUN apt-get update -y && \
apt-get install -y \
libstdc++6 openssl libncurses5 locales ca-certificates chromium \
libnss3 libfreetype6 libharfbuzz0b fonts-freefont-ttf imagemagick \
tini fontconfig curl \
&& apt-get clean && rm -f /var/lib/apt/lists/*_*
Is there anything I am missing?
First Post!
windexoriginal
Are you running Google Chrome rather than Chromium on your dev machine? Google Chrome is run from a different directory and started with a different command (“chrome” vs “chromium-browser”), which may be causing the issues in your container.
Last Post!
maltoe
Hi @runyonave
chromic doesn’t have log_level and temp_dir options, plus a lot of your chrome-specific options shouldn’t be necessary. Can you also share what kind of error message you’re seeing, if any, or how else your system doesn’t work as expected?
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #hex
- #security









