简体   繁体   English

如何设置易于使用它进行Web应用程序部署

[英]How to set up apt to use it for web app deployment

If I want to use apt packages for deploying my web app to different linux servers, what steps should I take? 如果我想使用apt软件包将Web应用程序部署到不同的linux服务器,我应该采取什么步骤? Starting from a PHP/MySQL application, I would like to be able to install it as a package like this: 从PHP / MySQL应用程序开始,我希望能够将其作为一个软件包安装,如下所示:

apt-get update
apt-get install mywebapp-package

I suppose I have to set up a repository somewhere and add my packages to it, but how does this work? 我想我必须在某个地方建立一个存储库并向其中添加我的软件包,但是这如何工作? How to create the package itself? 如何创建包本身? What do I have to do to make any server find my repository? 我该怎么做才能使任何服务器找到我的存储库? Some googling only turned up confusing information, maybe I'm looking for the wrong buzzwords. 一些谷歌搜索只会发现令人困惑的信息,也许我在寻找错误的流行词。 Any help would be much appreciated! 任何帮助将非常感激!

Here's how to create an apt-package https://askubuntu.com/questions/27715/create-a-deb-package-from-scripts-or-binaries 这是创建apt-package的方法https://askubuntu.com/questions/27715/create-a-deb-package-from-scripts-or-binaries

It's really quite straightforward ... within your app folder there's a debian subfolder ... the ./debian/install file contains a really straightforward map of files to final locations 这真的非常简单...在您的应用程序文件夹中有一个debian子文件夹.... / debian / install文件包含一个非常直观的文件映射到最终位置

# debian/install must contain the list of scripts to install 
# as well as the target directory
echo myscript.sh usr/bin > debian/install 

You can use the makefile to create installation and post installation tasks. 您可以使用makefile创建安装和安装后任务。 If you've never compiled ac/c++ program with make before ... basically in the app folder you run "./configure" and then "make" or "make install" to compile / unpackage the program ... dh_make has a slightly different process and some defaults but it's a pretty similar workflow ... The following is a really simple makefile from the GNU Make Reference 如果您以前从未使用make编译过ac / c ++程序... ...基本上在app文件夹中运行“ ./configure”,然后运行“ make”或“ make install”来编译/解包该程序... dh_make有一个略有不同的过程和一些默认值,但这是一个非常相似的工作流程...以下是来自GNU Make Reference的一个非常简单的makefile

objects = main.o kbd.o command.o display.o \
               insert.o search.o files.o utils.o

     edit : $(objects)
             cc -o edit $(objects)
     main.o : main.c defs.h
             cc -c main.c
     kbd.o : kbd.c defs.h command.h
             cc -c kbd.c
     command.o : command.c defs.h command.h
             cc -c command.c
     display.o : display.c defs.h buffer.h
             cc -c display.c
     insert.o : insert.c defs.h buffer.h
             cc -c insert.c
     search.o : search.c defs.h buffer.h
             cc -c search.c
     files.o : files.c defs.h buffer.h command.h
             cc -c files.c
     utils.o : utils.c defs.h
             cc -c utils.c
     clean :
             rm edit $(objects)

Basically the default "make" task compiles the program edit ... and the dependencies are automatically detected from the filenames in this struct 基本上,默认的“ make”任务会编译程序编辑...,并从此结构中的文件名中自动检测到依赖项

For a webapp here's a makefile from an OSS project that includes pulling from Github http://build.shr-project.org/Makefile 对于Web应用程序,这是OSS项目中的makefile,包括从Github中提取http://build.shr-project.org/Makefile

Basically if you work on the project and put all your install tasks into a makefile ... and have the "make" default task unpackage your app and install the apache / nginx vhost and restart / reload the relevant server when done ... then apt is a totally viable way to handle it ... there's a lot of programs out there to manage apt packages simultaneously on hundreds of systems ... https://serverfault.com/questions/79093/managing-upgrades-on-hundreds-of-debian-servers 基本上,如果您在项目上工作,并将所有安装任务放入一个makefile中...,并让“ make”默认任务将您的应用程序解包,然后安装apache / nginx vhost并在完成后重新启动/重新加载相关服务器...然后apt是处理它的一种完全可行的方法...有很多程序可以同时在数百个系统上管理apt软件包... https://serverfault.com/questions/79093/managing-upgrades-on-hundreds Debian服务器

