GithubHelp home page GithubHelp logo

tloy1966 / app-sql-devops-demo-project Goto Github PK

View Code? Open in Web Editor NEW

This project forked from azure-samples/app-sql-devops-demo-project

0.0 0.0 0.0 417 KB

Demos for integrated CI / CD spanning Azure SQL DB, Azure App Service and Azure DevOps

License: MIT License

JavaScript 0.13% TypeScript 1.22% HTML 0.38% Vue 0.94% Dockerfile 0.43% TSQL 96.89%

app-sql-devops-demo-project's Introduction

Azure DevOps with Azure SQL and Azure Static Web App

This repository contains an example static web app and Azure SQL database along with a complete Azure DevOps pipeline definition to deploy the full stack.

architecture summary with development going into Azure DevOps to deploy a SQL database and web app

Repository Overview

  • ๐Ÿ“ .devcontainer: Codespaces/VS Code remote environment definition
  • ๐Ÿ“ .vscode: VS Code workspace settings
  • ๐Ÿ“ api: web application API (Azure Function)
  • ๐Ÿ“ devops: pipeline definition yml
  • ๐Ÿ“ my-app: web application front end (Vue.js)
  • ๐Ÿ“ sql: Azure SQL database project (sqlproj)

Editing the SQL Project

Open the .sqlproj in Azure Data Studio (with the SQL Database Projects extension) or in Visual Studio (with the Data storage and processing workload).

Editing the web application and API

Open the full repository folder in VS Code, Visual Studio, or GitHub Codespaces.

Azure DevOps Pipeline Recap

  • trigger on push to main
  • variables set on pipeline and pulled from a group linked to Azure key vault
  • Database stage run on the windows-latest image
    • Create and configure Azure SQL logical server
    • Create Azure SQL Elastic Pool and Database
    • Build DACPAC from SQL Database Project
    • Publish SQL Project output as Azure DevOps artifacts
    • Download the artifacts
    • Deploy Azure SQL DB
  • WebApp stage run on the ubuntu-latest image
    • Deploy static web app
    • Set static web app DB connection string

Running/Testing the Application Code

๐Ÿ’ป For the best experience testing the application code, build and run the components from the command line. This enables the front end and API to be coordinated with the Azure Static Web App CLI.

Build Static Web App

cd my-app
npm run-script build

This compiles the web app and places the production version in ./my-app/dist

Build the Azure Function(s)

cd api
tsc

Add Test Connection Settings

To test the static web app and API locally with an Azure SQL database, we need to add the connection string to our Azure Function project. In the api folder, add a file local.settings.json with these contents:

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "",
    "FUNCTIONS_WORKER_RUNTIME": "node",
    "AZURESQL": "servernamehere",
    "AZURESQL_DB": "databasenamehere",
    "AZURESQL_USER": "sqlusernamehere",
    "AZURESQL_PASSWORD": "yourpasswordhere"
  }
}

Note: the Azure SQL server address is appended to the server name, you will omit .database.windows.net from the settings.

Start the Static Web App Emulator

swa start ./my-app/dist --api ./api

After the app has started up, it should be available in the browser at localhost:4280

sample vue app

app-sql-devops-demo-project's People

Contributors

dzsquared avatar microsoftopensource avatar tloy1966 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.