This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>MAC - ECP basemap</title> | |
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"> | |
<link href="css/core_style.css" media="all" rel="stylesheet"> | |
<link rel="icon" href="/images/favicon.ico" /> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
# Create Docker image | |
docker build --tag='your_image' . | |
# Create Docker service, default to 0 containers, set environment variable appropriately | |
docker service create --name service_etl --replicas 0 --e "action=etl" your_image # Run ETL example | |
docker service create --name service_analysis --replicas 0 --e "action=analysis" your_image # Run analysis example | |
# Scale as much as your infrastructure will handle | |
docker service scale service_etl=300 | |
docker service scale service_analysis=300 |
This file contains hidden or 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
# VERY basic Dockerfile | |
FROM python:2.7 | |
ADD your_script.py /home/user/your_script.py # Add to container | |
CMD ["python", "-u", "/home/user/your_script.py"] # Run |
This file contains hidden or 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
#!/usr/local/bin/python | |
""" | |
Example Python script for parallel processing with Docker containers | |
""" | |
from os import environ | |
if __name__ == "__main__": | |
action = environ.get('action') # Will be passed in via Docker -e environment variable |
This file contains hidden or 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
# Start the container and mount a local volume so you can access the shapefiles | |
# In this instance I am mounting /gisdata to /gisdata in the container | |
docker run --name "postgis" -v /gisdata:/gisdata -p 25432:5432 -d -t kartoza/postgis | |
# Attach to running container | |
docker exec -i -t postgis /bin/bash | |
# Install postgis using postgis rather than postgresql-9.5-postgis-2.2 | |
apt-get install postgis |
This file contains hidden or 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
# Example is for a Python Flask app | |
# Assumes your project is structured as: | |
/project/Dockerfile | |
/project/app/... #Source code that you can edit | |
# Dockerfile snippet ----------------------------- | |
# Add /app as /webroot/app in the container | |
ADD ./app /webroot/app | |
# Commands to use Docker ----------------------------- |
This file contains hidden or 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
-- SELECT polygon centroid as latitude/longitude in PostGIS | |
SELECT | |
st_x(st_transform(ST_Centroid(the_geom),4326)) as lat, | |
st_y(st_transform(ST_Centroid(the_geom),4326)) as long | |
FROM table; |