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

Binary dependencies? #23

Closed
triptec opened this issue Feb 4, 2019 · 5 comments
Closed

Binary dependencies? #23

triptec opened this issue Feb 4, 2019 · 5 comments

Comments

@triptec
Copy link

triptec commented Feb 4, 2019

Hello, I’ve been playing around with this plugin and I wonder if you got any idea for how to handle dependencies on dynamic libs? Just add the lib folder if it exist to every binary zip or perhaps something else? I’d like to hear your thoughts on the matter.
Thanks

@softprops
Copy link
Owner

Hi @triptec thanks for reaching out. Do you have a concrete example of what you're blocked on. I can think of a few ideas. Atm this plugin only bundles your rust binary into a deployment. I could add a hook to also include other binaries. Alternatively there's a newer feature of lambda that serverless exposes called layers which may be of interest

@triptec
Copy link
Author

triptec commented Feb 5, 2019

Well, I've been playing around with crates that depend on sys crates and those sys crates depend on c headers and dynamic libraries.
So my work flow right now is

  1. Create a aws linux docker image where I install/build the dependencies.
  2. Copy those .so files that I depend on to a lib dir
  3. Point out previous docker image in my serverless.yml so that my project builds
  4. Then include the lib folder together with the binary in the zip stage

@softprops
Copy link
Owner

Thanks posting back.

I think I have some idea for how to make this happen. I'll try to turn those ideas into code next weekend.

I think this the fact that this plugin leverages the actual lambda runtime makes binaries will be deployed into actually enables some predicability useful approaches.

I can get a list of provided libs in the runtime using

 $ ldconfig -c -new -p

then in the lambda rust docker image I can get a list of link dependencies using

$ ldd {bin-name}

what I'd have to bundle into the zip is just whats missing from the runtime.

@triptec
Copy link
Author

triptec commented Feb 6, 2019

Yes that’s what I was playing with in my head as well. Though I think there would need to be a option like “include” or something that also would be added to the final zip. Like in my case there’s .gir files because of gobject-introspection though now that I think of it that might not be a dependency on those. I’ll have to look that up. Anyhow, thanks for taking the time making this, serverless and rust is neat on their own and even more together.

@softprops
Copy link
Owner

no doubt. thanks for reaching out. I'm always interested in seeing how people are using this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants