Re: [Cdk-user] InChi and Docker [solved]

2018-09-14 Thread John Mayfield
Knew it was the JAR packaging, I did try to send the JAR file I has working
in debain-slim but Gmail blocks JAR attachments.

Interestingly I stopped using SpringBoot (for another reason I can't
remember) a few years ago and use the TomCat (exec-war) plugin instead.
Jetty also has a plugin which is another option. I think the best option
here is to use the TomCat DockerHub images and deploy it as a WAR file.

https://github.com/cdk/depict/blob/master/pom.xml#L88-L109


> org.apache.tomcat.maven
> tomcat7-maven-plugin
> 2.1
> 
> 
> tomcat-run
> 
> exec-war-only
> 
> package
> 
> ${project.name
> }-${project.version}.jar
> /
> boot
> 
> jar
> 
> 
> 
> 
> 


On Fri, 14 Sep 2018 at 07:12, Egon Willighagen 
wrote:

>
> Oh, very happy to hear that! Are you going to put it up on DockerHub?
>
> Egon
>
> On Thu, Sep 13, 2018 at 10:42 PM Maria Sorokina 
> wrote:
>
>> I managed to make my app function.
>>
>> The problem comes from the way a Spring Boot application packages the jar
>> - internally, the jar is different from plain old Java, so the deployment
>> of artefacts is also different. The Jnati library that allows the wrapping
>> of the InChi factory is not adapted to that special deployment and is
>> simply lost and doesn’t find the artifacts in correct places *if it never
>> ran on the system before* (case of a brand new minimal image).
>> The trick I found to make a Spring Boot application using InChis run in
>> Docker is not very elegant, but functional. In the container, during the
>> compilation, or at the execution of the container, before running the main
>> Spring Boot jar, run the simples possible mini POJO jar containing the
>> InChiGeneratorFactory, that will create the correct environment.
>> Now everything works!
>>
>> This is my Dockerfile:
>>
>> FROM openjdk:8u171-slim
>> EXPOSE 8080
>> VOLUME /tmp
>> ARG JAR_FILE
>> COPY ${JAR_FILE} app.jar
>> COPY inchiPet.jar /
>>
>> RUN java -jar inchiPet.jar
>>
>> ENTRYPOINT 
>> ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
>>
>> Where « inchiPet.jar » is the tiny regular jar with only a call to an
>> inchiGeneratorFactory, and « app.jar » is my main app.
>>
>> However, I used a bunch of libraries from CDK and until now, only the
>> InChi generator caused this problem within the Spring Boot - Docker
>> ecosystem.
>>
>> Hope this solution could help anybody encountering this kind of problem
>> in the future!
>>
>> Maria Sorokina, PhD
>> Steinbeck Research Group
>> Analytical Chemistry - Cheminformatics and Chemometrics
>> Friedrich-Schiller-University Jena, Germany
>> http://cheminf.uni-jena.de
>>
>
>
> --
> E.L. Willighagen
> Department of Bioinformatics - BiGCaT
> Maastricht University (http://www.bigcat.unimaas.nl/)
> Homepage: http://egonw.github.com/
> Blog: http://chem-bla-ics.blogspot.com/
> PubList: https://www.zotero.org/egonw
> ORCID: -0001-7542-0286 
> ImpactStory: https://impactstory.org/u/egonwillighagen
>
___
Cdk-user mailing list
Cdk-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdk-user


Re: [Cdk-user] InChi and Docker [solved]

2018-09-14 Thread Egon Willighagen
Oh, very happy to hear that! Are you going to put it up on DockerHub?

Egon

On Thu, Sep 13, 2018 at 10:42 PM Maria Sorokina 
wrote:

> I managed to make my app function.
>
> The problem comes from the way a Spring Boot application packages the jar
> - internally, the jar is different from plain old Java, so the deployment
> of artefacts is also different. The Jnati library that allows the wrapping
> of the InChi factory is not adapted to that special deployment and is
> simply lost and doesn’t find the artifacts in correct places *if it never
> ran on the system before* (case of a brand new minimal image).
> The trick I found to make a Spring Boot application using InChis run in
> Docker is not very elegant, but functional. In the container, during the
> compilation, or at the execution of the container, before running the main
> Spring Boot jar, run the simples possible mini POJO jar containing the
> InChiGeneratorFactory, that will create the correct environment.
> Now everything works!
>
> This is my Dockerfile:
>
> FROM openjdk:8u171-slim
> EXPOSE 8080
> VOLUME /tmp
> ARG JAR_FILE
> COPY ${JAR_FILE} app.jar
> COPY inchiPet.jar /
>
> RUN java -jar inchiPet.jar
>
> ENTRYPOINT 
> ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
>
> Where « inchiPet.jar » is the tiny regular jar with only a call to an
> inchiGeneratorFactory, and « app.jar » is my main app.
>
> However, I used a bunch of libraries from CDK and until now, only the
> InChi generator caused this problem within the Spring Boot - Docker
> ecosystem.
>
> Hope this solution could help anybody encountering this kind of problem in
> the future!
>
> Maria Sorokina, PhD
> Steinbeck Research Group
> Analytical Chemistry - Cheminformatics and Chemometrics
> Friedrich-Schiller-University Jena, Germany
> http://cheminf.uni-jena.de
>


-- 
E.L. Willighagen
Department of Bioinformatics - BiGCaT
Maastricht University (http://www.bigcat.unimaas.nl/)
Homepage: http://egonw.github.com/
Blog: http://chem-bla-ics.blogspot.com/
PubList: https://www.zotero.org/egonw
ORCID: -0001-7542-0286 
ImpactStory: https://impactstory.org/u/egonwillighagen
___
Cdk-user mailing list
Cdk-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdk-user


Re: [Cdk-user] InChi and Docker [solved]

2018-09-13 Thread Maria Sorokina
I managed to make my app function.

The problem comes from the way a Spring Boot application packages the jar - 
internally, the jar is different from plain old Java, so the deployment of 
artefacts is also different. The Jnati library that allows the wrapping of the 
InChi factory is not adapted to that special deployment and is simply lost and 
doesn’t find the artifacts in correct places *if it never ran on the system 
before* (case of a brand new minimal image).
The trick I found to make a Spring Boot application using InChis run in Docker 
is not very elegant, but functional. In the container, during the compilation, 
or at the execution of the container, before running the main Spring Boot jar, 
run the simples possible mini POJO jar containing the InChiGeneratorFactory, 
that will create the correct environment.
Now everything works!

This is my Dockerfile:

FROM openjdk:8u171-slim
EXPOSE 8080
VOLUME /tmp
ARG JAR_FILE
COPY ${JAR_FILE} app.jar
COPY inchiPet.jar /

RUN java -jar inchiPet.jar

ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
Where « inchiPet.jar » is the tiny regular jar with only a call to an 
inchiGeneratorFactory, and « app.jar » is my main app.

However, I used a bunch of libraries from CDK and until now, only the InChi 
generator caused this problem within the Spring Boot - Docker ecosystem.

Hope this solution could help anybody encountering this kind of problem in the 
future!



Maria Sorokina, PhD
Steinbeck Research Group
Analytical Chemistry - Cheminformatics and Chemometrics
Friedrich-Schiller-University Jena, Germany
http://cheminf.uni-jena.de

> Le 11 sept. 2018 à 20:57, John Mayfield  a écrit 
> :
> 
> Do you have a different machine to test on? Could also be a factor, alpine 
> gave me a segfault (see attached) but slim works OK.
> 
> [john@toaster jni-inchi-docker]$ more Dockerfile
> FROM openjdk:8u171-slim
> COPY smi2inchi.jar .
> 
> John 
> 
> On Tue, 11 Sep 2018 at 16:23, John Mayfield  > wrote:
> I'll have a poke around in an alpine container this evening, does seem odd.
> 
> A third option is nested-vm version, we used this in JChemPaint when it was 
> an Applet - (see inchi-nestedvm in https://github.com/JChemPaint/jchempaint 
> ).
> 
> On Tue, 11 Sep 2018 at 16:03, Maria Sorokina  > wrote:
> I am building my jar with Maven, but I don’t think that it is the problem, as 
> I tried tu run the jar on a Centos7 VM having just Java and it worked without 
> any problem.
> I also desperately tried the dirty solution of downloading the manifest and 
> the jniinchi-1.03_1-LINUX-AMD64.so  
> files the ini-inchi seems to search for and put them where it seems to search 
> them within the container, but, of course it failed.
> 
> I’ll try to search for a solution, but for now I’ll just do my thing without 
> containerizing this part of my app. If I find a solution, I’ll post it here. 
> Meanwhile, I’m still very open to any suggestion!
> 
> Kind regards,
> 
> Maria Sorokina, PhD
> Steinbeck Research Group
> Analytical Chemistry - Cheminformatics and Chemometrics
> Friedrich-Schiller-University Jena, Germany
> http://cheminf.uni-jena.de 
> 
>> Le 11 sept. 2018 à 14:51, John Mayfield > > a écrit :
>> 
>> Right, alpine was probably a red herring. Looking again I presume you build 
>> app.jar yourself? It looks like you've removed the MANIFEST.xml that is 
>> needed by JNI InChI to locate the native dependency. How are you building 
>> the JAR?
>> 
>> Unfortunately v1.03 of InChI is all we have for JNI ATM. My former colleague 
>> has been looking at JNA InChI version (https://github.com/dan2097/jna-inchi 
>> ) but this is very different to the 
>> JNI bindings and not a drop in replacement.
>> 
>> John
>> 
>> On Tue, 11 Sep 2018 at 09:48, Maria Sorokina > > wrote:
>> I tried the ubuntu 16.04 based image with Java 8 added, I get exactly the 
>> same error, only at the InChi generation. I have the feeling that something 
>> is missing in this minimal linux images for the InChi generator to run 
>> correctly, but I cannot find what.
>> 
>> I also noticed that for an old version of ini-inchi (1.03, and the latest 
>> and only available is 1.6):
>>  npls-db-filler_1  | 2181 [main] INFO  
>> net.sf.jnati.deploy.repository.RemoteRepository  - Searching remote 
>> repository for: jniinchi-1.03_1-LINUX-AMD64 
>> (http://jnati.sourceforge.net/jnati-repo 
>> )
>> 
>> What am I missing in my configuration ? Knowing that everything works fine 
>> outside of Docker?
>> 
>> The Dockerfile using Ubuntu:
>> 
>> FROM ubuntu:16.04
>> LABEL maintainer="maria.ssorok...@gmail.com 
>> "
>> 
>> 
>> RUN apt-get