Created
July 20, 2015 15:56
-
-
Save tjanczuk/b56f74fc20b1eecc38a0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.4/raphael-min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-sequence-diagrams/1.0.6/sequence-diagram-min.js"></script> | |
</head> | |
<body> | |
<h2>Create named webtask</h2> | |
<p>(revocation checking and authorization omitted for brevity)</p> | |
<p>The STORE_CODE webtask code is located <a href="https://github.com/auth0/auth0-sandbox-ext/blob/master/webtasks/store_code_s3.js">here</a>.</p> | |
<div class="diagram"> | |
participant wt CLI as WT | |
participant Webtask\ncluster as W1 | |
participant Webtask\ncluster' as W2 | |
participant Webtask\ncluster" as W3 | |
participant S3 as S3 | |
WT->W1: create {webtask_token}:\nPOST /tokens/issue (code, name, container) | |
note over W1: compute {md5} of {code}\nset {path} to /code/{md5} | |
W1->W2: run STORE_CODE webtask to store {code}:\nPUT /run/auth0_webtask_code (code, path) | |
W2->S3: PUT {path} (code) | |
S3->W2: 200 | |
W2->W3: create {code_get} webtask token:\nPOST /tokens/issue (path, GET) | |
note over W3: use STORE_CODE webtask token to create\n{code_get} webtask token\n limited to GET on {path} in S3 | |
W3->W2: {code_get} webtask token | |
note over W2: create {code_get_url} URL\nusing {code_get} webtask token | |
W2->W1: {code_get_url} URL | |
note over W1: create {webtask_token} with\nurl: {code_get_url}\njtn: {name} | |
note over W1: set {path1} to \n/tokens/{host}/{container}/{name} | |
W1->W2: run STORE_CODE webtask to store {webtask_token}:\nPUT /run/auth0_webtask_code (webtask_token, path1) | |
W2->S3: PUT {path1} (webtask_token) | |
S3->W2: 200 | |
W2->W1: {webtask_token} | |
note over W1: create {webtask_token_url} as\nhttps://{self_host}/api/run/{container}/{name} | |
W1->WT: {webtask_token_url} | |
</div> | |
<h2>Use named webtask (cold start)</h2> | |
<p>(revocation checking and authorization omitted for brevity)</p> | |
<p>The STORE_CODE webtask code is located <a href="https://github.com/auth0/auth0-sandbox-ext/blob/master/webtasks/store_code_s3.js">here</a>.</p> | |
<div class="diagram"> | |
participant App as A | |
participant Webtask\ncluster as W1 | |
participant Webtask\ncluster' as W2 | |
participant S3 as S3 | |
participant Webtask container as C | |
A->W1: run named webtask:\n{VERB} {host}/api/run/{container}/{name}/... (payload) | |
note over W1: set {path1} to\n/tokens/{host}/{container}/{name} | |
W1->W2: run STORE_CODE webtask to get {webtask_token}:\nGET /api/run/auth0_webtask_code (path1) | |
W2->S3: GET {path1} | |
S3->W2: {webtask_token} | |
W2->W1: {webtask_token} | |
note over W1: assign webtask container to {container} | |
W1->C: run code in assigned webtask container:\n{VERB} /api/run/{container}/{name}/... (payload, webtask_token) | |
note over C: {webtask_token.url}\nis a STORED_CODE webtask | |
C->W2: get webtask code:\nGET {webtask_token.url} | |
note over W2: {webtask_token.path}\nis path to webtask code in S3 | |
W2->S3: GET {webtask_token.path} | |
S3->W2: {code} | |
W2->C: {code} | |
note over C: execute {code} over {payload},\ncollect {result} | |
C->W1: {result} | |
W1->A: {result} | |
</div> | |
<script> | |
$(".diagram").sequenceDiagram({theme: 'simple'}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment