magento2 扩展日志_可扩展的magento 2架构-程序员宅基地

技术标签: python  java  linux  php  数据库  

magento2 扩展日志

I write this post with mixed feelings as a company in my portfolio has recently decided to no longer on-board new Magento development projects due to various reasons beyond the scope of this post. However, we are still here to help with companies that are looking for a hand on designing infrastructure, maintaining the systems side of Magento environments, and migrating working Magento instances to the cloud.

我写这篇文章时充满了困惑,因为我的投资组合中的一家公司最近出于各种原因,决定不再参与新的Magento开发项目。 但是,我们仍然在这里为正在寻求基础架构设计,维护Magento环境的系统方面以及将工作的Magento实例迁移到云中的公司提供帮助。

For those of you who are not familiar, Magento is one of the most popular E-Commerce platforms used by e-tailers of all sizes. Perhaps it gained its popularity due to the fact that it’s an opensource project with a freely distributed community edition helping lots of companies build out powerful e-commerce websites quickly at extremely low costs. It has also in the past been one of the only few choices in its class that could efficiently handle large amounts of SKUs until the recent years where some of its competitors have caught up a bit. According to Wikipedia, there are over 100,000 stores globally that run on Magento and the software itself has been downloaded more than 2.5 million times. In 2018, Magento was acquired by Adobe for 1.68 billion US dollars, effectively becoming one of the members of Adobe’s brigade of web presence building tools.

对于不熟悉的人来说,Magento是各种规模的电子零售商使用的最受欢迎的电子商务平台之一。 也许由于它是一个具有免费分发的社区版本的开源项目,该项目帮助许多公司以极低的成本快速建立了强大的电子商务网站,所以它之所以受到青睐。 过去,它也是同类产品中能够有效处理大量SKU的仅有的少数选择之一,直到最近几年,其一些竞争对手对此有所追赶。 根据Wikipedia的数据 ,全球在Magento上运行的商店超过100,000家,该软件本身已被下载超过250万次。 2018年,Magento以16.8亿美元的价格被Adobe收购,实际上成为Adobe的Web现场构建工具大队的成员之一。

As you can tell from the above, even though we always advice customers to build out their e-commerce sites the right way from the start with custom builds rather than using pre-built template based platforms for many very good reasons, it’s extremely easy for budget conscious businesses to be tempted to go with a template based platform to reduce up-front costs instead. Whether this is a good decision or not is yet another topic beyond the scope of this post. However the point is that because of this phenomenon, we have over the years done quite a bit of work with Magento and some of the other platforms like WooCommerce, Odoo, and even Shopify.

从上面的内容可以看出,尽管出于很多很好的原因,尽管我们始终建议客户从定制构建开始就以正确的方式构建自己的电子商务站点,而不是使用基于预先构建的模板的平台,但对于精打细算的企业倾向于使用基于模板的平台来降低前期成本。 这是否是一个明智的决定,这是本文范围之外的另一个话题。 但是,关键是由于这种现象,我们多年来与Magento以及WooCommerceOdoo甚至Shopify之类的其他平台进行了大量的工作。

背景 (Background)

Around two years ago, a friend’s company running 3 e-commerce websites on a single Magento 1.9 instance came to me and asked for some help with their site. Apparently, at the time, the site would keep on crashing especially during high season and that was causing them business opportunities. I took a look at it and it was a typical growth situation. Basically, everything was running on a single VPS that just wasn’t cutting it anymore. So without going into too much detail, we essentially decoupled their Magento instance to an AWS EC2 auto-scaling group mounting EFS shares (we talked about containerization but the in-house team wasn’t quite ready for such a big leap) and Aurora to handle the database along with slapping Cloudflare in front of the whole thing to do some CDN and caching. They then had a somewhat scalable infrastructure from there and a single point to upload media and configure magento for all EC2 web instances. Off we went on a launch and the problem was solved.

大约两年前,一个朋友的公司在一个Magento 1.9实例上运行了3个电子商务网站,并向我求助于他们的网站。 显然,当时,该站点将继续崩溃,尤其是在旺季期间,这给他们带来了商机。 我看了看,这是典型的增长情况。 基本上,所有内容都在单个VPS上运行,而现在不再削减了。 因此,无需过多讨论,我们基本上将他们的Magento实例与安装EFS份额的AWS EC2自动伸缩组脱钩(我们谈到了集装箱化,但内部团队尚未为实现如此大的飞跃做好充分准备),而Aurora处理数据库以及将Cloudflare打在整个事情的前面,以进行一些CDN和缓存。 然后,他们从那里有了一个具有一定可扩展性的基础架构,并且可以通过单个点上传媒体并为所有EC2 Web实例配置magento。 我们出发了,问题解决了。

