-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
3,474 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
|
||
This repository offers a Dev Container template, enabling you to effortlessly explore **.NET** and **Azure SQL**. In just a few simple steps, you can dive into the capabilities of these powerful technologies. | ||
|
||
A **development container** (Dev Container for short) is a running [Docker](https://www.docker.com) container with a well-defined tool/runtime stack and its prerequisites.You can try out Dev Containers with **[GitHub Codespaces](https://github.com/features/codespaces)** or **[Visual Studio Code Dev Containers](https://aka.ms/vscode-remote/containers)**. | ||
A **development container** (Dev Container for short) is a running [Docker](https://www.docker.com) container with a well-defined tool/runtime stack and its prerequisites. You can try out Dev Containers with **[GitHub Codespaces](https://github.com/features/codespaces)** or **[Visual Studio Code Dev Containers](https://aka.ms/vscode-remote/containers)**. | ||
|
||
To learn more details about all the Azure SQL Database templates, you can explore the template repository at [aka.ms/azuresql-devcontainers](https://aka.ms/azuresql-devcontainers). This repository includes comprehensive information for each Azure SQL template. To learn more about Dev Containers, visit [containers.dev](https://containers.dev/) website, where you'll find a diverse range of templates. | ||
To learn more details about all the Azure SQL Database templates, you can explore the template repository at [aka.ms/azuresql-devcontainers](https://aka.ms/azuresql-devcontainers). This repository includes comprehensive information for each Azure SQL template. To learn more about Dev Containers, visit [containers.dev](https://containers.dev/) website, where you find a diverse range of templates. | ||
|
||
> **Note:** If you already have a Codespace or Dev Container, you can jump to the [About this template](#about-this-template) section. | ||
|
@@ -13,63 +13,60 @@ To learn more details about all the Azure SQL Database templates, you can explor | |
|
||
Follow these steps to open this sample in a Codespaces: | ||
|
||
1. Click the Code drop-down menu and select the **Codespaces** tab. | ||
2. Click on **Create codespaces on main** at the bottom of the pane. | ||
1. Select the Code drop-down menu and select the **Codespaces** tab. | ||
2. Select on **Create codespaces on main** at the bottom of the pane. | ||
|
||
For more info, check out the [GitHub documentation](https://docs.github.com/en/free-pro-team@latest/github/developing-online-with-codespaces/creating-a-codespace#creating-a-codespace). | ||
|
||
### Visual Studio Code - Dev Containers | ||
|
||
If you already have VS Code and Docker installed, you can click the badge above or [here](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/microsoft/vscode-remote-try-sqlserver) to get started. Clicking these links will cause VS Code to automatically install the Dev Containers extension if needed, clone the source code into a container volume, and spin up a dev container for use. | ||
|
||
Follow these steps to open this sample in a container using the VS Code Dev Containers extension: | ||
|
||
1. If this is your first time using a development container, please ensure your system meets the pre-reqs (i.e. have Docker installed) in the [getting started steps](https://aka.ms/vscode-remote/containers/getting-started). | ||
1. If you're using a Dev Container for the first time, ensure your system meets the prerequisites in the [getting started steps](https://aka.ms/vscode-remote/containers/getting-started). | ||
2. To use this repository, you can either open the repository in an isolated Docker volume: | ||
- Press `F1` or `Ctrl+Shift+P` to open the command palette. | ||
- Select the **Dev Containers: New Dev Container** command. | ||
- Select the desired Dev Container template for Azure SQL Database, typing `*Azure SQL*`. | ||
- Select the **.NET and Azure SQL (dotnet)** template | ||
- Wait for the container to build. | ||
- Visual Studio Code will build the container based on the selected configuration. | ||
- Visual Studio Code builds the container based on the selected configuration. | ||
- The build process might take a few minutes the first time. | ||
- Subsequent builds will be faster. | ||
- Once the container is built, the repository will open in the Dev Container. | ||
- Subsequent builds are faster. | ||
- Once the container is built, the repository opens in the Dev Container. | ||
|
||
> **Note:** Under the hood, this will use the **Dev Containers: Clone Repository in Container Volume...** command to clone the source code in a Docker volume instead of the local filesystem. [Volumes](https://docs.docker.com/storage/volumes/) are the preferred mechanism for persisting container data. | ||
### About this template | ||
|
||
This Dev Container includes a preconfigured database, specifically tailored for use with the Aspire component. This database serves as a foundation for demonstrating how the Aspire component interacts with Azure SQL. | ||
This Dev Container includes a preconfigured database, specifically tailored for use with Node.js. This database serves as a foundation for demonstrating how the Node.js component interacts with Azure SQL. | ||
|
||
This template creates two containers, one for the Dev Container that includes .NET, and one for Microsoft SQL Server. You will be connected to the Ubuntu, and from within that container, the MS SQL container will be available on **`localhost`** port 1433. The Dev Container also includes supporting scripts in the `.devcontainer/sql` folder used to configure the `Library` sample database. | ||
This template creates two containers, one for the Dev Container that includes Node.js, and one for Microsoft SQL Server. You will be connected to the Ubuntu container, and from within that container, the MS SQL container will be available on localhost port 1433. The Dev Container also includes supporting scripts in the .devcontainer/sql folder used to configure the Library sample database. | ||
|
||
The SQL container is deployed from the latest developer edition of Microsoft SQL 2022. The database(s) are made available directly in the Codespace/VS Code through the MSSQL extension with a connection labeled "LocalDev". The default `sa` user password is set using the .devcontainer/.env file. The default SQL port is mapped to port `1433` in `.devcontainer/docker-compose.yml`. | ||
The SQL container is deployed from the latest developer edition of Microsoft SQL 2022. The database(s) are made available directly in the Codespace/VS Code through the MSSQL extension with a connection labeled "LocalDev". The default sa user password is set using the .devcontainer/.env file. The default SQL port is mapped to port 1433 in .devcontainer/docker-compose.yml. | ||
|
||
.NET 8 is a state-of-the-art framework for developing cloud-native applications, with a focus on containerized environments. Building on .NET Core, .NET 8 offers advanced features for creating scalable, performant, and resilient applications. | ||
Node.js is a powerful platform for building fast, scalable network applications. With its event-driven, non-blocking I/O model, Node.js is ideal for data-intensive real-time applications that run across distributed devices. The combination of Node.js and Azure SQL Database enables developers to create high-performance applications with ease. | ||
|
||
With .NET 8, developers can prototype locally using the Dev Container environment and easily deploy to Azure. The framework's seamless integration with Azure SQL Database and Azure Kubernetes Service (AKS) simplifies the deployment process and enhances productivity. Improved performance, support for microservices, and robust tools make .NET 8 ideal for modern cloud development. | ||
|
||
**Note:** | ||
While the SQL Server container employs a standard version of SQL Server, all database development within this Dev Container can be validated for Azure SQL Database using the SQL Database Project. The SQL Database project is preconfigured with the target platform set as Azure SQL Database. | ||
|
||
#### Visual Code Tasks | ||
|
||
We have added several tasks to this repository to help with common actions. You can access these tasks by opening the Command Palette in VS Code. Here's how: | ||
This Dev Container template includes multiple tasks that can help with common actions. You can access these tasks by opening the Command Palette in VS Code. Here's how: | ||
|
||
1. Press <kbd>F1</kbd> or <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> to open the Command Palette. | ||
1. To open the Command Palette, press <kbd>F1</kbd> or <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd>. | ||
2. Type "Run Task" and select "Tasks: Run Task". | ||
3. Choose the task you want to run from the list. | ||
|
||
##### Verify database schema and data | ||
|
||
This task opens the `verifyDatabase.sql` file in your workspace and executes the SQL query using the `ms-mssql.mssql` extension. This is an optional task that will help you to get familiar with the sample `Library` database tables and data. | ||
This task opens the `verifyDatabase.sql` file in your workspace and executes the SQL query using the `ms-mssql.mssql` extension. This task is optional however it can help you to become familiar with the sample `Library` database tables and data included in this Dev Container template. | ||
|
||
##### Build SQL Database project | ||
|
||
This task builds the SQL Database project. It runs the command `dotnet build` in the `database/Library` directory of your workspace. | ||
|
||
This task is optional, but it is useful to verify the database schema. You can use this SQL Database project to make changes to the database schema and deploy it to the SQL Server container. | ||
This task is optional, but it's useful to verify the database schema. You can use this SQL Database project to make changes to the database schema and deploy it to the SQL Server container. | ||
|
||
#### Deploy SQL Database Project | ||
|
||
|
@@ -89,8 +86,8 @@ To adjust the sa password, you need to modify the `.env` file located within the | |
|
||
The password must comply with the following rules: | ||
|
||
- It should have a minimum length of 8 characters. | ||
- It should include characters from at least three of the following categories: uppercase letters, lowercase letters, numbers, and non-alphanumeric symbols. | ||
- It should have a minimum length of eight characters. | ||
- It should include characters from at least three of the following categories: uppercase letters, lowercase letters, numbers, and nonalphanumeric symbols. | ||
|
||
### Database deployment | ||
|
||
|
@@ -133,25 +130,4 @@ This project uses the `5000` and `5001` ports for DAB, and the port `1433` for S | |
``` | ||
> **Note:** You can add additional ports to this list as needed. | ||
|
||
The `ports` property in `docker-compose.yml` [publishes](https://docs.docker.com/config/containers/container-networking/#published-ports) rather than forwards the port. This will not work in a cloud environment like Codespaces and applications need to listen to `*` or `0.0.0.0` for the application to be accessible externally. Fortunately the `forwardPorts` property does not have this limitation. | ||
|
||
## Contributing | ||
|
||
This project welcomes contributions and suggestions. Most contributions require you to agree to a | ||
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us | ||
the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com. | ||
|
||
When you submit a pull request, a CLA bot will automatically determine whether you need to provide | ||
a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions | ||
provided by the bot. You will only need to do this once across all repos using our CLA. | ||
|
||
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). | ||
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or | ||
contact [[email protected]](mailto:[email protected]) with any additional questions or comments. | ||
|
||
## Trademarks | ||
|
||
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow [Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general). | ||
|
||
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. | ||
Any use of third-party trademarks or logos are subject to those third-party's policies. | ||
The `ports` property in `docker-compose.yml` [publishes](https://docs.docker.com/config/containers/container-networking/#published-ports) rather than forwards the port. This configuration couldn't work in a cloud environment like Codespaces and applications need to listen to `*` or `0.0.0.0` for the application to be accessible externally. Fortunately the `forwardPorts` property doesn't have this limitation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.