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

Switch from EB to Zappa #45

Closed
ebridges opened this issue May 30, 2019 · 3 comments
Closed

Switch from EB to Zappa #45

ebridges opened this issue May 30, 2019 · 3 comments
Labels
enhancement New feature or request major

Comments

@ebridges
Copy link
Owner

Original report by Edward Bridges (Bitbucket: ebridges, GitHub: ebridges).


After deploying changes for organization of views of media by date I could not get the app to come up in Elastic Beanstalk. Troubleshooting was very frustrating (log access was clumsy and overly verbose, log messages were vague), and the ostensible error “`SECRET_KEY` not configured” was non-obvious on how to troubleshoot further.

After some research led to this Reddit thread that was very optimistic about Zappa. It has good traction in the community, has more uptake than AWS Chalice, and clear docs.

See Research multi-stage deployment envs.

@ebridges
Copy link
Owner Author

ebridges commented Jun 3, 2019

Original comment by Edward Bridges (Bitbucket: ebridges, GitHub: ebridges).


In order to build GDAL, we need to use a docker image designed to replicate the Lambda execution environment. Unfortunately was unable to get that to build, with the following errors noted:

----------------------------------------------------------------------

The GDAL python package has been installed in lib/python2.7/dist-packages
Please ensure to add lib/python2.7/dist-packages to your PYTHONPATH

----------------------------------------------------------------------
env PYTHONPATH=lib/python2.7/dist-packages${PYTHONPATH:+:$PYTHONPATH} \
        python setup.py install --single-version-externally-managed --record=record.txt --prefix=/usr --install-layout=deb
WARNING: numpy not available!  Array support will not be enabled
running install
error: unknown value for --install-layout
make[2]: *** [install] Error 1
make[2]: Leaving directory `/tmp/gdal-2.4.1/swig/python'
make[1]: *** [install] Error 2
make[1]: Leaving directory `/tmp/gdal-2.4.1/swig'
make: *** [install-actions] Error 2
  • Even though the application was built in a Python 3.6 venv, it seems to be only compatible with Python 2.7 based on the above errors.
gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/var/venv/include -I/usr/include/python3.6m -I. -I/usr/include -c extensions/gdal_wrap.cpp -o build/temp.linux-x86_64-3.6/extensions/gdal_wrap.o -std=c++11 -I/usr/include
    extensions/gdal_wrap.cpp: In function ‘OSRSpatialReferenceShadow* GDALDatasetShadow_GetSpatialRef(GDALDatasetShadow*)’:
    extensions/gdal_wrap.cpp:4672:54: error: ‘GDALGetSpatialRef’ was not declared in this scope
         OGRSpatialReferenceH ref = GDALGetSpatialRef(self);
                                                          ^
    extensions/gdal_wrap.cpp: In function ‘void GDALDatasetShadow_SetSpatialRef(GDALDatasetShadow*, OSRSpatialReferenceShadow*)’:
    extensions/gdal_wrap.cpp:4681:57: error: ‘GDALSetSpatialRef’ was not declared in this scope
          GDALSetSpatialRef( self, (OGRSpatialReferenceH)srs );
                                                             ^
    extensions/gdal_wrap.cpp: In function ‘OSRSpatialReferenceShadow* GDALDatasetShadow_GetGCPSpatialRef(GDALDatasetShadow*)’:
    extensions/gdal_wrap.cpp:4722:57: error: ‘GDALGetGCPSpatialRef’ was not declared in this scope
         OGRSpatialReferenceH ref = GDALGetGCPSpatialRef(self);
                                                             ^
    extensions/gdal_wrap.cpp: In function ‘CPLErr GDALDatasetShadow_SetGCPs2(GDALDatasetShadow*, int, const GDAL_GCP*, OSRSpatialReferenceShadow*)’:
    extensions/gdal_wrap.cpp:4735:73: error: ‘GDALSetGCPs2’ was not declared in this scope
         return GDALSetGCPs2( self, nGCPs, pGCPs, (OGRSpatialReferenceH)hSRS );
                                                                             ^
    extensions/gdal_wrap.cpp:4736:3: warning: control reaches end of non-void function [-Wreturn-type]
       }
       ^
    error: command 'gcc' failed with exit status 1
    
    ----------------------------------------
Command "/var/venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-iaa7781w/GDAL/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-4u566o70/install-record.txt --single-version-externally-managed --compile --install-headers /var/venv/include/site/python3.6/GDAL" failed with error code 1 in /tmp/pip-install-iaa7781w/GDAL/

@ebridges
Copy link
Owner Author

ebridges commented Jun 3, 2019

Original comment by Edward Bridges (Bitbucket: ebridges, GitHub: ebridges).


Based on the above-noted issues compiling GDAL, I decided to drop the field in the media_item model that queries the PostGIS field in the database, thus allowing me to drop the dependency on: django.contrib.gis in INSTALLED_APPS

@ebridges
Copy link
Owner Author

ebridges commented Jun 9, 2019

Original comment by Edward Bridges (Bitbucket: ebridges, GitHub: ebridges).


update changelog, close #45

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request major
Projects
None yet
Development

No branches or pull requests

1 participant