This is especially common when using libraries that use C extensions, but different build-time options can cause problems and errors.
Especially the character code ... In the observed range, CircleCI environment uses ʻUCS2, and Lambda (Amazon Linux) standard uses ʻUCS4
, so an error may occur.
I don't remember what kind of error it was because it was a time of trial and error, but I have experienced that the Python code that I put in my Ubuntu environment with pyenv
did not work on Lambda. ..
First, there is a method of installing and deploying the pypi library etc. in an environment independent with virtualenv on Amazon Linux. The easiest and most reliable. However, it is not good to set up one EC2 just for that purpose, and Jenkins etc. will be used, but the operation is also troublesome.
You can use this anywhere. However, it is troublesome to take care not to pollute the existing environment, and CI as a Service is thrown away every time, so it takes time to build each time it is deployed. There is a way to burn the image using a service that allows you to bring in a Docker image, but it feels a bit exaggerated.
This is my favorite this time. If you have rpm
, deb
, etc., which are built with the same options as Amazon Linux and provide an independent Python runtime, you can use them easily, quickly, and safely.
** So yes. I made. ** ** http://qiita.com/marcy-terui/items/9b3610bed4e5fcafd9b9 There are some options that I removed because I can't depend on some system global libraries, but there should be no problem because I didn't usually use them.
yum
① Add repository
echo "
[bintraybintray-willyworks-rpm]
name=bintray-willyworks-rpm
baseurl=https://dl.bintray.com/willyworks/rpm/centos/\$releaserver/\$basearch/
gpgcheck=0
enabled=1
" | sudo tee -a /etc/yum.repos.d/bintray-willyworks-rpm.repo
② Installation
sudo yum install lamvery
apt
① Add repository
echo "deb https://dl.bintray.com/willyworks/deb trusty main" | sudo tee -a /etc/apt/sources.list
② Installation
sudo apt-get update
sudo apt-get install install lamvery
The following execution binaries (scripts) are available under / opt / lamvery / bin
, so please use them by passing them through your PATH if necessary.
--Python 2.7.9 (as of March 18, 2016)
For reference, here is a description example when using it with CircleCI.
circle.yml
---
machine:
environment:
PATH: /opt/lamvery/bin:$PATH
dependencies:
pre:
- |
echo "deb https://dl.bintray.com/willyworks/deb trusty main" | sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo apt-get install lamvery
Using lamvery
inside virtualenv
makes it very easy to deploy Lambda for Python functions.
If you are interested, please refer to this as well. Of course, you can use it to use only Python.
About "Lamvery", a deployment and management tool for AWS Lambda http://qiita.com/marcy-terui/items/1617ab4e20e3339d1930
Lambda function deploy best practices with CircleCI + Lamvery http://qiita.com/marcy-terui/items/900b72efb38f9b26e8f0
That was the stemmer.
Recommended Posts