Skip to content

Commit

Permalink
Merge pull request #616 from CDLUC3/bug/pdf-grover
Browse files Browse the repository at this point in the history
Bug/pdf grover
  • Loading branch information
briri authored Jun 26, 2024
2 parents dcf0226 + e8d071a commit 01ff79c
Show file tree
Hide file tree
Showing 44 changed files with 1,129 additions and 353 deletions.
5 changes: 2 additions & 3 deletions .env.mysql2
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ PORT=3000
# Rails 6.1+ has a white-list of valid domains. You must set this for your production env!
DMPROADMAP_HOST=localhost

# The location of the wkhtmltopdf app. Once bundler has installed it, you can find it with
# `which wkhtmltopdf` on linux/osx systems.
DMPROADMAP_WKHTMLTOPDF_PATH=/usr/local/bin/wkhtmltopdf
# The location of the chromium executable.
CHROMIUM_PATH=/usr/bin/chromium

# Database settings.
DMPROADMAP_DATABASE_HOST=127.0.01
Expand Down
5 changes: 2 additions & 3 deletions .env.postgresql
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ PORT=3000
# Rails 6.1+ has a white-list of valid domains. You must set this for your production env!
DMPROADMAP_HOST=localhost

# The location of the wkhtmltopdf app. Once bundler has installed it, you can find it with
# `which wkhtmltopdf` on linux/osx systems.
DMPROADMAP_WKHTMLTOPDF_PATH=/usr/local/bin/wkhtmltopdf
# The location of the chromium executable.
CHROMIUM_PATH=/usr/bin/chromium

# Database settings.
DMPROADMAP_DATABASE_HOST=127.0.01
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ lib/tasks/init.rake
# Ignore the local Docker DB files
docker/

# Ignore cache files for Puppeteer
.cache/

# Homepage background images
app/assets/images/homepage
# ----------------------
Expand Down
8 changes: 8 additions & 0 deletions .puppeteerrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const {join} = require('path');

/**
* @type {import("puppeteer").Configuration}
* */
module.exports = {
cacheDirectory: join(__dirname, '.cache', 'puppeteer'),
};
46 changes: 26 additions & 20 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,18 @@ RUN groupadd -g 1000 dmpt && useradd -u 1000 -g 1000 dmpt
# they were clobbered by a parent image.
RUN set -ex \
&& RUN_DEPS=" \
vim \
mtr \
autoconf \
automake \
build-essential \
gawk \
g++ \
git \
curl \
imagemagick \
libffi-dev \
libgdbm-dev \
libmariadb-dev \
libreadline-dev \
libssl-dev \
libtool \
libyaml-dev \
shared-mime-info \
apt-transport-https autoconf automake build-essential ca-certificates chromium curl \
dumb-init fonts-liberation gawk g++ gconf-service git imagemagick \
libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libcurl4-gnutls-dev \
libdbus-1-3 libexpat1 libffi-dev libfontconfig1 libgdbm-dev libgbm1 libgcc1 \
libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libmariadb-dev \
libnspr4 libnss3 libreadline-dev libpango-1.0-0 libpangocairo-1.0-0 \
libssl-dev libstdc++6 libtool libx11-6 libx11-xcb1 libxcb1 libxcomposite1 \
libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 \
libxrender1 libxss1 libxtst6 libyaml-dev locales lsb-release mtr \
shared-mime-info tzdata vim wget xdg-utils xfonts-base \
xfonts-75dpi xz-utils yarn \
nodejs -qqy \
" \
&& seq 1 8 | xargs -I{} mkdir -p /usr/share/man/man{} \
&& apt-get update && apt-get install -y --no-install-recommends $RUN_DEPS \
Expand All @@ -43,22 +37,34 @@ RUN apt-get update && apt-get install -y --no-install-recommends nodejs yarn
ENV INSTALL_PATH /opt/app
RUN mkdir -p $INSTALL_PATH

# Install gems
# Copy the app in and make the dmpt user the owner
COPY . $INSTALL_PATH/
RUN chown -R dmpt:dmpt $INSTALL_PATH
WORKDIR $INSTALL_PATH

# Cleanup from build
ENV RAILS_ENV development
RUN rm -rf node_modules vendor
RUN rm -rf node_modules vendor .cache

# Install bundler foreman and then build Bundle and Yarn
RUN gem install bundler -v 2.5
RUN gem install foreman
RUN bundle config without pgsql rollbar
RUN bundle install
RUN yarn install

# RUN npx puppeteer browsers install chrome

# Install the fonts needed by Puppeteer to generate PDFs
RUN mkdir -p /home/dmpt/.local/share/fonts
RUN cp app/assets/fonts/Roboto-*.ttf /home/dmpt/.local/share/fonts
RUN cp app/assets/fonts/Tinos-*.ttf /home/dmpt/.local/share/fonts
RUN fc-cache -f -v

USER dmpt

ENTRYPOINT ["/usr/bin/dumb-init", "--"]

# EXPOSE 25 80 443
# CMD ["bundle", "exec", "puma", "-C", "config/puma.rb", "-p", "80"]
CMD ["echo", "Ready…"]
9 changes: 3 additions & 6 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,9 @@ gem 'autoprefixer-rails'
# EXPORTING #
# ========= #

# Provides binaries for WKHTMLTOPDF project in an easily accessible package.
gem 'wkhtmltopdf-binary'

# PDF generator (from HTML) gem for Ruby on Rails
# (https://github.com/mileszs/wicked_pdf)
gem 'wicked_pdf'
# A Ruby gem to transform HTML into PDFs, PNGs or JPEGs using Google Puppeteer and Chromium.
# https://github.com/Studiosity/grover
gem 'grover'

# This simple gem allows you to create MS Word docx documents from simple
# html documents. This makes it easy to create dynamic reports and forms
Expand Down
Loading

0 comments on commit 01ff79c

Please sign in to comment.