git clone https://github.com/skydvr01/Docker_NodeJS_Hello_World.git
docker image build -t test:1.0 .
docker login -u <username> docker.mobiledgex.net
docker push docker.mobiledgex.net/<orgname>/images/test:1.0
docker logout docker.mobiledgex.net
Request
$ curl -s -XPOST https://console.mobiledgex.net/api/v1/login \
-H "Content-Type: application/json" \
-d '{ "password": "somepass", "username": "demo" }'
Response
{"token":"eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1ODYyOTcxNTMsImlhdCI6MTU4NjIxMDc1MywidXNlcm5hbWUiOiJkZW1vIiwiZW1haWwiOiJkZW1vQG1vYmlsZWRnZXguY29tIiwia2lkIjoyfQ.bAqdwNw2stM0r24nrbu08c7qbZjraOGoTLVCopYvsIoX1uxKoEeOm8i78ihp8Tze9gKxttLTx76hKYS6tKo0sA"}
All subsequent calls are shown with two assumptions:
https://console.mobiledgex.net/api/v1
.curlrc
file setup with the following values:
-H "Content-Type: application/json"
-H "Authorization: Bearer <JWT Token>"
For 2xx responses, the body of the response will be printed to stdout. For all other responses the body will be dumped to stderr.
Request
POST /auth/ctrl/CreateApp < payload.json
payload.json
{
"Region": "EU",
"App": {
"key": {
"developer_key" : {
"name": "demoorg"
},
"name": "testapp",
"organization": "demoorg",
"version": "1.0"
},
"deployment": "docker",
"access_type": 0,
"image_path": "docker.mobiledgex.net/demoorg/images/test:1.0",
"image_type": 1,
"internal_ports": true,
"default_flavor": {
"name": "m4.small"
},
"revision": 0,
"access_ports": "TCP:8000"
}
}
Response
{
}
Request
POST api/v1/auth/ctrl/CreateClusterInst < payload.json
payload.json
{
"Region": "EU",
"ClusterInst": {
"allocated_ip": "dynamic",
"ip_access": 1,
"key": {
"cloudlet_key": {
"operator_key": {
"name": "TDG"
},
"developer_key" : {
"name": "demoorg"
},
"name": "munich-main"
},
"organization": "string",
"cluster_key": {
"name": "testcluster"
}
},
"node_flavor": "m4.small",
"deployment": "docker"
}
}
Response
{"data":{"message":"Creating"}}
{"data":{"message":"Creating Dedicated VM for Docker"}}
{"data":{"message":"Creating Heat Stack for munich-main-testcluster-demoorg"}}
{"data":{"message":"Creating Heat Stack for munich-main-testcluster-demoorg, Heat Stack Status: CREATE_IN_PROGRESS"}}
{"data":{"message":"Setting Up Root LB"}}
{"data":{"message":"Ready"}}
{"data":{"message":"Created ClusterInst successfully"}}
Request
POST api/v1/auth/ctrl/CreateAppInst < payload.json
payload.json
{
"Region": "EU",
"AppInst": {
"key": {
"app_key": {
"organization": "demoorg",
"name": "testapp",
"version": "1.0",
"developer_key": {
"name": "demoorg"
}
},
"cluster_inst_key": {
"cluster_key": {
"name": "testcluster"
},
"cloudlet_key": {
"operator_key": {
"name": "TDG"
},
"name": "munich-main"
},
"developer": "demoorg"
}
},
"flavor": {
"name": "m4.small"
}
}
}
Response
{"data":{"message":"Seeding docker secret"}}
{"data":{"message":"Deploying Docker App"}}
{"data":{"message":"Configuring Firewall Rules and DNS"}}
{"data":{"message":"Creating"}}
{"data":{"message":"Ready"}}
{"data":{"message":"Created AppInst successfully"}}
Get FQDN and Port; payload content is used to filter (note that this is not currently working - see EDGECLOUD-2412).
Request
POST /auth/ctrl/ShowAppInst \
'{"region": "EU", "appinst": { "key": { "app_key": {"name": "testapp", "version": "1.0" }}}}' \
| json -Hag data.key.app_key.name data.key.app_key.version data.uri data.mapped_ports
Response
testapp 1.0 testcluster.munich-main.tdg.mobiledgex.net [
{
"proto": 1,
"internal_port": 8000,
"public_port": 8000
}
]
Test
$ curl testcluster.munich-main.tdg.mobiledgex.net:8000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://fonts.googleapis.com/css?family=Lobster|Saira+Condensed&display=swap" rel="stylesheet">
<title>Hello World!</title>
<style>
body {
margin: 0;
}
.center-me {
display: flex;
justify-content: center;
align-items: center;
/*font-family: 'Saira Condensed', sans-serif;*/
font-family: 'Lobster', cursive;
font-size: 100px;
height: 100vh;
}
</style>
</head>
<body>
<div class="center-me">
<p>Hello World! 🥳</p>
</div>
</body>
</html>%