Skip to content

Commit

Permalink
Merge pull request #2 from vsfexperts/release-0.2.0
Browse files Browse the repository at this point in the history
Release 0.2.0
  • Loading branch information
vsfalexanderpilch authored Apr 5, 2018
2 parents 813a9a8 + c6f47e3 commit 34e0137
Show file tree
Hide file tree
Showing 50 changed files with 619 additions and 186 deletions.
20 changes: 20 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
language: java
cache:
directories:
- "$HOME/.m2"
before_install:
- sudo apt-get install texlive-latex-base texlive-latex-extra texlive-fonts-recommended
xzdec -y
script:
- mvn -f latex/pom.xml -Pcodecoverage,release clean install jacoco:report
deploy:
provider: releases
api_key:
secure: JhYKgsXgu74+snLH1XK1ZZknA4X7a8V6AKyiIyZjX7ph3uJ1aIzOaMKsWvrwYkwrB5stE4H+yDmvgPgrzRuRlWTwh+S0ArhbIQDTsezTAX0gCxWIiAEcpK+/1tZmC8JUR4gFPvn+i6VZ0hnbMteV4wj+gox2aFac0LadCkyMTsp1oXmKvp/3xOEdKNhLlgN2J3JCHMu28Zml65ydDaLgtt6seUbZ5tu/Jt1A3YdqrzxTvdqzCdMdis6oj9Zu7/b9BEnEazsJvSVzWx6e4GRvLp9G7KMOOgONbRBsW/kQ3fFVVTgKw3C0v4MpmocOB2rOtsmrgqC1s7Wr25zPim/cMXsSKht46ygOdS0nDfeX6AfRq9c/7ttlhTPQDxBoB+cfoTaxrWMftnFOcluZR6P3yRgZ/GccOCb68/ErvnyQ6Pnfz/Am/8CJLh9Ip49DpSGAZnEaq9ILSceUmA5kvBSrwXCADsa+91jdis8lwZrA29FwaU9s7oFUrcU9QsRx3BIBNv0+bpks/fxz3XnDLqJ8Q7qkNWi2ET9n8GShwX196EU7RYcM06gUMt2/ErIIdCcDBKBAmCOE4LC8EVpIpAxpDSt8vGr2UmsSg7ayU2wL2lfMsdqb3nhwfq+J8R/SCT1mbHKOkpbk1YVaqxqNEQJH+fpYUbLoOv5vcfZ0zHLtRv0=
file: latex-distribution/target/release.zip
skip_cleanup: true
on:
repo: vsfexperts/LaTeX
tags: true
after_success:
- bash <(curl -s https://codecov.io/bash)

This file was deleted.

This file was deleted.

This file was deleted.

19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[![Build Status](https://travis-ci.org/vsfexperts/LaTeX.svg?branch=release-0.2.0)](https://travis-ci.org/vsfexperts/LaTeX)
[![codecov](https://codecov.io/gh/vsfexperts/LaTeX/branch/release-0.2.0/graph/badge.svg)](https://codecov.io/gh/vsfexperts/LaTeX)

# Overview
This project is providing a simple integration of LaTeX with java. Velocity templates are compiled to valid LaTeX code and the result is fed to the external pdflatex process.

Expand All @@ -13,8 +16,8 @@ This project is providing a simple integration of LaTeX with java. Velocity temp

# Quickstart
1. Install [MiKTeX](https://miktex.org/download) on windows / [TexLive](https://launchpad.net/~jonathonf/+archive/ubuntu/texlive-2016) on Linux and make sure the `pdflatex` executable is available via system path (e.g. by executing it on the command line).
2. Browse to `src/test/resources/META-INF` and compile the `sample.tex` file by executing `pdflatex sample.tex`. MiKTeX will try to download the missing packages off the internet. You might have to install them manually in TexLive by using tlmgr.
3. See `LatexTemplateIT`/`SynchronousLatexRendererIT` to get started in your project.
2. Browse to `latex-renderer/src/test/resources/META-INF` and compile the `sample.tex` file by executing `pdflatex sample.tex`. MiKTeX will try to download the missing packages off the internet. You might have to install them manually in TexLive by using tlmgr.
3. See [LatexTemplateIT](latex-template/src/test/java/de/vsfexperts/latex/template/LatexTemplateIT.java) or [SynchronousLatexRendererIT](latex-renderer/src/test/java/de/vsfexperts/latex/renderer/SynchronousLatexRendererIT.java) to get started in your project.

# Server Tasks
Install missing TexLive packages
Expand All @@ -27,6 +30,17 @@ Install missing TexLive packages
- Retrieving a pdf: send get request to base url, e.g. http://renderer/65891272-fbd6-44fe-8152-dc4ea8e1901b. If it's not available yet, the service will return a 404 status code. If it was already created, the pdf file will be returned.
- The server status url is /admin/index.html. Jolokia(jmx remoting) and dropwizard metrics have been integrated.

# Configuration
There're 3 config values, which can be set in [application.yaml](latex-server/src/main/resources/application.yaml) or by specifying them on the command line:

| Property | Default (prod) | Description |
| ------------------------- | ------------------ | --------------------------------------------------------------------- |
| renderer.archiveDirectory | /var/archive | Base directory of archive. Render output will be stored in subfolders |
| renderer.workDirectory | /tmp/renderer | Base temp directory. Temp data will be stored in subfolders |
| renderer.threads | \<number of cpus\> | Size of rendering thread pool |

example: `java -Dspring.profiles.active=prod -Drenderer.threads=2 -Drenderer.workDirectory=c:\temp\work -Drenderer.archiveDirectory=c:\temp\archive -jar latex-server.jar`

# Scaling the service
- Deploy it in a loadbalanced setup on multiple servers
- Our installation is using [GlusterFS](https://www.gluster.org/) as backend storage of the archive folder, so the pdfs will be distributed and available on all members of the cluster. Each job output is stored in a subdirectory named by its uuid. The tex template and the pdf will be stored there for debugging purposes.
Expand All @@ -35,3 +49,4 @@ Install missing TexLive packages
# ToDos/Limitations
- The whole tex template is submitted in the post request, so it's currently not possible to include external resources (e.g. images), because those won't be found/available on the render server. Use [pdfinlimg](https://github.com/zerotoc/pdfinlimg) to inline small images (e.g. company logos) and supply them within the tex document.
- Currenly pdflatex is run multiple times to create the pdf. BibTeX or other external tools aren't executed as part of this build. If you need that, it's probably easier to switch to [Latexmk](http://personal.psu.edu/jcc8/latexmk/) instead of pdflatex to render files

57 changes: 57 additions & 0 deletions latex-distribution/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>de.vsfexperts.latex</groupId>
<artifactId>latex</artifactId>
<version>0.2.0</version>
<relativePath>../latex</relativePath>
</parent>

<artifactId>latex-distribution</artifactId>
<packaging>pom</packaging>

<name>LaTeX Distribution</name>

<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>latex-distribution</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<finalName>release</finalName>
<descriptors>
<descriptor>src/assembly/assembly.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>de.vsfexperts.latex</groupId>
<artifactId>latex-renderer</artifactId>
</dependency>
<dependency>
<groupId>de.vsfexperts.latex</groupId>
<artifactId>latex-server</artifactId>
</dependency>
<dependency>
<groupId>de.vsfexperts.latex</groupId>
<artifactId>latex-template</artifactId>
</dependency>
</dependencies>

</project>
46 changes: 46 additions & 0 deletions latex-distribution/src/assembly/assembly.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">

<id>bin</id>

<formats>
<format>zip</format>
</formats>

<includeBaseDirectory>false</includeBaseDirectory>

<dependencySets>
<dependencySet>
<outputDirectory>dependencies</outputDirectory>
<useTransitiveDependencies>true</useTransitiveDependencies>
<useProjectArtifact>false</useProjectArtifact>
<excludes>
<exclude>${project.groupId}:*:*</exclude>
</excludes>
</dependencySet>
<dependencySet>
<outputDirectory>distribution</outputDirectory>
<useTransitiveDependencies>false</useTransitiveDependencies>
<useProjectArtifact>false</useProjectArtifact>
<includes>
<include>${project.groupId}:*</include>
</includes>
</dependencySet>
</dependencySets>

<fileSets>
<fileSet>
<directory>../licenses</directory>
<outputDirectory>distribution/licenses</outputDirectory>
</fileSet>
<fileSet>
<directory>..</directory>
<includes>
<include>LICENSE</include>
</includes>
<outputDirectory>distribution</outputDirectory>
</fileSet>
</fileSets>

</assembly>
4 changes: 2 additions & 2 deletions LaTeX-renderer/pom.xml → latex-renderer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<parent>
<groupId>de.vsfexperts.latex</groupId>
<artifactId>latex</artifactId>
<version>0.1.0</version>
<relativePath>../LaTeX</relativePath>
<version>0.2.0</version>
<relativePath>../latex</relativePath>
</parent>

<artifactId>latex-renderer</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
import static org.junit.Assume.*;
import static org.junit.Assume.assumeThat;

import java.io.File;
import java.nio.charset.Charset;
Expand Down
19 changes: 12 additions & 7 deletions LaTeX-server/pom.xml → latex-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<parent>
<groupId>de.vsfexperts.latex</groupId>
<artifactId>latex</artifactId>
<version>0.1.0</version>
<relativePath>../LaTeX</relativePath>
<version>0.2.0</version>
<relativePath>../latex</relativePath>
</parent>

<artifactId>latex-server</artifactId>
Expand All @@ -33,16 +33,12 @@
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-core</artifactId>
</dependency>
<dependency>
<groupId>com.ryantenney.metrics</groupId>
<artifactId>metrics-spring</artifactId>
</dependency>

<dependency>
<groupId>org.jolokia</groupId>
<artifactId>jolokia-core</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
Expand Down Expand Up @@ -72,6 +68,15 @@
<artifactId>snakeyaml</artifactId>
</dependency>

<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-core</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>

<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
Expand Down
Loading

0 comments on commit 34e0137

Please sign in to comment.