DEV Community

Cover image for Embedded Elixir (without Nerves)

Embedded Elixir (without Nerves)

Lasse Skindstad Ebert on October 20, 2019

This story was originally posted by me on Medium on 2018-08-29, but moved here since I'm closing my Medium account. I love Nerves. Unfortunately I...
Collapse
 
exadra37 profile image
Paulo Renato • Edited

This is because most of the file system is read-only, because the gateway should not be able to get to a state where it can’t just reboot and everything is fine again.

Sounds like that the use of an almost read-only file system will also improve its security.

So only the /data dir is writable?

Collapse
 
lasseebert profile image
Lasse Skindstad Ebert • Edited

IMHO the greatest advantage of the write-only read-only filesystem on an embedded device is that a restart of the device is more likely to fix a bad state and make the device boot successfully.

Yes, on my specific device, the /data dir was already mounted as read-write.

Collapse
 
exadra37 profile image
Paulo Renato

I think you meant read-only instead write-only in your reply?

Thread Thread
 
lasseebert profile image
Lasse Skindstad Ebert

I did πŸ‘

Collapse
 
exadra37 profile image
Paulo Renato

HOME: Again, not specific to Erlang, but Erlang tries to save a cookie file in the home dir for some reason.

The reason for this cookie existence is to allow to run distributed Erlang/Elixir. So the cookie will be used to allow nodes to talk with each other.

You can read more here, where at some point you will read:

First of all, you need to ensure all machines have a ~/.erlang.cookie file with exactly the same value.

Collapse
 
lasseebert profile image
Lasse Skindstad Ebert

Correct :)

You can also set the cookie on startup of the application with some command line argument or env var, which might prevent erlang from saving a generated cookie. I haven't tried this though.