Skip to content

Commit a03dc0a

Browse files
Restructure + Reworking Doco
1 parent 308516c commit a03dc0a

6 files changed

Lines changed: 120 additions & 49 deletions

File tree

README.MD

Lines changed: 8 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,6 @@ The base use case is the ability to upload remote images into a cloud storage bu
1818
- Security [Who can access which images]
1919
- Resilience []
2020

21-
## Setup
22-
1. Create Project.
23-
2. Add Project_ID to config.json
24-
TODO: add script to deploy.sh to add Project_ID to bucket name
25-
26-
### Service Accounts
27-
28-
## Leads
29-
Consider spinning up app in Firebase
30-
Resumable file uploads: https://cloud.google.com/storage/docs/json_api/v1/how-tos/resumable-upload
31-
https://github.com/mkahn5/gcloud-resumable-uploads/blob/master/views/index.ejs
32-
Google Websocket demo: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/tree/master/appengine/websockets
33-
Firebase approach to uploads: https://firebase.google.com/docs/storage/web/upload-files#monitor_upload_progress
34-
Pub/Sub: https://github.com/googleapis/nodejs-pubsub/
35-
36-
37-
## TODO
38-
- Filetype verification
39-
- Partitioned file uploads
40-
- Caching
41-
- Match Catch expiry to Bucket item expiration
42-
4321
## Architecture
4422
The API endpoint footprint is small and doesn't need to maintain any state. This makes it a prime candidate for Lamba-style webhooks. (Benefits: Auto-scaling, minimal upkeep, smaller code footprint etc.)
4523
User will interact with a single REST endpoint (/images) through GET and PUT requests.
@@ -48,26 +26,13 @@ User will interact with a single REST endpoint (/images) through GET and PUT req
4826

4927
![Image API PUT sequence](/doc_assets/PUT.png)
5028

29+
## Providers - Development State
30+
### Phase 1 Complete - Upload, Download
31+
- GCP - Google Cloud Platform
5132

52-
### Provider
53-
Note: GCP's Node 8 driver is still Beta.
54-
55-
### Implementation
56-
#### Item Expiry
57-
The item expiry can be handled directly in the data bucket policy.
58-
`gsutil mb --retention 80d gs://ImageAPI`
59-
(For a more nuanced/extensible approach we could specify a more detailed lifecycle policy or have a lambda function launched via scheduled CRON job - eg. via cloud scheduler)
60-
61-
62-
## Implementation Notes
63-
### Code/Folder Structure - gcloud deploy limitations
64-
The `gcloud deploy` command, unfortunately, appears to only work on a singular local index.js file (or remote repositories).
65-
66-
### (Prepackaged solutions)
67-
Google's AppEngine provides ready made image servicing, including resizing and cropping.
68-
https://cloud.google.com/appengine/docs/standard/python/refdocs/google.appengine.api.images#google.appengine.api.images.get_serving_url
69-
https://medium.com/google-cloud/uploading-resizing-and-serving-images-with-google-cloud-platform-ca9631a2c556
33+
### Phase 1 In Progress
34+
- Bluemix - IBM Cloud
7035

71-
### Performance considerations
72-
#### HTTP Requests to Google Cloud
73-
We're currently utilizing Google's prebuilt node module for access. For a smaller footprint, to aid with speed of load for the cloud functions, we could use a streamlined request library to interact directly with their REST API.
36+
### Future
37+
- Azure
38+
- AWS

package.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@
1717
],
1818
"author": "Owen Smith",
1919
"license": "MIT",
20-
"dependencies": {
21-
"@google-cloud/storage": "^2.3.4",
22-
"request": "^2.88.0",
23-
"uuidv4": "^2.0.0"
24-
},
2520
"engines": {
2621
"node": "~10.13.0",
2722
"npm": "~6.4.1"
@@ -30,5 +25,9 @@
3025
"express": "^4.16.4",
3126
"helmet": "^3.15.0",
3227
"sharp": "^0.21.1"
33-
}
28+
},
29+
"repository": {
30+
"type": "git",
31+
"url": "git+https://github.com/CaffeineFusion/ImageAPI.git"
32+
},
3433
}

