diff --git a/docs/guides/add-suga.mdx b/docs/guides/add-suga.mdx index 4a07c92f..bde7d0dd 100644 --- a/docs/guides/add-suga.mdx +++ b/docs/guides/add-suga.mdx @@ -181,6 +181,76 @@ Suga helps you migrate existing applications to a cloud-agnostic architecture. W log.Fatal(http.ListenAndServe(":"+port, router)) } ``` + + + ```diff title="main.go" icon="file-plus-minus" +package main + + import ( ++ "example/suga" +- "context" + "fmt" + "log" + "net/http" + "os" +- "strings" +- "github.com/aws/aws-sdk-go-v2/aws" +- "github.com/aws/aws-sdk-go-v2/config" +- "github.com/aws/aws-sdk-go-v2/service/s3" + ) + + func main() { +- // Load AWS configuration +- cfg, err := config.LoadDefaultConfig(context.TODO()) +- if err != nil { +- log.Fatalf("Failed to load AWS config: %v", err) +- } + +- // Create S3 client +- s3Client := s3.NewFromConfig(cfg) +- bucketName := os.Getenv("S3_BUCKET_NAME") + ++ // Initialize Suga client ++ app, err := suga.NewClient() ++ if err != nil { ++ log.Fatalf("Failed to create suga client: %v", err) ++ } + + + router := http.NewServeMux() + router.HandleFunc("GET /hello/{name}", func(w http.ResponseWriter, r *http.Request) { + name := r.PathValue("name") + +- // AWS S3 PutObject +- _, err := s3Client.PutObject(context.TODO(), &s3.PutObjectInput{ +- Bucket: aws.String(bucketName), +- Key: aws.String("example.txt"), +- Body: strings.NewReader("Hello, " + name + "!"), +- }) +- if err != nil { +- log.Printf("Failed to upload to S3: %v", err) +- http.Error(w, "Error uploading to S3", http.StatusInternalServerError) +- return +- } ++ // Simplified file write using Suga ++ if err := app.Files.Write("example.txt", []byte("Hello, "+name+"!")); err != nil { ++ log.Printf("Failed to write file: %v", err) ++ http.Error(w, "Error writing file", http.StatusInternalServerError) ++ return ++ } + + fmt.Fprintf(w, "Hello, %s!", name) + }) + + port := os.Getenv("PORT") + if port == "" { + port = "8080" + } + + log.Printf("Server starting on port %s\n", port) + log.Fatal(http.ListenAndServe(":"+port, router)) + } +``` ```go title="main.go" icon="rocket" @@ -266,7 +336,7 @@ Suga helps you migrate existing applications to a cloud-agnostic architecture. W Select your cloud provider and region when prompted. You'll see: - ``` + ```bash ✓ Terraform generated successfully output written to ./.suga/stacks/my-app-aws-12345 diff --git a/docs/guides/aws/environment-management.mdx b/docs/guides/aws/environment-management.mdx index 4aa317c0..59ae511c 100644 --- a/docs/guides/aws/environment-management.mdx +++ b/docs/guides/aws/environment-management.mdx @@ -47,6 +47,9 @@ graph TB ProdRole -->|Deploys to| Prod Admin --> S3 + + classDef nitricGreen stroke:#25b355,stroke-width:2px + class Admin,DevRole,StagingRole,ProdRole,Dev,Staging,Prod nitricGreen ``` Each target account has a `TerraformRole` that trusts the administrative account, allowing Terraform to assume the role and deploy resources to the appropriate environment. diff --git a/docs/guides/terraform-backend-config.mdx b/docs/guides/terraform-backend-config.mdx index 07b96bf3..794527b5 100644 --- a/docs/guides/terraform-backend-config.mdx +++ b/docs/guides/terraform-backend-config.mdx @@ -55,8 +55,8 @@ After running `suga build`, add a backend configuration file to the synthesized Choose your backend provider and add the appropriate configuration: - - + + ```hcl title="backend.tf - AWS S3" icon="aws" terraform { backend "s3" { @@ -72,9 +72,9 @@ After running `suga build`, add a backend configuration file to the synthesized Ensure your S3 bucket has versioning enabled and consider enabling MFA delete for production environments. - + - + ```hcl title="backend.tf - Google Cloud" icon="cloud" terraform { backend "gcs" { @@ -87,9 +87,9 @@ After running `suga build`, add a backend configuration file to the synthesized Enable object versioning on your GCS bucket to maintain state history. - + - + ```hcl title="backend.tf - Azure Storage" icon="cloud" terraform { backend "azurerm" { @@ -100,9 +100,9 @@ After running `suga build`, add a backend configuration file to the synthesized } } ``` - + - + ```hcl title="backend.tf - Terraform Cloud" icon="cloud" terraform { backend "remote" { @@ -113,7 +113,8 @@ After running `suga build`, add a backend configuration file to the synthesized } } ``` - + + diff --git a/docs/introduction.mdx b/docs/introduction.mdx index c7a2883d..a2650e3e 100644 --- a/docs/introduction.mdx +++ b/docs/introduction.mdx @@ -4,7 +4,21 @@ sidebarTitle: "Introduction" description: "Cloud development with visual design, local testing, and multi-cloud deployment" --- -Suga makes cloud development simple by combining visual infrastructure design with automatic Terraform generation. Build applications with any framework, test locally with emulated cloud resources, and deploy anywhere with production-ready Terraform. +Suga makes cloud development simple by combining visual infrastructure design with automatic Terraform generation for AWS or GCP today (Azure coming soon). +Build applications with any framework, test locally with emulated cloud resources, and deploy anywhere with production-ready Terraform. +```mermaid +graph LR +HardenedInfra["Hardened Building Blocks"] ==> AppDesigner["Infrastructure Designer"] +AppDesigner ==> Generate["Generate Terraform"] +AppDesigner ==> Code["Code integration"] +Code ==> Test["Local Testing"] +Test ==> Deploy["Deploy"] +Generate ==> Deploy["Deploy"] + +classDef nitricGreen stroke:#25b355,stroke-width:2px +class HardenedInfra,AppDesigner,Code,Test,Generate,Deploy nitricGreen + +``` Deploy your first application in minutes with the quickstart guide. diff --git a/docs/quickstart.mdx b/docs/quickstart.mdx index afeba3e5..b389eeff 100644 --- a/docs/quickstart.mdx +++ b/docs/quickstart.mdx @@ -20,8 +20,10 @@ Deploy your first application on the Suga platform in just a few steps. The Suga ``` Select a template that matches your use case: - - ``` + + You can make your own templates too. + + ```bash Welcome to Suga, this command will help you create a project from a template. If you already have a project, run suga init instead. @@ -80,7 +82,7 @@ Deploy your first application on the Suga platform in just a few steps. The Suga ``` You'll see a confirmation: - ``` + ```bash ⚡ Suga Logging in... ✓ Logged in as User @@ -93,7 +95,7 @@ Deploy your first application on the Suga platform in just a few steps. The Suga ``` The editor launches in your browser: - ``` + ```bash ⚡ Suga Editor Opening visual editor at http://localhost:3001 Press Ctrl+C to stop the editor @@ -107,7 +109,7 @@ Deploy your first application on the Suga platform in just a few steps. The Suga The editor automatically updates your `suga.yaml` file as you make changes. - Let's review what the template `suga.yaml` has: + Let's review what the `go-standard` template has defined in the `suga.yaml`: ```yaml title="suga.yaml" icon="file-code" targets: @@ -154,7 +156,7 @@ Deploy your first application on the Suga platform in just a few steps. The Suga Your application starts with hot reload: - ``` + ```bash ⚡ Suga v1.0.0 - App: my-first-app - Addr: http://localhost:50051 @@ -207,8 +209,8 @@ Deploy your first application on the Suga platform in just a few steps. The Suga suga build ``` - You'll see the build output: - ``` + You'll see the build output as a terraform stack with everything needed to deploy your application to the cloud: + ```bash ✓ Terraform generated successfully output written to ./.suga/stacks/my-first-app-aws-12345 @@ -253,7 +255,7 @@ Deploy your first application on the Suga platform in just a few steps. The Suga ``` Confirm when prompted: - ``` + ```bash Do you want to perform these actions? Terraform will perform the actions described above. Only 'yes' will be accepted to approve. @@ -275,10 +277,16 @@ Deploy your first application on the Suga platform in just a few steps. The Suga **What you've accomplished:** -- ✅ Created and configured a Suga application from a template -- ✅ Developed and tested your application locally with hot reload -- ✅ Generated production-ready Terraform infrastructure code -- ✅ Deployed your application to your chosen cloud provider +```mermaid +graph TB +One["Created and configured a Suga application from a template"] ==> Two["Developed and tested your application locally with hot reload"] +Two ==> Three["Generated production-ready Terraform infrastructure code"] +Three ==> Four["Deployed your application to your chosen cloud provider"] + +classDef nitricGreen stroke:#25b355,stroke-width:2px +class One,Two,Three,Four nitricGreen + +``` **Need help?** Contact [support@addsuga.com](mailto:support@addsuga.com) or