{"id":1752,"date":"2017-11-22T17:24:57","date_gmt":"2017-11-22T16:24:57","guid":{"rendered":"https:\/\/blog.alwaysdata.com\/?p=1752"},"modified":"2020-04-17T15:17:24","modified_gmt":"2020-04-17T13:17:24","slug":"heberger-une-application-elixir-chez-alwaysdata","status":"publish","type":"post","link":"https:\/\/blog.alwaysdata.com\/fr\/2017\/11\/22\/heberger-une-application-elixir-chez-alwaysdata\/","title":{"rendered":"H\u00e9berger une application Elixir chez alwaysdata"},"content":{"rendered":"<p>Apr\u00e8s une pause dans notre s\u00e9rie \u00ab&nbsp;nouveaux langages&nbsp;\u00bb, nous vous pr\u00e9sentons aujourd\u2019hui <a href=\"https:\/\/elixir-lang.org\">Elixir<\/a>. Ce langage fonctionnel cr\u00e9\u00e9 en 2011 tourne sur la VM d\u2019<a href=\"http:\/\/www.erlang.org\/\">Erlang<\/a>, notamment connue pour ses capacit\u00e9s de tol\u00e9rance aux pannes ou de <a href=\"https:\/\/en.wikipedia.org\/wiki\/Hot_swapping#Software\"><em>hot swapping<\/em><\/a>.<\/p>\n<h3>Le cinqui\u00e8me langage majeur<\/h3>\n<p>Elixir est le cinqui\u00e8me langage \u00ab&nbsp;majeur&nbsp;\u00bb support\u00e9 chez alwaysdata. Nous avions r\u00e9cemment&nbsp;<a href=\"https:\/\/blog.alwaysdata.com\/fr\/2017\/09\/05\/heberger-une-application-node-js-chez-alwaysdata\/\">expliqu\u00e9 en d\u00e9tails<\/a>&nbsp;ce qu\u2019est un langage majeur, nous n\u2019y revenons donc pas ici. Pr\u00e9cisons donc simplement que nous proposons la derni\u00e8re version d\u2019Elixir (1.5.2), tournant sous Erlang&nbsp;19.2, et qu\u2019un nouveau type de site fait son apparition dans notre interface d\u2019administration.<\/p>\n<h3>Exemple&nbsp;: d\u00e9ployer une application Phoenix<\/h3>\n<p><a href=\"http:\/\/phoenixframework.org\/\">Phoenix<\/a>&nbsp;est l\u2019un des principaux frameworks web pour Elixir. C\u2019est donc celui que nous utiliserons dans notre exemple de d\u00e9ploiement.<\/p>\n<p>Connectons-nous \u00e0&nbsp;notre compte en SSH, puis installons Phoenix et cr\u00e9ons une nouvelle application&nbsp;:<\/p>\n<pre class=\"lang:sh decode:true\">$ mix local.hex \n$ mix local.rebar \n$ mix archive.install https:\/\/github.com\/phoenixframework\/archives\/raw\/master\/phx_new.ez \n$ mix phx.new myapp --no-brunch --no-ecto \n$ cd myapp<\/pre>\n<p>\u00c9ditons le fichier <em>config\/prod.exs<\/em> de mani\u00e8re \u00e0&nbsp;remplacer la&nbsp;ligne&nbsp;:<\/p>\n<pre class=\"lang:default decode:true\">  load_from_system_env: true,<\/pre>\n<p>par&nbsp;:<\/p>\n<pre class=\"lang:default decode:true  \"> &nbsp;http: [ \n &nbsp;&nbsp;&nbsp;ip: elem(:inet.parse_address(to_charlist(System.get_env(\"IP\"))), 1), \n &nbsp;&nbsp;&nbsp;port: System.get_env(\"PORT\") \n &nbsp;],<\/pre>\n<p>Enfin, compilons l\u2019application&nbsp;:<\/p>\n<pre class=\"lang:sh decode:true\">$ MIX_ENV=prod mix compile\n$ MIX_ENV=prod mix phx.digest\n<\/pre>\n<p>Derni\u00e8re \u00e9tape, allons dans l\u2019administration alwaysdata puis cr\u00e9ons un site de type&nbsp;<em>Elixir<\/em>, en indiquant&nbsp;:<\/p>\n<ul>\n<li>commande&nbsp;: <em>mix phx.server<\/em><\/li>\n<li>r\u00e9pertoire de travail&nbsp;: <em>myapp<\/em><\/li>\n<li>environnement&nbsp;: <em>MIX_ENV=prod<br>\n<\/em><\/li>\n<\/ul>\n<p>Le tour est jou\u00e9, notre application est joignable par le web et affiche&nbsp;<em>Welcome to Phoenix&nbsp;!<br>\n<\/em><\/p>\n<p>Prochain langage qui aura droit \u00e0&nbsp;son billet de blog&nbsp;: <a href=\"https:\/\/java.com\/\">Java<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Apr\u00e8s une pause dans notre s\u00e9rie \u00ab&nbsp;nouveaux langages&nbsp;\u00bb, nous vous pr\u00e9sentons aujourd\u2019hui Elixir. Ce langage fonctionnel cr\u00e9\u00e9 en 2011 tourne sur la VM d\u2019Erlang, notamment \u2026 <a class=\"read-more\" href=\"https:\/\/blog.alwaysdata.com\/fr\/2017\/11\/22\/heberger-une-application-elixir-chez-alwaysdata\/\">Keep reading<\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"wp_typography_post_enhancements_disabled":false,"footnotes":""},"categories":[1],"tags":[107,118],"class_list":["post-1752","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-elixir","tag-languages"],"acf":[],"_links":{"self":[{"href":"https:\/\/blog.alwaysdata.com\/fr\/wp-json\/wp\/v2\/posts\/1752","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.alwaysdata.com\/fr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.alwaysdata.com\/fr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.alwaysdata.com\/fr\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.alwaysdata.com\/fr\/wp-json\/wp\/v2\/comments?post=1752"}],"version-history":[{"count":0,"href":"https:\/\/blog.alwaysdata.com\/fr\/wp-json\/wp\/v2\/posts\/1752\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.alwaysdata.com\/fr\/wp-json\/wp\/v2\/media?parent=1752"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.alwaysdata.com\/fr\/wp-json\/wp\/v2\/categories?post=1752"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.alwaysdata.com\/fr\/wp-json\/wp\/v2\/tags?post=1752"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}