Skip to content

Commit

Permalink
circle and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
normanrz committed Aug 7, 2018
1 parent 2ec375d commit fc66c8c
Show file tree
Hide file tree
Showing 3 changed files with 134 additions and 0 deletions.
74 changes: 74 additions & 0 deletions .circleci/config.yml
@@ -0,0 +1,74 @@
version: 2
jobs:
build:
machine: true
steps:
- checkout

- run:
name: Build docker container
command: docker build -t "normanrz/elevation-service:${CIRLCE_BUILD_NUM}" .

- run:
name: Run unit tests
command: |
docker run \
--rm \
"normanrz/elevation-service:${CIRLCE_BUILD_NUM}" \
yarn test
- run:
name: Run S3 tests
command: |
docker run \
--rm \
-d \
-eTILE_SET_PATH=s3:// \
-p3000:3000 \
--name elevation \
"normanrz/elevation-service:${CIRLCE_BUILD_NUM}"
sleep 5
curl \
-d '[[51.3, 13.4], [51.4, 13.3]]' \
-XPOST \
-H 'Content-Type: application/json' \
http://localhost:3000
docker stop elevation
- run:
name: Run local tests
command: |
mkdir -p data/N51
aws s3 cp s3://elevation-tiles-prod/skadi/N51/N51E013.hgt.gz data/N51
docker run \
--rm \
-d \
-p3000:3000 \
--name elevation \
-v$(pwd)/data:/app/data \
"normanrz/elevation-service:${CIRLCE_BUILD_NUM}"
sleep 5
curl \
-d '[[51.3, 13.4], [51.4, 13.3]]' \
-XPOST \
-H 'Content-Type: application/json' \
http://localhost:3000
docker stop elevation
- run:
name: Push Docker images
command: |
echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin
docker tag \
"normanrz/elevation-service:${CIRLCE_BUILD_NUM}" \
"normanrz/elevation-service:${CIRLCE_BRANCH}"
docker push "normanrz/elevation-service:${CIRLCE_BUILD_NUM}"
docker push "normanrz/elevation-service:${CIRLCE_BRANCH}"
docker push "normanrz/elevation-service:latest"
if [ "${CIRCLE_BRANCH}" == "master" ]; then
docker tag \
"normanrz/elevation-service:${CIRLCE_BUILD_NUM}" \
"normanrz/elevation-service:latest"
docker push "normanrz/elevation-service:latest"
fi
docker logout
21 changes: 21 additions & 0 deletions License
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 Norman Rzepka

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
39 changes: 39 additions & 0 deletions README.md
@@ -0,0 +1,39 @@
# elevation-service

Elevation service that works with the [Terrain data provided on Amazon AWS S3](https://registry.opendata.aws/terrain-tiles/). You can either pre-download the data on your server (ca. 200 GB) or access directly on S3 (for minimal latency from `us-east-1` region).

Inspired by:

* https://github.com/perliedman/elevation-service
* https://github.com/perliedman/node-hgt

## API usage
The service has a very simple API. Just post your latitude-longitude pairs as a JSON array to the service and receive an array of elevations as response. Maximum post payload is by default 500 KB.

```bash
# > [[lat, lng], ...]
curl -d '[[51.3, 13.4], [51.4, 13.3]]' -XPOST -H 'Content-Type: application/json' http://localhost:3000
# < [ele, ...]
```

## Usage with pre-downloaded data

Download data (ca. 200 GB):
```bash
aws s3 cp --recursive s3://elevation-tiles-prod/skadi /path/to/data/folder
```

Run the docker container:
```bash
docker run --rm -v/path/to/data/folder:/app/data -p3000:3000 normanrz/elevation-service
```

## Usage with S3-hosted data

Run the docker container:
```bash
docker run --rm -eTILE_SET_PATH=s3:// -p3000:3000 normanrz/elevation-service
```

## License
MIT

0 comments on commit fc66c8c

Please sign in to comment.