initial commit
All checks were successful
Deploy to Humanitec v2 / Deploy to Humanitec v2 (push) Successful in 16s
Deploy to Humanitec v2 / Publish TechDocs (push) Successful in 1m28s

Change-Id: I12ab4ff8d5ef148640de63bdc0e9f41f3e885d8a
This commit is contained in:
Scaffolder
2026-02-25 11:48:19 +00:00
commit cdac1f451f
6 changed files with 372 additions and 0 deletions

126
.gitea/workflows/deploy.yml Normal file
View File

@@ -0,0 +1,126 @@
name: Deploy to Humanitec v2
on:
push:
branches: [ "main" ]
workflow_dispatch:
inputs:
environment:
description: 'Target environment'
required: true
default: 'dev'
type: choice
options:
- dev
- staging
- prod
env:
HUMANITEC_ORG: skillful-wild-chicken-2617
PROJECT_ID: demo-apps-1
# Default environment (used on push); overridden at runtime by workflow_dispatch input
DEFAULT_ENV_ID: dev
HUMANITEC_TOKEN: ${{ secrets.HUMANITEC_TOKEN }}
HUMANITEC_AUTH_TOKEN: ${{ secrets.HUMANITEC_TOKEN }}
HUMANITEC_API_PREFIX: https://api.humanitec.dev
jobs:
deploy:
name: Deploy to Humanitec v2
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install hctl CLI
run: |
echo "Installing hctl (Humanitec Platform Orchestrator v2 CLI)..."
# Install jq if not present (node:20-bullseye base image omits it)
if ! command -v jq &>/dev/null; then
apt-get update -qq && apt-get install -y -qq jq
fi
HCTL_VERSION=$(curl -s https://api.github.com/repos/humanitec/hctl/releases/latest | jq -r '.tag_name')
echo "Installing hctl ${HCTL_VERSION}..."
mkdir -p /tmp/hctl-install
curl -sLo /tmp/hctl-install/hctl.tar.gz "https://github.com/humanitec/hctl/releases/download/${HCTL_VERSION}/hctl_${HCTL_VERSION#v}_linux_amd64.tar.gz"
tar -xzf /tmp/hctl-install/hctl.tar.gz -C /tmp/hctl-install
install -m 755 /tmp/hctl-install/hctl /usr/local/bin/hctl
hctl --version
- name: Validate environment
run: |
# Use workflow_dispatch input if provided, otherwise fall back to default
DISPATCH_ENV="${{ github.event.inputs.environment }}"
ENV_ID="${DISPATCH_ENV:-$DEFAULT_ENV_ID}"
echo "ENV_ID=$ENV_ID" >> $GITHUB_ENV
echo "Target environment: $ENV_ID"
echo " Org: $HUMANITEC_ORG"
echo " Project: $PROJECT_ID"
echo " API: $HUMANITEC_API_PREFIX"
- name: Deploy with Score
id: deploy
run: |
SHORT_SHA="${GITHUB_SHA:0:7}"
echo "Deploying to Humanitec v2..."
echo " Project: $PROJECT_ID"
echo " Environment: $ENV_ID"
echo " Commit: $SHORT_SHA"
hctl score deploy "$PROJECT_ID" "$ENV_ID" score.yaml \
--no-prompt
echo "Deployment successful!"
- name: Deployment summary
if: always()
run: |
SHORT_SHA="${GITHUB_SHA:0:7}"
echo "## Deployment Result" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Field | Value |" >> $GITHUB_STEP_SUMMARY
echo "|---|---|" >> $GITHUB_STEP_SUMMARY
echo "| Project | \`$PROJECT_ID\` |" >> $GITHUB_STEP_SUMMARY
echo "| Environment | \`$ENV_ID\` |" >> $GITHUB_STEP_SUMMARY
echo "| Commit | \`$SHORT_SHA\` |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "[View in Humanitec Console](https://console.humanitec.dev/orgs/$HUMANITEC_ORG/projects/$PROJECT_ID/environments/$ENV_ID)" >> $GITHUB_STEP_SUMMARY
publish-techdocs:
name: Publish TechDocs
runs-on: ubuntu-latest
needs: deploy
if: github.ref == 'refs/heads/main'
env:
ENTITY_NAME: demo-app-1-v2
STORAGE_ACCOUNT: bstagecjotdevsttechdocs
AZURE_STORAGE_ACCOUNT_KEY: ${{ secrets.TECHDOCS_AZURE_STORAGE_KEY }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Python deps
run: |
apt-get update -qq && apt-get install -y -qq python3-pip
pip3 install mkdocs-techdocs-core --quiet
- name: Install techdocs-cli
run: npm install -g @techdocs/cli --silent
- name: Generate TechDocs
run: techdocs-cli generate --no-docker --source-dir . --output-dir site/
- name: Publish TechDocs to Azure Blob Storage
run: |
techdocs-cli publish \
--publisher-type azureBlobStorage \
--azureAccountName "$STORAGE_ACCOUNT" \
--storage-name techdocs \
--entity default/Component/"$ENTITY_NAME" \
--directory site/
- name: TechDocs summary
if: always()
run: |
echo "## TechDocs" >> $GITHUB_STEP_SUMMARY
echo "Published docs for \`default/Component/$ENTITY_NAME\` to Azure Blob Storage (\`$STORAGE_ACCOUNT\`)." >> $GITHUB_STEP_SUMMARY

82
README.md Normal file
View File

@@ -0,0 +1,82 @@
# My Application v2 1
Application deployed via Humanitec Platform Orchestrator v2
## Humanitec Platform Orchestrator v2
This application deploys to [Humanitec Platform Orchestrator v2](https://humanitec.com) on Azure AKS via [Score](https://score.dev).
### Configuration
| Field | Value |
|---|---|
| Organization | `skillful-wild-chicken-2617` |
| Project | `demo-apps-1` |
| Default Environment | `dev` |
| Humanitec Console | [Open](https://console.humanitec.dev/orgs/skillful-wild-chicken-2617/projects/demo-apps-1) |
### Environments
| Environment | Namespace | Trigger |
|---|---|---|
| `dev` | `dev` | Every push to `main` (when default env is dev) |
| `staging` | `staging` | Manual `workflow_dispatch` → select staging |
| `prod` | `prod` | Manual `workflow_dispatch` → select prod |
To promote to staging or prod, use the **Run workflow** button in the Gitea Actions UI and select the target environment.
### Score Manifest (`score.yaml`)
Defines the workload — containers, ports, and external resource dependencies. Resources are resolved by the Humanitec platform at deploy time:
```yaml
resources:
env: # type: environment — injects env vars
# blob: # type: azure-blob — Azure Blob Storage container
# config: # type: azure-keyvault-secret — Key Vault secret
# db: # type: postgres — Azure PostgreSQL database
```
### CI/CD Workflow
Deployments are automated via Gitea Actions (`.gitea/workflows/deploy.yml`):
1. **Install hctl** — downloads the Humanitec v2 CLI from `humanitec/hctl`
2. **Deploy** — runs `hctl score deploy <project> <env> score.yaml`
3. **Humanitec runner** applies the Terraform module on AKS, creating/updating K8s Deployment + Service
The `HUMANITEC_TOKEN` secret must be set in the Gitea repository (done automatically by the Backstage template).
### Local Development
```bash
# Run locally with Docker
docker run -p 8080:80 nginx:alpine
```
### Manual Deployment
To deploy manually using `hctl`:
```bash
# Authenticate
export HUMANITEC_TOKEN="your-service-user-token"
# Deploy to dev environment
hctl score deploy demo-apps-1 dev \\
--file score.yaml \\
--message "Manual deployment" \\
--token "$HUMANITEC_TOKEN"
```
### View Deployment
Access the Humanitec v2 console:
- [Project Overview](https://console.humanitec.dev/orgs/skillful-wild-chicken-2617/projects/demo-apps-1)
- [Environment: dev](https://console.humanitec.dev/orgs/skillful-wild-chicken-2617/projects/demo-apps-1/environments/dev)
### Resources
- [Humanitec Platform Orchestrator v2 Docs](https://developer.humanitec.com/platform-orchestrator/docs/)
- [Score Specification](https://score.dev)
- [hctl CLI Reference](https://developer.humanitec.com/platform-orchestrator/docs/integrations/cli/)

56
catalog-info.yaml Normal file
View File

@@ -0,0 +1,56 @@
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: demo-app-1-v2
title: My Application v2 1
description: Application deployed via Humanitec Platform Orchestrator v2
annotations:
# --- Source Control ---
gitea.kyndemo.live/project-slug: validate/demo-app-1-v2
gitea.kyndemo.live/repo-slug: validate/demo-app-1-v2
# --- Kubernetes plugin: finds pods with label app=<component_id> across namespaces ---
backstage.io/kubernetes-label-selector: app=demo-app-1-v2
# --- TechDocs: builds from docs/ directory in this repo ---
backstage.io/techdocs-ref: dir:.
# --- Humanitec Platform Orchestrator v2 ---
humanitec.dev/orgId: skillful-wild-chicken-2617
humanitec.dev/projectId: demo-apps-1
tags:
- humanitec-v2
- platform-orchestrator
- score
- azure
- microservice
links:
- url: https://console.humanitec.dev/orgs/skillful-wild-chicken-2617/projects/demo-apps-1/environments/dev
title: Humanitec Console
icon: dashboard
- url: https://gitea.kyndemo.live/validate/demo-app-1-v2
title: Source Repository
icon: github
- url: https://gitea.kyndemo.live/validate/demo-app-1-v2/actions
title: CI/CD Pipelines
icon: code
spec:
type: service
lifecycle: experimental
owner: group:default/platform-engineering
system: demo-app-1-v2-system
---
apiVersion: backstage.io/v1alpha1
kind: System
metadata:
name: demo-app-1-v2-system
title: My Application v2 1 System
description: System grouping for My Application v2 1 and its dependencies
annotations:
humanitec.dev/orgId: skillful-wild-chicken-2617
humanitec.dev/projectId: demo-apps-1
tags:
- humanitec-v2
- azure
spec:
owner: group:default/platform-engineering

54
docs/index.md Normal file
View File

@@ -0,0 +1,54 @@
# My Application v2 1
Application deployed via Humanitec Platform Orchestrator v2
## Overview
| Property | Value |
|--------------|-----------------------------------------------------------------------------------------------|
| **Owner** | `` |
| **Org** | [skillful-wild-chicken-2617](https://app.humanitec.dev/skillful-wild-chicken-2617) |
| **Project** | `demo-apps-1` |
| **App** | `demo-app-1-v2` |
| **Repo** | [validate/demo-app-1-v2](https:///validate/demo-app-1-v2) |
## Environments
| Environment | Link |
|-------------|-----------------------------------------------------------------------------------------------------------------------------------------------|
| **dev** | [Humanitec Console](https://app.humanitec.dev/skillful-wild-chicken-2617/projects/demo-apps-1/apps/demo-app-1-v2/envs/dev) |
## CI/CD
Build and deployment pipelines are managed via Gitea Actions.
View runs in the **CI/CD** tab of this component in Backstage, or directly in the
[demo-app-1-v2 repository](https:///validate/demo-app-1-v2/actions).
## Architecture
This service is deployed on **Azure AKS** via the Humanitec Platform Orchestrator.
- Workloads are scheduled in the `dev` namespace
- Pods carry the label `app: demo-app-1-v2`
- Kubernetes resources are visible in the **Kubernetes** tab
## Getting Started
```bash
# Clone the repository
git clone https:///validate/demo-app-1-v2
cd demo-app-1-v2
# Build the image
docker build -t demo-app-1-v2:local .
# Deploy via Score
score-humanitec delta \
--token "$HUMANITEC_TOKEN_V2" \
--org "skillful-wild-chicken-2617" \
--project "demo-apps-1" \
--app "demo-app-1-v2" \
--env dev \
-f score.yaml \
--deploy
```

9
mkdocs.yml Normal file
View File

@@ -0,0 +1,9 @@
site_name: My Application v2 1
site_description: Application deployed via Humanitec Platform Orchestrator v2
docs_dir: docs
nav:
- Home: index.md
plugins:
- techdocs-core

45
score.yaml Normal file
View File

@@ -0,0 +1,45 @@
apiVersion: score.dev/v1b1
metadata:
# component_id is lowercase+hyphens — matches the catalog-info K8s label selector
name: demo-app-1-v2
labels:
# Propagated to Deployment metadata.labels so the Backstage K8s plugin
# can find the Deployment via label selector (app=<component_id>)
app: demo-app-1-v2
containers:
main:
image: nginx:alpine
# Uncomment to inject values from Humanitec resource outputs, e.g.:
# variables:
# APP_ENV: "${resources.env.values.APP_ENV}"
# Uncomment to configure resource requests/limits:
# resources:
# requests: { cpu: 100m, memory: 128Mi }
# limits: { cpu: 500m, memory: 512Mi }
service:
ports:
web:
port: 80
targetPort: 80
# Resources declare external dependencies resolved by Humanitec at deploy time.
# Platform resource types available: environment, azure-blob, azure-keyvault-secret,
# azure-service-bus, postgres, redis
resources:
env:
type: environment
# Uncomment to request an Azure Blob Storage container:
# blob:
# type: azure-blob
#
# Uncomment to request a Key Vault secret:
# config:
# type: azure-keyvault-secret
# params:
# secret_name: my-app-secret
#
# Uncomment to request a PostgreSQL database:
# db:
# type: postgres