Front-end full-stack road - some thoughts on front-end operation and maintenance

Dachang technology adheres to weekly updates and selects good articles

foreword

In the previous column, all the content we updated along the way was related to technology, so let’s take it easy in this chapter and talk to you about some interesting things about front-end operation and maintenance, which may also be encountered in the process of the front-end moving towards the full stack. some problems.

background

The difference between  front-end operation and maintenance and traditional operation and maintenance is that the update iteration of the front-end is too fast. In addition to SSR , CSR , and SSG  , there are various front-end frameworks that are continuously launched and their own destructive version iterations.

Different from the backend that needs to maintain a stable running environment for a long time (for example, some Java  services  may still be  JDK8 ), the front-end build script needs to be changed according to various requirements and frameworks. For example, the requirements for front-end automated testing require the use of a headless browser To take a screenshot, you need to  install  Chrome and the Chinese font library in the corresponding  Docker image  , which is something that traditional back-end operation and maintenance has never touched.

If operation and maintenance is needed to help solve the problem, in addition to continuous learning, front-end students also need to pre-research and provide certain technical solutions and requirements to complete the goal. Moreover, after the popularization of the concept of the big front-end , the appearance of the APP  side and various cross-end frameworks, and the connection of small programs or third-party services launched by various major manufacturers is a very novel content.

For operation and maintenance students, building such  a Devops  system requires a lot of learning, and the update frequency is also very fast, and a lot of content is fragmented. To be honest, although being a programmer is to constantly learn new technologies, But the process is really painful.

The front-end operation and maintenance is taken at random by me. Generally, the front-end architecture group or the basic group do such things, but I also manage a lot of work on the server. By the way, I just call this a joke.

Scene recurrence

We do operation and maintenance, especially the front-end operation and maintenance. The biggest pain is: every time a classmate will come to you when the server construction is unsuccessful, give you all the logs and say confidently that this project is in my local environment. There is no problem with the operation, and there is no problem with the construction. Why can't it be built on the server? You can solve it for me, and it will go online .

14e6ef8ce2f4f31e235c38deb1f2f690.png
image.png

After doing operation and maintenance for so long, the problems that occurred in the server construction of the front-end project may be summarized as follows:

  1. Project dependencies or ghost dependencies have been upgraded, and there are  *.lock files in local development, so even if they are deleted  node_modules, the reinstallation will still be the old version, but it will not be uploaded or read when the server is built,  *.lock resulting in inconsistent versions of installed dependencies and references Method exceptions lead to build failures;

  2. Similar to the first problem, a dependency is installed locally and globally, but it is not placed  package.json , resulting in an abnormal build on the server;

  3. The local  Node  version is inconsistent with the server. For example, some  APIs are  only available in  version 18  , but the server generally only chooses stable version  14  or  16 , so the build fails. At this time, you can choose a new mirror version to build or be compatible with lower-level  Node  versions;

  4. Some projects rely on some special services such as  Python  . These third-party software have been installed locally, but the server does not, so the build will be abnormal. It is necessary to determine whether to install such third-party software in the build script.

I hope that front-end students who encounter similar problems can first solve it by themselves according to the above, and reduce the burden of operation and maintenance. When existence cannot take care of you, it is the best and most convenient to save yourself. If there are still missing or other strange questions, you can leave a message in the comment area for discussion.

There may be some other strange problems, but the failure of most server construction projects has nothing to do with the server itself, so in general, as long as you pay attention to avoid the above problems, there will be no   abnormalities in the CI process.

Because I also belong to the front-end background, so I can help to solve these problems, but it is impossible for him to understand these problems in the traditional operation and maintenance, which may cause some misunderstandings and minor problems between the front-end and operation and maintenance. contradiction.

Operations and maintenance pay more attention to what abnormalities in the construction process

It is impossible for build exceptions to have absolutely nothing to do with the server, but most of the exceptions will appear during the  CD  process, so the operation and maintenance is more concerned about and can solve the problem of not compiling the code of the project itself, but the environment during the compiling process, Server and other issues:

  1. Permission-related: Some project build scripts may need to install some additional tools that require system permissions. At this time, contact the operation and maintenance to help give higher permissions or build a built-in basic image;

  2. Security-related: If an external image with vulnerabilities is used, but it is difficult to handle by yourself, or some interfaces (internal  RPC , external service callback interface, etc.) need to enable  the IP  whitelist, you can contact the operation and maintenance for help;

  3. Server-related: If there is a project such as  RN , APP  construction that requires a high-performance server or  iOS  that requires  a Mac  to build, quickly find an operation and maintenance solution, hardware is the primary productivity ;

  4. Database related: For some projects that require database services, database user permissions, internal and external network permissions, database data synchronization, backup and other issues;

  5. Cluster deployment related: such as mirror synchronization failure, insufficient pod resources, etc.;

afc4b6c059c0bb82593fa0723e2c46c2.png
image.png

In  the All in Docker  solution, we can use  Docker  to ensure the unity of the server, that is, the production environment, and ensure the dependencies and related environment variables and third-party software deployed in each production environment ( dev , test , pre , prod ) consistent with external factors.

But in the development environment, we will face more problems. For example, the system environment of each student may be inconsistent. There are  Windows , Mac  , and many gods who use  the Linux  system, not to mention  the Node  version and three-party dependent services. Inconsistency and various cache problems in each development environment, etc., so it is often a very big problem to solve environmental dependencies in legacy projects or multi-team collaboration.

So is there a good solution to resolve the dependencies of the development environment?

This must be true, this is the next  article in the Docker  series [Docker Remote Development], you can pay attention to it.

95350430dc705c6f3d9d92caf6f5b497.png
image.png

Summarize

From my experience, if the company does not meet  the Node  business, but the front-end wants to go to the full-stack route, the best entry point is  Devops .

There are many types of front-end frameworks, and they need to be compatible with various frameworks. Even if the technology stack can be unified, there will still be cross-end and small programs that require three-party docking. They belong to the front-end technology field but are biased towards developing and experiencing back-end modules.

So if you are interested in  Node  and want to take the full-stack route, you might as well try to build a small  Devops  system first. After all, the people who are most familiar with the needs, capable of development, and in need are all the same person ( product + R &D + users ), how? Might not do well?

write at the end

Finally, I wish you all the best and better progress on the road of full stack. Continuous learning is the foundation and interest of programmers.

The above is the whole content of this sharing, I hope it will be helpful to you ^_^

If you like it, don't forget to share, like, and bookmark three times~.

a7151a410a022cd44b4ed108d308d81c.gif

Build a full-stack visual large-screen production platform V6.Dooring from scratch

Build an engine from zero design visualization large screen

Analysis of Data Source Design of Dooring Visual Construction Platform

Some thinking and practice of visual construction

Develop a full-stack document editor from scratch based on Koa + React + TS (advanced practice

Click to see you look the best

Guess you like

Origin blog.csdn.net/KlausLily/article/details/129869997