From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by c5ff346549e7 (Postfix) with ESMTPS id 24A721E6 for ; Thu, 29 Mar 2018 18:13:38 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.48,378,1517871600"; d="scan'208,217";a="320609470" Received: from sympa.inria.fr ([193.51.193.213]) by mail2-relais-roc.national.inria.fr with ESMTP; 29 Mar 2018 20:13:36 +0200 Received: by sympa.inria.fr (Postfix, from userid 20132) id 5B45A82437; Thu, 29 Mar 2018 20:13:36 +0200 (CEST) Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 0E10C8239C for ; Thu, 29 Mar 2018 20:13:30 +0200 (CEST) Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=scott.dj@gmail.com; spf=Pass smtp.mailfrom=scott.dj@gmail.com; spf=None smtp.helo=postmaster@mail-lf0-f51.google.com IronPort-PHdr: =?us-ascii?q?9a23=3ACocIrBY/CZ4BNa8eDYyM7fj/LSx+4OfEezUN459i?= =?us-ascii?q?sYplN5qZoMS5bnLW6fgltlLVR4KTs6sC17KN9fi4EUU7or+5+EgYd5JNUxJXwe?= =?us-ascii?q?43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6arXK99yMdFQviPgRp?= =?us-ascii?q?OOv1BpTSj8Oq3Oyu5pHfeQpFiCazbL9oMBm6sRjau9ULj4dlNqs/0AbCrGFSe+?= =?us-ascii?q?RRy2NoJFaTkAj568yt4pNt8Dletuw4+cJYXqr0Y6o3TbpDDDQ7KG81/9HktQPC?= =?us-ascii?q?TQSU+HQRVHgdnwdSDAjE6BH6WYrxsjf/u+Fg1iSWIdH6QLYpUjm58axlVAHnhz?= =?us-ascii?q?sGNz4h8WHYlMpwjL5AoBm8oxBz2pPYbJ2JOPZ7eK7WYNEUSndbXstJVSNBDIOy?= =?us-ascii?q?YYUMAeQcI+hXs5LwqEESoRakHwSgGP/jxz1Oi3Tr3aM6yeMhEQTe0QIuBd0Orn?= =?us-ascii?q?XUo8joP6kPTe+1y7XIzSneZP5Rwjfy9I/Icgw9of2WQL1wc9HcyUYqFwzfj1WQ?= =?us-ascii?q?rZbpMC+S1uQIqmWW6fdrW+yoi24isQ5xoz6vy98jionImoIVyk3E+j5jzIkpIt?= =?us-ascii?q?24TUh2asOnHptIryyWKZd6T8c4T2xruCs20KMKtYO7cSQQyJkr2hjSYOGdfYeS?= =?us-ascii?q?+BLsTuORLC94hH17fLK/gA6/8U26xe39Usm4yVJKriRZntXVuHAA1wHf5tKISv?= =?us-ascii?q?t6+Ueh1jKP2B7J5u5YJkA0kLLXK58nwrEuipoeqVrPEjPylUnsj6Kbdl8o9va1?= =?us-ascii?q?5+nneLnrpoKQO5dxig7kM6QunsK/Af4/MggLR2Wb4viz1Lr//U3lWrlFk/82n7?= =?us-ascii?q?LWsJDfP8sbp6q5DxVJ3YYk7hazFy2m38gAnXkbMFJFfwqKgJTzNFHLJPD0FPO/?= =?us-ascii?q?g1W3kDd33P3GJb3gApDVLnfZirvhfLB961RdyAUp19xf6YhUWfk9J6fTU0nq/P?= =?us-ascii?q?vcA1cDOgK9zuL8BdM1goMEUGyGD6uCPaX6vlqB5+ZpKO6JMtw7ojH4ftQs+f/i?= =?us-ascii?q?xUQynkMBNf2y1pwLdDa0HNxpJkyYZTznhdJXQjRChRY3UOG/0A7KajVUfXvnGv?= =?us-ascii?q?tkvmhqWrLjNp/KQ8WWuJLE2S66GpNMYWUfUwKDFH7pc8OPXPJeMXvOcP8kqSQN?= =?us-ascii?q?UP2ac6FkzQun7VaoxL9uL+6S8Sod58q6iYpFotbLnBR3zgRaSsSQ12bXEjNxl2?= =?us-ascii?q?IMAjs4hOVx/BU7xVCE3qx1xfdfEI4L6g=3D=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0CdAAD5K71afzPXVdFeHgEGDIMXTwE8b?= =?us-ascii?q?xUTg1xSS5NlgXR1Go1thGSBegsjhGEChBoZBwEEMBgBAgEBAQEBAQEBARIBAQk?= =?us-ascii?q?LCwgmMYI4JAGCSQEEASMdARsSCwEDAQsGBQs3AgIhAQERAQUBHAYTCIRsAQMNC?= =?us-ascii?q?A+hXzyLBYF/BQEXgm8Fg0gKGSYNVVeCIgIBBRKHTIITgQyCUAYugk9CAoIJglO?= =?us-ascii?q?CVAKXBywIhVGFX4J8WFeGL4RUiRQ7hhwPIYEEHF6BLDMaI08xghKCFAwXegEIj?= =?us-ascii?q?RQ+MI53AQE?= X-IPAS-Result: =?us-ascii?q?A0CdAAD5K71afzPXVdFeHgEGDIMXTwE8bxUTg1xSS5NlgXR?= =?us-ascii?q?1Go1thGSBegsjhGEChBoZBwEEMBgBAgEBAQEBAQEBARIBAQkLCwgmMYI4JAGCS?= =?us-ascii?q?QEEASMdARsSCwEDAQsGBQs3AgIhAQERAQUBHAYTCIRsAQMNCA+hXzyLBYF/BQE?= =?us-ascii?q?Xgm8Fg0gKGSYNVVeCIgIBBRKHTIITgQyCUAYugk9CAoIJglOCVAKXBywIhVGFX?= =?us-ascii?q?4J8WFeGL4RUiRQ7hhwPIYEEHF6BLDMaI08xghKCFAwXegEIjRQ+MI53AQE?= X-IronPort-AV: E=Sophos;i="5.48,378,1517871600"; d="scan'208,217";a="320609448" Received: from mail-lf0-f51.google.com ([209.85.215.51]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 29 Mar 2018 20:13:29 +0200 Received: by mail-lf0-f51.google.com with SMTP id m200-v6so3858404lfm.4 for ; Thu, 29 Mar 2018 11:13:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=9CzVQgSuScJlmOgPe1H/qeKufffuNteAdhGNPr8H68E=; b=Uoz92zX5owhxcHput751CQ5J2hqmTNY5nMz1Oyzv60CEqa1V4vCk9u9gSrshCMaJSh CHfeD7Pd4e39TL92buFU7WczHuwr8wt5xa4VpJfgluIQCPSIIPmpHPrhOS5x2II8aIQ1 fSf32vYuS6c1rOQMOtPU9FM5XoqOXJkJcCjCWrQ2eys12l9VlL6S1IvMVsD/SxscRLCN b7ih4IZMu8qoWclvQUBskulJ4vxstu1WCZ3Wn8VaFfGwSL9VWDA2L6jDl4tlqQzIhuhh atYyQmwF6AeSvx/xPRlNEPb+RDVBcNg4fZYvG/vKJex51Q/39ryWYc1sHW8AEMcV2OHW mELg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=9CzVQgSuScJlmOgPe1H/qeKufffuNteAdhGNPr8H68E=; b=dxxr1R8o3PfSLxwQ7zJ8OE10UOs1E8TIZmF9kbBTdsJEfARKyR5W/c8jggK3GOJHQ6 6fqvztfcGZvavq+eBxyE88zMEWy/SH7OE+mwo/lDb5kivN3y/UjR3vf5Qix/VQPyNxI/ WcfVvRkfsG+1BwDCwERBgksV9Jx3Qqp9soGGKrR4t6CoClJ0piv2VoBpj+YPiFWmfndE Oqr8BFOlx3mL3nWrtoZefpNhggGg3brrxOyqtPJOay268KJcG/FpjzhJifE219r3vQOk HOIS14k6CIxRa/qBXjxcQtTe05FiWzqMs3MqmN1R7dMaVtNnhM65+mjAnzSPuklF12pT j/3w== X-Gm-Message-State: AElRT7HloYCjOIeU2+LxafiIlnbBsmlpVIrDKzyMkP+psJoBYyVwVeez wXfgO9Sye35uBWU02xK8YK/q7owY06KepWWQCJM= X-Google-Smtp-Source: AIpwx4/fDV/49EwwopzuowPibZ+JJZOWKv34xfsjZuRkb7AEd+nwhEJXA6ftkMfmvEwwcuKPJj2XwXdHb+iNcwIF1EQ= X-Received: by 2002:a19:c4c8:: with SMTP id u191-v6mr6309415lff.109.1522347208377; Thu, 29 Mar 2018 11:13:28 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a19:198d:0:0:0:0:0 with HTTP; Thu, 29 Mar 2018 11:13:27 -0700 (PDT) In-Reply-To: References: From: David Scott Date: Thu, 29 Mar 2018 19:13:27 +0100 Message-ID: To: Hans Ole Rafaelsen Cc: caml-list@inria.fr Content-Type: multipart/alternative; boundary="000000000000948d3305689114ee" Subject: Re: [Caml-list] Create a deployable application unit from OPAM? Reply-To: David Scott X-Loop: caml-list@inria.fr X-Sequence: 16757 Errors-to: caml-list-owner@inria.fr Precedence: list Precedence: bulk Sender: caml-list-request@inria.fr X-no-archive: yes List-Id: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --000000000000948d3305689114ee Content-Type: text/plain; charset="UTF-8" Hi, I had a quick go at creating something with Docker: (and alpine since I was more familiar with it, but I suspect a similar technique would work with ubuntu) https://github.com/djs55/experiments/pull/1 It uses `opam` to build a simple OCaml example (taken from cryptokit) which needs `libgmp` at runtime. The `Dockerfile` has a slightly hacky attempt to detect the runtime dependency: opam depext -n cryptokit | grep -v '#' | grep '\-dev' | while read in; do basename "$in" -dev; done > needed-packages.txt It assumes that - all external C libraries have an alpine depext called foo-dev - foo-dev has a corresponding runtime package called foo and installs these `foo` in an output minimal alpine image (i.e. one without the development tools or other unnecessary stuff) Another approach would be to use `ldd` or `objdump` recursively to find libraries and copy only those binaries into the output (possibly using `FROM scratch`?) I don't know if this will help -- I realise my test case is a bit minimal :-) Cheers, Dave On Thu, Mar 29, 2018 at 5:31 PM, Hans Ole Rafaelsen wrote: > Hi, > > I have small application written using Ocsigen. Ocaml and the rest of the > development environment is installed using OPAM. > > Now I want to install this application on a few other nodes, without > having to bring bring along the whole development process for deployment on > each node. What I want to end up with, is a single unit, e.g a tar-file, a > docker container or similar, that can be copied and deployed to the target > nodes. This unit should only contain the binaries needed to run the > application. > > I have tried to ask on the Ocsigen mailing-list how do do this for Ocsigen > applications, but without success. But I guess the problem is more related > to how to deploy applications built using OPAM. I did not find any way to > do this with OPAM, but I might have missed something. I have tried to copy > all the binary files (.so, .cmxa .cmxs, etc) from the OPAM directory and > setting the environment variables to point the this new location, but > without much success. When starting ocsigenserver it was not able to solve > all symbols. Looking more into the problem, it looks like binaries such as > ocsigenserver has hard coded the location of the OPAM development > environment. Might be possible to override this using environment > variables, but I'm not sure how. So I gave up on this track. > > > Is there a way to generate such a deployable unit from OPAM development > environment? > > Do anyone have some tips / best practice on how to deploy applications > built using OPAM? > > (I'm developing and want to deploy on Ubuntu 16.04.) > > Regards, > > Hans Ole Rafaelsen > -- Dave Scott -- Caml-list mailing list. Subscription management and archives: https://sympa.inria.fr/sympa/arc/caml-list Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs --000000000000948d3305689114ee Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

