On 26.03.2014 15:27, Aarni Koskela wrote:
You're correct in that *-attach-daemon definitely does not read sym:// links 
(at least as far as I could read the source in daemons.c).
Even if it did, there's difficulty in that any given daemon program can't read the sym:// 
syntax to read its config (consider "cat sym://myfile" -- doesn't make much 
sense).

I think the most generic solution to this problem would be a new configuration 
option/action, something like

extract-symbol=daemon_conf=placeholder_name
extract-symbol-to=daemon_conf=/tmp/foo

wherein the first option would extract a symbol to some temporary, randomly 
generated file (tmpnam or equivalent) and save its path into the given 
configuration placeholder,
and the second one obviously would extract the symbol to a concrete path 
(caveat configurator regarding multiple instances).

This way you could do

[uwsgi]
extract-symbol=daemon=daemon-bin
extract-symbol=daemon-conf=daemon-conf
smart-attach-daemon = /tmp/daemon.pid %(daemon-bin) -pid=/tmp/daemon.pid 
-conf=%(daemon-conf)

Feel free to shoot this idea down! :)

-Aarni

ps. I don't think sym:// is Linux specific; after all (afaicr) those just refer 
to ELF symbols, and FreeBSD uses ELF binary images too.


-----Original Message-----
From: [email protected] [mailto:[email protected]] On
Behalf Of Vladislav Manchev
Sent: 26. maaliskuuta 2014 15:13
To: uWSGI developers and users list
Subject: [uWSGI] Embedding files on FreeBSD

Hi guys,

I've been following the list in the last few years and just dug through it but
found no usable solution to my problem.

Basically my use case is this: I have a bunch of daemons that I want to embed
(embed_files) in uWSGI and start them with a predefined configuration
which is also embedded (embed_config). I already tried this on Linux with
this build config and intial configuration:

uwsgi/buildconf/daemons.ini
[uwsgi]
bin_name = daemons
plugin_dir = .
embed_files = daemon,daemon2,daemon.conf embed_config =
daemons_config.ini

uwsgi/daemons_config.ini
[uwsgi]
socket = :3031
master = true
smart-attach-daemon = /tmp/daemon.pid sym://daemon -
pid=/tmp/daemon.pid -conf=sym://daemon_conf

It more or less works (or at least reads the embedded configuration)
although I think uWSGI does not parse the sym:// links in smart-attach-
daemon option.

I found an old email on the mailing list about section:// and data://
embedding, but as far as I can tell section:// embedding is Linux specific
(sym:// seems to be too) and there's not too much information about data://
embedding either.

So, is there any way to run a uWSGI binary with a bunch of embedded
binaries and a configuration like the one above on FreeBSD?


Best,
Vladislav
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
Thanks for the input Aarni! The solution you outlined seems good enough to me although I was thinking more along the lines of using the embedded binaries directly from memory if there happens to be an easy way to do it/implement it.

Otherwise, you're absolutely right that FreeBSD uses ELF so I'm a bit puzzled why embedding doesn't work for me. If anyone can confirm/disprove this I'll be grateful.

Roberto, it would be great to get some input from you when you've got a minute on how hard it would be to implement a solution similar to what Aarni outlined above.


Best,
Vladislav
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to