mongo 删除节点

在AWS中部署生产Web应用程序的经验教训 (Lessons learned deploying a production web application in AWS)

背景 (Background)

This is not a code-based tutorial. It consists of all the things I wish I knew before I started the project and the steps I took that worked out pretty well. It follows the development of a production Node.js web application created with the Express framework that was deployed onto Amazon Web Services (AWS).

这不是基于代码的教程。 它包括我在开始该项目之前希望了解的所有内容,以及我所采取的步骤,这些步骤都很好地完成了。 它遵循使用Express框架创建的生产Node.js Web应用程序的开发,该应用程序已部署到Amazon Web Services(AWS)上。

The full-scale tutorial is available here.

完整的教程可在此处获得 。

制定计划至关重要 (Developing a plan is crucial)

There are entire books about developing plans, so I’m not going to elaborate upon that here. Just have one, whatever it is.

整本书中都有关于制定计划的书,因此在这里我不再赘述。 不管是什么,只要一个。

你永远不会分配足够的时间 (You never allot yourself enough time)

It didn’t seem to matter how simple or complex a task was. I never estimated the time a given task would take correctly. I imagine that as I do more of these, I will get better at estimating time frames.

看起来任务多么简单或复杂并不重要。 我从未估计过给定任务所需的时间。 我想象随着我做更多的事情,我将在估计时间范围方面变得更好。

Something that can help with this is to set a realistic timeline that gives yourself enough buffer to adjust if necessary.

可以帮助您解决此问题的方法是设置一个现实的时间表,为您提供足够的缓冲以在必要时进行调整。

从一开始就部署到服务器 (Deploy to the Server from the very beginning)

There’s an old dev saying that goes something like, “Always develop in an environment that is the same as your deployment environment.” This is why things like Virtual Environments exist. This is sage advice.

有一个古老的开发人员说:“始终在与部署环境相同的环境中进行开发。” 这就是为什么存在诸如虚拟环境之类的原因。 这是圣人的建议。

Right now, it’s so easy to just grab a generator (such as express generator or create-react-app), yarn install and write all our code locally. This is great for a development, but what I learned on the last project is if you wait for deployment until the end, you’ll be surprised at the number of things that “should work” but don’t.

现在,只需抓住一个生成器(例如express generator或create-react-app ), yarn install并在本地编写我们的所有代码都非常容易。 这对于开发非常有用,但是我在上一个项目中了解到的是,如果您等待部署直到最后,您会惊讶于“应该起作用”但不起作用的事物数量。

For this project I chose to incrementally deploy the application while I built it. It made sure that what I was building was going to work on the environment I would be deploying it on. Also, it saved a ton of time when the actual deployment time came.

对于这个项目,我选择在构建应用程序时逐步部署该应用程序。 它确保了我正在构建的内容可以在要部署它的环境上工作。 此外,当实际部署时间到来时,它节省了大量时间。

与客户沟通是关键 (Communication with the client is key)

I do most of my work by myself, so sometimes I find that a solution I’ve come up with doesn’t always make sense to the person who is going to use it. It’s incredibly important to get client buy-in. In fact, if you can manage to get them to come up with the idea, they will love it, I promise. Nothing makes a human happier than being listened to.

我大部分工作都是由我自己完成的,因此有时我发现我想出的解决方案并不总是对打算使用它的人有意义。 获得客户的认可非常重要。 事实上,我保证,如果您能够设法让他们提出这个想法,他们会喜欢的 。 没有什么比聆听使人快乐。

除了-我很幸运有一个非常好的客户 (Aside - I got lucky with a REALLY good client)

This isn’t so much a lesson, so much as a reminder of how important it is that you pick your clients. I know this sounds impossible, and frankly when you’re first starting out, it is very hard to be picky about your jobs. However, I’ve accepted jobs before that turned into nightmares because I ignored the signs.

这不是一堂课,而是提醒您选择客户是多么重要。 我知道这听起来是不可能的,坦率地说,当您刚开始工作时,很难对您的工作保持挑剔。 但是,在那之前,我已经接受了工作,变成了噩梦,因为我忽略了这些迹象。

Phrases like, “We need it ASAP” are a good indicator that the client is going to undervalue your worth.

