Skip to content

Instantly share code, notes, and snippets.

@jmorton
Last active June 8, 2016 15:47
Show Gist options
  • Save jmorton/3c527a0ee574555ea5639de7e47233c4 to your computer and use it in GitHub Desktop.
Save jmorton/3c527a0ee574555ea5639de7e47233c4 to your computer and use it in GitHub Desktop.
My LCMAP Setup Script [WIP]
## Preliminaries
apt-get install git curl
## Java
echo "Installing JDKs"
add-apt-repository ppa:webupd8team/java -y
apt-get update -qq
apt-get install oracle-java7-installer
apt-get install oracle-java8-installer
apt-get install openjdk-7-jdk -y -qq
update-java-alternatives -s java-1.7.0-openjdk-amd64
## Leiningen
echo "Installing lein"
cd ~/bin \
&& curl -O https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein \
&& chmod +x lein \
&& lein \
&& cd -
## GIS
add-apt-repository ppa:ubuntugis/ppa -y
apt-get update -qq
apt-get install libgdal-dev libgdal-java -y -qq
## Cassandra
mkdir ~/Projects/apache
cd ~/Projects/apache \
&& curl -O http://apache.claz.org/cassandra/2.1.14/apache-cassandra-2.1.14-bin.tar.gz \
&& tar -xvzf apache-cassandra-2.1.14-bin.tar.gz \
cd -
## Rabbit
apt-get install rabbitmq-server
## Docker
apt-get install apt-transport-https ca-certificates
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys F76221572C52609D
echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.sources.list
apt-get update
apt-get install linux-image-extra-$(uname -r)
apt-get install apparmor
apt-get install docker-engine
groupadd docker
usermod -aG docker $(whoami)
## Misc Tools
add-apt-repository ppa:webupd8team/y-ppa-manager -y
apt-get update -qq
apt-get install y-ppa-manager -y -qq
## Repositories
mkdir -p ~/Projects/lcmap \
&& cd ~/Projects/lcmap \
&& git clone [email protected]:USGS-EROS/lcmap-config.git \
&& git clone [email protected]:USGS-EROS/lcmap-logger.git \
&& git clone [email protected]:USGS-EROS/lcmap-rest.git \
&& git clone [email protected]:USGS-EROS/lcmap-data.git \
&& git clone [email protected]:USGS-EROS/lcmap-event.git \
&& git clone [email protected]:USGS-EROS/lcmap-see.git \
&& git clone [email protected]:USGS-EROS/lcmap-client-py.git \
&& git clone [email protected]:USGS-EROS/lcmap-client-docs.git \
&& git clone [email protected]:USGS-EROS/lcmap-system.git \
&& git clone [email protected]:USGS-EROS/lcmap-change-detection-c.git
## Config
mkdir -p ~/.usgs
cp ~/Projects/lcmap/lcmap-rest/test/support/lcmap.test.ini.example ~/.usgs/lcmap.ini
## Python (and Friends) for lcmap-client-py
apt-get install python3 python3-dev libzmq-dev
## CCDC Dependencies
apt-get install -y libgsl0-dev libgsl0ldbl gsl-bin libmatio-dev libmatio2 gfortran
## Emacs
add-apt-repository ppa:ubuntu-elisp/ppa -y
apt-get update -qq
apt-get install emacs-snapshot
# In lcmap-data directory...
mkdir scenes
cd scenes \
&& curl -O http://espa.cr.usgs.gov/downloads/assessments/lcmap/1024_30_grid/p46r27/LC80460272013104-SC20160517152035.tar.gz \
&& curl -O http://espa.cr.usgs.gov/downloads/assessments/lcmap/1024_30_grid/p46r27/LC80460272013120-SC20160517172059.tar.gz \
&& curl -O http://espa.cr.usgs.gov/downloads/assessments/lcmap/1024_30_grid/p46r27/LC80460272013136-SC20160517165729.tar.gz \
&& curl -O http://espa.cr.usgs.gov/downloads/assessments/lcmap/1024_30_grid/p46r27/LT50460272011147-SC20160517160327.tar.gz \
&& curl -O http://espa.cr.usgs.gov/downloads/assessments/lcmap/1024_30_grid/p46r27/LT50460272011163-SC20160517174549.tar.gz \
&& curl -O http://espa.cr.usgs.gov/downloads/assessments/lcmap/1024_30_grid/p46r27/LT50460272011179-SC20160517151804.tar.gz \
&& curl -O http://espa.cr.usgs.gov/downloads/assessments/lcmap/1024_30_grid/p46r27/LE70460272011139-SC20160517164701.tar.gz \
&& curl -O http://espa.cr.usgs.gov/downloads/assessments/lcmap/1024_30_grid/p46r27/LE70460272011155-SC20160517162749.tar.gz \
&& curl -O http://espa.cr.usgs.gov/downloads/assessments/lcmap/1024_30_grid/p46r27/LE70460272011171-SC20160517151133.tar.gz \
cd -
lein lcmap run-cql --file resources/schema.cql
lein lcmap make-specs scenes/LC80460272013104-SC20160517152035.tar.gz --tile-keyspace lcmap --tile-table conus --tile-size 128:128
lein lcmap make-specs scenes/LT50460272011147-SC20160517160327.tar.gz --tile-keyspace lcmap --tile-table conus --tile-size 128:128
lein lcmap make-specs scenes/LE70460272011139-SC20160517164701.tar.gz --tile-keyspace lcmap --tile-table conus --tile-size 128:128
lein lcmap make-tiles scenes/*.tar.gz
#!/bin/bash
POINT="-1909498,2978512"
TIME="2013-01-01/2014-01-01"
BAND="LCMAP/SEE/NDVI"
BAND="LANDSAT_8/OLI_TIRS/sr_band1"
TILES=$(curl -s \
-H "$LCMAP_ACCEPT_HDR" \
-H "$LCMAP_TOKEN_HDR" \
"http://10.0.2.15:1077/api/data/tiles?band=$BAND&point=$POINT&time=$TIME")
#echo $BAND
#echo $TILES | jq '.body.result.spec | {type: .data_type, tx: .tile_x, ty: .tile_y, px: .pixel_x, py: .pixel_y, sx: .shift_x, sy: .shift_y, shape: .data_shape}'
#echo $TILES | jq '.body.result.tiles[0].data' | wc
echo $TILES
@jmorton
Copy link
Author

jmorton commented Jun 8, 2016

Cassandra needs to be configured to use endpoint_snitch: PropertyFileSnitch in conf/cassandra.yaml before being started for the first time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment