No description
- HCL 60.4%
- Nim 17.2%
- Shell 15%
- Dockerfile 7.4%
| .github/workflows | ci(build): tag name | |
| infra | docs(readme): fix infra diagram | |
| src | feat(app): logging | |
| tests | feat(app): simple auth | |
| .dockerignore | feat: dockerfile | |
| .editorconfig | feat: hello world server and tests | |
| .env.example | feat(app): simple auth | |
| .gitignore | fix: infra | |
| config.nims | feat: dockerfile | |
| Dockerfile | fix(dockerfile): deliver a clean image after build | |
| nims_tofu_cloud.nimble | feat(app): simple auth | |
| readme.org | docs(readme): fix infra diagram | |
Nim's Tofu Cloud
Nim Hello World HTTP server deployed on AWS ECS via Open Tofu.
Learning purposes
Infra
architecture-beta
group vpc(cloud)[VPC]
group cluster(server)[ECS Cluster] in vpc
service ecs_service(server)[ECS Service] in cluster
group task_group(server)[ECS Task Definition] in vpc
service container(server)[Container] in task_group
group subnets(cloud)[Public Subnets] in vpc
service ecs_task(server)[ECS Task] in subnets
service sg(cloud)[Security Group] in vpc
service role(cloud)[IAM Role for ECS Task Execution]
service logs(cloud)[CloudWatch Log Group]
service internet(cloud)[Internet]
container:R -- L:logs
ecs_service:T -- B:sg
ecs_service:R -- L:ecs_task
ecs_task:T -- B:container
role:L -- R:ecs_task
internet:T -- B:ecs_task
Usage Locally
Build The Server
nimble build_release
Set .env
SECRET=passphrase
Running
./build/nims_tofu_cloud
Call the API
curl 'http://localhost:5000?secret=passphrase'
{"message":"Hello, World!"}
Usage With Docker
Build Docker Image
docker build .
Run the Image
docker run \
--rm \
-p 5000:5000 \
--env SECRET=hello \
$IMAGE_SHA256
Call the API
curl 'http://localhost:5000?secret=hello'
{"message":"Hello, World!"}
Run Hurl Tests
nimble test
Development Steps
- Hello World application that requires a secret to respond.
- Docker Image building and pushing
- Define the infrastructure