*Roberto: *my responses below!

*Everyone else: *Roberto has very kindly done some modifications to uwsgi to
get things moving. See below comments for more info :)

On Sun, Jul 10, 2011 at 6:57 PM, Roberto De Ioris <robe...@unbit.it> wrote:

>
> >>
> >
> > I'll pull the most recent code tomorrow, and have a play around :) Will
> > let
> > you know how far I get. I'm quite excited now :D
> >
> >
>
> Ok, i have extremely improved it:
>
> - a new parameters in buildconf is available
>
> embed_files =
>
> you can use it to attach all the files you want to the uwsgi binary.
>
> Example:
>
> embed_files = embedme.py,uwsgidecorators.py,uWSGI_logo.png
>
> (i suppose you are editing default.ini, so launch make)
>
> now you have your binary with a new group of symbols:
>
> # objdump -t uwsgi
>
> (if you do not know, objdump will print the information about a binary)
>
> The output will list all of the uWSGI functions plus 3 symbols for each
> embedded file:
>
> 08095378 g       .data  00000000              _binary_embedme_py_start
> 0809547d g       .data  00000000              _binary_embedme_py_end
> 0809547d g       .data  00000000
>  _binary_uwsgidecorators_py_start
> 0000118d g       *ABS*  00000000
>  _binary_uwsgidecorators_py_size
> 00000105 g       *ABS*  00000000              _binary_embedme_py_size
> 0809660a g       .data  00000000
>  _binary_uwsgidecorators_py_end
>

Nice, didn't know about that tool.


>
> (here i have embedded empedme.py and uwsgidecorators.py)
>
> As you see the name of the symbols is the name of the file (with dot
> replaced by _ ) prefixed with _binary_ and suffixed with _start/_end/_size
>

I assume _start / _end / _size are references to the address space (within
the binary) where these embedded binaries (in symbol form) are kept??

Is there any sort of restrictions on maximum allowed symbol size? (looked on
Google, but couldn't find anything)


>
> Now you can reference this data with all the uWSGI options taking file/path
>
> ex:
>
> uwsgi --socket :3031 --import sym://embedme_py --import
> sym://uwsgidecorators_py
>
> or
>
> uwsgi --ini sym://myfile_ini
>

Really like the "sym://" protocol reference, that will make CLI usage very
easy.


> and so on
>
> But the most important thing is that you can reference them from python
> too:
>
>
> import uwsgi
>
>    1. print uwsgi.embedded_data('embedme_py')
>
>
Just had a look at http://projects.unbit.it/hg/uwsgi/rev/2cc21926d986, to
see how the embedded_data() extension works.. looks clean!


>
> I think all of the pieces are here, you now have to create a bootstrap.py
> script that will extend the import subsystem to take a whole zip blob
> (StringIO.StringIO(uwsgi.embedded_data('mydjangoapp_zip')) ), so that you
> can set the buildconf with
>
> embed_files = bootstrap.py,mydjangoapp.zip
> embed_config = myconfig.ini
>
> with myconfig.ini simply containing:
>
> [uwsgi]
> import = sym://bootstrap_py
> socket = :xxxx
> master = true
>

That looks pretty straight forward. The C code looks fairly simple to work
with too, so I might even be able to make some changes along the way.

I'll give this a real good thrashing tomorrow, and will let you know the
results.


> ....
>
> I hope it is clear, feel free to move the discussion to the uwsgi list
> (obviously introduce to the others guy what you are trying to accomplish)
>

Once I've played with this tomorrow, I'll type up a full report on what I
did to get it working, suggested improvements etc, so others can play with
it. I'll also forward this to the mailing list to keep everyone updated.

Great work on this!! :)


>
> --
> Roberto De Ioris
> http://unbit.it
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to