From owner-freebsd-erlang@freebsd.org Thu May 30 20:48:28 2019 Return-Path: Delivered-To: freebsd-erlang@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 41E4815AA866 for ; Thu, 30 May 2019 20:48:28 +0000 (UTC) (envelope-from joe@getsomewhere.net) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id B8D876D4AE for ; Thu, 30 May 2019 20:48:27 +0000 (UTC) (envelope-from joe@getsomewhere.net) Received: by mailman.ysv.freebsd.org (Postfix) id 745AB15AA865; Thu, 30 May 2019 20:48:27 +0000 (UTC) Delivered-To: erlang@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 51C0815AA864 for ; Thu, 30 May 2019 20:48:27 +0000 (UTC) (envelope-from joe@getsomewhere.net) Received: from prak.gameowls.com (prak.gameowls.com [IPv6:2001:19f0:5c00:950b:5400:ff:fe14:46b7]) by mx1.freebsd.org (Postfix) with ESMTP id B99966D4AD for ; Thu, 30 May 2019 20:48:26 +0000 (UTC) (envelope-from joe@getsomewhere.net) Received: from [IPv6:2606:7d80:2001:8701:3cc6:8ec9:bcea:9550] (unknown [IPv6:2606:7d80:2001:8701:3cc6:8ec9:bcea:9550]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by prak.gameowls.com (Postfix) with ESMTPSA id 541F318E56; Thu, 30 May 2019 15:48:25 -0500 (CDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.2 \(3445.102.3\)) Subject: Re: Deploying program on erlang runtime 21 From: Joe Love In-Reply-To: <36da7161-b304-4456-8027-d12eba2ac217@www.fastmail.com> Date: Thu, 30 May 2019 15:48:24 -0500 Cc: erlang@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <18BC9005-CDE4-43A8-8EC0-F4D7556E20EC@getsomewhere.net> References: <4259DD93-00E2-4EB6-A1C3-DC4CBCEDD34C@getsomewhere.net> <36da7161-b304-4456-8027-d12eba2ac217@www.fastmail.com> To: Dave Cottlehuber X-Mailer: Apple Mail (2.3445.102.3) X-BeenThere: freebsd-erlang@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Support of Erlang-related ports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 May 2019 20:48:28 -0000 > On May 30, 2019, at 7:50 AM, Dave Cottlehuber = wrote: >=20 > On Wed, 29 May 2019, at 20:31, Joe Love wrote: >> Hi, >>=20 >> I=E2=80=99ve been trying to wrap my head around creating my = Elixir-based=20 >> projects on my client workstations (which are not freebsd) and=20 >> deploying them to a FreeBSD server using the erlang-runtime-21 = package. >>=20 >> I think I=E2=80=99m a bit lost somewhere on it, and am hoping to get = some guidance here. >>=20 >> I=E2=80=99ve created my project on my mac. I=E2=80=99ve added = Distillery (per many=20 >> suggestions & guides). If I understand everything correctly, I = can=E2=80=99t=20 >> include ERTS, as that=E2=80=99s the part which is compiled based on = the host=20 >> OS. Therefore, I modified my Distillery config to not include ERTS = in=20 >> the production build, and then ran `mix release --env=3Dprod`. >>=20 >> I uploaded the resulting _build/dev/rel/myproject to the FreeBSD = server=20 >> which has erlang-runtime-21 on it. >> I set my path to include /usr/local/lib/erlang21/bin, added=20 >> ERTS_LIB_DIR =3D /usr/local/lib/erlang21/erts-10.3 and tried to run = it. =20 >> Apparently I have erts-10.1 on my machine and the server had = erts-10.3,=20 >> so it seems that that also needs to match. >>=20 >> So, given all of this, I remember being told that while the = lang/erlang=20 >> port was older, that I could always use the runtime ports, and things=20= >> would work. Can someone fill me in on how they're supposed to work? =20= >> It seems like things are more intricate regarding running = beam-vm-based=20 >> programs on a different machine than that you=E2=80=99re building it = on. >>=20 >> Thanks, >> -Joe >=20 > Hey Joe, >=20 > welcome. I deploy to FreeBSD with Elixir & distillery 2.0 without any = issues.=20 > The simple fix is to move off OSX to FreeBSD like I did and then this = problem > goes away ;-). >=20 > TLDR: build your releases on the same OS+package as your deploy = target. >=20 > If you unpack the .tar.gz that distillery creates, you'll see inside a = ./releases/ > folder. the RELEASES and *.rel and start_erl.data all specify explicit = versions > of runtime and related libraries. If your Mac-based OTP release is = *exactly* > the same as the FreeBSD one, *and* you have no NIFs, then it's = possible > to get this working. >=20 > IMHO getting cross-compilation etc sorted isn't worth it when you can > build in a jail anyway. I then create FreeBSD packages from the = distillery > release, and simply pkg-install those. >=20 > I'll write this up and post a link to it tomorrow on how to do this, = it's > too long to fit in an email. >=20 > details: >=20 > 1. always build releases on the same OS+arch+BEAM+packages as you > intend to deploy to. Cross-building is possible but surprisingly = tricky. > If the patch versions are different, stuff may not start. >=20 > erts (Erlang RunTime System) has different patch levels and point = releases. > The OTP 21 runtime on your Mac may not be the same one you're = deploying > to. >=20 > The FreeBSD ones have just this week been updated and moved to a much > easier-to-update system (thanks olgeni@ ) so we should be staying = pretty > up to date with official releases now. We have OTP21,22 and Elixir = 1.8.2 >=20 > Right now, that's 21.3.8.2 which has different modules from the = original > OTP 21.0 shipped months ago - > asn1, crypto, kernel, ssl, stdlib, & more have all evolved. Your mac > built release probably won't have the same modules on it, and the = release > is *very* specific about what it requires. >=20 > 2. if you have NIF modules (native C code) then this definitely won't = work > as the linked libraries aren't remotely compatible. >=20 > 3. Every time the lang/erlang-* port is updated, you'll need to = rebuild your > application (if you're not including erts). >=20 > A+ > Dave Hi Dave, Thanks for following up. I look forward to reading any sort of write-up = you might make on the subject, but I get the short answer: =E2=80=9CCompil= e it on FreeBSD.=E2=80=9D I know I=E2=80=99ve seen the emails on the mailing list regarding = updating lang/erlang to 21, so I=E2=80=99ll get my ports tree updated = and go from there. Thanks, -Joe