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 774DE1E6 for ; Thu, 29 Mar 2018 18:51:14 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.48,378,1517871600"; d="scan'208,217";a="320611960" Received: from sympa.inria.fr ([193.51.193.213]) by mail2-relais-roc.national.inria.fr with ESMTP; 29 Mar 2018 20:51:13 +0200 Received: by sympa.inria.fr (Postfix, from userid 20132) id 215BB82438; Thu, 29 Mar 2018 20:51:13 +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 0299C8239C for ; Thu, 29 Mar 2018 20:50:58 +0200 (CEST) Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=hrafaelsen@gmail.com; spf=Pass smtp.mailfrom=hrafaelsen@gmail.com; spf=None smtp.helo=postmaster@mail-oi0-f51.google.com IronPort-PHdr: =?us-ascii?q?9a23=3A8YSEDBM2BGOR7cXSsp4l6mtUPXoX/o7sNwtQ0KIM?= =?us-ascii?q?zox0Ivz+rarrMEGX3/hxlliBBdydt6ofzbKO+4nbGkU4qa6bt34DdJEeHzQksu?= =?us-ascii?q?4x2zIaPcieFEfgJ+TrZSFpVO5LVVti4m3peRMNQJW2aFLduGC94iAPERvjKwV1?= =?us-ascii?q?Ov71GonPhMiryuy+4ZLebxlGiTanfb9+MAi9oBnMuMURnYZsMLs6xAHTontPde?= =?us-ascii?q?RWxGdoKkyWkh3h+Mq+/4Nt/jpJtf45+MFOTav1f6IjTbxFFzsmKHw65NfqtRbY?= =?us-ascii?q?UwSC4GYXX3gMnRpJBwjF6wz6Xov0vyDnuOdxxDWWMMvrRr0vRz+s87lkRwPpiC?= =?us-ascii?q?cfNj427mfXitBrjKlGpB6tvgFzz5LIbI2QMvd1Y6HTcs4ARWdZXMlRWSxPDI2/?= =?us-ascii?q?YYUSEeQOIf1VoJPhq1YUtxayGRWgCeHpxzRVhnH2x6o60+E5HA/ExgMgGckOu2?= =?us-ascii?q?nNotXxKqgZTPy7w7PGzTrZcfxW3Sz955bOchs8pvyMXahwftDfyUY1CQzFik6Q?= =?us-ascii?q?ppLjPz6O2eQNtnKU7+tkVe61l2EnrARxryGpy8wxhIfJgYcVxUrF9SV/2Is1Kt?= =?us-ascii?q?y4SFJ7Yd65C5RcrT2VN4xzQs4kXmpmuz46x6UYtZKneCUG0pcqyh7FZ/CZboSF?= =?us-ascii?q?4QjvWeaMLTp+mXlrYqiwhwyo/kil0uD8Vte70FJNriddl9nDrHEN1xjK5siAS/?= =?us-ascii?q?tx4l6t2TiP2gzO8O1ELkc0la3UK54l3LE8jIYcsUPGHiPumUX2irGZdlk89+S2?= =?us-ascii?q?9+jqZq/qq5ycOoNulA3yL6cjlta/DOglKgQOWnKU+eW41L3t5035R7BKg+U2kq?= =?us-ascii?q?nDqp/aK94UqbC9Aw9OzIkj7Q2yDzij0NsCnHkHKEhJdw6Aj4jsI13OOuz3De+j?= =?us-ascii?q?g1Swlzdm3+zJMafkApXJN3TDlLbhfa1h60NH0woyzdVf54pOBb0bIfLzXFXxtN?= =?us-ascii?q?3CARMjPQy02bWvNNIo+ooAWG7HOaSeLL+a5USD4f4zZeWOTIAQsTf5bfMi4qi9?= =?us-ascii?q?o2U+nAo9dK+ylbwTZTiCF/pvLkGCbHyk1tcbGGkDsw4lQerCh1iLUDoVbHG3Cf?= =?us-ascii?q?FvrgonAZ6rWN+QDrumh6aMiWLiRsUPNzJ2T2uUGHKtTL2qHvIFaSacOMhky2VW?= =?us-ascii?q?Wr2oSotn3har5lajl+hXa9HM8yhdjqrNkcBv7rSKxx43/D1wSc+a1jPVFjwmri?= =?us-ascii?q?YzXzYzmZtHjwl9x1OEi/UqhvVZEZlU5qsMXFpjc5HbyON+Bpb5XQeTJto=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0B5AABrNL1ahjPaVdFeHAEBAQQBAQoBA?= =?us-ascii?q?YMXgQxvFRMKg1KBHYZjjQKBdHUajW2EZIF6CyOEYQKEEwcZBwEEMBgBAgEBAQE?= =?us-ascii?q?BAQEBARIBAQEICwsIKC+COCQBgkgBAQEDASMdARsSCwEDAQsGBQsNKgICIQEBE?= =?us-ascii?q?QEFARwGE4R0AQMNCA+hcTyLBYF/BQEXgm8Fg0gKGSYNVVeCIgIBBRKHTIFUP4E?= =?us-ascii?q?MglAGLoJPQgKCCYJTglQClwcsCIVRhV+CfIEvhi+EVIkUO4YcDwMegQQcXoEsM?= =?us-ascii?q?xojTzGCEoFwJAwOCXoBCI0VPTCOdwEB?= X-IPAS-Result: =?us-ascii?q?A0B5AABrNL1ahjPaVdFeHAEBAQQBAQoBAYMXgQxvFRMKg1K?= =?us-ascii?q?BHYZjjQKBdHUajW2EZIF6CyOEYQKEEwcZBwEEMBgBAgEBAQEBAQEBARIBAQEIC?= =?us-ascii?q?wsIKC+COCQBgkgBAQEDASMdARsSCwEDAQsGBQsNKgICIQEBEQEFARwGE4R0AQM?= =?us-ascii?q?NCA+hcTyLBYF/BQEXgm8Fg0gKGSYNVVeCIgIBBRKHTIFUP4EMglAGLoJPQgKCC?= =?us-ascii?q?YJTglQClwcsCIVRhV+CfIEvhi+EVIkUO4YcDwMegQQcXoEsMxojTzGCEoFwJAw?= =?us-ascii?q?OCXoBCI0VPTCOdwEB?= X-IronPort-AV: E=Sophos;i="5.48,378,1517871600"; d="scan'208,217";a="320611851" Received: from mail-oi0-f51.google.com ([209.85.218.51]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 29 Mar 2018 20:50:56 +0200 Received: by mail-oi0-f51.google.com with SMTP id j143-v6so6009488oih.11 for ; Thu, 29 Mar 2018 11:50:56 -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=ZjXzGb3jACb5UkkmAHyKT8U1PalksSunsSf9FzJy6Sg=; b=pzSyAkeHNF2yx2SZzrW5LELr2A3D+FOwU5bH4HYBjyrCrJ8qYSYP7k+l8FmvGTQi5t WC+2BLz2gDVpJhz5s9+ZNfrK5XLjfCHURYVh8S1g4loRqUOX+MZdnXFYdFbCGFzxoESS W48Q7vqXhhwzEozYPaQj1vVo9l9eN/RY3RLOmp2OEpZQfqKvssJcXvvA1fbeM86ccnN3 f3WdV/eTN6KrHsw++Wb4UV6aXfxSVACBC6O1r+Q5t/5mAsv5d6/CACu+jbT7aK9VFQgL 8q+OK6ZkPjB89z2IXzNgmBrdbPGyomhnYiA4vyoWfUeYNUseSANzwEgmmZi1A4ZZF7I0 U9AQ== 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=ZjXzGb3jACb5UkkmAHyKT8U1PalksSunsSf9FzJy6Sg=; b=TUl9TztzHQFTjLHIsMIo6vvMdkesIAogPNB/rGrI7JsJosWuzmEkjB5fG2yMlfvJJQ tWirwJKDNF2OF57GRYy6ghd7OtAz3/caXe/bhL00LYYWUGnsnitT91/v8KMPQN+masSu UFurzYU6rUCUdYF1mbhv3z5mLnemqOgQ5YpiEhPExQYhw+gpYELzEGTnuiqcsou0AzrD cFHfLpEpAogWvAeWXhC/a/7otOJuH6SEA48XNdyP3sy7U4MIrrS4q+FkVYLmFMhoxUjV 4eyHacuym5Ms9JXR6yLtv6JM4el/DMJUEgLeGW8hn3YAwLzgJOrLkjy8tC2CL6yCaIQl HKsg== X-Gm-Message-State: ALQs6tC5zlwUf1MtD3EousRcYqjRyo+v6knVz1ZW3LN83arMBehRR6sl XFYUP0ob8aly/lC7/xMe9gwfHJSOUfyXEb117dD5Cg== X-Google-Smtp-Source: AIpwx49hQuw9Bb7E4eisrXKoOc0VApyhlbL3+QtP/mjjdA//g+KHH/jaOjLy7agFvh8fShkyWR1OU/LDepCQmIH6As0= X-Received: by 10.202.82.82 with SMTP id g79mr5292418oib.83.1522349455358; Thu, 29 Mar 2018 11:50:55 -0700 (PDT) MIME-Version: 1.0 Received: by 10.74.203.2 with HTTP; Thu, 29 Mar 2018 11:50:34 -0700 (PDT) In-Reply-To: References: From: Hans Ole Rafaelsen Date: Thu, 29 Mar 2018 20:50:34 +0200 Message-ID: To: David Scott Cc: caml-list@inria.fr Content-Type: multipart/alternative; boundary="001a113d859082bf8f0568919a58" Subject: Re: [Caml-list] Create a deployable application unit from OPAM? Reply-To: Hans Ole Rafaelsen X-Loop: caml-list@inria.fr X-Sequence: 16758 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: --001a113d859082bf8f0568919a58 Content-Type: text/plain; charset="UTF-8" Hi David, It helps a bit. But my biggest problem is that the Ocaml application (main.exe in your example) has dependencies to other Ocaml libraries built using OPAM. I need to find a way to find those dependencies and make sure that the paths are resolved correctly once libraries have have been copied to the image. -- Hans Ole On Thu, Mar 29, 2018 at 8:13 PM, David Scott wrote: > 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 --001a113d859082bf8f0568919a58 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi David,

It helps a bit. But my bi= ggest problem is that the Ocaml application (main.exe in your example) has = dependencies to other Ocaml libraries built using OPAM. I need to find a wa= y to find those dependencies and make sure that the paths are resolved corr= ectly once libraries have have been copied to the image.

--
Hans Ole

On Thu, Mar 29, 2018 at 8:13 PM, David Scott <scott.dj@gmail.com&g= t; wrote:
Hi,
I had a quick go at creating something with Docker: (and al= pine since I was more familiar with it, but I suspect a similar technique w= ould work with ubuntu)


It uses `opam` to bui= ld a simple OCaml example (taken from cryptokit) which needs `libgmp` at ru= ntime. The `Dockerfile` has a slightly hacky attempt to detect the runtime = dependency:

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

It assum= es that

- all external C libraries have an al= pine 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 o= r other unnecessary stuff)

Another approach would = be to use `ldd` or `objdump` recursively to find libraries and copy only th= ose 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= <hrafaelsen@gmail.com> wrote:
Hi,

I h= ave small application written using Ocsigen. Ocaml and the rest of the deve= lopment environment is installed using OPAM.

Now I want to ins= tall this application on a few other nodes, without having to bring bring a= long 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 si= milar, that can be copied and deployed to the target nodes. This unit shoul= d only contain the binaries needed to run the application.

I h= ave tried to ask on the Ocsigen mailing-list how do do this for Ocsigen app= lications, 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 t= his 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 settin= g the environment variables to point the this new location, but without muc= h success. When starting ocsigenserver it was not able to solve all symbols= . Looking more into the problem, it looks like binaries such as ocsigenserv= er has hard coded the location of the OPAM development environment. Might b= e possible to override this using environment variables, but I'm not su= re how. So I gave up on this track.


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

Do anyone have some tips / best practice on how to deploy applications bui= lt using OPAM?

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

Regards,

Hans = Ole Rafaelsen



--
Dave Scott

--001a113d859082bf8f0568919a58--