Skip to content

Implement a prereqCmd option for installing system deps #103

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

Closed
wants to merge 3 commits into from

Conversation

dschep
Copy link
Contributor

@dschep dschep commented Nov 14, 2017

closes #101

Test this out and let me know if it fulfills your requirements @AndrewFarley

(install with npm i UnitedIncome/serverless-python-requirements@prereq-script)

@dschep
Copy link
Contributor Author

dschep commented Nov 14, 2017

However! Another approach I have considered in the past is building a serverless plugin just for installing system dependencies. Thoughts on that approach? (you'd just add serverless-aws-system-deps to your plugins and add an option under custom like: deps: [mysql-dev]. The only issue was that I wasn't sure what to grab or where to copy things after the system package is installed.

@AndrewFarley
Copy link
Contributor

@dschep Glanced at the files changed, looks great. Will try it out this evening and let you know. Cheers!

@AndrewFarley
Copy link
Contributor

Hey @dschep a quick check of this and it doesn't seem to run prereqCmd at all for me.

  pythonRequirements:
    dockerizePip: true
    invalidateCaches: false
    prereqCmd: bash -c "yum install mysql-devel && cp /usr/lib64/mysql/libmysqlclient.so.18.0.0 ./libmysqlclient.so.18"
    #    prereqCmd: ./install-mysql-client.sh

I tried both ways, inline shell and included file. I dropped some debug echoes into the prereqCmd.js and that function never gets executed. Am I missing something?

@dschep
Copy link
Contributor Author

dschep commented Nov 18, 2017

Hmm.. When you did an included file, how did you specify the name/path? In my test I used ./foobar (a relative path). I think that it has to be a path that node's child_process.Spawn can excecute. I'll add the shell option which might make the bash command work. I'll add a test for that too.

@AndrewFarley
Copy link
Contributor

AndrewFarley commented Nov 18, 2017

Well... the prereq command isn't even running at all for me, as I said I threw some quick debug console logs in there to show it. A good example to test against, it making sure that requirements.txt has "mysqlclient" in it, and that pip package compiles properly. Might want to add that to your test to be sure it works.

@dschep
Copy link
Contributor Author

dschep commented Nov 19, 2017

did you try again with the new commits?

@AndrewFarley
Copy link
Contributor

Yeah, still no go. I don't know if it's because I'm on OS-X, or perhaps using it dockerized?

@dschep
Copy link
Contributor Author

dschep commented Nov 19, 2017

mmm yeah, i'll have to test it dockerized.

@AndrewFarley
Copy link
Contributor

Yeah, sorry @dschep the whole point of this was for use while in dockerized pip mode. Otherwise, I would/could have just done some simple wrapper to install and some local system libraries. :) Hoping this can still happen one day soon though.

@Arsen00
Copy link

Arsen00 commented Jan 13, 2018

open

@@ -113,6 +113,16 @@ custom:
pythonBin: /opt/python3.6/bin/python
```

### Run Custom extra packaging scripts
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+### Run Custom extra packaging scripts

@dschep
Copy link
Contributor Author

dschep commented Jan 15, 2018

@Arsen00, What?

@cgrimal cgrimal mentioned this pull request Jan 17, 2018
@dschep dschep closed this in #128 Jan 18, 2018
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

Successfully merging this pull request may close these issues.

Need to install Python module that have system dependencies
3 participants