Commit Graph

17 Commits

Author SHA1 Message Date
Tom Byers
a4bca73b80 Make Jenkins use Node 10 2019-04-12 15:36:57 +01:00
Chris Hill-Scott
57bccc0314 Use debian jessie instead of stretch until npm is installed differently 2018-07-17 11:37:29 +01:00
Leo Hemsted
69b766b3c9 test on python3.5 2017-10-27 13:10:12 +01:00
bandesz
aef9bb3615 Ignore docker pull errors 2017-02-28 18:26:48 +00:00
bandesz
b148a0a6a0 Add awslogs logging for PaaS 2017-02-16 14:19:37 +00:00
bandesz
74536530b0 Install libjpeg62 in the Docker image 2017-01-18 14:30:49 +00:00
bandesz
7eab0f411f Run Docker container with host user and group 2017-01-17 11:44:42 +00:00
bandesz
10950bb8a6 Run on Paas 2017-01-17 11:44:42 +00:00
bandesz
57493aff51 Fix apt proxy and curl proxy in Docker 2016-12-20 11:04:29 +00:00
Chris Hill-Scott
43296469d6 Add endpoint for generating an image of a letter
The PDF preview is all good, but it’s hard, finickeity and feels dirty
to embed a PDF in a web page. It’s a more natural thing to embed an
image in a web page.

So this commit adds another endpoint to return an image of a letter
template. It generates this image from the PDF preview, so the stack
looks like:

1. `template.png` (generated in admin)
2. `template.pdf` (generated in admin)
3. HTML preview (generated by a `Renderer` in utils)
4. `Template` instance
5. serialised template from API
6. Template stored in database

The library used to convert the PDF to an image is Wand[1], which binds
to ImageMagick underneath. So in order to get this working locally on a
Mac you will probably need to do:
`brew install imagemagick ghostscript cairo pango`.

To get it working on Ubuntu/EC2 is an exercise left to the reader…

1. http://docs.wand-py.org/en/0.4.4/
2016-12-13 10:34:18 +00:00
Chris Hill-Scott
d0f90eac7e Add an endpoint for generating a PDF of a letter
Previewing a letter is different to previewing an email or text message
because:

- a letter has a layout
- the layout is fixed, ie it doesn’t depend on the user’s device
- the ‘send yourself a test’ feature won’t be as useful because it has
  a lead time, so the feedback loop will be much longer

For these reasons a HTML-only preview of the letter won’t be enough (we
don’t think). A PDF is more appropriate because:

- it can replicate the layout of the letter exactly
- it is a print format, so the user could even print themselves a copy
  locally to get a feel for how it will look

This commit makes use of Flask WeasyPrint [1] to take a HTML
representation of the letter, convert it to a PDF and serve it back to
the user.

The actual work to generate the HTML and specify the layout is done in
utils, same as we do for rendering other messages.

1. https://pythonhosted.org/Flask-WeasyPrint/
2016-12-13 10:34:18 +00:00
bandesz
4c89c8c33d Set http proxy params for Docker build 2016-12-02 14:45:01 +00:00
bandesz
b7d1a10e2d Use http proxy for Docker 2016-11-30 15:57:20 +00:00
bandesz
2734f27369 Add python-dev, libffi-dev, libssl-dev to the Docker build image 2016-11-23 12:41:07 +00:00
Imdad Ahad
75854d91fc Use python wheels to speed up deployments 2016-11-07 17:56:08 +00:00
bandesz
c63f1012cc Always pull base Docker image before building 2016-09-29 17:15:10 +01:00
bandesz
26ff449b77 Create Docker build image, build project with Docker 2016-08-22 17:25:05 +01:00