This repository has been archived by the owner on Jun 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
vincentsarago
committed
Feb 6, 2018
0 parents
commit 9b440cb
Showing
15 changed files
with
824 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
.DS_Store | ||
.serverless/ | ||
wheel.zip | ||
custom.zip | ||
node_modules/ | ||
config.json | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
env/ | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*,cover | ||
.hypothesis/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
#Ipython Notebook | ||
.ipynb_checkpoints | ||
|
||
.*.swp | ||
|
||
.python-version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
FROM remotepixel/amazonlinux-gdal:latest | ||
|
||
# Install rio-tiler | ||
RUN pip3 install rio-tiler==1.0a.3 lambda_proxy==0.0.2 numexpr aws-sat-api==0.0.3 --no-binary numpy -t /tmp/vendored -U | ||
|
||
# Reduce Lambda package size to fit the 250Mb limit | ||
# Mostly based on https://github.com/jamesandersen/aws-machine-learning-demo | ||
RUN du -sh /tmp/vendored | ||
|
||
# This is the list of available modules on AWS lambda Python 3 | ||
# ['boto3', 'botocore', 'docutils', 'jmespath', 'pip', 'python-dateutil', 's3transfer', 'setuptools', 'six'] | ||
RUN find /tmp/vendored -name "*-info" -type d -exec rm -rdf {} + | ||
RUN rm -rdf /tmp/vendored/boto3/ | ||
RUN rm -rdf /tmp/vendored/botocore/ | ||
RUN rm -rdf /tmp/vendored/docutils/ | ||
RUN rm -rdf /tmp/vendored/dateutil/ | ||
RUN rm -rdf /tmp/vendored/jmespath/ | ||
RUN rm -rdf /tmp/vendored/s3transfer/ | ||
RUN rm -rdf /tmp/vendored/numpy/doc/ | ||
|
||
# Leave module precompiles for faster Lambda startup | ||
RUN find /tmp/vendored -type f -name '*.pyc' | while read f; do n=$(echo $f | sed 's/__pycache__\///' | sed 's/.cpython-36//'); cp $f $n; done; | ||
RUN find /tmp/vendored -type d -a -name '__pycache__' -print0 | xargs -0 rm -rf | ||
RUN find /tmp/vendored -type f -a -name '*.py' -print0 | xargs -0 rm -f | ||
|
||
RUN du -sh /tmp/vendored | ||
|
||
COPY app /tmp/vendored/app | ||
|
||
################################################################################ | ||
# CREATE ARCHIVE # | ||
################################################################################ | ||
|
||
RUN cd /tmp/vendored && zip -r9q /tmp/package.zip * | ||
RUN cd $APP_DIR/local && zip -r9q --symlinks /tmp/package.zip lib/*.so* | ||
RUN cd $APP_DIR/local && zip -r9q /tmp/package.zip share | ||
|
||
# Cleanup | ||
RUN rm -rf /tmp/vendored/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Use the official amazonlinux AMI image | ||
FROM amazonlinux:latest | ||
|
||
# Install apt dependencies | ||
RUN yum install -y gcc gcc-c++ freetype-devel yum-utils findutils openssl-devel | ||
|
||
RUN yum -y groupinstall development | ||
|
||
RUN curl https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tar.xz | tar -xJ \ | ||
&& cd Python-3.6.1 \ | ||
&& ./configure --prefix=/usr/local --enable-shared \ | ||
&& make \ | ||
&& make install \ | ||
&& cd .. \ | ||
&& rm -rf Python-3.6.1 | ||
|
||
ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH | ||
|
||
# Install Python dependencies | ||
RUN pip3 install rio-tiler==1.0a.3 lambda_proxy==0.0.2 aws-sat-api==0.0.3 --no-binary numpy -t /tmp/vendored -U | ||
|
||
# Reduce Lambda package size to fit the 250Mb limit | ||
# Mostly based on https://github.com/jamesandersen/aws-machine-learning-demo | ||
RUN du -sh /tmp/vendored | ||
|
||
# This is the list of available modules on AWS lambda Python 3 | ||
# ['boto3', 'botocore', 'docutils', 'jmespath', 'pip', 'python-dateutil', 's3transfer', 'setuptools', 'six'] | ||
RUN find /tmp/vendored -name "*-info" -type d -exec rm -rdf {} + | ||
RUN rm -rdf /tmp/vendored/boto3/ | ||
RUN rm -rdf /tmp/vendored/botocore/ | ||
RUN rm -rdf /tmp/vendored/docutils/ | ||
RUN rm -rdf /tmp/vendored/dateutil/ | ||
RUN rm -rdf /tmp/vendored/jmespath/ | ||
RUN rm -rdf /tmp/vendored/s3transfer/ | ||
RUN rm -rdf /tmp/vendored/numpy/doc/ | ||
|
||
# Leave module precompiles for faster Lambda startup | ||
RUN find /tmp/vendored -type f -name '*.pyc' | while read f; do n=$(echo $f | sed 's/__pycache__\///' | sed 's/.cpython-36//'); cp $f $n; done; | ||
RUN find /tmp/vendored -type d -a -name '__pycache__' -print0 | xargs -0 rm -rf | ||
RUN find /tmp/vendored -type f -a -name '*.py' -print0 | xargs -0 rm -f | ||
|
||
RUN du -sh /tmp/vendored | ||
|
||
COPY app /tmp/vendored/app | ||
|
||
# Create archive | ||
RUN cd /tmp/vendored && zip -r9q /tmp/package.zip * | ||
|
||
# Cleanup | ||
RUN rm -rf /tmp/vendored/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
BSD 3-Clause License | ||
|
||
Copyright (c) 2018, RemotePixel.ca | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
* Neither the name of the copyright holder nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
SHELL = /bin/bash | ||
|
||
wheel: | ||
docker build -f Dockerfiles/wheel --tag lambda:latest . | ||
docker run -w /var/task/ --name lambda -itd lambda:latest | ||
docker cp lambda:/tmp/package.zip wheel.zip | ||
docker stop lambda | ||
docker rm lambda | ||
|
||
custom: | ||
docker build -f Dockerfiles/custom --tag lambda:latest . | ||
docker run -w /var/task/ --name lambda -itd lambda:latest | ||
docker cp lambda:/tmp/package.zip custom.zip | ||
docker stop lambda | ||
docker rm lambda | ||
|
||
|
||
deploy: | ||
sls deploy --sat cbers | ||
sls deploy --sat landsat | ||
sls deploy --sat sentinel | ||
|
||
clean: | ||
docker stop lambda | ||
docker rm lambda |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# remotepixel-tiler | ||
Sentinel / Landsat / CBERS serverless tile server | ||
|
||
Bundle of `landsat-tiler`, `sentinel-tiler` and `cbers-tiler` powering RemotePixel [viewer](https://viewer.remotepixel.ca). | ||
|
||
![viewer](https://user-images.githubusercontent.com/10407788/34139036-873c23e2-e440-11e7-9699-a2da6046a494.jpg) | ||
|
||
# Features | ||
While the lambda function are the same is found in the original repo (landsat-tiler ...) I haded two features: | ||
- Alarms: get mail notifcation when something is not right | ||
- Token: pseudo secure endpoint using user defined Token | ||
|
||
# Installation | ||
|
||
##### Requirement | ||
- AWS Account | ||
- Docker | ||
- node + npm | ||
|
||
##### Configuration | ||
|
||
```bash | ||
#Clone the repo | ||
git clone https://github.com/RemotePixel/remotepixel-tiler.git | ||
cd remotepixel-tiler/ | ||
|
||
# set Token and Email | ||
vi config.json | ||
{"token": "this is a token I defined", "mail": "[email protected]"} | ||
|
||
# Fetch Amazon linux AMI docker container + Install Python modules + create package | ||
# Create package using rasterio wheel | ||
make wheel | ||
|
||
# Create package using custom GDAL install | ||
make custom | ||
|
||
# Deploy sentinel, landsat and cbers lambda functions | ||
make deploy | ||
``` | ||
|
||
|
||
|
||
#### Infos & links | ||
- [rio-tiler](https://github.com/mapbox/rio-tiler) rasterio plugin that process Landsat data hosted on AWS S3. | ||
- [landsat-tiler](https://github.com/mapbox/landsat-tiler) | ||
- [sentinel-tiler](https://github.com/mapbox/sentinel-tiler) | ||
- [cbers-tiler](https://github.com/mapbox/cbers-tiler) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# app | ||
|
||
__version__ = '2.0.0' |
Oops, something went wrong.