Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] Created AI Converter + Added Static Web App Exec Doc #126

Merged
merged 27 commits into from
Jan 31, 2024
Merged
Changes from 24 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
74f8f93
added static web app exec doc
naman-msft Nov 1, 2023
1a7708f
add env variables, echoed website url at the end, formatted the doc
naman-msft Nov 2, 2023
28df129
removed the first duplicate staticwebapp show block
naman-msft Nov 2, 2023
c9476b7
made small formatting changes;
naman-msft Nov 2, 2023
b9fad3c
added github action for automated PR generation for AI-generated exec…
naman-msft Nov 27, 2023
ba5712a
added github action for automated PR generation for ai-generated-docs
naman-msft Nov 27, 2023
5f7871a
made some changes to the converter
naman-msft Nov 28, 2023
530193d
added test readme.md files
naman-msft Nov 28, 2023
9d03147
modified file name for pr
naman-msft Nov 28, 2023
ffbb3cb
modified file name for pr
naman-msft Nov 28, 2023
910b998
AI generated doc titled
naman-msft Nov 28, 2023
ab8b498
changed filename for pr
naman-msft Nov 28, 2023
468b528
changed filename for pr
naman-msft Nov 28, 2023
fc012cf
successfully tested ai pipeline for existing exec docs now testing fo…
naman-msft Nov 28, 2023
4aba19a
successfully tested ai pipeline for existing exec docs now testing fo…
naman-msft Nov 28, 2023
c9bf735
made changes to tool it now works
naman-msft Nov 29, 2023
9700a8c
cleaned the converter and removed a file from AIDocs
naman-msft Nov 29, 2023
8277b62
cleaned the code and added comments at necessary places
naman-msft Nov 29, 2023
c157a62
added input functionality for testing exec docs
naman-msft Dec 5, 2023
159e033
placed the ai tool called converter under the scripts subfolder/ai_ge…
naman-msft Dec 6, 2023
891c38f
configured the directory access and ie testing
naman-msft Dec 6, 2023
7d5acd9
amended some code
naman-msft Dec 7, 2023
97d6015
fixed curl issue while loading the app
naman-msft Jan 31, 2024
25be3f1
fixed static web app
naman-msft Jan 31, 2024
78575e9
fixed static web app
naman-msft Jan 31, 2024
62056bd
re-added linux vm doc
naman-msft Jan 31, 2024
0f3049b
fixed static web app
naman-msft Jan 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/ai-docs-auto-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Create PR

on:
push:
branches:
- 'naman_code'

jobs:
create_pr:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install dependencies
run: |
python -m pip install --upgrade pip

- name: Get doc-name
id: doc-name
run: |
python get_exec_doc_name.py

- name: Create PR
uses: peter-evans/create-pull-request@v3
with:
title: "[RFC] ${{ steps.doc-name.outputs.name }}"
branch: "${{ github.ref }}"
53 changes: 53 additions & 0 deletions cloud-init-nginx.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#cloud-config

# Install, update, and upgrade packages
package_upgrade: true
package_update: true
package_reboot_if_require: true

# Install packages
packages:
- nginx

write_files:
- owner: www-data:www-data
- path: /etc/nginx/sites-available/secure-server
content: |
server {
server_name mydnslabela57f44.eastus.cloudapp.azure.com;
listen 443 ssl http2;
ssl_certificate /etc/nginx/ssl/nginxcerta57f44.crt;
ssl_certificate_key /etc/nginx/ssl/nginxcerta57f44.key;
}
server {
listen 80;
server_name mydnslabela57f44.eastus.cloudapp.azure.com;
return 301 https://mydnslabela57f44.eastus.cloudapp.azure.com$request_uri;
}

- owner: root:root
path: /root/convert_akv_cert.sh
permissions: "0750"
content: |
#!/bin/bash
runtime="10 minute"; endtime=$(date -ud "$runtime" +%s);
while [[ $(date -u +%s) -le $endtime ]]; do
if [[ ! -f /etc/nginx/ssl/mykeyvaulta57f44.nginxcerta57f44 ]]
then
sleep 5;
else
break;
fi;
done
# Split the file in two (cert and key)
echo "Creating .key file with private key..."
openssl rsa -outform pem -in /etc/nginx/ssl/mykeyvaulta57f44.nginxcerta57f44 -out /etc/nginx/ssl/nginxcerta57f44.key
echo "Creating .crt file with certificate..."
openssl x509 -outform pem -in /etc/nginx/ssl/mykeyvaulta57f44.nginxcerta57f44 -out /etc/nginx/ssl/nginxcerta57f44.crt
runcmd:
- mkdir /etc/nginx/ssl
- ln -s /etc/nginx/sites-available/secure-server /etc/nginx/sites-enabled/
- rm /etc/nginx/sites-enabled/default
- bash /root/convert_akv_cert.sh
- (crontab -l 2>/dev/null; echo "0 * * * * /root/convert_akv_cert.sh && service nginx reload") | crontab -
- service nginx restart
2 changes: 1 addition & 1 deletion scenarios/ocd/CreateLinuxVMAndSSH/README.md
Original file line number Diff line number Diff line change
@@ -117,4 +117,4 @@ ssh -o StrictHostKeyChecking=no $MY_USERNAME@$IP_ADDRESS
* [VM Documentation](https://learn.microsoft.com/en-us/azure/virtual-machines/)
* [Use Cloud-Init to initialize a Linux VM on first boot](https://learn.microsoft.com/en-us/azure/virtual-machines/linux/tutorial-automate-vm-deployment)
* [Create custom VM images](https://learn.microsoft.com/en-us/azure/virtual-machines/linux/tutorial-custom-images)
* [Load Balance VMs](https://learn.microsoft.com/en-us/azure/load-balancer/quickstart-load-balancer-standard-public-cli)
* [Load Balance VMs](https://learn.microsoft.com/en-us/azure/load-balancer/quickstart-load-balancer-standard-public-cli)
143 changes: 143 additions & 0 deletions scenarios/ocd/CreateStaticWebApp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
# Azure Static Web Apps Quickstart: Building Your First Static Site Using the Azure CLI

Azure Static Web Apps publishes websites to production by building apps from a code repository. In this quickstart, you deploy a web application to Azure Static Web Apps using the Azure CLI.

## Define Environment Variables

The First step in this tutorial is to define environment variables.

```bash
export RANDOM_ID="$(openssl rand -hex 3)"
export MY_RESOURCE_GROUP_NAME="myStaticWebAppResourceGroup$RANDOM_ID"
export REGION=EastUS2
export MY_STATIC_WEB_APP_NAME="myStaticWebApp$RANDOM_ID"
```

## Create a Repository (optional)

(Optional) This article uses a GitHub template repository as another way to make it easy for you to get started. The template features a starter app to deploy to Azure Static Web Apps.

- Navigate to the following location to create a new repository: https://github.com/staticwebdev/vanilla-basic/generate
- Name your repository `my-first-static-web-app`

> **Note:** Azure Static Web Apps requires at least one HTML file to create a web app. The repository you create in this step includes a single `index.html` file.

Select `Create repository`.

## Deploy a Static Web App

You can deploy the app as a static web app from the Azure CLI.

1. Create a resource group.

```bash
az group create \
--name $MY_RESOURCE_GROUP_NAME \
--location $REGION
```

Results:

<!-- expected_similarity=0.3 -->
```json
{
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/my-swa-group",
"location": "eastus2",
"managedBy": null,
"name": "my-swa-group",
"properties": {
"provisioningState": "Succeeded"
},
"tags": null,
"type": "Microsoft.Resources/resourceGroups"
}
```

2. Deploy a new static web app from your repository.

```bash
az staticwebapp create \
--name $MY_STATIC_WEB_APP_NAME \
--resource-group $MY_RESOURCE_GROUP_NAME \
--location $REGION
```

There are two aspects to deploying a static app. The first operation creates the underlying Azure resources that make up your app. The second is a workflow that builds and publishes your application.

Before you can go to your new static site, the deployment build must first finish running.

3. Return to your console window and run the following command to list the website's URL.

```bash
export MY_STATIC_WEB_APP_URL=$(az staticwebapp show --name $MY_STATIC_WEB_APP_NAME --resource-group $MY_RESOURCE_GROUP_NAME --query "defaultHostname" -o tsv)
```

```bash
runtime="1 minute";
endtime=$(date -ud "$runtime" +%s);
while [[ $(date -u +%s) -le $endtime ]]; do
if curl -I -s $MY_STATIC_WEB_APP_URL > /dev/null ; then
curl -L -s $MY_STATIC_WEB_APP_URL 2> /dev/null | head -n 9
break
else
sleep 10
fi;
done
```

Results:

<!-- expected_similarity=0.3 -->
```HTML
<!DOCTYPE html>
<html lang=en>
<head>
<meta charset=utf-8 />
<meta name=viewport content="width=device-width, initial-scale=1.0" />
<meta http-equiv=X-UA-Compatible content="IE=edge" />
<title>Azure Static Web Apps - Welcome</title>
<link rel="shortcut icon" href=https://appservice.azureedge.net/images/static-apps/v3/favicon.svg type=image/x-icon />
<link rel=stylesheet href=https://ajax.aspnetcdn.com/ajax/bootstrap/4.1.1/css/bootstrap.min.css crossorigin=anonymous />
```

```bash
echo "You can now visit your web server at https://$MY_STATIC_WEB_APP_URL"
```




## Next Steps

Congratulations! You have successfully deployed a static web app to Azure Static Web Apps using the Azure CLI. Now that you have a basic understanding of how to deploy a static web app, you can explore more advanced features and functionality of Azure Static Web Apps.

In case you want to use the GitHub template repository, follow the additional steps below.

Go to https://github.com/login/device and enter the user code 329B-3945 to activate and retrieve your GitHub personal access token.

1. Go to https://github.com/login/device.
2. Enter the user code as displayed your console's message.
3. Select `Continue`.
4. Select `Authorize AzureAppServiceCLI`.

### View the Website via Git

1. As you get the repository URL while running the script, copy the repository URL and paste it into your browser.
2. Select the `Actions` tab.

At this point, Azure is creating the resources to support your static web app. Wait until the icon next to the running workflow turns into a check mark with green background ( ). This operation may take a few minutes to complete.

3. Once the success icon appears, the workflow is complete and you can return back to your console window.
4. Run the following command to query for your website's URL.

az staticwebapp show \
--name $MY_STATIC_WEB_APP_NAME \
--query "defaultHostname"

5. Copy the URL into your browser to go to your website.

## Feedback

We would love to hear your feedback on this quickstart. If you have any comments or suggestions, please let us know by opening an issue on the [GitHub repository](https://github.com/Azure/static-web-apps-docs/issues/new/choose). Thank you for your feedback!

---
Loading