robertd9ed1d1a79034263/hello

wasi

Public
wasmer run robertd9ed1d1a79034263/hello

hellowcgi

Quickstart

GOOS=wasip1 GOARCH=wasm go build -o main.wasm main.go
wasmer run-unstable .

publish

wasmer publish

deploy

wasmer deploy

Quickstart

if you have just and docker installed, you can start the project with just run. Otherwise run

$ docker run -p 8000:8000 hellowcgi:latest

Setup and Configuration

create an iam user with the following permissions for terraform:

{
   "Version":"2012-10-17",
   "Statement":[
      {
         "Sid":"ListImagesInRepository",
         "Effect":"Allow",
         "Action":[
            "ecr:ListImages"
         ],
         "Resource":"arn:aws:ecs:us-east-1::repository/hellowcgi"
      },
      {
         "Sid":"GetAuthorizationToken",
         "Effect":"Allow",
         "Action":[
            "ecr:GetAuthorizationToken"
         ],
         "Resource":"*"
      },
      {
         "Sid":"ManageRepositoryContents",
         "Effect":"Allow",
         "Action":[
                "ecr:*"
         ],
         "Resource":"arn:aws:ecr:us-east-1::repository/hellowcgi"
      },
     {
       "Sid": "VisualEditor0",
       "Effect": "Allow",
       "Action": [
         "apprunner:ListConnections",
         "apprunner:ListAutoScalingConfigurations",
         "apprunner:ListServices",
         "iam:*"

       ],
       "Resource": "*"
     },
     {
       "Sid": "VisualEditor1",
       "Effect": "Allow",
       "Action": "apprunner:*",
       "Resource": [
         "arn:aws:apprunner:us-east-1::connection/*/*",
         "arn:aws:apprunner:us-east-1::autoscalingconfiguration/*/*/*",
         "arn:aws:apprunner:us-east-1::service/*/*"
       ]
     }
   ]
}

example terraform

resource "aws_iam_user" "hellowcgi" {
  name = "hellowcgi"

  tags = {
    Project  = "hellowcgi"
    Type  = "terraform"
  }
}

data "template_file" "hellowcgi" {
  template = file("./policies/hellowcgi.json")
} 
resource "aws_iam_user_policy" "hellowcgi" {
  name = "hellowcgi"
  user = aws_iam_user.hellowcgi.name

  policy = data.template_file.hellowcgi.rendered
}

configure https://gitlab.com/reedrichards/hellowcgi/-/settings/ci_cd for with access key terraform user

create access key https://console.aws.amazon.com/iam/home#/users/hellowcgi?section=security_credentials

  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY

push this repo to the new project on gitlab

git init --initial-branch=main
git remote add origin git@gitlab.com:reedrichards/hellowcgi.git
git add .
git commit -m "Initial commit"
git push -u origin main

A template for WCGI applications


Github