cloud66/snippets

Wkhtmltopdf setup issue on Ubuntu 22.04 Jammy

Opened this issue · 0 comments

Problem

Hello! Cloud66 has wkhtmltopdf snippet which is broken for Ubuntu 22.04 Jammy. Script tries to install wkhtmltox_0.12.6-1.jammy_amd64.deb package which doesn't exist (was not compiled for Ubuntu 22.04 Jammy)

Due to that fact we are getting the following error during server build:
Screenshot 2024-04-23 at 12 14 35.

Solution

It is needed to change wkhtmltopdf snippet to the following one:

# {{Description: This deploy hook will run the following code snippet to automate the installation of wkhtmltopdf.}}
# download the latest wkhtmltopdf version
curl -sL https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.$(lsb_release -cs)_amd64.deb >> /tmp/wkhtmltopdf.deb
# install the wkhtmltopdf package
sudo dpkg -i /tmp/wkhtmltopdf.deb
# install the package dependencies
sudo apt install --fix-broken -y

I can open a PR that will contain this script rework but not sure about backwards compatibility 'cause your customers could probably still use Ubuntu 14 or Ubuntu 16. Probably a solution could be to check (lsb_release -cs) and use direct links for each release to the latest compiled wkhtmltopdf.deb packages instead of the dynamic links.

Another important thing is that https://github.com/wkhtmltopdf/packaging repository was archived. So probably it is needed to simply use sudo apt -y install wkhtmltopdf command to install this package.