src/gcp/README.MD

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# ImageAPI
2+
This project is experimenting with different providers of cloud based web hooks and storage.
3+
[Note: This is in the very early stages of the experimentation and is not currently functional. The specs and approach may change without any notice.]
4+
5+
The base use case is the ability to upload remote images into a cloud storage bucket as well as to retrieve and resize them.
6+
(Note: some providers have resizing capabilities inbuilt [eg. GCP], this project will examine other methods to implement the same)
7+
8+
## API Requirements
9+
- Upload Images via URL
10+
- Download Images / provide Signed URL
11+
- Resize Images
12+
- 80 day expiry
13+
14+
### Additional Considerations
15+
- Real time updates for large uploads
16+
- Performance [Optimization for write heavy load]
17+
- Caching
18+
- Security [Who can access which images]
19+
- Resilience []
20+
21+
## Setup
22+
1. Create Project.
23+
2. Add Project_ID to config.json
24+
TODO: add script to deploy.sh to add Project_ID to bucket name
25+
26+
### Service Accounts
27+
28+
## Leads
29+
Consider spinning up app in Firebase
30+
Resumable file uploads: https://cloud.google.com/storage/docs/json_api/v1/how-tos/resumable-upload
31+
https://github.com/mkahn5/gcloud-resumable-uploads/blob/master/views/index.ejs
32+
Google Websocket demo: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/tree/master/appengine/websockets
33+
Firebase approach to uploads: https://firebase.google.com/docs/storage/web/upload-files#monitor_upload_progress
34+
Pub/Sub: https://github.com/googleapis/nodejs-pubsub/
35+
36+
37+
## TODO
38+
- Filetype verification
39+
- Partitioned file uploads
40+
- Caching
41+
- Match Catch expiry to Bucket item expiration
42+
43+
## Architecture
44+
The API endpoint footprint is small and doesn't need to maintain any state. This makes it a prime candidate for Lamba-style webhooks. (Benefits: Auto-scaling, minimal upkeep, smaller code footprint etc.)
45+
User will interact with a single REST endpoint (/images) through GET and PUT requests.
46+
47+
![Image API GET sequence](/doc_assets/GET.png)
48+
49+
![Image API PUT sequence](/doc_assets/PUT.png)
50+
51+
52+
### Provider
53+
Note: GCP's Node 8 driver is still Beta.
54+
55+
### Implementation
56+
#### Item Expiry
57+
The item expiry can be handled directly in the data bucket policy.
58+
`gsutil mb --retention 80d gs://ImageAPI`
59+
(For a more nuanced/extensible approach we could specify a more detailed lifecycle policy or have a lambda function launched via scheduled CRON job - eg. via cloud scheduler)
60+
61+
62+
## Implementation Notes
63+
### Code/Folder Structure - gcloud deploy limitations
64+
The `gcloud deploy` command, unfortunately, appears to only work on a singular local index.js file (or remote repositories).
65+
66+
### (Prepackaged solutions)
67+
Google's AppEngine provides ready made image servicing, including resizing and cropping.
68+
https://cloud.google.com/appengine/docs/standard/python/refdocs/google.appengine.api.images#google.appengine.api.images.get_serving_url
69+
https://medium.com/google-cloud/uploading-resizing-and-serving-images-with-google-cloud-platform-ca9631a2c556
70+
71+
### Performance considerations
72+
#### HTTP Requests to Google Cloud
73+
We're currently utilizing Google's prebuilt node module for access. For a smaller footprint, to aid with speed of load for the cloud functions, we could use a streamlined request library to interact directly with their REST API.
File renamed without changes.

src/gcp/package.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "imageapi",
3+
"version": "0.0.1",
4+
"description": "ImageAPI built using lambda webhooks",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"keywords": [
10+
"image",
11+
"image",
12+
"resize",
13+
"lambdas",
14+
"gcp",
15+
"google",
16+
"cloud"
17+
],
18+
"author": "Owen Smith",
19+
"license": "MIT",
20+
"dependencies": {
21+
"@google-cloud/storage": "^2.3.4",
22+
"request": "^2.88.0",
23+
"uuidv4": "^2.0.0"
24+
},
25+
"engines": {
26+
"node": "~10.13.0",
27+
"npm": "~6.4.1"
28+
},
29+
"devDependencies": {
30+
"express": "^4.16.4",
31+
"helmet": "^3.15.0",
32+
"sharp": "^0.21.1"
33+
}
34+
}
File renamed without changes.

0 commit comments

Comments
 (0)