Change-Id: I9ad6c3837a837ad68f28b6ea1901397a9a432227
This commit is contained in:
@@ -0,0 +1 @@
|
||||
.DS_Store
|
||||
@@ -0,0 +1,56 @@
|
||||
|
||||
name: cleanup-expired
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "17 * * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
cleanup-expired:
|
||||
runs-on:
|
||||
- toolzoo-host
|
||||
env:
|
||||
AWS_REGION: us-east-1
|
||||
APP_STACK_PREFIX: temp-stack
|
||||
TTL_GRACE_SECONDS: "600"
|
||||
steps:
|
||||
- name: Cleanup expired app stacks
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
now_epoch="$(date -u +%s)"
|
||||
prefix="${APP_STACK_PREFIX}-"
|
||||
stacks="$(aws cloudformation list-stacks \
|
||||
--stack-status-filter CREATE_COMPLETE UPDATE_COMPLETE UPDATE_ROLLBACK_COMPLETE \
|
||||
--query "StackSummaries[?starts_with(StackName, \`${prefix}\`)].StackName" \
|
||||
--output text)"
|
||||
|
||||
for stack in $stacks; do
|
||||
expires_at="$(aws cloudformation describe-stacks --stack-name "$stack" --query "Stacks[0].Tags[?Key=='ExpiresAt'].Value | [0]" --output text)"
|
||||
owner_raw="$(aws cloudformation describe-stacks --stack-name "$stack" --query "Stacks[0].Tags[?Key=='Owner'].Value | [0]" --output text)"
|
||||
repo_raw="$(aws cloudformation describe-stacks --stack-name "$stack" --query "Stacks[0].Tags[?Key=='Repository'].Value | [0]" --output text)"
|
||||
|
||||
if [[ "$expires_at" == "None" || -z "$expires_at" ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
expires_epoch="$(date -u -d "$expires_at" +%s 2>/dev/null || echo 0)"
|
||||
if [[ "$expires_epoch" -eq 0 ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
if (( now_epoch >= expires_epoch + TTL_GRACE_SECONDS )); then
|
||||
aws cloudformation delete-stack --stack-name "$stack"
|
||||
aws cloudformation wait stack-delete-complete --stack-name "$stack"
|
||||
|
||||
if [[ "$owner_raw" != "None" && "$repo_raw" != "None" && -n "$owner_raw" && -n "$repo_raw" ]]; then
|
||||
repo_slug="$(printf '%s' "$repo_raw" | tr '[:upper:]' '[:lower:]')"
|
||||
ecr_repo="temp/${repo_slug}"
|
||||
if aws ecr describe-repositories --repository-names "$ecr_repo" >/dev/null 2>&1; then
|
||||
aws ecr delete-repository --repository-name "$ecr_repo" --force
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -0,0 +1,217 @@
|
||||
|
||||
name: deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
ttl:
|
||||
description: "TTL for deploy operation (1h | 4h | 24h)"
|
||||
required: false
|
||||
default: 1h
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on:
|
||||
- toolzoo-host
|
||||
env:
|
||||
BACKSTAGE_STACK_NAME: toolzoo-backstage
|
||||
AWS_REGION: us-east-1
|
||||
APP_STACK_PREFIX: temp-stack
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Derive deployment settings
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
repo_full="${GITHUB_REPOSITORY}"
|
||||
owner_raw="${repo_full%%/*}"
|
||||
repo_raw="${repo_full##*/}"
|
||||
repo_slug="$(printf '%s' "$repo_raw" | tr '[:upper:]' '[:lower:]')"
|
||||
service_slug="${repo_slug}"
|
||||
stack_name="${APP_STACK_PREFIX}-${repo_slug}"
|
||||
account_id="$(aws sts get-caller-identity --query Account --output text)"
|
||||
image_tag="${GITHUB_SHA:-manual}"
|
||||
short_tag="${image_tag:0:12}"
|
||||
registry="${account_id}.dkr.ecr.${AWS_REGION}.amazonaws.com"
|
||||
ecr_repo="temp/${repo_slug}"
|
||||
image_uri="${registry}/${ecr_repo}:${short_tag}"
|
||||
techdocs_bucket="$(aws cloudformation describe-stacks --stack-name "$BACKSTAGE_STACK_NAME" --query "Stacks[0].Outputs[?OutputKey=='TechDocsBucketName'].OutputValue" --output text)"
|
||||
ttl_input="${{ github.event.inputs.ttl }}"
|
||||
case "${ttl_input:-}" in
|
||||
""|"1h") ttl_hours="1" ;;
|
||||
"4h") ttl_hours="4" ;;
|
||||
"24h") ttl_hours="24" ;;
|
||||
*) ttl_hours="1" ;;
|
||||
esac
|
||||
expires_at="$(date -u -d "+${ttl_hours} hour" +%Y-%m-%dT%H:%M:%SZ)"
|
||||
|
||||
{
|
||||
echo "TOOLZOO_OWNER=${owner_raw}"
|
||||
echo "TOOLZOO_REPO=${repo_raw}"
|
||||
echo "TOOLZOO_STACK_NAME=${stack_name}"
|
||||
echo "TOOLZOO_SERVICE_NAME=${service_slug}"
|
||||
echo "TOOLZOO_ECR_REPO=${ecr_repo}"
|
||||
echo "TOOLZOO_IMAGE_URI=${image_uri}"
|
||||
echo "TOOLZOO_TECHDOCS_BUCKET=${techdocs_bucket}"
|
||||
echo "TOOLZOO_EXPIRES_AT=${expires_at}"
|
||||
} >> "$GITHUB_ENV"
|
||||
|
||||
- name: Ensure ECR repository exists
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
aws ecr describe-repositories --repository-names "$TOOLZOO_ECR_REPO" >/dev/null 2>&1 || \
|
||||
aws ecr create-repository \
|
||||
--repository-name "$TOOLZOO_ECR_REPO" \
|
||||
--image-scanning-configuration scanOnPush=true >/dev/null
|
||||
|
||||
- name: Log in to ECR
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
aws ecr get-login-password --region "$AWS_REGION" | \
|
||||
docker login --username AWS --password-stdin "${TOOLZOO_IMAGE_URI%/*}"
|
||||
|
||||
- name: Build and push container image
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
docker build -t "$TOOLZOO_IMAGE_URI" .
|
||||
docker push "$TOOLZOO_IMAGE_URI"
|
||||
|
||||
- name: Deploy ECS service stack
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
aws cloudformation deploy \
|
||||
--stack-name "$TOOLZOO_STACK_NAME" \
|
||||
--template-file infra/cloudformation/service.yaml \
|
||||
--capabilities CAPABILITY_NAMED_IAM \
|
||||
--parameter-overrides \
|
||||
EnvironmentName="$TOOLZOO_STACK_NAME" \
|
||||
ContainerImage="$TOOLZOO_IMAGE_URI" \
|
||||
ServiceName="$TOOLZOO_SERVICE_NAME" \
|
||||
--tags \
|
||||
Owner="$TOOLZOO_OWNER" \
|
||||
Repository="$TOOLZOO_REPO" \
|
||||
ExpiresAt="$TOOLZOO_EXPIRES_AT" \
|
||||
ManagedBy="gitea-actions"
|
||||
|
||||
- name: Write Service URL to catalog metadata
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
service_url="$(aws cloudformation describe-stacks --stack-name "$TOOLZOO_STACK_NAME" --query "Stacks[0].Outputs[?OutputKey=='ServiceUrl'].OutputValue" --output text)"
|
||||
if [[ -z "$service_url" || "$service_url" == "None" ]]; then
|
||||
echo "ServiceUrl output not found for stack $TOOLZOO_STACK_NAME"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf '%s\n' \
|
||||
' # BEGIN TOOLZOO MANAGED LINK' \
|
||||
" - url: \"$service_url\"" \
|
||||
' title: Service URL' \
|
||||
' icon: web' \
|
||||
' # END TOOLZOO MANAGED LINK' \
|
||||
> /tmp/toolzoo-managed-link-item.yaml
|
||||
|
||||
awk '
|
||||
BEGIN { in_block=0 }
|
||||
/^ # BEGIN TOOLZOO MANAGED LINK$/ { in_block=1; next }
|
||||
/^ # END TOOLZOO MANAGED LINK$/ { in_block=0; next }
|
||||
in_block==1 { next }
|
||||
{ print }
|
||||
' catalog-info.yaml > /tmp/catalog-info.yaml.base
|
||||
|
||||
if grep -q '^ links:$' /tmp/catalog-info.yaml.base; then
|
||||
awk '
|
||||
BEGIN { inserted=0 }
|
||||
{ print }
|
||||
/^ links:$/ && inserted==0 {
|
||||
while ((getline l < "/tmp/toolzoo-managed-link-item.yaml") > 0) {
|
||||
print l
|
||||
}
|
||||
close("/tmp/toolzoo-managed-link-item.yaml")
|
||||
inserted=1
|
||||
}
|
||||
' /tmp/catalog-info.yaml.base > /tmp/catalog-info.yaml.updated
|
||||
else
|
||||
awk '
|
||||
BEGIN { inserted=0 }
|
||||
/^ labels:$/ && inserted==0 {
|
||||
print " links:"
|
||||
while ((getline l < "/tmp/toolzoo-managed-link-item.yaml") > 0) {
|
||||
print l
|
||||
}
|
||||
close("/tmp/toolzoo-managed-link-item.yaml")
|
||||
inserted=1
|
||||
}
|
||||
/^ annotations:$/ && inserted==0 {
|
||||
print " links:"
|
||||
while ((getline l < "/tmp/toolzoo-managed-link-item.yaml") > 0) {
|
||||
print l
|
||||
}
|
||||
close("/tmp/toolzoo-managed-link-item.yaml")
|
||||
inserted=1
|
||||
}
|
||||
/^spec:$/ && inserted==0 {
|
||||
print " links:"
|
||||
while ((getline l < "/tmp/toolzoo-managed-link-item.yaml") > 0) {
|
||||
print l
|
||||
}
|
||||
close("/tmp/toolzoo-managed-link-item.yaml")
|
||||
inserted=1
|
||||
}
|
||||
{ print }
|
||||
' /tmp/catalog-info.yaml.base > /tmp/catalog-info.yaml.updated
|
||||
fi
|
||||
|
||||
mv /tmp/catalog-info.yaml.updated catalog-info.yaml
|
||||
|
||||
- name: Commit catalog metadata update
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if git diff --quiet -- catalog-info.yaml; then
|
||||
echo "No catalog-info.yaml changes to commit."
|
||||
exit 0
|
||||
fi
|
||||
git config user.name "toolzoo-bot"
|
||||
git config user.email "toolzoo-bot@local"
|
||||
git add catalog-info.yaml
|
||||
git commit -m "Update catalog service URL from deployment output"
|
||||
git push origin HEAD:main
|
||||
|
||||
- name: Publish TechDocs to S3
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
python3 -m venv .techdocs-venv
|
||||
. .techdocs-venv/bin/activate
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install mkdocs-techdocs-core
|
||||
npx -y @techdocs/cli generate --no-docker
|
||||
npx -y @techdocs/cli publish \
|
||||
--publisher-type awsS3 \
|
||||
--storage-name "$TOOLZOO_TECHDOCS_BUCKET" \
|
||||
--entity "default/Component/${TOOLZOO_REPO}"
|
||||
|
||||
- name: Emit deployment summary
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
: "${GITHUB_STEP_SUMMARY:=/tmp/toolzoo-step-summary}"
|
||||
service_url="$(aws cloudformation describe-stacks --stack-name "$TOOLZOO_STACK_NAME" --query "Stacks[0].Outputs[?OutputKey=='ServiceUrl'].OutputValue" --output text)"
|
||||
{
|
||||
echo "Deployment stack: $TOOLZOO_STACK_NAME"
|
||||
echo "Image: $TOOLZOO_IMAGE_URI"
|
||||
echo "TechDocs bucket: $TOOLZOO_TECHDOCS_BUCKET"
|
||||
echo "ExpiresAt (UTC): $TOOLZOO_EXPIRES_AT"
|
||||
echo "Service URL: $service_url"
|
||||
} | tee -a "$GITHUB_STEP_SUMMARY"
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
|
||||
name: destroy
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
confirm_destroy:
|
||||
description: "Type the repository name to confirm destroy"
|
||||
required: true
|
||||
default: ""
|
||||
|
||||
jobs:
|
||||
destroy:
|
||||
runs-on:
|
||||
- toolzoo-host
|
||||
env:
|
||||
AWS_REGION: us-east-1
|
||||
APP_STACK_PREFIX: temp-stack
|
||||
steps:
|
||||
- name: Destroy stack and ECR images
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
repo_full="${GITHUB_REPOSITORY}"
|
||||
owner_raw="${repo_full%%/*}"
|
||||
repo_raw="${repo_full##*/}"
|
||||
confirm="${{ github.event.inputs.confirm_destroy }}"
|
||||
if [[ "$confirm" != "$repo_raw" ]]; then
|
||||
echo "Refusing destroy: confirm_destroy must exactly match '$repo_raw'."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
repo_slug="$(printf '%s' "$repo_raw" | tr '[:upper:]' '[:lower:]')"
|
||||
stack_name="${APP_STACK_PREFIX}-${repo_slug}"
|
||||
ecr_repo="temp/${repo_slug}"
|
||||
|
||||
aws cloudformation delete-stack --stack-name "$stack_name"
|
||||
aws cloudformation wait stack-delete-complete --stack-name "$stack_name"
|
||||
|
||||
if aws ecr describe-repositories --repository-names "$ecr_repo" >/dev/null 2>&1; then
|
||||
aws ecr delete-repository --repository-name "$ecr_repo" --force
|
||||
fi
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
FROM public.ecr.aws/docker/library/nginx:1.27-alpine
|
||||
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
COPY . /usr/share/nginx/html
|
||||
|
||||
EXPOSE 8080
|
||||
@@ -0,0 +1,24 @@
|
||||
# the-mardown-converter
|
||||
|
||||
This repository was generated from the Backstage **Paste-and-Deploy Static Web App** template.
|
||||
|
||||
## What you get
|
||||
|
||||
- `index.html` written from the pasted HTML
|
||||
- `assets/site.css` written from the optional CSS
|
||||
- `assets/site.js` written from the optional JavaScript
|
||||
- Nginx configuration
|
||||
- Dockerfile serving the site on port 8080
|
||||
- Backstage `catalog-info.yaml`
|
||||
|
||||
If you included separate CSS or JavaScript, make sure your HTML references:
|
||||
|
||||
- `/assets/site.css`
|
||||
- `/assets/site.js`
|
||||
|
||||
## Run locally with Docker
|
||||
|
||||
```bash
|
||||
docker build -t the-mardown-converter .
|
||||
docker run --rm -p 8080:8080 the-mardown-converter
|
||||
```
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
apiVersion: backstage.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: "the-mardown-converter"
|
||||
description: "A markdown converter for AI agent responses"
|
||||
tags:
|
||||
- static
|
||||
- website
|
||||
- nginx
|
||||
- ai
|
||||
|
||||
|
||||
|
||||
annotations:
|
||||
|
||||
toolzoo.io/created-by: "user:default/towhitfield@proofpoint.com"
|
||||
|
||||
backstage.io/techdocs-ref: dir:.
|
||||
spec:
|
||||
type: website
|
||||
owner: "group:default/seti"
|
||||
lifecycle: experimental
|
||||
@@ -0,0 +1,18 @@
|
||||
# the-mardown-converter
|
||||
|
||||
## Overview
|
||||
|
||||
A markdown converter for AI agent responses
|
||||
|
||||
## Operations
|
||||
|
||||
- Runtime port: `8080`
|
||||
- Health check path: `/`
|
||||
- Deployment: Gitea Actions publishes a container image and updates the ECS service stack on pushes to `main`.
|
||||
- `index.html` is written from the pasted HTML field.
|
||||
- `assets/site.css` and `assets/site.js` are optional companion files for pasted CSS and JavaScript.
|
||||
- After scaffold, track workflow in SETI Gitea -> Actions.
|
||||
|
||||
## Ownership
|
||||
|
||||
- Catalog owner: `group:default/seti`
|
||||
+603
@@ -0,0 +1,603 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>The Markdown Converter</title>
|
||||
<style>
|
||||
:root {
|
||||
--bg: #ffffff;
|
||||
--surface: #f7fbff;
|
||||
--surface-strong: #eef7f8;
|
||||
--text: #102033;
|
||||
--muted: #5b7285;
|
||||
--border: #cce3ea;
|
||||
--primary: #0877c9;
|
||||
--primary-strong: #075ea1;
|
||||
--accent: #00a98f;
|
||||
--accent-strong: #008f78;
|
||||
--shadow: 0 20px 45px rgba(8, 119, 201, 0.12);
|
||||
--code-bg: #eaf4f7;
|
||||
--preview-bg: #ffffff;
|
||||
}
|
||||
|
||||
body.dark {
|
||||
--bg: #06111d;
|
||||
--surface: #0c1f2e;
|
||||
--surface-strong: #102d3a;
|
||||
--text: #e8f8ff;
|
||||
--muted: #9bc3cf;
|
||||
--border: #214657;
|
||||
--primary: #27a8ff;
|
||||
--primary-strong: #7ed0ff;
|
||||
--accent: #22d3b6;
|
||||
--accent-strong: #6fffe3;
|
||||
--shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
|
||||
--code-bg: #102737;
|
||||
--preview-bg: #081925;
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
min-height: 100vh;
|
||||
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
||||
color: var(--text);
|
||||
background:
|
||||
radial-gradient(circle at top left, rgba(0, 169, 143, 0.12), transparent 28rem),
|
||||
radial-gradient(circle at top right, rgba(8, 119, 201, 0.14), transparent 28rem),
|
||||
var(--bg);
|
||||
transition: background 0.25s ease, color 0.25s ease;
|
||||
}
|
||||
|
||||
.page {
|
||||
width: min(1440px, calc(100% - 32px));
|
||||
margin: 0 auto;
|
||||
padding: 28px 0 36px;
|
||||
}
|
||||
|
||||
header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 20px;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.title-wrap {
|
||||
display: grid;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 0;
|
||||
font-size: clamp(2rem, 5vw, 4.3rem);
|
||||
letter-spacing: 0.08em;
|
||||
line-height: 1;
|
||||
text-transform: uppercase;
|
||||
color: transparent;
|
||||
-webkit-text-stroke: 1.6px var(--primary);
|
||||
text-shadow:
|
||||
0 0 8px rgba(39, 168, 255, 0.65),
|
||||
0 0 18px rgba(0, 169, 143, 0.45),
|
||||
0 0 34px rgba(8, 119, 201, 0.25);
|
||||
font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
margin: 0;
|
||||
color: var(--muted);
|
||||
font-size: 0.98rem;
|
||||
}
|
||||
|
||||
.toolbar {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
button {
|
||||
border: 0;
|
||||
border-radius: 999px;
|
||||
padding: 11px 16px;
|
||||
font-weight: 700;
|
||||
color: #ffffff;
|
||||
cursor: pointer;
|
||||
background: linear-gradient(135deg, var(--primary), var(--accent));
|
||||
box-shadow: 0 10px 24px rgba(8, 119, 201, 0.22);
|
||||
transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
|
||||
}
|
||||
|
||||
button.secondary {
|
||||
color: var(--text);
|
||||
background: var(--surface-strong);
|
||||
border: 1px solid var(--border);
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 14px 28px rgba(8, 119, 201, 0.28);
|
||||
}
|
||||
|
||||
button.secondary:hover {
|
||||
box-shadow: 0 10px 24px rgba(8, 119, 201, 0.12);
|
||||
}
|
||||
|
||||
.layout {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 20px;
|
||||
min-height: 70vh;
|
||||
}
|
||||
|
||||
.panel {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 70vh;
|
||||
overflow: hidden;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 24px;
|
||||
background: var(--surface);
|
||||
box-shadow: var(--shadow);
|
||||
}
|
||||
|
||||
.panel-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
padding: 16px 18px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
background: linear-gradient(135deg, rgba(8, 119, 201, 0.10), rgba(0, 169, 143, 0.10));
|
||||
}
|
||||
|
||||
.panel-title {
|
||||
margin: 0;
|
||||
font-size: 1rem;
|
||||
letter-spacing: 0.02em;
|
||||
}
|
||||
|
||||
.status {
|
||||
min-height: 1.3rem;
|
||||
color: var(--accent-strong);
|
||||
font-size: 0.86rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
textarea {
|
||||
flex: 1;
|
||||
width: 100%;
|
||||
min-height: 520px;
|
||||
resize: none;
|
||||
padding: 22px;
|
||||
border: 0;
|
||||
outline: none;
|
||||
color: var(--text);
|
||||
background: transparent;
|
||||
font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
|
||||
font-size: 0.98rem;
|
||||
line-height: 1.58;
|
||||
}
|
||||
|
||||
.preview {
|
||||
flex: 1;
|
||||
min-height: 520px;
|
||||
padding: 24px;
|
||||
overflow: auto;
|
||||
background: var(--preview-bg);
|
||||
line-height: 1.65;
|
||||
}
|
||||
|
||||
.preview h1,
|
||||
.preview h2,
|
||||
.preview h3 {
|
||||
line-height: 1.2;
|
||||
margin-top: 1.2em;
|
||||
margin-bottom: 0.45em;
|
||||
color: var(--primary-strong);
|
||||
}
|
||||
|
||||
.preview h1:first-child,
|
||||
.preview h2:first-child,
|
||||
.preview h3:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.preview p {
|
||||
margin: 0 0 1em;
|
||||
}
|
||||
|
||||
.preview a {
|
||||
color: var(--accent-strong);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.preview blockquote {
|
||||
margin: 1em 0;
|
||||
padding: 12px 16px;
|
||||
border-left: 4px solid var(--accent);
|
||||
border-radius: 12px;
|
||||
background: var(--surface-strong);
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.preview code {
|
||||
padding: 0.18rem 0.36rem;
|
||||
border-radius: 7px;
|
||||
background: var(--code-bg);
|
||||
font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
|
||||
font-size: 0.92em;
|
||||
}
|
||||
|
||||
.preview pre {
|
||||
overflow-x: auto;
|
||||
padding: 16px;
|
||||
border-radius: 16px;
|
||||
background: var(--code-bg);
|
||||
border: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.preview pre code {
|
||||
padding: 0;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.preview table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
margin: 1em 0;
|
||||
overflow: hidden;
|
||||
border-radius: 14px;
|
||||
}
|
||||
|
||||
.preview th,
|
||||
.preview td {
|
||||
border: 1px solid var(--border);
|
||||
padding: 10px 12px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.preview th {
|
||||
background: var(--surface-strong);
|
||||
}
|
||||
|
||||
.preview hr {
|
||||
border: 0;
|
||||
border-top: 1px solid var(--border);
|
||||
margin: 1.5em 0;
|
||||
}
|
||||
|
||||
.footer-note {
|
||||
margin: 18px 4px 0;
|
||||
color: var(--muted);
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
header {
|
||||
align-items: flex-start;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.toolbar {
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.layout {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.panel,
|
||||
textarea,
|
||||
.preview {
|
||||
min-height: 420px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<main class="page">
|
||||
<header>
|
||||
<div class="title-wrap">
|
||||
<h1>The Markdown Converter</h1>
|
||||
<p class="subtitle">Paste Markdown on the left. Preview rich text on the right. Copy the preview into Word or another editor.</p>
|
||||
</div>
|
||||
<div class="toolbar">
|
||||
<button id="copyPreviewBtn" type="button">Copy Preview</button>
|
||||
<button id="darkModeBtn" class="secondary" type="button" aria-pressed="false">Dark Mode</button>
|
||||
<button id="clearBtn" class="secondary" type="button">Clear</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<section class="layout" aria-label="Markdown editor and preview">
|
||||
<article class="panel">
|
||||
<div class="panel-header">
|
||||
<h2 class="panel-title">Markdown Input</h2>
|
||||
<span class="status" id="inputStatus">Ready</span>
|
||||
</div>
|
||||
<textarea id="markdownInput" spellcheck="false" aria-label="Markdown input"># Paste an AI response here
|
||||
|
||||
Use this page to preview Markdown before pasting it somewhere else.
|
||||
|
||||
## Features
|
||||
|
||||
- **Side-by-side editing and preview**
|
||||
- Copy the rendered preview as rich HTML
|
||||
- Light and dark mode
|
||||
- Modern blue and green UI
|
||||
|
||||
> This blockquote should paste nicely into Microsoft Word.
|
||||
|
||||
```powershell
|
||||
Get-Service | Where-Object Status -eq 'Running'
|
||||
```
|
||||
|
||||
| Item | Status |
|
||||
| --- | --- |
|
||||
| Markdown preview | Working |
|
||||
| Copy button | Ready |
|
||||
|
||||
[Example link](https://example.com)</textarea>
|
||||
</article>
|
||||
|
||||
<article class="panel">
|
||||
<div class="panel-header">
|
||||
<h2 class="panel-title">Live Preview</h2>
|
||||
<span class="status" id="copyStatus"></span>
|
||||
</div>
|
||||
<div id="preview" class="preview" aria-label="Markdown preview"></div>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
<p class="footer-note">Tip: use <strong>Copy Preview</strong> to copy the rendered content, not the raw Markdown.</p>
|
||||
</main>
|
||||
|
||||
<script>
|
||||
const markdownInput = document.getElementById('markdownInput');
|
||||
const preview = document.getElementById('preview');
|
||||
const copyPreviewBtn = document.getElementById('copyPreviewBtn');
|
||||
const darkModeBtn = document.getElementById('darkModeBtn');
|
||||
const clearBtn = document.getElementById('clearBtn');
|
||||
const copyStatus = document.getElementById('copyStatus');
|
||||
const inputStatus = document.getElementById('inputStatus');
|
||||
|
||||
function escapeHtml(value) {
|
||||
return value
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, ''');
|
||||
}
|
||||
|
||||
function parseInline(text) {
|
||||
let output = escapeHtml(text);
|
||||
|
||||
output = output.replace(/`([^`]+)`/g, '<code>$1</code>');
|
||||
output = output.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>');
|
||||
output = output.replace(/__([^_]+)__/g, '<strong>$1</strong>');
|
||||
output = output.replace(/\*([^*]+)\*/g, '<em>$1</em>');
|
||||
output = output.replace(/_([^_]+)_/g, '<em>$1</em>');
|
||||
output = output.replace(/\[([^\]]+)\]\(([^\s)]+)\)/g, '<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>');
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
function parseMarkdown(markdown) {
|
||||
const lines = markdown.replace(/\r\n/g, '\n').split('\n');
|
||||
let html = '';
|
||||
let inCodeBlock = false;
|
||||
let codeBuffer = [];
|
||||
let inList = false;
|
||||
let inTable = false;
|
||||
let tableRows = [];
|
||||
|
||||
function closeList() {
|
||||
if (inList) {
|
||||
html += '</ul>';
|
||||
inList = false;
|
||||
}
|
||||
}
|
||||
|
||||
function flushTable() {
|
||||
if (!inTable || tableRows.length === 0) return;
|
||||
|
||||
const header = tableRows[0];
|
||||
const body = tableRows.slice(2);
|
||||
|
||||
html += '<table><thead><tr>';
|
||||
header.forEach(cell => html += `<th>${parseInline(cell.trim())}</th>`);
|
||||
html += '</tr></thead><tbody>';
|
||||
|
||||
body.forEach(row => {
|
||||
html += '<tr>';
|
||||
row.forEach(cell => html += `<td>${parseInline(cell.trim())}</td>`);
|
||||
html += '</tr>';
|
||||
});
|
||||
|
||||
html += '</tbody></table>';
|
||||
tableRows = [];
|
||||
inTable = false;
|
||||
}
|
||||
|
||||
function isTableDivider(line) {
|
||||
return /^\s*\|?\s*:?-{3,}:?\s*(\|\s*:?-{3,}:?\s*)+\|?\s*$/.test(line);
|
||||
}
|
||||
|
||||
function parseTableRow(line) {
|
||||
return line.trim().replace(/^\|/, '').replace(/\|$/, '').split('|');
|
||||
}
|
||||
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
const line = lines[i];
|
||||
const trimmed = line.trim();
|
||||
|
||||
if (trimmed.startsWith('```')) {
|
||||
closeList();
|
||||
flushTable();
|
||||
|
||||
if (!inCodeBlock) {
|
||||
inCodeBlock = true;
|
||||
codeBuffer = [];
|
||||
} else {
|
||||
html += `<pre><code>${escapeHtml(codeBuffer.join('\n'))}</code></pre>`;
|
||||
inCodeBlock = false;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (inCodeBlock) {
|
||||
codeBuffer.push(line);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (trimmed.includes('|') && lines[i + 1] && isTableDivider(lines[i + 1])) {
|
||||
closeList();
|
||||
flushTable();
|
||||
inTable = true;
|
||||
tableRows.push(parseTableRow(line));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (inTable) {
|
||||
if (isTableDivider(line)) {
|
||||
tableRows.push(parseTableRow(line));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (trimmed.includes('|')) {
|
||||
tableRows.push(parseTableRow(line));
|
||||
continue;
|
||||
}
|
||||
|
||||
flushTable();
|
||||
}
|
||||
|
||||
if (!trimmed) {
|
||||
closeList();
|
||||
flushTable();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (/^---+$/.test(trimmed)) {
|
||||
closeList();
|
||||
flushTable();
|
||||
html += '<hr />';
|
||||
continue;
|
||||
}
|
||||
|
||||
const headingMatch = trimmed.match(/^(#{1,6})\s+(.+)$/);
|
||||
if (headingMatch) {
|
||||
closeList();
|
||||
flushTable();
|
||||
const level = headingMatch[1].length;
|
||||
html += `<h${level}>${parseInline(headingMatch[2])}</h${level}>`;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (trimmed.startsWith('> ')) {
|
||||
closeList();
|
||||
flushTable();
|
||||
html += `<blockquote>${parseInline(trimmed.slice(2))}</blockquote>`;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (/^[-*+]\s+/.test(trimmed)) {
|
||||
flushTable();
|
||||
if (!inList) {
|
||||
html += '<ul>';
|
||||
inList = true;
|
||||
}
|
||||
html += `<li>${parseInline(trimmed.replace(/^[-*+]\s+/, ''))}</li>`;
|
||||
continue;
|
||||
}
|
||||
|
||||
closeList();
|
||||
flushTable();
|
||||
html += `<p>${parseInline(trimmed)}</p>`;
|
||||
}
|
||||
|
||||
closeList();
|
||||
flushTable();
|
||||
|
||||
if (inCodeBlock) {
|
||||
html += `<pre><code>${escapeHtml(codeBuffer.join('\n'))}</code></pre>`;
|
||||
}
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
function updatePreview() {
|
||||
preview.innerHTML = parseMarkdown(markdownInput.value);
|
||||
inputStatus.textContent = `${markdownInput.value.length.toLocaleString()} characters`;
|
||||
}
|
||||
|
||||
async function copyPreview() {
|
||||
copyStatus.textContent = '';
|
||||
|
||||
const html = preview.innerHTML;
|
||||
const plainText = preview.innerText;
|
||||
|
||||
try {
|
||||
if (navigator.clipboard && window.ClipboardItem) {
|
||||
const htmlBlob = new Blob([html], { type: 'text/html' });
|
||||
const textBlob = new Blob([plainText], { type: 'text/plain' });
|
||||
await navigator.clipboard.write([
|
||||
new ClipboardItem({
|
||||
'text/html': htmlBlob,
|
||||
'text/plain': textBlob
|
||||
})
|
||||
]);
|
||||
} else {
|
||||
const range = document.createRange();
|
||||
range.selectNodeContents(preview);
|
||||
const selection = window.getSelection();
|
||||
selection.removeAllRanges();
|
||||
selection.addRange(range);
|
||||
document.execCommand('copy');
|
||||
selection.removeAllRanges();
|
||||
}
|
||||
|
||||
copyStatus.textContent = 'Preview copied';
|
||||
} catch (error) {
|
||||
copyStatus.textContent = 'Copy failed';
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
window.setTimeout(() => copyStatus.textContent = '', 2200);
|
||||
}
|
||||
|
||||
function toggleDarkMode() {
|
||||
const isDark = document.body.classList.toggle('dark');
|
||||
darkModeBtn.textContent = isDark ? 'Light Mode' : 'Dark Mode';
|
||||
darkModeBtn.setAttribute('aria-pressed', String(isDark));
|
||||
localStorage.setItem('markdown-converter-theme', isDark ? 'dark' : 'light');
|
||||
}
|
||||
|
||||
function clearEditor() {
|
||||
markdownInput.value = '';
|
||||
updatePreview();
|
||||
markdownInput.focus();
|
||||
}
|
||||
|
||||
markdownInput.addEventListener('input', updatePreview);
|
||||
copyPreviewBtn.addEventListener('click', copyPreview);
|
||||
darkModeBtn.addEventListener('click', toggleDarkMode);
|
||||
clearBtn.addEventListener('click', clearEditor);
|
||||
|
||||
if (localStorage.getItem('markdown-converter-theme') === 'dark') {
|
||||
document.body.classList.add('dark');
|
||||
darkModeBtn.textContent = 'Light Mode';
|
||||
darkModeBtn.setAttribute('aria-pressed', 'true');
|
||||
}
|
||||
|
||||
updatePreview();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,311 @@
|
||||
AWSTemplateFormatVersion: '2010-09-09'
|
||||
Description: |
|
||||
Tool Zoo application service stack. Builds a dedicated ECS Fargate web service
|
||||
with an internet-facing ALB and a stable CloudFormation-managed URL.
|
||||
|
||||
Parameters:
|
||||
EnvironmentName:
|
||||
Type: String
|
||||
AllowedPattern: ^[a-zA-Z0-9-]+$
|
||||
Description: Prefix used for naming resources.
|
||||
|
||||
ServiceName:
|
||||
Type: String
|
||||
AllowedPattern: ^[a-z0-9-]+$
|
||||
Description: Logical service name used for the ECS service and log group.
|
||||
|
||||
ContainerImage:
|
||||
Type: String
|
||||
Description: Fully-qualified container image URI to deploy.
|
||||
|
||||
ContainerPort:
|
||||
Type: Number
|
||||
Default: 8080
|
||||
MinValue: 1
|
||||
MaxValue: 65535
|
||||
Description: Port exposed by the web container.
|
||||
|
||||
HealthCheckPath:
|
||||
Type: String
|
||||
Default: "/"
|
||||
Description: HTTP path used by the ALB health check.
|
||||
|
||||
DesiredCount:
|
||||
Type: Number
|
||||
Default: 1
|
||||
MinValue: 1
|
||||
MaxValue: 3
|
||||
Description: Number of running tasks.
|
||||
|
||||
TaskCpu:
|
||||
Type: Number
|
||||
Default: 512
|
||||
AllowedValues:
|
||||
- 256
|
||||
- 512
|
||||
- 1024
|
||||
- 2048
|
||||
- 4096
|
||||
Description: Fargate task CPU units.
|
||||
|
||||
TaskMemory:
|
||||
Type: Number
|
||||
Default: 1024
|
||||
AllowedValues:
|
||||
- 512
|
||||
- 1024
|
||||
- 2048
|
||||
- 3072
|
||||
- 4096
|
||||
- 5120
|
||||
- 6144
|
||||
- 7168
|
||||
- 8192
|
||||
Description: Fargate task memory in MiB.
|
||||
|
||||
Mappings:
|
||||
SubnetConfig:
|
||||
Vpc:
|
||||
CIDR: 10.52.0.0/16
|
||||
PublicOne:
|
||||
CIDR: 10.52.0.0/24
|
||||
PublicTwo:
|
||||
CIDR: 10.52.1.0/24
|
||||
|
||||
Resources:
|
||||
Vpc:
|
||||
Type: AWS::EC2::VPC
|
||||
Properties:
|
||||
CidrBlock: !FindInMap [SubnetConfig, Vpc, CIDR]
|
||||
EnableDnsHostnames: true
|
||||
EnableDnsSupport: true
|
||||
Tags:
|
||||
- Key: Name
|
||||
Value: !Sub ${EnvironmentName}-vpc
|
||||
|
||||
InternetGateway:
|
||||
Type: AWS::EC2::InternetGateway
|
||||
Properties:
|
||||
Tags:
|
||||
- Key: Name
|
||||
Value: !Sub ${EnvironmentName}-igw
|
||||
|
||||
VpcGatewayAttachment:
|
||||
Type: AWS::EC2::VPCGatewayAttachment
|
||||
Properties:
|
||||
InternetGatewayId: !Ref InternetGateway
|
||||
VpcId: !Ref Vpc
|
||||
|
||||
PublicSubnetOne:
|
||||
Type: AWS::EC2::Subnet
|
||||
Properties:
|
||||
VpcId: !Ref Vpc
|
||||
AvailabilityZone: !Select [0, !GetAZs '']
|
||||
CidrBlock: !FindInMap [SubnetConfig, PublicOne, CIDR]
|
||||
MapPublicIpOnLaunch: true
|
||||
Tags:
|
||||
- Key: Name
|
||||
Value: !Sub ${EnvironmentName}-public-a
|
||||
|
||||
PublicSubnetTwo:
|
||||
Type: AWS::EC2::Subnet
|
||||
Properties:
|
||||
VpcId: !Ref Vpc
|
||||
AvailabilityZone: !Select [1, !GetAZs '']
|
||||
CidrBlock: !FindInMap [SubnetConfig, PublicTwo, CIDR]
|
||||
MapPublicIpOnLaunch: true
|
||||
Tags:
|
||||
- Key: Name
|
||||
Value: !Sub ${EnvironmentName}-public-b
|
||||
|
||||
PublicRouteTable:
|
||||
Type: AWS::EC2::RouteTable
|
||||
Properties:
|
||||
VpcId: !Ref Vpc
|
||||
Tags:
|
||||
- Key: Name
|
||||
Value: !Sub ${EnvironmentName}-public-rt
|
||||
|
||||
PublicDefaultRoute:
|
||||
Type: AWS::EC2::Route
|
||||
DependsOn: VpcGatewayAttachment
|
||||
Properties:
|
||||
RouteTableId: !Ref PublicRouteTable
|
||||
DestinationCidrBlock: 0.0.0.0/0
|
||||
GatewayId: !Ref InternetGateway
|
||||
|
||||
PublicSubnetOneRouteTableAssociation:
|
||||
Type: AWS::EC2::SubnetRouteTableAssociation
|
||||
Properties:
|
||||
RouteTableId: !Ref PublicRouteTable
|
||||
SubnetId: !Ref PublicSubnetOne
|
||||
|
||||
PublicSubnetTwoRouteTableAssociation:
|
||||
Type: AWS::EC2::SubnetRouteTableAssociation
|
||||
Properties:
|
||||
RouteTableId: !Ref PublicRouteTable
|
||||
SubnetId: !Ref PublicSubnetTwo
|
||||
|
||||
LoadBalancerSecurityGroup:
|
||||
Type: AWS::EC2::SecurityGroup
|
||||
Properties:
|
||||
GroupDescription: !Sub ${EnvironmentName} ALB ingress
|
||||
VpcId: !Ref Vpc
|
||||
SecurityGroupIngress:
|
||||
- IpProtocol: tcp
|
||||
FromPort: 80
|
||||
ToPort: 80
|
||||
CidrIp: 0.0.0.0/0
|
||||
SecurityGroupEgress:
|
||||
- IpProtocol: -1
|
||||
CidrIp: 0.0.0.0/0
|
||||
|
||||
ServiceSecurityGroup:
|
||||
Type: AWS::EC2::SecurityGroup
|
||||
Properties:
|
||||
GroupDescription: !Sub ${EnvironmentName} ECS service ingress
|
||||
VpcId: !Ref Vpc
|
||||
SecurityGroupIngress:
|
||||
- IpProtocol: tcp
|
||||
FromPort: !Ref ContainerPort
|
||||
ToPort: !Ref ContainerPort
|
||||
SourceSecurityGroupId: !Ref LoadBalancerSecurityGroup
|
||||
SecurityGroupEgress:
|
||||
- IpProtocol: -1
|
||||
CidrIp: 0.0.0.0/0
|
||||
|
||||
ApplicationLoadBalancer:
|
||||
Type: AWS::ElasticLoadBalancingV2::LoadBalancer
|
||||
Properties:
|
||||
Scheme: internet-facing
|
||||
Type: application
|
||||
SecurityGroups:
|
||||
- !Ref LoadBalancerSecurityGroup
|
||||
Subnets:
|
||||
- !Ref PublicSubnetOne
|
||||
- !Ref PublicSubnetTwo
|
||||
|
||||
ApplicationTargetGroup:
|
||||
Type: AWS::ElasticLoadBalancingV2::TargetGroup
|
||||
Properties:
|
||||
Port: !Ref ContainerPort
|
||||
Protocol: HTTP
|
||||
TargetType: ip
|
||||
VpcId: !Ref Vpc
|
||||
HealthCheckEnabled: true
|
||||
HealthCheckPath: !Ref HealthCheckPath
|
||||
HealthCheckProtocol: HTTP
|
||||
Matcher:
|
||||
HttpCode: 200-399
|
||||
|
||||
ApplicationListener:
|
||||
Type: AWS::ElasticLoadBalancingV2::Listener
|
||||
Properties:
|
||||
DefaultActions:
|
||||
- Type: forward
|
||||
TargetGroupArn: !Ref ApplicationTargetGroup
|
||||
LoadBalancerArn: !Ref ApplicationLoadBalancer
|
||||
Port: 80
|
||||
Protocol: HTTP
|
||||
|
||||
LogGroup:
|
||||
Type: AWS::Logs::LogGroup
|
||||
Properties:
|
||||
LogGroupName: !Sub /aws/ecs/${EnvironmentName}/${ServiceName}
|
||||
RetentionInDays: 14
|
||||
|
||||
Cluster:
|
||||
Type: AWS::ECS::Cluster
|
||||
Properties:
|
||||
ClusterName: !Sub ${EnvironmentName}-cluster
|
||||
|
||||
TaskExecutionRole:
|
||||
Type: AWS::IAM::Role
|
||||
Properties:
|
||||
RoleName: !Sub ${EnvironmentName}-task-exec-role
|
||||
AssumeRolePolicyDocument:
|
||||
Version: '2012-10-17'
|
||||
Statement:
|
||||
- Effect: Allow
|
||||
Principal:
|
||||
Service:
|
||||
- ecs-tasks.amazonaws.com
|
||||
Action:
|
||||
- sts:AssumeRole
|
||||
ManagedPolicyArns:
|
||||
- arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy
|
||||
|
||||
TaskRole:
|
||||
Type: AWS::IAM::Role
|
||||
Properties:
|
||||
RoleName: !Sub ${EnvironmentName}-task-role
|
||||
AssumeRolePolicyDocument:
|
||||
Version: '2012-10-17'
|
||||
Statement:
|
||||
- Effect: Allow
|
||||
Principal:
|
||||
Service:
|
||||
- ecs-tasks.amazonaws.com
|
||||
Action:
|
||||
- sts:AssumeRole
|
||||
|
||||
TaskDefinition:
|
||||
Type: AWS::ECS::TaskDefinition
|
||||
Properties:
|
||||
Family: !Sub ${EnvironmentName}-taskdef
|
||||
Cpu: !Ref TaskCpu
|
||||
Memory: !Ref TaskMemory
|
||||
NetworkMode: awsvpc
|
||||
RequiresCompatibilities:
|
||||
- FARGATE
|
||||
ExecutionRoleArn: !GetAtt TaskExecutionRole.Arn
|
||||
TaskRoleArn: !GetAtt TaskRole.Arn
|
||||
ContainerDefinitions:
|
||||
- Name: web
|
||||
Image: !Ref ContainerImage
|
||||
Essential: true
|
||||
PortMappings:
|
||||
- ContainerPort: !Ref ContainerPort
|
||||
Protocol: tcp
|
||||
Environment:
|
||||
- Name: PORT
|
||||
Value: !Sub '${ContainerPort}'
|
||||
LogConfiguration:
|
||||
LogDriver: awslogs
|
||||
Options:
|
||||
awslogs-group: !Ref LogGroup
|
||||
awslogs-region: !Ref AWS::Region
|
||||
awslogs-stream-prefix: web
|
||||
|
||||
Service:
|
||||
Type: AWS::ECS::Service
|
||||
DependsOn:
|
||||
- ApplicationListener
|
||||
Properties:
|
||||
ServiceName: !Ref ServiceName
|
||||
Cluster: !Ref Cluster
|
||||
LaunchType: FARGATE
|
||||
DesiredCount: !Ref DesiredCount
|
||||
HealthCheckGracePeriodSeconds: 120
|
||||
NetworkConfiguration:
|
||||
AwsvpcConfiguration:
|
||||
AssignPublicIp: ENABLED
|
||||
SecurityGroups:
|
||||
- !Ref ServiceSecurityGroup
|
||||
Subnets:
|
||||
- !Ref PublicSubnetOne
|
||||
- !Ref PublicSubnetTwo
|
||||
LoadBalancers:
|
||||
- TargetGroupArn: !Ref ApplicationTargetGroup
|
||||
ContainerName: web
|
||||
ContainerPort: !Ref ContainerPort
|
||||
TaskDefinition: !Ref TaskDefinition
|
||||
|
||||
Outputs:
|
||||
ServiceUrl:
|
||||
Description: Public URL for the deployed Tool Zoo service
|
||||
Value: !Sub http://${ApplicationLoadBalancer.DNSName}
|
||||
|
||||
ClusterName:
|
||||
Description: ECS cluster name for the deployed service
|
||||
Value: !Ref Cluster
|
||||
@@ -0,0 +1,8 @@
|
||||
site_name: the-mardown-converter
|
||||
site_description: A markdown converter for AI agent responses
|
||||
|
||||
nav:
|
||||
- Overview: docs/index.md
|
||||
|
||||
plugins:
|
||||
- techdocs-core
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
server {
|
||||
listen 8080;
|
||||
server_name _;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user