https://github.com/epiphone/image-manager
Benchmarking serverless/VM deployments of a simple image transformation API
https://github.com/epiphone/image-manager
Last synced: about 1 year ago
JSON representation
Benchmarking serverless/VM deployments of a simple image transformation API
- Host: GitHub
- URL: https://github.com/epiphone/image-manager
- Owner: epiphone
- License: mit
- Created: 2019-04-04T04:47:09.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-05-06T18:08:05.000Z (about 7 years ago)
- Last Synced: 2025-02-14T19:22:56.740Z (over 1 year ago)
- Language: TypeScript
- Homepage:
- Size: 918 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Image Manager
Benchmarking serverless/VM deployments of a simple image transformation app.
Check `package.json` for available commands.
## Deploying Cloud Functions
First set up `gcloud` and `gsutil`.
```bash
# Build and package function source:
yarn clean && yarn resizer:build && yarn resizer:zip
# Push to Cloud Storage:
gsutil cp src/resizer/resizer.zip gs://imgmgr-functions
# Deploy function:
gcloud beta functions deploy resizer --runtime nodejs10 --trigger-resource imgmgr-images --trigger-event google.storage.object.finalize --region us-east1 --source gs://imgmgr-functions/resizer.zip --service-account serverless@imgmgr.iam.gserviceaccount.com --entry-point resizer
```
## Deploying VM app
```bash
# Build image:
docker build -t image-manager .
# Run locally:
docker run --rm -p 3000:3000 -v ~/.config:/root/.config --name image-manager image-manager:latest
# Push image to GCR:
gcloud auth configure-docker
docker tag image-manager:latest gcr.io/imgmgr/image-manager
docker push gcr.io/imgmgr/image-manager
```
## Running VM app locally
```bash
# Run server in development mode:
GOOGLE_APPLICATION_CREDENTIALS=/somepath/service-account-key.json yarn server:dev
# Upload an image file with httpie:
http -f POST localhost:3000 image@~/Pictures/tiikeri.jpg
```
## IAM
Serverless functions use a service account with the following roles:
```
Cloud Functions Developer
Cloud Trace Agent
Deployment Manager Editor
Service Account User
Logging Admin
Monitoring Metric Writer
Storage Admin
```
## Utilities
```bash
# Clean up buckets:
gsutil -m rm -r gs://imgmgr-server-images/** gs://imgmgr-server-thumbnails/** gs://imgmgr-images/** gs://imgmgr-thumbnails/**
# List files in server buckets:
gsutil -m ls gs://imgmgr-server-images/ gs://imgmgr-server-thumbnails/
```