-
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.
Updating OS for Node.js template, updating README according to Acroli…
…nx recommendations.
- Loading branch information
Showing
41 changed files
with
192 additions
and
3,501 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 Aspire** 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)**. | ||
|
||
Check out our diverse range of Dev Container templates on the [containers.dev/templates](https://containers.dev/templates) website. Additionally, you can also experiment with other sample projects available under [vscode-remote-try-*](https://github.com/search?q=org%3Amicrosoft+vscode-remote-try-&type=Repositories). | ||
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,67 +13,59 @@ Check out our diverse range of Dev Container templates on the [containers.dev/te | |
|
||
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 one of the following templates: | ||
- .NET with Aspire and Azure SQL (dotnet-aspire) | ||
- .NET and Azure SQL (dotnet) | ||
- Python and Azure SQL (python) | ||
- Node.js and Azure SQL (node) | ||
- Select the **.NET with Aspire and Azure SQL (dotnet-aspire)** 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 template creates two containers, one for the Dev Container that includes .NET and Aspire, 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 Dev Container includes a preconfigured database, tailored for use with the Aspire component. This database serves as a foundation for demonstrating how the Aspire component interacts with Azure SQL. | ||
|
||
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`. | ||
This template creates two containers, one for the Dev Container that includes .NET and Aspire, and one for Microsoft SQL Server. You're connected to the Ubuntu, and from within that container, the MS SQL container is available on **`localhost`** port 1433. The Dev Container also includes supporting scripts in the `.devcontainer/sql` folder used to configure the `Library` sample database. | ||
|
||
.NET Aspire is a cutting-edge framework crafted for developing cloud-native applications, with a primary focus on containerized environments. Engineered with .NET Core, Aspire empowers developers to architect scalable and resilient applications optimized for cloud deployment. | ||
The SQL container is deployed from the latest developer edition of Microsoft SQL 2022. The database 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. In `.devcontainer/docker-compose.yml`, port `1433` is mapped as the default SQL Server port. | ||
|
||
By harnessing the power of Aspire, developers can prototype and refine their applications locally using this Dev Container environment. Subsequently, deploying these applications to Azure becomes a streamlined process, facilitated by the native integration between .NET Aspire and Azure SQL Database. | ||
.NET Aspire is a cutting-edge framework crafted for developing cloud-native applications, with a primary focus on containerized environments. Aspire, built with .NET Core, empowers developers to architect scalable and resilient applications optimized for cloud deployment. | ||
|
||
**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. | ||
|
||
##### Execute SQL Query | ||
##### Verify database schema and data | ||
|
||
This task opens the `verifyDatabase.sql` file in your workspace and executes the SQL query in it. It uses the `ms-mssql.mssql` extension to execute the query. This task is part of the build group and is the default task that runs when you run the build task group. | ||
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,16 +81,16 @@ This task trusts the HTTPS certificate for the .NET Aspire project. It runs the | |
|
||
##### Update .NET SDK | ||
|
||
This task updates the .NET SDK. This update ensures that .NET Aspire can leverage the latest advancements and enhancements provided by the .NET ecosystem, enabling smoother development experiences and potentially addressing any compatibility issues with newer versions of .NET or its related components. | ||
This task ensures that .NET Aspire uses the latest advancements and enhancements provided by the .NET ecosystem, enabling smoother development experiences and potentially addressing any compatibility issues with newer versions of .NET or its related components. | ||
|
||
### Changing the sa password | ||
|
||
To adjust the sa password, you need to modify the `.env` file located within the `.devcontainer` directory. This password is crucial for the creation of the SQL Server container and the deployment of the Library database using the `database/Library/bin/Debug/Library.dacpac` file. | ||
|
||
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 | ||
|
||
|
@@ -119,13 +111,7 @@ The `postCreateCommand.sh` script handles the database deployment by performing | |
|
||
#### Using the SQL Database Projects Extension | ||
|
||
You can use the SQL Database Projects extension to deploy the database schema. The Library.sqlproj project is located in the database/Library folder and can be built using the Build SQL Database project task. The output .dacpac files should be placed in the ./bin/Debug folder for deployment. | ||
|
||
#### Verifying the Database Schema | ||
|
||
The `verifyDatabase.sql` file in the `database/Library` folder can be used to verify the database schema after deployment. You can run this script using the `Execute SQL Query` VS Code task. | ||
|
||
This setup ensures that your databases are properly deployed and ready to use after the container is created. | ||
You can use the SQL Database Projects extension to deploy the database schema. The Library.sqlproj project is located in the database/Library folder and can be built using the Build SQL Database project task. The output .dacpac files should be placed in the ./bin/Debug folder for deployment. | ||
|
||
### Adding another service | ||
|
||
|
@@ -147,26 +133,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. |
Oops, something went wrong.