Skip to content

Instantly share code, notes, and snippets.

View matt-baker's full-sized avatar

Matt Baker matt-baker

View GitHub Profile
@matt-baker
matt-baker / gist:4d30599eac73adf44d326e194791c5ff
Last active February 15, 2019 16:36
temp_ror_spills.html
<!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.
# 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
@matt-baker
matt-baker / Dockerfile
Last active December 15, 2016 02:51
Sample Dockerfile for parallel processing with Docker
# 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
#!/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
@matt-baker
matt-baker / gist:206ffbd5e17c88482b99930ac16ccf35
Last active July 19, 2016 23:06
Docker PostGIS workaround
# 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
@matt-baker
matt-baker / sample-docker-dev-commands
Last active August 29, 2015 14:25
Sample Docker development commands
# 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 -----------------------------
@matt-baker
matt-baker / select-centroid-polygon-as-latlong
Last active February 17, 2023 10:01
Select lat/long centroid from a polygon in PostGIS.
-- 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;