诸如“我们需要它”之类的短语很好地表明了客户将低估您的价值。

计划失败 (Plan for Failure)

I think sometimes we look at established apps like Facebook or Instagram and try to reach that goal with our Version 1.0 apps. This is impossible for two reasons:

我认为有时我们会查看Facebook或Instagram等已建立的应用程序,并尝试通过我们的1.0版应用程序实现这一目标。 这是不可能的,原因有两个:

  1. Proper growth of an app requires user input. Do you think Instagram had a plan to add stories in their 1.0 version? Of course not, they waited for Snapchat to do it first then copied them. ?应用的正确增长需要用户输入。 您是否认为Instagram有计划在其1.0版本中添加故事? 当然不是,他们等着Snapchat先做后复制。 ?
  2. If you wait until it’s perfect, it will never be finished.如果您等到完美为止,它将永远不会完成。

What I’m getting at is, do the best you can, but don’t get hung up on writing the perfect function. Make it work, and improve as you go.

我正在做的是,尽力而为,但不要挂在编写完美的函数上。 使它起作用,并随着您的发展而不断改进。

Also, knowing that things will fail, make sure you are handling your errors correctly. The user needs to know if something goes wrong, even if they can’t do anything about it.

另外,知道一切都会失败,请确保正确处理错误。 用户需要知道是否出了什么问题,即使他们对此无能为力。

用户测试的重要性 (The Importance of User Testing)

Do NOT send the client a link and say, “Go check this out,” if you are planning on leaving your computer anytime soon. I made the mistake of doing that and then was bombarded with messages within an hour, while I was trying to eat lunch. Unless of course you enjoy bugs with your sushi.Not always the solution.

如果您打算尽快离开计算机,请不要向客户发送链接并说“去检查一下”。 我犯了一个错误,然后在尝试吃午餐的一个小时内被消息轰炸。 除非您当然喜欢寿司中的虫子,但并非总是解决方案。

It may be obvious to you, but that doesn’t mean it’s obvious to anyone else. A lot of the little things that became bugs were because of a bad UX or UI. I took for granted that I knew exactly what needed to happen because I wrote the thing. I’m not saying that you can plan for everything, but be aware that you will need to adjust some of your layouts so everyone will know what you want them to do.

这对您可能很明显,但这并不意味着对其他任何人都显而易见。 变成错误的许多小问题是由于不良的UX或UI。 我想当然了,因为我写了东西,所以我确切地知道需要做什么。 我并不是说您可以为所有事情做计划,但是要注意,您将需要调整一些布局,以便每个人都知道您想要它们做什么。

I originally only allotted two weeks for beta testing. One to test, one to fix. This is not enough time. I ended up having a week of beta testing part one, a week of cleanup, and then another week of beta testing, followed by another week of cleanup.

我最初只分配了两个星期的Beta测试时间。 一个要测试,一个要修复。 时间不够。 我最后进行了一周的beta测试(第一部分),一周的清理,然后进行了一周的beta测试,然后又进行了一周的清理。

不要依附于产品 (Don’t get attached to the product)

This ideal is driven by my graphic design background. If we stick to a design because we really like it, we will ignore all user feedback (what really matters) and never change. It is the same with building an app.

这个理想是由我的图形设计背景决定的。 如果我们坚持设计,因为我们真的很喜欢它,那么我们将忽略所有用户反馈(真正重要的信息),并且永远不会改变。 与构建应用程序相同。

Creating something out of nothing is, as the name implies, a creative act. You are making a lot of decisions about how you think a user will interact with the thing you are building. Don’t think you know better than the user — you don’t.

顾名思义,一无所有是创造力。 您正在做出许多有关用户如何与正在构建的事物进行交互的决定。 不要以为您比用户更了解-您没有。

玩得开心 (Have fun)

There’s no reason why you can’t enjoy the thing you’re doing. That’s not to say it won’t be incredibly frustrating, but try and enjoy it as much as you can.

没有理由让您无法享受正在做的事情。 这并不是说它不会令人难以置信的沮丧,而是尝试并尽可能多地享受它。

学习一些东西 (Learn something)

Deadlines are deadlines, but if you can incorporate one new thing into your stack, do it. You’ll be a much better developer afterwards.