Canonical/Ubuntu's Landscape is a great tool for this type of thing ... I have used it before on a platform of about 20 servers ... not too sure of the specifics of setting up your own upstream repository and signing the key etc so apt can manage the package fully but I'm sure it's pretty straightforward once you've got your dpkg going Canonical / Ubuntu的Landscape是用于此类事情的好工具...我以前在大约20台服务器的平台上使用过它...不太确定设置自己的上游存储库并签名密钥的细节,因此apt可以完全管理该程序包,但是我敢肯定,一旦有了dpkg,它就非常简单

Debconf / apt offers a pretty good use case for many types of apps ... however if it's an app that's in continuous deployment and you have to keep making upgrades (rule of thumb for me is if you make an upgrade more than once a week or 5x month) ... then you may be better off with a continuous deployment tool ... both Capistrano and Fabric are excellent (used Cap, with multi-stage extension ... it's great, Fabric I've only heard great things) ... but I still wouldn't trust Cap on hundreds of Debian servers ... it's really all about the scale of your project ... above say 10 or maybe 20 servers cap is just too slow and ponderous to really manage deployments well (IMHO, obviously anything can be done by anyone, and I have not really studied this enough, but both Ruby Rake and Capistrano etc are DAMN SLOW and unreliable compared to Gnu Make and debconf, especially out in the wild) Debconf / apt为许多类型的应用程序提供了一个很好的用例...但是,如果它是持续部署的应用程序,则您必须继续进行升级(对我而言,如果您每周进行一次以上升级,则是经验法则或5个月)...那么使用连续部署工具可能会更好... Capistrano和Fabric都很出色(使用过的Cap,经过多阶段扩展...太好了,Fabric我只听过很棒的事情)...但是我仍然不相信Cap在数百台Debian服务器上的使用...这实际上与您的项目规模有关...上面说的10或20个服务器的使用上限太慢且难以真正管理部署好(恕我直言,显然任何人都可以做,而且我还没有真正地研究过这一点,但是Ruby Rake和Capistrano等都是DAMN Slow,与Gnu Make和debconf相比不可靠,尤其是在野外)

Specifically with respect to general server automation, I would suggest you check out Puppet and Chef , both of which are pretty viable looking tools. 特别是对于一般服务器自动化而言,我建议您查看PuppetChef ,它们都是非常可行的工具。 Not used either but all our admin scripts are in Ruby and definitely Chef's knife tool is unbelievably handy for configuring servers in a scripted fashion 两者都没有使用,但是我们所有的管理脚本都在Ruby中进行,并且绝对可以使用Chef的刀工具以脚本方式配置服务器

I would suggest using something like Capistrano or Fabric to deploy your application instead of apt-get. 我建议使用CapistranoFabric之类的东西来部署您的应用程序,而不是apt-get。 These tools are made for deploying applications and are able to deploy to multiple servers. 这些工具专门用于部署应用程序,并且能够部署到多个服务器。

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

相关问题 如何使用TFSBuild for MVC应用程序设置连续部署? - how can I set up a continuous deployment with TFSBuild for MVC app? 如何管理Web应用程序的逐步部署 - How to manage gradual deployment of a web app 如何加快包含大量文件的Azure Web应用程序的部署? - How to speed up an Azure web application deployment with lots of files? 如何在PhpStorm中设置部署部分? - How do I set up the deployment section in PhpStorm? 如何加快 Java Google App Engine 部署? - How do I speed up Java Google App Engine deployment? 如何通过数据库更新实现零停机时间部署到Azure Web应用程序? - How to achieve zero downtime deployment to Azure web app with database updates? 如何一次将Web应用程序部署到多个服务器上? - How to organize a web app deployment onto multiple servers at once? Web应用程序部署最佳实践:如何管理本地和实时文件? - Web app deployment Best Practices : how to manage local & live files? Web应用程序部署 - git环境 - Web app deployment - git environments 如何在Azure App Service中设置或检索部署凭据? - How to set or retrieve deployment credentials in Azure App Service?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM