Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to package Chromium and all dependencies for deployment

Following an update from JasperServer 7.1.0 to 7.9.1, PDF export of dashboards no longer functioned. Looking into it, I saw that Chromium is necessary due to the deprecation of PhantomJS, and as such I need to make a chrome binary available to the server.

We do not have the ability to install applications on the JasperServer host machine - even the jasperserver deployment is done by copying over a built package rather than running the installer. As such, I cannot just install Chrome on the host. I also cannot have the host download files from external URLs at deployment time, only access files from the local artifact storage.

The first workaround I tried is to download chromium from https://commondatastorage.googleapis.com/chromium-browser-snapshot and store the zip file in the local artifact store, then pull it at deploy time. This gets Chrome onto the server, but it misses several dependencies chrome needs.

My next thought is to download the missing dependencies to the Chrome folder using yum install ----install-root=<CHROME_DIRECTORY> <MISSING_REPO>, then zip up the folder with the dependencies included. However, trying this still fails - it creates symlinks to the lib and lib64 directories, but it doesn't actually put the files in the chrome directory. Additionally, Chrome still throws an error for a missing file, even if the file it needs is in the lib64 folder or in the same folder as the Chrome executable.

The error I see right now is error while loading shared libraries: libatk-1.0.so.0: cannot open shared object file: No such file or directory.

Running ldd against chrome, I see the following missing libraries:

        libatk-1.0.so.0 => not found
        libatk-bridge-2.0.so.0 => not found
        libcups.so.2 => not found
        libxkbcommon.so.0 => not found
        libatspi.so.0 => not found
        libXcomposite.so.1 => not found
        libXdamage.so.1 => not found
        libgbm.so.1 => not found
        libasound.so.2 => not found

How can I package Chrome and it's dependencies together so they can be deployed by just unzipping them into the relevant repository?

like image 724
Chris Avatar asked Nov 28 '25 13:11

Chris


1 Answers

The solution to this was as follows:

Generate a good version of Chrome by extracting the version to be used on a second machine with the same OS as the JasperServer host, and installing any dependencies normally.

Identify missing dependencies by extracting Chrome onto the JasperServer host, setting LD_LIBRARY_PATH to your chrome directory, and running ldd <chrome_path> | grep not. Add them to the chrome archive. Repeat until no further dependencies missing dependencies are identified.

Finally, either reconfigure jasperserver to run Chrome from the provided chrome-wrapper executable, or set it to use a custom wrapper that only sets LD_LIBRARY_PATH then passes all arguments to chrome.

like image 95
Chris Avatar answered Nov 30 '25 06:11

Chris



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!