runyonave

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

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

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?

Where Next?

Popular in Questions Top

lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New

Other popular topics Top

minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New

We're in Beta

About us Mission Statement