简体   繁体   English

如何在 python 中自动化远程部署?

[英]How can I automate remote deployment in python?

I want to automate the remote deployment which currently I am doing manually.我想自动化目前我正在手动执行的远程部署。

The process includes该过程包括

  1. Make the tar ball from certain folders从某些文件夹制作焦油球
  2. SFTP to the remote server SFTP到远程服务器
  3. Rename the old folders重命名旧文件夹
  4. Untar the new tar file解压新的 tar 文件
  5. Restart apache重启apache

The remote system is on the intranet and has no access to the outside internet远程系统在内部网上,无法访问外部互联网

I want to know how can I transfer the file from my python script and then when the transfer is complete then log into ssh and do stuff.我想知道如何从我的 python 脚本传输文件,然后在传输完成后登录到 ssh 并执行操作。 I am confused about how can I achieve that.我对如何实现这一目标感到困惑。 On localhost and I can do all that but how can I do that on a remote host?在本地主机上,我可以做到这一切,但如何在远程主机上做到这一点?

For simple&dirty work you can use fabric (This by no means say that you cannot use fabric to build serious product)对于简单而肮脏的工作,您可以使用面料(这绝不是说您不能使用面料来构建严肃的产品)

For heavy configuration routines, you'd better pick a CMS (eg, ansible )对于繁重的配置例程,您最好选择一个CMS (例如, ansible

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM