rollthecloudinc / quell

Climate aware CMS breaking web apps free from carbon emissions.
https://demo.carbonfreed.app/pages/create-panel-page
GNU General Public License v3.0
14 stars 1 forks source link

Provisioning Druid Environment #291

Open ng-druid opened 2 years ago

ng-druid commented 2 years ago

The building blocks of a single hosted druid.

Building Blocks

Onboarding

Architectural MVP requirements for onboarding new user onto druid cloud and quickly on the way to greening the web via first dev druid and promotion sustainable prod web.

Step 1

[panel page form]

submit -> bounce to cognito

Step 2

Cognito Registration Form

submit -> bounce back to dc

Step 3

Continue configuring druid

Step 4

Review and Submit

Backend

When druid submitted provision environment.

There could also be a repo less option... using shared objects space.

API

POST /druid

Add druid to pre-existing validate_entity function

When build repo has been created with dev branch create azure static web app for both dev and prod.

Create azure static web app entity adaptor Create github repo entity adaptor

Structure

POST /druid

{
  "siteName": "name",
  "host": {
     "azure_static_wep_app": {
        ...
     }
  }
}

Refs

Create repository using graph ql mutation

Github has template repositories that can be easily clone to a new repo. This might be the better direction. This would eliminate the need to create branches and files. Yes, this is the right direction.

template repos:

It might be easier to clone the repos in an action initiated by a new json file upload. We could also kick them off in a after save hook inside vert-go.

Create branch using new ref

mutation AddBranch($input: CreateRefInput!) {
  createRef(input: $input) {
    ref {
      name
    }
  }
}

Query variable

{
  “input”: {
    “clientMutationId”: “1234”,
    “name”: “refs/heads/<new_branch_name>”,
    “oid”: “<commit_sha>”,
    “repositoryId”: “<repository_id>”
  }
}

Create azure static web app using azure go sdk


Create github repo using action.

https://github.com/repo-ctrl/create-repo-action

Digest of github actions

https://github.com/sdras/awesome-actions

——-

Go daddy has an api that allows updates of cname records. This will work for pended druids. However, if people want to use their own custom domain more effort will be needed to facilitate this. It’s probably Easter to allow them to clone the build repo or manage it entirely.


Experiments


Godaddy

This is the api end-point to add a new cname record to a domain which the org owns.

https://developer.godaddy.com/doc/endpoint/domains#/v1/recordAdd


Github

This is the github graph ql end-point to clone a template repository.

https://docs.github.com/en/graphql/reference/mutations#clonetemplaterepository

Docs for template repositories.

https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-template-repository


Azure

Azure static site golang demo.

https://github.com/Azure-Samples/azure-sdk-for-go-samples/blob/main/sdk/resourcemanager/appservice/staticsite/main.go

Static site resource definition

https://docs.microsoft.com/en-us/azure/templates/microsoft.web/staticsites?pivots=deployment-language-bicep

Static web app pricing

https://azure.microsoft.com/en-us/pricing/details/app-service/static/

Enterprise grade edge

https://docs.microsoft.com/en-us/azure/static-web-apps/enterprise-edge?tabs=azure-portal

Add hostname via cli (based on my research this is the only method available to programmatically update hostname of static app).

Refs:

Screen Shot 2022-08-26 at 4 17 28 PM Screen Shot 2022-08-26 at 4 18 02 PM Screen Shot 2022-08-26 at 4 43 42 PM Screen Shot 2022-08-26 at 4 44 50 PM