Search code examples
deploymentengineyardnmatrix

Doing git pull in Engine Yard


I am deploying my rails app to Engine Yard.

What i had so far: 1. created SSH hey 2. Install public key to Engine Yard app. 3. ssh [email protected]

I was put at home/deploy, which is not a right place to perform git pull.

The reason I need to deploy in this way, is because my app is using nmatrix gem, which need to be installed manually using c++ compiler. The automatic bundler got an error while fetching that gem, and stopped.

Update: I guess my question should be, how to install nmatrix to EngineYard. This is the error message I got from calling gem install nmatrix:

Building native extensions.  This could take a while...
ERROR:  Error installing nmatrix:
    ERROR: Failed to build gem native extension.

    /usr/bin/ruby21 extconf.rb
checking for main() in -llapack... no
checking for main() in -lcblas... yes
checking for main() in -latlas... no
checking for clapack.h... no
checking for cblas.h... yes
checking for cblas.h... yes
checking for clapack_dgetrf() in cblas.h,clapack.h... no
checking for clapack_dgetri() in cblas.h,clapack.h... no
checking for dgesvd_() in clapack.h... no
checking for cblas_dgemm() in cblas.h... yes
using C++ standard... c++0x
g++ reports version... Hardened
creating nmatrix_config.h
creating Makefile

make "DESTDIR="
compiling nmatrix.cpp
In file included from nmatrix.cpp:331:0:
ruby_nmatrix.c: In function ‘VALUE nm_mset(int, VALUE*, VALUE)’:
ruby_nmatrix.c:1378:108: warning: format ‘%u’ expects type ‘unsigned int’, but argument 4 has type ‘size_t’
ruby_nmatrix.c: In function ‘VALUE nm_xslice(int, VALUE*, void* (*)(const STORAGE*, SLICE*), void (*)(NMATRIX*), VALUE)’:
ruby_nmatrix.c:1556:91: warning: format ‘%u’ expects type ‘unsigned int’, but argument 4 has type ‘size_t’
ruby_nmatrix.c: In function ‘SLICE* get_slice(size_t, int, VALUE*, size_t*)’:
ruby_nmatrix.c:1903:104: warning: format ‘%u’ expects type ‘unsigned int’, but argument 3 has type ‘size_t’
ruby_nmatrix.c:1903:104: warning: format ‘%u’ expects type ‘unsigned int’, but argument 4 has type ‘size_t’
compiling ruby_constants.cpp
compiling data/data.cpp
compiling util/io.cpp
compiling math.cpp
In file included from math.cpp:140:0:
math/rot.h: In function ‘void nm::math::rot(int, DType*, int, DType*, int, CSDType, CSDType) [with DType = nm::Complex<float>, CSDType = float]’:
math/rot.h:123:40: error: ‘cblas_csrot’ was not declared in this scope
math/rot.h: In function ‘void nm::math::rot(int, DType*, int, DType*, int, CSDType, CSDType) [with DType = nm::Complex<double>, CSDType = double]’:
math/rot.h:128:40: error: ‘cblas_zdrot’ was not declared in this scope
In file included from math.cpp:141:0:
math/rotg.h: In function ‘void nm::math::rotg(DType*, DType*, DType*, DType*) [with DType = nm::Complex<float>]’:
math/rotg.h:99:125: error: ‘cblas_crotg’ was not declared in this scope
math/rotg.h: In function ‘void nm::math::rotg(DType*, DType*, DType*, DType*) [with DType = nm::Complex<double>]’:
math/rotg.h:104:125: error: ‘cblas_zrotg’ was not declared in this scope
make: *** [math.o] Error 1


Gem files will remain installed in /home/deploy/.gem/ruby/2.1.0/gems/nmatrix-0.0.9 for inspection.
Results logged to /home/deploy/.gem/ruby/2.1.0/gems/nmatrix-0.0.9/ext/nmatrix/gem_make.out

One of the prerequisite to install nmatrix is to have gcc > v4.7, but EngineYard is having v4.5.4 only. Anyone know how to upgrade gcc? I think I am running Gentoo.


Solution

  • The question actually should include what you want to git pull.

    When you ssh in, you are put into /home/deploy which is your home directory.

    The Git copy of your app is located in /data/APPNAME/shared/cache-copy/ on the App Master

    You can have multiple apps on one instance and each one can have a different deploy key so you use a GIT_SSH wrapper

    GIT_SSH=/data/APPNAME/shared/config/pulse-ssh-wrapper git pull
    

    (in all the above commands remember to replace APPNAME with the name used for the app)

    If you want to find the actual location for a bundled gem, you can look in

    /data/APPNAME/shared/bundled_gems/ruby/2.0.0/gems (version will depend on Ruby ABI)

    if your Gemfile uses a :git remember that only a single deploy key can be used for both the app clone and bundle phase, you cannot select different keys per gem.

    Most likely the issue with installing the nmatrix gem is that the ATLAS libraries are not installed yet and those would be installed with the system's package manager (Portage for Gentoo and Apt-get for Ubuntu). You can add them via "Edit Unix Packages" on the UI, just select sci-libs/blas-atlas and sci-libs/lapack-atlas. Currently this will fail because the EC2 instances are Xeon processors and the libraries do not build on these yet.

    You can see the CPU type on your Linux instance with "cat /proc/cpuinfo" and will see something like

    model name  :Intel(R) Xeon(R) CPU E5-2650 0 @ 2.00GHz