[英]How to deploy and manage docker instances into Azure using Azure DevOps?
Our project requires two docker instances:我们的项目需要两个 docker 实例:
Public access to the MySQL should be forbidden.应禁止公开访问 MySQL。 However, there should be a way to connect to the MySQL server from specific computers / specific AAD users if needed to manually alter the database or get a dump of it.
但是,如果需要手动更改数据库或获取数据库转储,应该有一种方法可以从特定计算机/特定 AAD 用户连接到 MySQL 服务器。
The PHP web should be available via HTTPS using a custom or Let's Encrypt certificate. PHP Web 应该可以使用自定义证书或 Let's Encrypt 证书通过 HTTPS 访问。 Not sure, whether it should be handled inside the PHP instance, via a proxy instance, via Azure API gateway or another way.
不确定是否应该在 PHP 实例内部、通过代理实例、通过 Azure API 网关或其他方式处理。
After deploing a new PHP image, the CI should run a script inside the docker image which migrate the MySQL schema and data.在部署一个新的 PHP 镜像后,CI 应该在 docker 镜像中运行一个脚本来迁移 MySQL 架构和数据。 The script should get a MySQL "root"-like password so it has enough permissions to do its work.
该脚本应该获得一个类似 MySQL 的“root”密码,以便它有足够的权限来完成它的工作。
We use Azure DevOps for git repositories and for CI.我们将 Azure DevOps 用于 git 存储库和 CI。
I was able to set up a Azure DevOps Pipeline YAML to build and publish the custom PHP image to an Azure Container Repository.我能够设置 Azure DevOps Pipeline YAML 来构建自定义 PHP 映像并将其发布到 Azure 容器存储库。 However, I found no suitable tasks to start/configure/deploy/stop a Container Instance from Azure DevOps Releases.
但是,我发现没有合适的任务可以从 Azure DevOps Releases 启动/配置/部署/停止容器实例。 Neither I am sure what to use / how to add HTTPS support.
我也不知道要使用什么/如何添加 HTTPS 支持。
It's my first docker deployment in production - up to now, I was only using docker for development.这是我在生产中的第一个 docker 部署 - 到目前为止,我只使用 docker 进行开发。 I've tried to study the docs, search net but still has no idea what the best practices are, how to build it together.
我试图研究文档、搜索网络,但仍然不知道最佳实践是什么,如何一起构建它。 I would appreaciate any, even partial help and hints, how to correctly deploy the thing.
我会感谢任何,甚至是部分帮助和提示,如何正确部署这个东西。 Thanks.
谢谢。
I was able to set up a Azure DevOps Pipeline YAML to build and publish the custom PHP image to an Azure Container Repository. However, I found no suitable tasks to start/configure/deploy/stop a Container Instance from Azure DevOps Releases. Neither I am sure what to use / how to add HTTPS support.
Since you already succeed set CI to build the docker image and push it to Azure Container Registry (ACR).由于您已经成功设置 CI 来构建 docker 映像并将其推送到 Azure 容器注册表 (ACR)。
You could then use both Azure App Service deploy and Azure Web App for Containers task to handle the deploy.然后,您可以使用 Azure App Service 部署和 Azure Web App for Containers 任务来处理部署。
The Azure WebApp Container task similar to other built-in Azure tasks, requires an Azure service connection as an input. Azure WebApp 容器任务与其他内置 Azure 任务类似,需要Azure 服务连接作为输入。 The Azure service connection stores the credentials to connect from Azure Pipelines or Azure DevOps Server to Azure.
Azure 服务连接存储用于从 Azure Pipelines 或 Azure DevOps 服务器连接到 Azure 的凭据。
Kindly take a look at below blogs show:how do people actually build their containers and then deploy them to each environment?:请看看下面的博客展示:人们如何实际构建他们的容器,然后将它们部署到每个环境中?:
Deploy an Azure Web App Container (official) 部署 Azure Web 应用容器(官方)
Azure DevOps: Create a Web App for Containers CI/Release pipeline for an ASP.NET Core app Azure DevOps:为 ASP.NET Core 应用程序创建容器 CI/发布管道的 Web 应用程序
Build & release a Container Image from Azure DevOps to Azure Web App for Containers 构建容器映像并将其从 Azure DevOps 发布到 Azure Web App for Containers
Neither I am sure what to use / how to add HTTPS support.
For this part, according to my personal understanding, it should more related to Docker image side.对于这部分,根据我个人的理解,应该更多地与Docker镜像端相关。 This should not related to Azure DevOps pipeline side.
这应该与 Azure DevOps 管道端无关。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.