Skip to content

gitter-badger/hyp3

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HyP3

Static code analysis Deploy to AWS Run tests

A processing environment for HyP3 Plugins in AWS.

Table of contents

Deployment

Prerequisites

These resources are required for a successful deployment, but managed separately:

  • HyP3 plugin container images and tags:
    • RTC_GAMMA
    • INSAR_GAMMA
    • AUTORIFT
  • S3 bucket for CloudFormation deployment artifacts
  • DNS record for custom API domain name
  • SSL certificate in AWS Certificate Manager for custom API domain name
  • EarthData Login account authorized to download data from ASF
  • default VPC
  • IAM user and roles for automated CloudFormation deployments (if desired)

Stack Parameters

Review the parameters in cloudformation.yml for deploy time configuration options.

Deploy with CloudFormation

  • Install dependencies for build and run
pip install -r requirements-all.txt
  • Render cloudformation templates
python apps/render_cf.py --job-types-file job_types.yml
  • Install API dependencies (requires pip for python 3.8)
pip install -r apps/api/requirements-api.txt -t apps/api/src
  • Package the CloudFormation template
aws cloudformation package \
            --template-file apps/main-cf.yml \
            --s3-bucket <CloudFormation artifact bucket> \
            --output-template-file packaged.yml
  • Deploy to AWS with CloudFormation
aws cloudformation deploy \
            --stack-name <name of your HyP3 Stack> \
            --template-file packaged.yml \
            --role-arn <arn for your deployment user/role> \
            --capabilities CAPABILITY_IAM \
            --parameter-overrides \
                "VpcId=<default vpc>" \
                "SubnetIds=<comma separated list of subnet ids>" \
                "EDLUsername=<EDL Username to download products>" \
                "EDLPassword=<EDL Password to download products>" \
                "DomainName=<Domain Name>" \
                "CertificateArn=<arn for ssl certificate>" \
                "RtcGammaImage=<location of RtcGammaImage to use>" \
                "InsarGammaImage=<location of InsarGammaImage to use>" \
                "AutoriftImage=<location of AutoriftImage to use>"
  • Check API at https://<Domain Name>/ui

Testing the API

The HyP3 API source contains test files in tests/api/. To run them you need to do a bit of setup first.

  • Add hyp3-api to python path
export PYTHONPATH="${PYTHONPATH}:`pwd`/apps/api/src"
  • Setup environment variables
export $(cat tests/api/cfg.env | xargs)
  • Install test requirements
pip install -r apps/api/requirements-all.txt
  • Run tests
pytest tests/api/

Running the API Locally

The API can be run locally to verify changes, but must be connected to an existing DynamoDB jobs table.

  • Setup aws credentials in your environment Documentation by AWS
  • Setup environment variables
    • TABLE_NAME=<jobs table id>
    • MONTHLY_JOB_QUOTA_PER_USER=25
    • AUTH_PUBLIC_KEY=123456789 we use this auth config so that we can set the cookie ourselves to a known good value
    • AUTH_ALGORITHM=HS256
  • Add hyp3-api to python path
export PYTHONPATH="${PYTHONPATH}:`pwd`/apps/api/src"
  • run API
python3 apps/api/src/hyp3_api/__main__.py
  • In order to use you will need to include the following cookie
asf-urs=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1cnMtdXNlci1pZCI6InVzZXIiLCJleHAiOjIxNTk1Mzc0OTYyLCJ1cnMtZ3JvdXBzIjpbeyJuYW1lIjoiYXV0aC1ncm91cCIsImFwcF91aWQiOiJhdXRoLXVpZCJ9XX0.hMtgDTqS5wxDPCzK9MlXB-3j6MAcGYeSZjGf4SYvq9Y

About

A processing environment for HyP3 Plugins in AWS.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 83.8%
  • HTML 15.7%
  • Shell 0.5%