截止日期是截止日期,但是如果您可以将新事物集成到堆栈中,请执行截止日期。 之后,您将成为更好的开发人员。

My biggest challenge for this project was AWS. I spent a ton of hours getting to know AWS. But now I have that notch on my belt for the next job. It would have been so easy to just deploy it to Heroku and call it a day, but that’s not the best option for a number of reasons.

这个项目的最大挑战是AWS。 我花了很多小时来了解AWS。 但是现在,我可以胜任下一份工作了。 只需将其部署到Heroku并每天进行调用就很容易了,但是由于多种原因,这并不是最佳选择。

推动最有价值球员 (Push for that MVP)

At the time of this writing, I still have about 20 open issues on the project. Expecting to finish every single item for version 1.0 is unrealistic. Always push for the minimum viable product (MVP) initially. Prioritization is key to determining what really matters in a project.

在撰写本文时,我在该项目上仍有大约20个未解决的问题。 期望完成1.0版的每个项目都是不现实的。 始终始终争取最低可行产品(MVP)。 优先级是确定项目中真正重要的关键。

Example: One of the open issues I have is that the padding is not right on the navigation. Is this a breaking issue? No. Can it wait until all the core features are done to fix it? Yes.

示例:我有一个未解决的问题,就是导航区上的填充不正确。 这是一个重大问题吗? 不可以。它可以等到所有核心功能都完成后再修复吗? 是。

So, I haven’t fixed it yet. However, I’ve expressed this to the client and they are OK with it.

所以,我还没有解决。 但是,我已经向客户表示了这一点,他们对此表示满意。

下次我会做的事情有所不同 (Things I will do differently next time)

单元测试 (Unit Testing)

I hadn’t done anything with testing before this project, so I didn’t do unit testing for this project. Huge mistake. I ended up having to integrate tests after I had already built the thing.

在这个项目之前,我没有做任何测试,因此我没有为这个项目做单元测试。 巨大的错误。 在构建完东西之后,我最终不得不集成测试。

Unit testing helps with the following:

单元测试有助于以下方面:

  1. Every time I added a new feature or changed something, I had to test everything manually. Not good.

    每次添加新功能或更改某些功能时,都必须手动测试所有内容。 不好。

  2. It maintains a level of functionality and also allows you to realize some shortcomings of your code. Purposely writing tests that will fail helps identity issues within the code.它保持一定的功能水平,还使您能够意识到代码的某些缺点。 故意编写将失败的测试有助于代码中的身份问题。

I highly suggest the TDD course by FunFunFunction to get started.

我强烈建议您使用FunFunFunction开发 TDD课程。

Small aside: If you use the express generator, it doesn’t export the server.

撇开一点:如果使用express生成器,它不会导出服务器。

If you want to test the server with Mocha, you have to export it at the end of the bin/www file.module.exports = server;

如果要使用Mocha测试服务器,则必须将其导出到bin/www file.modulesexports = server的末尾。

从一开始就更深入地了解每个功能 (Get a more in depth look at each feature from the beginning)

I made a list of all the features when I started, but I didn’t do a deep dive up front to see how I was actually going to implement them. If I had done this, I probably could have estimated my time better.

我在开始时就列出了所有功能,但并没有深入了解我实际上将如何实现它们。 如果这样做,我可能可以更好地估计自己的时间。

我学到的小知识 (Little things I learned)

您可以使用HTML输入访问相机-欢迎使用2018 (You can access the camera with an HTML input — Welcome to 2018)

However, this doesn’t work over non-secure pages in iOS.

但是,这不适用于iOS中的非安全页面。

文件上传和调整大小很麻烦 (File upload and resize is a pain)

The tutorial I went through showed the method for saving locally, however I wanted to leverage AWS S3. To be honest, the method I have setup is not ideal, so hopefully I can address this better in the future.

我阅读的教程展示了本地保存的方法,但是我想利用AWS S3。 老实说,我设置的方法并不理想,因此希望以后可以更好地解决此问题。

如果您是新帐户,AWS不允许您创建SSL证书 (AWS doesn’t let you create SSL Certificates if you are a new account)

As it turns out, AWS is pretty picky about new accounts. The customer service rep said it was to prevent new accounts from racking up huge bills, which I guess makes sense. Either way it’s pretty annoying when you are trying to launch an app and you can’t get your SSL Cert sorted.

事实证明,AWS对新帐户非常挑剔。 客户服务代表说,这是为了防止新帐户积累大量账单,我认为这是有道理的。 无论哪种方式,当您尝试启动应用程序并且无法对SSL证书进行排序时,这都很烦人。

Side note: if you use AWS for hosting, their certificate manager is amazingly easy.

旁注:如果您使用AWS进行托管,则其证书管理器非常简单。

Mongo数据库托管 (Mongo Database hosting)

I chose mLab to host my mongo database for a number of reasons:

由于多种原因,我选择了mLab来托管我的mongo数据库:

  1. I wanted backups without having to handle backups. mLab does that for you.我想要备份而不必处理备份。 mLab为您做到了。
  2. I didn’t want to spend a ton of money (or rather I didn’t want my client to spend a ton of money). They cost $10 per gigabyte.我不想花很多钱(或者我不想我的客户花很多钱)。 每GB成本为10美元。
  3. Also, they allow hosting on AWS. So in my mind that will be faster. I doubt it, but it’s the thought that counts, right?此外,它们允许在AWS上托管。 所以在我看来,这会更快。 我对此表示怀疑,但这是很重要的想法,对吗?

更漂亮 (Prettier)

Prettier is a life saver. However, it often fights with my ESLint. For one thing, it always removes my parentheses around single param functions. Meaning: (var) => {}

更漂亮可以节省生命。 但是,它经常与我的ESLint冲突。 一方面,它总是消除单个参数函数的括号。 含义: (var) => {}

vs

var => {}

var => {}

Illustrator不断创建1000 x 1001像素的图标 (Illustrator kept creating favicons that were 1000 x 1001 pixels)

Turns out if you don’t arrange the art boards to the pixel grid, it will throw it off. Using the auto arrange art boards feature will solve that issue. More info here.

事实证明,如果不将画板布置在像素网格上,它将被丢弃。 使用自动排列画板功能可以解决该问题。 更多信息在这里 。

为失败而努力很重要 (Building for failure is important)

The further along I got with other people using the app, the more I had to adjust my database and views. That meant breaking things that used to work.

我与其他人使用该应用程序的距离越远,我调整数据库和视图所需的时间就越多。 这意味着要打破曾经起作用的东西。

It’s hard to plan for everything but I got into the habit of expecting there to be no data and handling it.

很难为所有事情做计划,但是我养成了期待没有数据并处理它的习惯。

Example: I changed how I was storing images. It was in a field called ‘documentation’. When I switched how I was storing it I also changed it in the view, but that broke the older entries.

示例:我更改了存储图像的方式。 它位于一个称为“文档”的字段中。 当我切换存储方式时,我也在视图中进行了更改,但这打破了旧的条目。

I solved this by first checking to see if there was anything at all. And if there was, run some logic.

我通过首先检查是否有任何东西来解决此问题。 如果有,请运行一些逻辑。

摘要 (Summary)

This isn’t everything I learned, but hopefully some of it is useful to someone. If you have questions, hit me up.

这不是我学到的一切,但希望其中一些对某人有用。 如果您有任何疑问,请打我。

I can’t share the code for this project due to it being for a client. However, I’m happy to expand on any of the things in this article if you have questions.

我无法共享此项目的代码,因为它是针对客户的。 但是,如果您有任何疑问,我很乐意扩展本文中的任何内容。

Happy Coding!

科丁快乐

翻译自: https://www.freecodecamp.org/news/deploying-a-production-node-express-mongo-app-to-aws-a-reflection-8982894289c6/

mongo 删除节点

mongo 删除节点_将生产节点/ Express Mongo App部署到AWS —反思相关推荐

  1. java删除第一个节点_访问单个节点的删除(Java)

    实现一个算法,删除单向链表中间的某个结点,假定你只能访问该结点. 给定带删除的节点,请执行删除操作,若该节点为尾节点,返回false,否则返回true class ListNode { int val ...

  2. sql server父节点_将新节点添加到现有SQL Server Always On可用性组中

    sql server父节点 This is the 5th article in the series of a comprehensive guide to SQL Server Always On ...

  3. aws waf sql注入_适用于快速SQL Server Always On部署的AWS启动向导

    aws waf sql注入 SQL Server Always On is a high-availability and disaster recovery solution. We can use ...

  4. java根节点到叶子节点_二叉树根节点到叶子节点的所有路径和

    我觉得这个题目和剑指offer中的一道题目非常相似.先说这个题: 解题思路:从根结点开始,当每访问到一个结点,我们把该结点添加到路径上,并"累加" 该结点的值,这里"累加 ...

  5. 删除单链上数据域值最小的节点_深入浅出数据结构

    作为一名前端开发工程师,你可能有时会问:学习数据结构或者算法对于前端工程师有用么? 总的来说,这些基础学科在短期内收效确实甚微,但是我们首先不要将自己局限在前端工程师这点上,当我们把视野放到编程这个角 ...

  6. unity 删除子节点_【Unity文档】Realtime GI介绍(一)

    * 介绍 Unity中,有两种GI的技术:烘焙(Baked)和预计算实时(Precomputed Realtime)全局光照,这篇是讲预计算实时部分的 目录 如何决定光图分辨率 光图中的Charts是 ...

  7. python 链表倒数第k个节点_链表-删除单链表中倒数第k个节点

    题目 实现一个函数,一个可以删除单链表中倒数第k个节点 难度 简单 分析 本题比较简单,实现方法多种多样,这里提供一种方法 首先明确一点,在单链表中删除倒数第k个节点,需要找到他的前一个节点,让前一个 ...

  8. bst 删除节点_在BST中删除大于或等于k的节点

    bst 删除节点 Problem statement: 问题陈述: Given a BST and a value x, write a function to delete the nodes ha ...

  9. 删除链表的中间节点 Java实现_【链表问题】删除单链表的中间节点

    前言 以专题的形式更新刷题贴,欢迎跟我一起学习刷题,相信我,你的坚持,绝对会有意想不到的收获.每道题会提供简单的解答,如果你有更优雅的做法,欢迎提供指点,谢谢. [题目描述] 给定链表的头节点head ...

最新文章

  1. imopen和bwmorph_MATLAB图像处理中的应用
  2. 验证和训练loss和acc多种情况分析
  3. python3.5怎么安装pip-为python 3.5安装pip
  4. 查看docker的端口映射情况
  5. JMM如何解决顺序一致性问题-重排序问题
  6. oracle数据库扩展目录,Oracle 扩充磁盘空间
  7. 你不该错过的2020中国开源年报,填开源开发者问卷,成为国内开源的见证者
  8. java项目短信群发接口_JAVA实现第三方短信发送过程详解
  9. 这份精子保存了1亿年,不仅长度惊人还刷新了一项记录
  10. 传京东将收购格力电器5%股权 官方回应:消息不实
  11. 循序渐进之Maven(4) - 第一个SpringMVC项目
  12. java8 stringbuilder_有了Java8的“+”真的可以不要StringBuilder了吗
  13. 字体系列之字体大小(CSS、HTML)
  14. 在java中实现订餐系统_Java实现简单订餐系统
  15. freetextbox java_FreeTextBox使用详解 (版本3.1.1)
  16. 无为而无不为——论老子哲学的深度悖论(转载)
  17. Mac连接Ubuntu服务器并用屏幕共享app显示远程应用图形界面
  18. 计算机考研408必考重难点整理(2022考纲大改后,陆续更新中。。)
  19. 骨传导蓝牙耳机推荐,2022年最好的骨传导耳机
  20. 高效能人士的七个习惯-第四章-阅读

热门文章

  1. vue2+less开发,使用vux-loader,配置全局less变量
  2. Django 的简单ajax
  3. 异常作业2(2018.08.22)
  4. 【9303】平面分割
  5. 第一章-从双向链表学习设计
  6. 第一冲刺阶段博客检查
  7. PS图层混合模式中英文对照
  8. javascript 对象基础 继承机制实例【对象冒充】
  9. ES6规范 ESLint
  10. docker 网络 不好用 docker: Error response from daemon: failed to create endpoint jovial_wing on network b