Coder Social home page Coder Social logo

Comments (5)

lau avatar lau commented on June 23, 2024

Yeah I actually have wanted a setting for that for a while. Basically something to use instead of priv.

Problem is, that it makes impossible to install release on immutable location(at least for a location themself), and configure the whole application to have it mutable data on another storage.

I'm not sure I understand what you mean by this. If data does not already exist, Tzdata will attempt to download it. Alternatively developers/admins can copy the existing .ets file to the defined dir before starting the app. Tzdata looks for the newest ets file and uses that.

from tzdata.

liveforeverx avatar liveforeverx commented on June 23, 2024

Sorry, if it was not understandable, I'll try to explain it in more details, the whole problem and confusion.

I'll try to show it on example( https://github.com/liveforeverx/test_app ). Most elixir software, running in production is using exrm under hood (self phoenix guideline have an section, how to run phoenix with exrm).

We can try to create the test_app and add exrm and tzdata to dependencies of our app.

Now, starting shell iex -S mix, we get it manually (Tzdata.DataLoader.download_new()) and what we see is:

test_app % ls
README.md  _build/    config/    deps/      lib/       mix.exs    mix.lock   priv/      test/

We get new priv directory in our app, now, I show the most confusion, that other can get:

test_app % mix release
rel/test_app/bin/test_app console
iex([email protected])1> Tzdata.DataLoader.download_new()

And after, we download it, that is the structure

ls
bin/            erts-7.0/       lib/            log/            priv/           releases/       running-config/

test_app/rel/test_app % find . -name "priv"
./lib/asn1-4.0/priv
./lib/crypto-3.6/priv
./lib/hackney-1.3.2/priv
./lib/test_app-0.0.1/priv
./lib/tzdata-0.5.4/priv
./priv

Every production release structure will be damaged with an priv directory on place, which is not means to be used for. That is a problem, with priv on CWD, which will simply creating on very different locations the priv directory.

Next problem is questionable, but good to think about(as I do not have answer for it). If we try for security reasons to split executable data location(where apps, beams are located) with mutable data locations(where for example database files located), which is requirement on most enterprise servers, which I know (May be I know, not so much).

If release directory shouldn't be changable, for example, if we make the whole rel/test_app directory immutable(read only), than the application can't download the tmp data and overwrite the tzdata.

That means 2 consequences:

  1. priv shouldn't contain mutable data
  2. mutable data location should be configure, too (that means, that to accept requirement of splitting executable and data locations, we need to save ets and tmp on configured locations, instead of locations, where executable is placed ).

Can follow me?

from tzdata.

lau avatar lau commented on June 23, 2024

Let's say there is a custom location for mutable tzdata files. For instance config :tzdata, :data_dir, "/var/tzdata" In this example /var/tzdata is writable by the release. Tzdata will then use that instead of the default priv dir. It can write files there. That's what I meant by having an alternative dir instead of priv. That should solve the problems, right?

from tzdata.

liveforeverx avatar liveforeverx commented on June 23, 2024

Yes

from tzdata.

lau avatar lau commented on June 23, 2024

@liveforeverx I have released a new version (0.5.5) where the data directory can be specified in a config file.

from tzdata.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.