Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve support for running in read-only environments #670

Open
lasseebert opened this issue May 20, 2019 · 4 comments
Open

Improve support for running in read-only environments #670

lasseebert opened this issue May 20, 2019 · 4 comments
Labels
deployment:scripts Anything to do with the management scripts fixed:pre-release An issue which has been addressed and is in pre-release phase

Comments

@lasseebert
Copy link

Steps to reproduce

  • Use Distillery 2.0.13 or 2.0.14
  • Deploy to read-only filesystem (embedded linux box)

Try to start app with e.g. (note that /data is read-write)

HOME=/data/balrog/ RELEASE_MUTABLE_DIR=/data/balrog/ /balrog/bin/balrog foreground

Verbose Logs (Logs from embedded box)

sh: /balrog/releases/0.2.3/libexec/erts.sh: line 306: /balrog/releases/start_erl.data: Read-only file system

Description of issue

This works fine on Distillery 2.0.12, but fails with the Read-only filesystem message on 2.0.13 and 2.0.14.

The app is deployed to a read-only dir, but I point to a read-write dir for the $RELEASE_MUTABLE_DIR.

Downgrading to Distillery 2.0.12 made it work again.

Details:

  • What OS, Erlang/Elixir versions are you seeing this issue on?
    Linux (embedded, ARM), Erlang 21.1, Elixir 1.8.2

  • If possible, also provide your rel/config.exs, as it is often
    my first troubleshooting question, and you'll save us both time :)

# rel/config.exs

# Import all plugins from `rel/plugins`
# They can then be used by adding `plugin MyPlugin` to
# either an environment, or release definition, where
# `MyPlugin` is the name of the plugin module.
~w(rel plugins *.exs)
|> Path.join()
|> Path.wildcard()
|> Enum.map(&Code.eval_file(&1))

use Mix.Releases.Config,
    # This sets the default release built by `mix release`
    default_release: :default,
    # This sets the default environment used by `mix release`
    default_environment: Mix.env()

# For a full list of config options for both releases
# and environments, visit https://hexdocs.pm/distillery/config/distillery.html


# You may define one or more environments in this file,
# an environment's settings will override those of a release
# when building in that environment, this combination of release
# and environment configuration is called a profile

environment :dev do
  set cookie: :"SECRET"
end

environment :stag do
  set cookie: :"SECRET"
end

environment :prod do
  set cookie: :"SECRET"
end

# You may define one or more releases in this file.
# If you have not set a default release, or selected one
# when running `mix release`, the first release in the file
# will be used by default

release :balrog do
  set version: current_version(:balrog)
  set include_erts: false
  set include_src: false
end

I will try to dig deeper into this tomorrow.

@bitwalker
Copy link
Owner

There hasn't been any change in behavior with regard to start_erl.data in a very long time - 2.0.12 would have failed at the same location as 2.0.14/2.0.x/master - it has not been supported to run Distillery on an entirely read-only system when not including ERTS (i.e. using host ERTS) in a long time, as Distillery's scripts have to detect the system ERTS, and write start_erl.data so the release can be booted.

But this issue got me wondering if start_erl.data could be moved to the mutable directory, and it turns out it can! So I've made that change in the 2.0.x branch. Would you be willing to test that branch in your environment and verify that it works as expected? My local testing looks good, but I would like to test in a "real" environment as well.

@bitwalker bitwalker changed the title Unable to run on Read-only after 2.0.13 Improve support for running in read-only environments May 20, 2019
@bitwalker bitwalker added deployment:scripts Anything to do with the management scripts fixed:pre-release An issue which has been addressed and is in pre-release phase labels May 20, 2019
@lasseebert
Copy link
Author

@bitwalker That sounds amazing. I will make a test as soon as possible.

For the record: My setup works fine with distillery 2.0.12 (deployed to multiple production units).

@lasseebert
Copy link
Author

@bitwalker It works with the 2.0.x branch 🎉

Only difference in my project from 2.0.12 is that I have to create the $RELEASE_MUTABLE_DIR before starting the application (which makes sense, but I didn't do that before and it was created for me).

@bitwalker
Copy link
Owner

I'll publish 2.0.15 soon from that branch then!. It's expected that $RELEASE_MUTABLE_DIR exists, so even if the behavior before was that it took care of it, that was not intended. Thanks for reporting back so quickly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployment:scripts Anything to do with the management scripts fixed:pre-release An issue which has been addressed and is in pre-release phase
Projects
None yet
Development

No branches or pull requests

2 participants