Skip to content

Commit

Permalink
Improve setup for devenv
Browse files Browse the repository at this point in the history
Signed-off-by: lloydmeta <[email protected]>
  • Loading branch information
lloydmeta committed Nov 8, 2024
1 parent 2578ab5 commit a78aaea
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
start_dev_env:
cd terraform/localdev && docker-compose up &

init_dev_env:
cd terraform/localdev && tflocal init

provision_dev_env:
cd terraform/localdev && tflocal apply -auto-approve

Expand Down
22 changes: 12 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ Tiny HTTP image resizer.

## Goals

* Secure
* Fast:
* Secure
* Fast:
* Startup should be in the low 2-digit ms range (e.g., avoid "oh, it's a lambda")
* Processing should be quick
* Cheap:
* Cheap:
* Pay as little as possible and avoid unnecessary work
* Being fast can help minimise costs
* Scalable: can handle lots of requests
Expand Down Expand Up @@ -82,7 +82,7 @@ flowchart
cdnCached <-->|fetch| cdnCache
cdnCached -->|yes| cdnResp
cache -->|cache| cdnCache
cache --> cdnResp
Expand All @@ -99,8 +99,8 @@ flowchart
processedCache[("Processed cache")]
fetchCachedResult["Fetch cached result"]
opsResultCached{"Operations Result Cached?"}
rawCache[("Unprocessed cache")]
fetchCachedRaw["Fetch cached unprocessed image"]
rawCached{"Unprocessed image Cached?"}
Expand All @@ -110,23 +110,23 @@ flowchart
cacheRaw["Cache unprocessed image"]
processImage["Process image according to operations"]
cacheResult["Cache processed result"]
cacheResult["Cache processed result"]
lambdaResponse[\"Ok/Error Response"\]
cdnCached -->|no| lambdaRequest
lambdaRequest --> sigCheck
sigCheck -->|no| lambdaResponse
sigCheck -->|yes| toOps
toOps --> opsCheck
opsCheck -->|no| lambdaResponse
opsCheck -->|yes| fetchCachedResult
opsCheck -->|yes| fetchCachedResult
fetchCachedResult <-->|fetch| processedCache
fetchCachedResult --> opsResultCached
opsResultCached -->|yes| lambdaResponse
opsResultCached -->|no| fetchCachedRaw
opsResultCached -->|no| fetchCachedRaw
fetchCachedRaw <-->|fetch| rawCache
fetchCachedRaw --> rawCached
rawCached -->|no| fetchRaw
Expand Down Expand Up @@ -155,6 +155,7 @@ Assuming we have the [Rust toolbelt installed](https://doc.rust-lang.org/cargo/g

```sh
❯ brew tap cargo-lambda/cargo-lambda
❯ brew install cargo-lambda
```

### AWS
Expand Down Expand Up @@ -190,6 +191,7 @@ Ensure `CLOUDFLARE_API_TOKEN` is defined in the environment (needed for Cloudfla
Use `Makefile` targets.

* For local dev:
* `make init_dev_env` (only needed if TF complains)
* `make start_dev_env provision_dev_env`
* `make begin_dev`
* `TO_SIGN="200x-100/https://beachape.com/images/octopress_with_container.png" make signature_for_localstack` to get a signed path for dev env
Expand Down

0 comments on commit a78aaea

Please sign in to comment.