Azure Post部署脚本命令 [英] Azure Post Deployment Script Commands

查看:74
本文介绍了Azure Post部署脚本命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Azure上有一个Django Web应用程序.我正在使用Azure的内置连续部署,因此我的存储库中没有任何.deployment文件.

但是,为了使我的应用程序正常运行,我必须手动安装几个无法通过pip获得的软件包.因此,在每次部署之后,我都必须通过SSH进入部署并执行以下2个命令:

  source home/site/wwwroot/pythonenv3.6/bin/activatesudo apt-get install XXX XXX XXX 

我相信我可以通过部署后脚本简单地执行此操作,但是很难找到任何文献来确切说明如何执行此操作.利用部署后脚本是执行此操作的最佳方法吗?如果可能,我宁愿不管理自定义docker文件.

更新这是我手动运行apt-get命令后安装的软件包的屏幕快照:

这是重新部署后安装的软件包的屏幕快照:

因此,除非有一种方法可以从部署后的脚本中运行此命令(并使其正确执行),否则我唯一的选择是创建自定义容器?考虑到这是一个很小的定制,我对此并不感到迷茫……但是我可能再也没有选择余地了?

更新我尝试添加"apt-get install XXX XXX";到"PRE_BUILD_COMMAND";在Azure中...结果是以下消息:

是否有任何想法如何使用prebuild或post build命令解决此消息?

解决方案

更新

如下所示的命令.

您必须使用错误的路径,只需输入/home ,然后输入要执行的命令,切记不要添加 sudo .

重要

步骤2.修改readme.md,检查部署状态.

我们可以看到我的自定义 .sh 命令正在运行,但是我们不需要这样做.

第3步.完成env config后检查webapp.

I have a Django web app on Azure. I'm using Azure's built in continuous deployment, so I don't have any .deployment files within my repo.

However, in order for my application to work correctly, I have to manually install a couple packages after that aren't available via pip. So after every deployment, I have to SSH into the deployment and execute the following 2 commands:

source home/site/wwwroot/pythonenv3.6/bin/activate
sudo apt-get install XXX XXX XXX

I believe I can simply execute this via a post deployment script, but am having a hard time finding any literature explaining exactly how to do so. Is utilizing a post deployment script the best way of doing this? I'd rather not manage a custom docker file if possible.

UPDATE Here is a screen shot of the packages installed after I manually run the apt-get command:

And here is a screen shot of the packages installed AFTER a re-deploy:

So unless there's a way to run this command from a post-deployment script (and have it execute correctly), my only option will be to create a custom container? I'm not wild about doing so considering that this is such a small customization... but I may no longer have a choice?

UPDATE I tried adding "apt-get install XXX XXX" to "PRE_BUILD_COMMAND" in Azure... and I got the following message as a result:

Are there any ideas how to get around this message using a prebuild or post build command?

解决方案

UPDATE

The command like below.

You must have the wrong path, just enter /home, and then enter the command you want to execute, remember not to add sudo.

PRIVIOUS

First of all, please check this post. The pyodbc in the post cannot be used. Later, I used apt-get install xxx and pip install to solve this problem.

I know you want to use the .sh file, when you publish or re-publish, or when you publish for the first time, execute your apt-get install xxx command.

But after my test, I can tell you that you only need to execute the command once after the portal creates the webapp, or after the first release, to configure the environment without having to execute the .sh file again.

In conclusion:

It is recommended to execute commands such as apt-get install xxx and pip install xxx after the first release using git. Then modify the Readme.md file on github to trigger the redeployment process.

You don’t need to execute the .sh file for every deployment in the future. I replied to your other post. You can execute the .sh file, but there is no need to call it every time after you execute it manually. Because this is a configurable environment variable, the configuration is successful.

Step 1. Install env.

Step 2. Modify readme.md,check deploy status.

we can see my custom .sh command is running.But we no need to do that.

Step 3. Check the webapp after finishing env config .

这篇关于Azure Post部署脚本命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