服务器部署基础知识
by Shruti Tanwar
通过Shruti Tanwar
我在生产部署期间学到的知识 (What I learned during production deployment)
Production deployment. The final stage of every project. When all the hard work you’ve put in over the course of time goes live to be used by the target audience. It sure is an exciting time, especially when you’re part of the infrastructure setup process!
生产部署。 每个项目的最后阶段。 随着时间的推移,您付出的所有辛勤劳动都可以被目标受众使用。 这无疑是一个令人兴奋的时刻,尤其是当您参与基础架构设置过程时!
I had been part of deployment processes in the past. But this time, I got to work on a huge system in terms of volume, technology stack and infrastructure, which was an enticing escapade! I got to experience the whole process first hand and I learned quite a few things.
过去,我曾参与过部署过程。 但是这一次,我必须在容量,技术堆栈和基础架构方面开发一个庞大的系统,这是一次诱人的旅程! 我必须亲身经历整个过程,并且学到了很多东西。
Here goes the list of my learnings which I’m gonna remember and apply throughout my career as a developer.
这是我将记住的学习列表,并将在我作为开发人员的整个职业生涯中应用。
两个Struts:准备与计划⏱️ (The two P’illars: Preparation & Planning⏱️)
It goes without saying that preparation and planning should be a part of anything you do. But when it comes to production deployment, it becomes a rule. It’s a given, an imperative. You need to know the intricacies of the technologies you have worked on in your project. You’d also need to think about what kind of infrastructure would be best suited for running different kinds of systems.
毫无疑问,准备和计划应该成为您所做任何事情的一部分。 但是,当涉及到生产部署时,它成为规则。 这是必然的, 当务之急 。 您需要知道您在项目中工作过的技术的复杂性。 您还需要考虑哪种类型的基础架构最适合运行不同类型的系统。
The system we built consisted of nodejs, MongoDB, InfluxDB, redis, asp.net, and rabbitMQ as part of its technology stack. One of the primary requirements of the system was to handle a huge volume of data on a daily basis. Thus the system had to go live with a proper deployment map in mind, which clearly stated stuff like:
我们构建的系统由nodejs,MongoDB,InfluxDB,redis, asp.net和RabbitMQ组成,是其技术堆栈的一部分。 该系统的主要要求之一是每天处理大量数据。 因此,系统必须在运行时牢记正确的部署图,该图清楚地说明了以下内容:
- What kind of system/technology was supposed to run on what kind of machine 应该在哪种机器上运行哪种系统/技术
- The specifications regarding the clustering of systems 有关系统集群的规范
- How all these stand-alone boxes were going to talk to each other in a foolproof manner. 所有这些独立的盒子如何以一种万无一失的方式互相交谈。
本地化,全球化吗? (Do local, think global ?)
Well, this was some advice from my project architect/friend. Myself and some other young developers on the team did not have any prior experience deploying such a huge system in our careers. So our architect advised us to create a production identical system locally.
好吧,这是我的项目建筑师/朋友的一些建议。 我自己和团队中的其他一些年轻开发人员都没有在我们的职业生涯中部署如此庞大系统的任何经验。 因此,我们的架构师建议我们在本地创建与生产相同的系统。
This meant that we needed to have a hands-on experience on everything. From a clustered NodeJS environment (comprising of 8 clusters) and multiple server MongoDB setup with a production-ready Redis installation, to having production ready pm2 configs and environment variables!
这意味着我们需要对所有内容都有实际经验。 从群集的NodeJS环境(包含8个群集)和多服务器MongoDB安装程序(可用于生产的Redis安装),到具有生产就绪的pm2配置和环境变量!
And we documented everything. We worked up all the production setups on our local machines and then tested them end to end. Later we noted down all the steps it took to reach the final working infrastructure locally on our machines. This practice helped us find the typical problems encountered during infrastructure setup, and how we could overcome them.
我们记录了一切。 我们在本地计算机上整理了所有生产设置,然后进行了端到端测试。 后来,我们记下了在本地计算机上达到最终正常工作基础结构所需采取的所有步骤。 这种做法帮助我们找到了基础架构设置过程中遇到的典型问题,以及如何克服这些问题。
We noted down all pointers, lessons, and particular tweaks which we performed to make the system working. It boosted up my confidence by several notches, and I felt ready to span out the production environment for our application.
我们记下了使系统正常运行的所有指示,教训和特定调整。 它使我的信心提高了几个等级,我感到准备为我们的应用扩展生产环境。
文档,文档和文档!? (Document, Document, & Document!!?)
I know, I know. This has been said a lot. Being a developer, you’ve heard it enough. You probably don’t want another lecture on the importance of documentation. So I’m gonna keep it short by just highlighting the bullet points:
我知道我知道。 这已经说了很多。 作为开发人员,您已经听够了。 您可能不想再发表有关文档重要性的讲座。 因此,我将通过突出显示要点来使它简短:
- Production setup should be documented to bits. It needs to be neat, foolproof, and understandable. 生产设置应记录在位。 它必须整洁,安全且易于理解。
- It should have all the system configurations, IP addresses, system specifications, and installation instructions. And also anything you consider important enough that you or a fellow developer should know. 它应该具有所有系统配置,IP地址,系统规格和安装说明。 还有您认为足够重要的任何东西,您或其他开发人员都应该知道。
- It needs to be updated as and when any change is made to the production environment of the system. 当对系统的生产环境进行任何更改时,都需要对其进行更新。
Being human, it’s quite common to think along the lines of, “Oh! I’m gonna remember that!” Trust me, you won’t. No one in the history of software development ever has (Okay, that might be taking it a little too far, but you get the idea.? )!
作为人,通常会想到“哦! 我会记得的!” 相信我, 你不会 。 在软件开发的历史上,没有人能做到(好吧,这可能会使它走得太远了,但是您知道了。)!
Document all the data & meta-data around your production setup. You’re gonna thank yourself later. Future developers who will be onboard your project will thank you subsequently!
记录生产设置中的所有数据和元数据。 您稍后会感谢您。 将来将参与您的项目的将来的开发人员将感谢您!
监视和记录? (Monitoring & Logging ?)
During the development tenure of a project, it’s comparatively easier to deal with bugs and errors. Something isn’t working? Lemme just quickly login to dev box and check. Well, that does not happen in production. You can’t login to a live system and start poking around just because you do not understand where the problem is coming from.
在项目的开发期间,处理错误和错误相对容易一些。 某事不起作用? Lemme只需快速登录到开发框并进行检查。 好吧,这在生产中不会发生。 您不能登录到实时系统并开始闲逛只是因为您不了解问题的根源。
Setting up a proper monitoring and logging system is essential to keeping a health check on the live system. Intelligent monitoring systems are available in the market today which can give you error frequency reports, scheduled health check emails, and more.
建立适当的监视和日志记录系统对于保持实时系统的运行状况检查至关重要。 当今市场上有智能监控系统,可以为您提供错误频率报告,计划的健康检查电子邮件等。
We decided on Sumologic and DataDog as our companions in spawning out the logging and monitoring system for our application. It was almost enthralling when I could figure out the problem in the system without doing a “ssh”.
我们选择Sumologic和DataDog作为我们的伴侣,为我们的应用程序生成日志记录和监视系统。 当我无需执行“ ssh”就能找出系统中的问题时,这简直令人着迷。
A decorous setup of a monitoring system goes a long way in laying a strong foundation for your live product. Do not miss out on that!
精心布置的监控系统可以为您的实时产品打下坚实的基础 。 千万不要错过!
Phew! Well, that’s a wrap! What are your findings? Feel free to share your learnings, advice, or pointers in the comments below!
! 好吧,这就是包装! 你有什么发现? 欢迎在下面的评论中分享您的学习,建议或建议!
翻译自: https://www.freecodecamp.org/news/what-i-learned-during-production-deployment-fe037a6ee4db/
服务器部署基础知识