在共享服务器和专用服务器的虚拟机上使用 Sphinx 进行 Web 开发
背景
我正在使用标准 LAMP 堆栈开发一个 Web 应用程序。我是 Web 开发新手,最初计划将我的代码(一旦完成)简单地通过 FTP 传输到我的托管提供商(目前是 BlueHost,但将来可能会发生变化)。
Sphinx 搜索
最近,我决定向由 Sphinx 搜索提供支持的网站添加高级搜索功能。显然这意味着我必须将 Sphinx 安装到我的开发机器上。当网站上线时,我必须在我的生产服务器上安装(通过 ssh)Sphinx。这可能需要大量时间来调试 Sphinx 的开发和生产安装(以及与此相关的其他环境)中的细微差异。
我仍在学习
我偶然发现了虚拟机,看起来(如果我错了,请纠正我)一些开发人员为每个项目创建虚拟机并将虚拟机加载到他们的生产服务器上。这使得他们不必在代码上传到生产服务器后对其进行调试,从而增加了成功的可能性。
问题
我的问题是:在虚拟机上进行开发并在应用程序开发完成后尝试将其加载到我的生产服务器上是否有意义?如果是这样,这通常可以针对共享服务器还是仅针对专用服务器来完成?如果没有,您介意解释一下您对解决开发服务器和生产服务器之间存在差异的潜在问题的最佳方法的看法吗?
Background
I am developing a web app with a standard LAMP stack. I am new to web development and had originally planned on simply FTP-ing my code (once completed) to my hosting provider (currently BlueHost, but may change in the future).
Sphinx Search
Recently, I decided to add advanced search functionality to my site powered by Sphinx search. Obviously this meant that I had to install Sphinx to my development machine. When it comes time for the site to go live I am going to have to install (via ssh) Sphinx on my production server. This could require a lot of time debugging subtle differences in the development and production installations of Sphinx (and the rest of the environment for that matter).
I'm Still Learning
I have stumbled upon virtual machines and it looks like (correct me if I'm wrong) some developers create VM's for each project and load the VM onto their production server. This keeps them from having to debug their code once it is uploaded to their production server, thus, increasing the probably for success.
The Question
My question is this: Would it make sense to develop on a virtual machine and attempt to load that onto my production server when app development is complete? If so, can this typically be done for shared servers or only for dedicated servers? If not, would you mind explaining what your opinion of the best way to solve the potential problem of having differences between your development and production servers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
continue
Most shared servers have very limited permissions. Some might not even allow you to run sphinx let alone a VM instance in your server.
The usual process is that you have 3 servers/environements (ideally 4 would be nice).
Development server - This is your local working machine and you on this machine. This can be on a completely different environment than your production server.
Staging server - This server should ideally be an identical copy of your live server. This server usually contains an unstable version of your application with all the latest commits on it. Having your staging server be as close (system wise) to your production server will help you identify and solve environment issues before they arise to blindside you on the production server.
Production server - This is your live server. Once you have a stable version on your staging server, you'd simply deploy the code base to your live server. This is where having your production and staging servers identical to each other helps as you don't need to worry about environment differences messing things up.
Additionally, you could have a mirror of your production server to debug any environment/data specific issues.
If you're running on a shared server, it's best if you have two domains setup with your web application. Have something like http://beta.webapp.com on your server and use that as your staging server.
I can't comment on VMs, I haven't used them on a production system in the way you describe but it would amount to the same thing I think.
JohnP 涵盖了很多内容。我想补充一点,你可以看看VirtualBox。它是免费的,并且根据我的经验,效果非常好。它应该允许您运行您选择的配置的虚拟机,例如,与您的部署主机完全相同。
JohnP covered a lot of ground. I would add that you could take a look at VirtualBox. It's free and works very well in my experience. It should let you run a VM configured however you choose, for example, exactly like your deployment host.