Image for post
Magento 1.9 New Architecture
Magento 1.9新架构

Fast forward to a few a months ago, Magento 1 using Paypal was falling out of PCI compliance and Paypal urged everyone to upgrade to Magento 2. So we regrouped with the client and discussed a plan of action. This time around, they were ready for containerization and AWS Fargate was at the same time finally mature enough for us to give it a run for its money. The hard part now is to migrate the Magento 1 data to Magento 2. This is the most painful part which I will definitely not cover here but let’s just say that we were able to successfully migrate all of the pertinent data over to a new Magento 2 instance running in Docker after a lot of pain and many sleepless nights. If anyone is thinking about doing this, I would strongly suggest you don’t go cheap and hire a strong firm that’s specifically focused on Magento with lots of experience doing migrations of this type. The difference is night and day.

几个月前,使用Paypal的Magento 1脱离了PCI合规性,Paypal敦促每个人都升级到Magento2。因此,我们与客户重组并讨论了一项行动计划。 这次,他们已经准备好进行容器化了,AWS Fargate终于终于成熟了,足以让我们为它赚钱了。 现在最困难的部分是将Magento 1数据迁移到Magento2。这是最痛苦的部分,我肯定不会在这里介绍,但是我们只能说我们能够将所有相关数据成功迁移到新的Magento 2中。经过很多痛苦和许多不眠之夜后,实例在Docker中运行。 如果有人在考虑这样做,我强烈建议您不要便宜,雇用一家专门针对Magento的强大公司,并具有进行此类迁移的丰富经验。 区别是白天和黑夜。

新建筑: (The New Archtecture:)

Image for post

Now that we have a pretty solid Magento 2 instance running in Docker on our local dev environment with the migrated data from Magento 1, we are ready to throw this onto AWS. We first imported the database to Aurora and created the Redis instance. Then, we started up an EC2 instance called DevOps and ran the image with it to reconfigure it for using Aurora and made some of the directories on EFS to be test mounted by the container. After that, we committed the image and pushed it to a newly created ECR registry.

现在,我们已经在本地开发环境中的Docker上运行了一个非常可靠的Magento 2实例,并从Magento 1迁移了数据,现在可以将其投放到AWS上了。 我们首先将数据库导入Aurora并创建Redis实例。 然后,我们启动了一个名为DevOps的EC2实例,并对其运行图像以对其进行重新配置以使用Aurora,并在EFS上建立了一些目录以供容器进行测试安装。 之后,我们提交了映像并将其推送到新创建的ECR注册表中。

We are then ready to give it a run on Fargate, we created the cluster and task definitions so that the image we have prepared is launched to have 2 minimum containers with an auto-scaler that maxes out at 4 containers sitting behind an Application Load Balancer which are configs derived from our past traffic based estimates. So why Fargate you might ask? Here is my logic behind it:

然后,我们准备在Fargate上运行它,我们创建了集群和任务定义,以便启动我们准备的映像,以使其具有2个最小容器,并具有一个自动缩放器,最多可将4个容器放在Application Load Balancer后面。这些配置是根据我们过去基于流量的估算得出的。 那么,为什么要问Fargate? 这是我背后的逻辑:

  1. No servers or orchestration infrastructure to manage

    无需管理服务器或业务流程基础架构
  2. Handles EFS mounting and launching/monitoring of docker containers for you via task definitions

    通过任务定义为您处理EFS的安装以及docker容器的启动/监视
  3. Load Balancer is automatically adjusted on launch and auto-scaling

    在启动和自动缩放时自动调整负载均衡器
  4. Overall cost reduction to only paying for what’s used compared to EC2

    与EC2相比,整体成本降低,仅需支付使用费用

Of course, we reused the bastion host that has OpenVPN (external) and ssh (internal LAN only) enabled to allow our customers to configure Magento and upload images to EFS that persists across all containers. It will also serve as the gateway for the client to access DevOps for making docker image changes and accessing the new analytics system we will be installing after.

当然,我们重用了启用了OpenVPN(外部)和ssh(仅内部LAN)的堡垒主机,以允许我们的客户配置Magento并将图像上载到可在所有容器中持久保存的EFS。 它还将用作客户端访问DevOps的网关,以进行docker映像更改和访问我们将要安装的新分析系统。

As mentioned, the client wanted to run some analytics on the data in Magento so it was only logical to create a read replica of the production database so that they can run an EC2 instance and install whatever they wanted to grab data and analyze with. So that’s exactly what we did.

如前所述,客户希望对Magento中的数据进行一些分析,因此创建生产数据库的只读副本是合理的,这样他们就可以运行EC2实例并安装任何想要获取数据并进行分析的对象。 这就是我们所做的。

And that’s it! We logged into Cloudflare, swapped out the CNAME of the domains to the new load balancer and went live. This sums up all the components of a modern scalable Magento 2 architecture as diagrammed above. There are more improvements that can be done or even components that’s already there which I didn’t really talk much about like varnish and maybe even CI/CD but what’s clearly within the diagram alone is already a solid enough foundation for general scaling and growth and definitely ready for you to add more or improve upon without any unwanted architectural issues.

就是这样! 我们登录到Cloudflare,将域的CNAME换成新的负载均衡器并开始使用。 总结了上图所示的现代可扩展Magento 2架构的所有组件。 还有更多可以改进的地方,甚至什至已经存在的组件我还没有真正谈论过,例如清漆,甚至CI / CD,但仅在图表中显然已经为总体缩放和增长奠定了坚实的基础。绝对可以为您添加或改进而没有任何不必要的体系结构问题。

If there are any questions or suggestions, please feel free to drop a comment below or get directly in touch!

如有任何疑问或建议,请随时在下面发表评论或直接联系!

翻译自: https://medium.com/@hkdb/a-scalable-magento-2-architecture-107f5fe7a813

magento2 扩展日志

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/weixin_26705651/article/details/108907105

智能推荐

5个超厉害的资源搜索网站,每一款都可以让你的资源满满!_最全资源搜索引擎-程序员宅基地

文章浏览阅读1.6w次,点赞8次,收藏41次。生活中我们无时不刻不都要在网站搜索资源,但就是缺少一个趁手的资源搜索网站,如果有一个比较好的资源搜索网站可以帮助我们节省一大半时间!今天小编在这里为大家分享5款超厉害的资源搜索网站,每一款都可以让你的资源丰富精彩!网盘传奇一款最有效的网盘资源搜索网站你还在为找网站里面的资源而烦恼找不到什么合适的工具而烦恼吗?这款网站传奇网站汇聚了4853w个资源,并且它每一天都会持续更新资源;..._最全资源搜索引擎

Book类的设计(Java)_6-1 book类的设计java-程序员宅基地

文章浏览阅读4.5k次,点赞5次,收藏18次。阅读测试程序,设计一个Book类。函数接口定义:class Book{}该类有 四个私有属性 分别是 书籍名称、 价格、 作者、 出版年份,以及相应的set 与get方法;该类有一个含有四个参数的构造方法,这四个参数依次是 书籍名称、 价格、 作者、 出版年份 。裁判测试程序样例:import java.util.*;public class Main { public static void main(String[] args) { List <Book>_6-1 book类的设计java

基于微信小程序的校园导航小程序设计与实现_校园导航微信小程序系统的设计与实现-程序员宅基地

文章浏览阅读613次,点赞28次,收藏27次。相比于以前的传统手工管理方式,智能化的管理方式可以大幅降低学校的运营人员成本,实现了校园导航的标准化、制度化、程序化的管理,有效地防止了校园导航的随意管理,提高了信息的处理速度和精确度,能够及时、准确地查询和修正建筑速看等信息。课题主要采用微信小程序、SpringBoot架构技术,前端以小程序页面呈现给学生,结合后台java语言使页面更加完善,后台使用MySQL数据库进行数据存储。微信小程序主要包括学生信息、校园简介、建筑速看、系统信息等功能,从而实现智能化的管理方式,提高工作效率。

有状态和无状态登录

传统上用户登陆状态会以 Session 的形式保存在服务器上,而 Session ID 则保存在前端的 Cookie 中;而使用 JWT 以后,用户的认证信息将会以 Token 的形式保存在前端,服务器不需要保存任何的用户状态,这也就是为什么 JWT 被称为无状态登陆的原因,无状态登陆最大的优势就是完美支持分布式部署,可以使用一个 Token 发送给不同的服务器,而所有的服务器都会返回同样的结果。有状态和无状态最大的区别就是服务端会不会保存客户端的信息。

九大角度全方位对比Android、iOS开发_ios 开发角度-程序员宅基地

文章浏览阅读784次。发表于10小时前| 2674次阅读| 来源TechCrunch| 19 条评论| 作者Jon EvansiOSAndroid应用开发产品编程语言JavaObjective-C摘要:即便Android市场份额已经超过80%,对于开发者来说,使用哪一个平台做开发仍然很难选择。本文从开发环境、配置、UX设计、语言、API、网络、分享、碎片化、发布等九个方面把Android和iOS_ios 开发角度

搜索引擎的发展历史

搜索引擎的发展历史可以追溯到20世纪90年代初,随着互联网的快速发展和信息量的急剧增加,人们开始感受到了获取和管理信息的挑战。这些阶段展示了搜索引擎在技术和商业模式上的不断演进,以满足用户对信息获取的不断增长的需求。

随便推点

控制对象的特性_控制对象特性-程序员宅基地

文章浏览阅读990次。对象特性是指控制对象的输出参数和输入参数之间的相互作用规律。放大系数K描述控制对象特性的静态特性参数。它的意义是:输出量的变化量和输入量的变化量之比。时间常数T当输入量发生变化后,所引起输出量变化的快慢。(动态参数) ..._控制对象特性

FRP搭建内网穿透(亲测有效)_locyanfrp-程序员宅基地

文章浏览阅读5.7w次,点赞50次,收藏276次。FRP搭建内网穿透1.概述:frp可以通过有公网IP的的服务器将内网的主机暴露给互联网,从而实现通过外网能直接访问到内网主机;frp有服务端和客户端,服务端需要装在有公网ip的服务器上,客户端装在内网主机上。2.简单的图解:3.准备工作:1.一个域名(www.test.xyz)2.一台有公网IP的服务器(阿里云、腾讯云等都行)3.一台内网主机4.下载frp,选择适合的版本下载解压如下:我这里服务器端和客户端都放在了/usr/local/frp/目录下4.执行命令# 服务器端给执_locyanfrp

UVA 12534 - Binary Matrix 2 (网络流‘最小费用最大流’ZKW)_uva12534-程序员宅基地

文章浏览阅读687次。题目:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=93745#problem/A题意:给出r*c的01矩阵,可以翻转格子使得0表成1,1变成0,求出最小的步数使得每一行中1的个数相等,每一列中1的个数相等。思路:网络流。容量可以保证每一行和每一列的1的个数相等,费用可以算出最小步数。行向列建边,如果该格子是_uva12534

免费SSL证书_csdn alphassl免费申请-程序员宅基地

文章浏览阅读504次。1、Let's Encrypt 90天,支持泛域名2、Buypass:https://www.buypass.com/ssl/resources/go-ssl-technical-specification6个月,单域名3、AlwaysOnSLL:https://alwaysonssl.com/ 1年,单域名 可参考蜗牛(wn789)4、TrustAsia5、Alpha..._csdn alphassl免费申请

测试算法的性能(以选择排序为例)_算法性能测试-程序员宅基地

文章浏览阅读1.6k次。测试算法的性能 很多时候我们需要对算法的性能进行测试,最简单的方式是看算法在特定的数据集上的执行时间,简单的测试算法性能的函数实现见testSort()。【思想】:用clock_t计算某排序算法所需的时间,(endTime - startTime)/ CLOCKS_PER_SEC来表示执行了多少秒。【关于宏CLOCKS_PER_SEC】:以下摘自百度百科,“CLOCKS_PE_算法性能测试

Lane Detection_lanedetectionlite-程序员宅基地

文章浏览阅读1.2k次。fromhttps://towardsdatascience.com/finding-lane-lines-simple-pipeline-for-lane-detection-d02b62e7572bIdentifying lanes of the road is very common task that human driver performs. This is important ..._lanedetectionlite

推荐文章

热门文章

相关标签