I have a Python Serverless project that uses a private Git (on Github) repo.
Requirements.txt file looks like this:
itsdangerous==0.24
boto3>=1.7
git+ssh://[email protected]/company/repo.git#egg=my_alias
Configurations of the project mainly looks like this
plugins:
- serverless-python-requirements
- serverless-wsgi
custom:
wsgi:
app: app.app
packRequirements: false
pythonRequirements:
dockerizePip: true
dockerSsh: true
When I deploy using this command:
sls deploy --aws-profile my_id --stage dev --region eu-west-1
I get this error:
Command "git clone -q ssh://[email protected]/company/repo.git /tmp/pip-install-a0_8bh5a/my_alias" failed with error code 128 in None
What am I doing wrong? I'm suspecting either the way I configured my SSH key for Github access or the configurations of the serverless package.
With the growing popularity of Serverless Cloud Architecture, developers and organizations are creating and hosting applications that support this architecture. Python is the first choice for developing these applications as it is easy to use and houses huge library support.
Serverless will auto-detect and exclude development dependencies based on the runtime your service is using. This ensures that only the production relevant packages and modules are included in your zip file.
So the only way I managed to sort this issue was
serverless.yml
, I added the following: custom:
wsgi:
app: app.app
packRequirements: false
pythonRequirements:
dockerizePip: true
dockerSsh: true
dockerSshSymlink: ~/.ssh
Notice I added dockerSshSymlink
to report the location of the ssh files on my local machine; ~/.ssh
.
In requirements.txt
, I added my private dependency like this:
git+ssh://[email protected]/my_comp/my_repo.git#egg=MyRepo
All works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With