I had a quick go at creating someth= ing with Docker: (and alpine since I was more familiar with it, but I suspe= ct a similar technique would work with ubuntu)


It uses `opam` to bu= ild a simple OCaml example (taken from cryptokit) which needs `libgmp` at r= untime. The `Dockerfile` has a slightly hacky attempt to detect the runtime= dependency:

opam depext -n cryptokit | grep -v &#= 39;#' | grep '\-dev' | while read in; do basename "$in&quo= t; -dev; done > needed-packages.txt

It assu= mes that

- all external C libraries have an a= lpine depext called foo-dev
- foo-dev has a corresponding runtime= package called foo

and installs these `foo`= in an output minimal alpine image (i.e. one without the development tools = or other unnecessary stuff)

Another approach would= be to use `ldd` or `objdump` recursively to find libraries and copy only t= hose binaries into the output (possibly using `FROM scratch`?)
I don't know if this will help -- I realise my test case i= s a bit minimal :-)

Cheers,
Dave


On Thu, Mar 29, 2018 at 5:31 PM, Hans Ole Rafaelsen <= ;hrafaelsen@gmail= .com> wrote:
Hi,

I have small application = written using Ocsigen. Ocaml and the rest of the development environment is= installed using OPAM.

Now I want to install this application = on a few other nodes, without having to bring bring along the whole develop= ment process for deployment on each node. What I want to end up with, is a = single unit, e.g a tar-file, a docker container or similar, that can be cop= ied and deployed to the target nodes. This unit should only contain the bin= aries needed to run the application.

I have tried to ask on th= e Ocsigen mailing-list how do do this for Ocsigen applications, but without= success. But I guess the problem is more related to how to deploy applicat= ions built using OPAM. I did not find any way to do this with OPAM, but I m= ight have missed something. I have tried to copy all the binary files (.so,= .cmxa .cmxs, etc) from the OPAM directory and setting the environment vari= ables to point the this new location, but without much success. When starti= ng ocsigenserver it was not able to solve all symbols. Looking more into th= e problem, it looks like binaries such as ocsigenserver has hard coded the = location of the OPAM development environment. Might be possible to override= this using environment variables, but I'm not sure how. So I gave up o= n this track.


Is there a way to generate such a deployable= unit from OPAM development environment?

Do anyone have some t= ips / best practice on how to deploy applications built using OPAM?

=
(I'm developing and want to deploy on Ubuntu 16.04.)

Regards,

Hans Ole Rafaelsen



--
Dave Scott
--000000000000948d3305689114ee--