Start Elixir / Phoenix on your Android smartphone! … By the way, Ubuntu is the strongest container in the world (with precompiled Elixir installed)

This is piacere from Elixir Digitalization Implementors / fukuoka.ex / kokura.ex Thank you for visiting: bow:

After writing Column to move Elixir / Nerves with Raspberry Pi last night

"Maybe you can run Elixir on the same edge Android smartphone?"

I suddenly thought about it, and when I tried to capture it, I succeeded: confetti_ball:

This time, I will share that know-how (and it's light on the rust)

: ocean :: ocean :: ocean: Advent Calendar, fukuoka.ex 1st place, Elixir 2nd place ヽ (= ´ ▽ `=) ノ: ocean :: ocean :: ocean:

fukuoka.ex Advent Calendar, No. 1 in the Web Technology category ... Please read each column. https://qiita.com/advent-calendar/2020/fukuokaex image

And in the programming language category, 1st place is Rust, 2nd place is Elixir, 3rd place is Go and the top 3 in modern language matching, hot Ne: laughing: https://qiita.com/advent-calendar/2020/elixir image

Basic thinking patterns

Thinking patterns common to all of GCP, AWS, and Raspberry Pi

Elixir is easy to run on any platform that runs Ubuntu

Is the idea

This also applies to Android smartphones, and if Ubuntu runs on Android, the possibilities of Elixir will open up.

And the background to this is the Ubuntu version of Elixir installation description written on the Elixir official site (Please note that the information on the Japanese version site is old, so please be careful not to refer to it ... Please update soon ...)

https://elixir-lang.org/install.html image

If you have installed Elixir using this procedure on CentOS etc., you probably know this.

Linux other than Ubuntu does not include the latest version of Elixir (it's also quite old ...)

If it's an Ubuntu procedure, you'll definitely get the latest version with almost no time lag.

Also, the latest version of Elixir installation with source build including adsf is difficult to memorize commands in the first place, it is troublesome, and the introduction of build tools that makes the environment feel rough * is a luck, but with Ubuntu, You don't need them at all. * Note: If you like that, there is no reason to stop it.

By the way, with docker pull, you can unify the environment construction, but since it consumes memory, there is a part that spoils the light weight / low memory consumption of Elixir / Phoenix (when handling a large amount of access with Phoenix, even nginx is wasted. I'm a memory eater ...)

So, apart from services that are left to money and are not likely to grow, or services that have high growth potential and systems that handle mass access, Linux production including GCP and AWS When creating an environment, if you use Ubuntu without asking questions, you will not have any trouble and feel refreshed.

If you want to make scaling out easier, Kubernetes is OK

In short, what I want to say is

Ubuntu is the strongest container in the world

Let's go to ISS (International Space Station) revolving in outer space and thank Mark Shuttleworth for awakening to the creation of Ubuntu ... He brilliantly removed the seeds of our human headaches. Gave me image

If you're a Gachi sect who wants to unify the development and production environments and don't want to cry for version integrity later, switch to Ubuntu notes now (especially mix release) instead of using something similar and non-like like mac notes. And Distillery want to release a binary build (absolutely): wink:

How to run Ubuntu on an Android smartphone?

Zubari, a one-shot solution with an app called "UserLAnd"

UserLAnd https://play.google.com/store/apps/details?id=tech.ula&hl=ja&gl=US image

You can use Ubuntu on your Android smartphone just by searching for "User LAnd" on Google Play on your smartphone, installing it, and registering as a user.

After running Ubuntu on an Android smartphone?

First, install Elixir

It ’s an Android smartphone, but it ’s Ubuntu for free.

Do the official Elixir installation above ...

I'd like to say ... but I got moss when I installed esl-erlang.

$ sudo apt install esl-erlang
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package esl-erlang is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source   
E: Package 'esl-erlang' has no installation candidate

Well, be quiet here, let's put Erlang without esl

$ sudo apt install erlang

The actual machine that started erl looks like this (By the way, my smartphone is the smallest size in the world, which is one size larger than the Frisk size Raspberry Zero WH) image

Check the detailed version of Erlang

$ sudo apt show erlang
Package: erlang
Version: 1:20.2.2+dfsg-1ubuntu2
…

Hmm? Erlang 20.2.2?

… Isn't it possible to use Elixir 1.10 or later…

Release v1.10.0 · elixir-lang/elixir (Elixir 1.10 is for OTP 21 or later) https://github.com/elixir-lang/elixir/releases/tag/v1.10.0

Well, it's not a big difference, so give up early on the latest version that can be installed with apt, and download and install the latest precompiled binary of the Elixir 1.9 series.

Release v1.9.4 · elixir-lang/elixir https://github.com/elixir-lang/elixir/releases/tag/v1.9.4

$ mkdir elixir
$ cd elixir
$ sudo apt install wget unzip
$ wget https://github.com/elixir-lang/elixir/releases/download/v1.9.4/Precompiled.zip
$ unzip Precompiled.zip
$ sudo cp -a * /usr/local

Let's start iex

$ iex
Erlang/OTP 20 [erts-9.2] [source] [64-bit] [smp:8:6] [ds:8:6:10] [async-threads:10] 
[kernel-poll:false]
warning: the VM is running with native name encoding of latin1 which may cause Elixir to 
malfunction as it expects utf8. Please ensure your locale is set to UTF-8 (which can be 
verified by running "locale" in your shell)
Interactive Elixir (1.9.4) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)>

It started up safely, and I was able to confirm that Elixir 1.9.4 was installed.

The rest is the usual Elixir ... Enjoy it to your heart's content

Then install Phoenix

Phoneix 1.5.7 itself can be installed in this environment, but OTP 21 premise is included (cowboy 2.8) LiveView, there may be others), so put in the latest version of Phoneix 1.4 series that LiveView is not bound to, and create Phoenix PJ

$ mix archive.install hex phx_new 1.4.17
$ mix phx.new sample --no-ecto --no-webpack

Then fix the cowboy version to 2.7.0 (otherwise you'll get cowboy 2.8 on Phoneix 1.4.17)

mix.exs


…
  defp deps do
    [
      {:cowboy, "== 2.7.0"},
      {:phoenix, "~> 1.5.4"},
…

Then, before deps.get again, unlock the version with deps.unlock, deps.get and launch Phoenix.

$ mix deps.unlock --all
$ mix deps.get
$ mix phx.server

If you can do so far, you can see Phoenix on your Android smartphone on your PC or other smartphone browser. image

In addition, since it is highly possible that the global IP of the smartphone is blocked and cannot be seen, it can be seen from within the same wireless LAN segment by connecting to a wireless LAN etc.

Finally

Elixir / Phoenix has finally moved on my smartphone

With this, smartphones will join the ambition to make all edges / edge servers / clouds Elixir, and it will be possible to live an even more exciting Elixir life.

Also, even if you don't carry a laptop anymore, you can develop on the Web if you bring a smartphone (although it is difficult without a Bluetooth keyboard).

Digression

Continuation from the context of the opening "Let's go to Ubuntu notes now"

"I don't want to be told to you who are Elixir on Windows!"

…e? ... Yeah, well, that's right ...

Well, because I'm a hardcore believer with 38 years of experience, and Elixir's Windows version is a distribution (?) That always keeps the latest version beautiful, which is a match with Ubuntu, so it's not difficult.

In the first place, it's a de M play that "confronts the difficulties that Windows hits and overcomes everything", or even a clause that is burning with tied up play ...

… So what I mean is: information_desk_person_tone1:

image

p.s. If this column is interesting or useful ...

image.pngimage.png にて、どうぞ応援よろしくお願いします:bow:

Recommended Posts

Start Elixir / Phoenix on your Android smartphone! … By the way, Ubuntu is the strongest container in the world (with precompiled Elixir installed)
Time is wrong with the application launched on the Docker container