CN109375946B - Method and system for managing component package of node package manager - Google Patents

Method and system for managing component package of node package manager Download PDF

Info

Publication number
CN109375946B
CN109375946B CN201811017082.5A CN201811017082A CN109375946B CN 109375946 B CN109375946 B CN 109375946B CN 201811017082 A CN201811017082 A CN 201811017082A CN 109375946 B CN109375946 B CN 109375946B
Authority
CN
China
Prior art keywords
package
component package
management server
version number
notification message
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811017082.5A
Other languages
Chinese (zh)
Other versions
CN109375946A (en
Inventor
林泽全
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Lian Intellectual Property Service Center
Shunwei Chongqing Technology Co ltd
Original Assignee
Shunwei Chongqing Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shunwei Chongqing Technology Co ltd filed Critical Shunwei Chongqing Technology Co ltd
Priority to CN201811017082.5A priority Critical patent/CN109375946B/en
Publication of CN109375946A publication Critical patent/CN109375946A/en
Application granted granted Critical
Publication of CN109375946B publication Critical patent/CN109375946B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Abstract

The invention is applicable to the technical field of computers, and provides a method and a system for managing component packages of a node package manager, wherein the method comprises the following steps: the management server sends a control instruction to a source server storing the component package according to the attribute information of the component package of the node package manager NPM contained in the request information sent by the terminal; the source server creates a virtual running environment according to the control instruction, and returns an identification first notification message containing the virtual running environment to the management server; the management server stores attribute information and the identifier of the virtual running environment in an associated mode according to the first notification message, and returns a second notification message to the terminal according to the terminal identifier; and the management server receives the component package uploaded by the terminal and operates the uploaded component package in the target virtual operation environment according to the association relation of the attribute information and the identifier of the virtual operation environment and the attribute information of the uploaded component package. The embodiment of the invention can save the hardware cost and the maintenance cost required by deploying the new source server.

Description

Method and system for managing component package of node package manager
Technical Field
The invention belongs to the technical field of computers, and particularly relates to a method and a system for managing a component package of a node package manager.
Background
The Node packet manager (Node Package Manager, NPM) is a Node js packet management and distribution tool, which has become an unofficial standard for publishing Node modules (packets), and the NPM contains three parts: a code base for storing third party packages, a mechanism for managing locally installed packages, and a criteria for defining package dependencies. NPM provides a common registration service that contains all packages (component installation packages) that are published by everyone, and provides a command line tool for downloading, installing and managing these packages.
When a user needs to use an NPM package (or an NPM component package for implementing a function), a local NPM source (download source) needs to be directed to a corresponding source server storing the NPM package, so that the component is downloaded and installed from the source server storing the NPM package. However, when NPM packages need parallel development and testing, the same NPM package will have different versions, and one source server only has one set of running environment, one set of running environment supports running NPM packages of one version, and one source server cannot support parallel development and testing of NPM packages. If parallel development and test of the NPM package are required to be realized, multiple sets of source servers are required to be built to respectively run the NPM packages with different versions, so that the hardware cost and the maintenance cost are high, and the actual execution is not facilitated.
Disclosure of Invention
In view of this, the embodiments of the present invention provide a method and a system for managing a package of a node package manager, so as to solve the problem in the prior art that when parallel development and testing of NPM packages need to be supported in parallel, NPM packages with different versions need to be operated respectively by setting up multiple source servers, which is very high in hardware cost and maintenance cost, and is not beneficial to practical implementation.
A first aspect of an embodiment of the present invention provides a method for managing a component package of a node package manager, including:
the management server obtains request information sent by a terminal, and sends a control instruction to a source server storing a component package according to attribute information of the component package of a node package manager NPM contained in the request information; the control instruction includes the attribute information; the attribute information comprises a unique identifier of the component package and a current first version number;
the source server creates a virtual running environment according to the control instruction sent by the management server, and returns a first notification message to the management server, wherein the first notification message comprises an identifier of the virtual running environment;
the management server stores the attribute information and the identifier of the virtual running environment in an associated mode according to the first notification message, and returns a second notification message to the terminal according to the terminal identifier carried by the request information; the second notification information at least comprises a download address of the component package of the first version number;
And the management server receives the component package uploaded by the terminal after downloading the component package of the first version number according to the download address, and operates the uploaded component package in a target virtual operation environment according to the association relation of the attribute information and the identifier of the virtual operation environment and the attribute information of the uploaded component package.
A second aspect of the embodiment of the present invention provides a system for managing a component package of a node package manager, including a management server, an origin server, and at least one terminal;
the management server acquires request information sent by a terminal, and sends a control instruction to a source server according to attribute information of a component package of a node package manager NPM contained in the request information; the control instruction includes the attribute information; the attribute information comprises a unique identifier of the component package and a current first version number;
the source server creates a virtual running environment according to the control instruction sent by the management server, and returns a first notification message to the management server, wherein the first notification message comprises an identifier of the virtual running environment;
the management server stores the attribute information and the identifier of the virtual running environment in an associated mode according to the first notification message, and returns a second notification message to the terminal according to the terminal identifier carried by the request information; the second notification information at least comprises a download address of the component package of the first version number;
And the management server receives the component package uploaded by the terminal after downloading the component package of the first version number according to the download address, and operates the uploaded component package in a target virtual operation environment according to the association relation of the attribute information and the identifier of the virtual operation environment and the attribute information of the uploaded component package.
The method and the system for managing the component package of the node package manager provided by the embodiment of the invention have the following beneficial effects:
according to the embodiment of the invention, when parallel development and testing are required to be carried out on the NPM component package, a control instruction is sent to the source server storing the NPM component package through the management server according to the request information sent by the terminal, and the source server is controlled to create a virtual operation environment for the NPM component package so as to operate and test the NPM component package with a new version in the virtual operation environment. By creating a virtual running environment in an original deployed source server according to actual demands, the development and test of multiple sets of parallel running environment supporting NPM component packages can be realized in the same source server without adding a new source server, and the hardware cost and maintenance cost required by deploying the new source server can be saved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the embodiments or the description of the prior art will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of a network topology of a system for managing component packages of a node package manager according to an embodiment of the present invention;
FIG. 2 is a flow chart of an implementation of a method for managing component packages of a node package manager according to an embodiment of the present invention;
FIG. 3 is a flow chart of an implementation of a method for managing component packages of a node package manager according to another embodiment of the present invention;
fig. 4 is a schematic diagram of a server according to an embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present invention more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
Referring to fig. 1, fig. 1 is a schematic diagram of a network topology of a system for managing component packages of a node package manager according to an embodiment of the present invention. For convenience of explanation, only the portions related to the present embodiment are shown.
The system as shown includes at least one terminal 110, a management server 120, and at least one source server 130, where the NPM package is stored in the source server 130. Terminal 110 includes, but is not limited to, a desktop computer, a notebook computer, and may be other terminals that may develop NPM component packages. The management server 120 may be an nmginx, also known as engine x, which is a high performance hypertext transfer protocol (Hyper Text Transport Protocol, HTTP) server and reverse proxy server.
The terminal 110 may communicate with the management server 120, and the management server 120 may communicate with the origin server.
Alternatively, when the terminal 110 knows the access address of the origin server 130, it can also communicate with the origin server 130.
The method for managing the component packages of the node package manager according to the present invention will be described in detail with reference to fig. 2 and 3, and the process of data interaction among the terminal, the management server and the source server will be described. Specifically, referring to fig. 1, fig. 1 is a flowchart illustrating an implementation of a method for managing a component package of a node package manager according to an embodiment of the present invention. The method of managing component packages of a node package manager as shown may comprise the steps of:
S101: the management server obtains request information sent by a terminal, and sends a control instruction to a source server storing a component package according to attribute information of the component package of a node package manager NPM contained in the request information; the control instruction includes the attribute information; the attribute information includes a unique identification of the component package and a current first version number.
When a developer needs to develop and test the NPM package, after the terminal establishes communication connection with the management server through the access address of the management server, the developer can input or select the unique identifier of the NPM package (NPM package) and the current first version number of the NPM package through the interactive interface displayed by the terminal, and trigger the terminal to generate request information. The first version number of the NPM package refers to the version number of the NPM package that currently needs to be downloaded. The NPM package refers to a package managed by NPM.
The request information is used for requesting to acquire a download address of an NPM component package to be debugged, the request information comprises attribute information of the NPM component package to be debugged and a terminal identifier, and the attribute information of the NPM component package to be debugged comprises a unique identifier of the NPM component package and a current first version number of the NPM component package. The terminal identity is a unique identity of the terminal, e.g. a media access control (Media Access Control, MAC) address. The NPM component package to be debugged refers to the NPM component package which needs to be downloaded and developed and tested by a developer.
The attribute information of the NPM component package to be debugged is used for acquiring the download address of the NPM component package, and the identifier of the terminal is used for returning the download address of the NPM component package to the terminal by the management server.
When the terminal generates the request information, the terminal transmits the generated request information to the management server.
The database of the management server stores the attribute information of the NPM package and the corresponding relation between the download addresses of the NPM package in advance, and the download addresses of the NPM package may be the storage addresses of the NPM package in the source server.
The method comprises the steps that a management server receives request information sent by each terminal, analyzes the request information, and obtains attribute information of NPM component packages contained in each request information from header (header) information of the request information to obtain unique identifiers and current first version numbers of the NPM component packages to be debugged; then, responding to the request information, searching a download address matched with the unique identifier and the current first version number from a database according to the unique identifier of the NPM component package to be debugged and the current first version number contained in the request information, establishing communication connection with the source server according to the matched download address, and sending a control instruction to the source server; the control instruction is used for indicating the source server to create a virtual running environment; the control instruction comprises attribute information of an NPM component package to be debugged; the attribute information includes a unique identification of the component package and a current first version number. The virtual execution environment is used for providing an execution environment for the NPM component package of the new version developed.
It is understood that the number of matched download addresses acquired by the management server may be one or at least two. When at least two matched download addresses are obtained, the management server can send a control instruction to the source server corresponding to the download address according to any one of the download addresses.
For example, when the management server receives first request information sent by the first terminal, a first control instruction is sent to the source server according to attribute information of a first NPM package contained in the first request information, so as to instruct the source server to create a virtual running environment for the first NPM package with a new version according to the first control instruction.
And when the management server receives second request information sent by the second terminal or the first terminal, sending a second control instruction to the source server according to the attribute information of the second NPM component package contained in the second request information so as to instruct the source server to create a virtual running environment for the second NPM component package with the new version according to the second control instruction.
S102: the source server creates a virtual running environment according to the control instruction sent by the management server, and returns a first notification message to the management server, wherein the first notification message comprises an identification of the virtual running environment.
When the source server receives a control instruction sent by the management server, a Docker mirror image is created in the source server for a new version of NPM component package corresponding to the attribute information of the NPM component package contained in the control instruction based on an application container engine Docker grammar, and a virtual running environment is obtained. The virtual operating environment is the same as the real operating environment in the origin server. The identifiers of the virtual running environments respectively created in the source servers can be docker1, docker2, docker3, … … and docker N. dockerN represents the identity of the Nth docker mirror.
After the virtual running environment is created, the source server sends a first notification message identifying that the virtual running environment is successfully created to the management server according to the access address of the management server, wherein the notification message comprises the identification of the created virtual running environment. The created virtual execution environment is used to execute the developed new version of NPM package. Wherein a virtual runtime environment provides a runtime environment for a version of the NPM package.
It can be understood that when the source server fails to create the virtual environment, a notification message for indicating that the virtual running environment is created is returned to the management server, so that when the management server acquires at least two matched download addresses, the control instruction for indicating that the source server corresponding to the download addresses creates the virtual running environment is sent by replacing the download addresses.
S103: the management server stores the attribute information and the identifier of the virtual running environment in an associated mode according to the first notification message, and returns a second notification message to the terminal according to the terminal identifier carried by the request information; the second notification information includes at least a download address of the component package of the first version number.
When receiving a notification message fed back by the source server and used for indicating that the virtual running environment is successfully created, the management server can store attribute information of the NPM component package and identification association of the virtual running environment created in the notification message.
Further, the management server can also store the download address of the NPM component package, the attribute information of the NPM component package and the identifier of the virtual running environment created in the notification message in an associated manner, so that the unique identifier of the NPM component package, the current version number, the download address of the NPM component package and the identifier of the virtual running environment created in the first notification message are stored in an associated manner, and when the management server receives the NPM component package of the new version sent by the terminal, the management server can determine the identifier of the virtual running environment matched with the NPM component package according to the unique identifier of the NPM component package.
It will be appreciated that when there are at least two virtual execution environments that match the unique identification of the NPM package, the management server may select any one of the virtual execution environments that is not used.
It may be understood that the management server may further associate and store the terminal identifier, attribute information of the NPM component package, and an identifier of the virtual running environment, so that when the management server receives the new version of the NPM component package uploaded by the terminal, the management server determines the virtual running environment corresponding to the new version of the NPM component package according to the terminal identifier, the unique identifier of the NPM component package, and the first version number of the downloaded NPM component package.
The management server may transmit the second notification information to the terminal transmitting the request message according to the identification of the terminal in the request message. The second notification information includes at least a download address of the NPM package of the first version number, the download address pointing to an origin server storing the NPM package of the first version. The download address is determined based on the unique identification of the NPM package and the current first version number. The second notification message is used for notifying the terminal to download the NPM component package according to the download address of the component package of the first version number.
When receiving a second notification message sent by the management server, the terminal downloads the NPM component package according to the download address of the NPM component package with the first version number in the second notification message, so that a developer can develop the NPM component package with the first version number on the basis of the NPM with the first version number, and the developer can develop the NPM component package with the new version on the basis of the NPM with the first version number through the interaction interface and trigger an uploading instruction. The terminal acquires the NPM component package of the new version uploaded by the developer and sends the NPM component package to the management server. The uploaded NPM component package includes at least a unique identification of the NPM component package.
S104: and the management server receives the component package uploaded by the terminal after downloading the component package of the first version number according to the download address, and operates the uploaded component package in a target virtual operation environment according to the association relation of the attribute information and the identifier of the virtual operation environment and the attribute information of the uploaded component package.
When the management server acquires the NPM package of the new version, the management server acquires the identification of the target virtual operation environment matched with the attribute information (unique identification and the first version number of the downloaded NPM package) of the uploaded NPM package according to the association relation between the attribute information of the NPM package and the identification of the virtual operation environment, determines the target source server to which the virtual operation environment belongs according to the identification of the target virtual operation environment, establishes communication connection with the target source server according to the access address of the target source server, and therefore stores the NPM package of the new version in the target virtual operation environment in the target source server, and operates the uploaded NPM package in the target virtual operation environment for testing.
It can be understood that when the terminal identifier, the attribute information of the NPM package and the identifier of the virtual running environment are stored in association in the management server, the identifier of the target virtual running environment, which is matched with the attribute information of the NPM package and the terminal identifier of the terminal uploading the NPM package, is obtained according to the association relationship among the terminal identifier, the attribute information of the NPM package and the identifier of the virtual running environment, so that the NPM package of the uploaded new version is stored in the target virtual running environment in the target source server, and the uploaded NPM package can be run in the target virtual running environment and tested.
According to the embodiment of the invention, when parallel development and testing are required to be carried out on the NPM component package, a control instruction is sent to the source server storing the NPM component package through the management server according to the request information sent by the terminal, and the source server is controlled to create a virtual operation environment for the NPM component package so as to operate and test the NPM component package with a new version in the virtual operation environment. By creating a virtual running environment in an original deployed source server according to actual demands, the development and test of multiple sets of parallel running environment supporting NPM component packages can be realized in the same source server without adding a new source server, and the hardware cost and maintenance cost required by deploying the new source server can be saved.
Referring to fig. 3, fig. 3 is a flowchart illustrating an implementation of a method for managing component packages of a node package manager according to another embodiment of the present invention. The method of managing component packages of a node package manager as shown may comprise the steps of:
s201: the management server obtains request information sent by the terminal, and creates a second version number for the component package according to a preset version naming strategy and attribute information of the component package of the node package manager NPM contained in the request information.
When a developer needs to develop and test the NPM package, after the terminal establishes communication connection with the management server through the access address of the management server, the developer can input or select the unique identifier and the current first version number of the NPM package (NPM package) through the interactive interface displayed by the terminal, and trigger the terminal to generate request information. The first version number of the NPM package refers to the version number of the NPM package that currently needs to be downloaded.
The request information is used for requesting to acquire a download address of the NPM component package to be debugged, the request information comprises attribute information of the NPM component package to be debugged and a terminal identifier, and the attribute information of the NPM component package to be debugged comprises a unique identifier and a current first version number. The terminal identity is a unique identity of the terminal, e.g. a media access control (Media Access Control, MAC) address. The NPM component package to be debugged refers to the NPM component package which needs to be downloaded and developed and tested by a developer.
The attribute information of the NPM component package to be debugged is used for acquiring the download address of the NPM component package, and the identifier of the terminal is used for returning the download address of the NPM component package to the terminal by the management server.
When the terminal generates the request information, the terminal transmits the generated request information to the management server.
The database of the management server stores the attribute information of the NPM package and the corresponding relation between the download addresses of the NPM package in advance, and the download addresses of the NPM package may be the storage addresses of the NPM package in the source server.
The method comprises the steps that a management server receives request information sent by each terminal, analyzes the request information, and obtains attribute information of NPM component packages contained in each request information from header (header) information of the request information to obtain unique identifiers and current first version numbers of the NPM component packages to be debugged; and then, respectively determining a second version number of the NPM component package of the updated version for each terminal according to the current first version number and the version naming strategy of the NPM component package, wherein the second version number is the version number of the new NPM component package obtained by developing the NPM component package based on the first version number by a developer. The control instruction sent by the management server further comprises a new version number of the NPM packet, so that when the source server receives the control instruction, a virtual running environment corresponding to the new version number is created.
The second version number is typically higher than the version number of the NPM package stored in the origin server.
It is understood that the number of matched download addresses acquired by the management server may be one or at least two.
S202: sending a control instruction to an origin server storing the component package; the control instruction includes the unique identification and the second version number.
The method comprises the steps that a management server obtains a unique identifier and a current first version number of an NPM component package to be debugged, searches a downloading address matched with the unique identifier and the current first version number from a database, establishes communication connection with a source server according to the matched downloading address, and sends a control instruction to the source server; the control instruction is used for indicating the source server to create a virtual running environment; the control instruction comprises attribute information of an NPM component package to be debugged; the attribute information includes a unique identification of the component package and a current first version number. The virtual execution environment is used for providing an execution environment for the NPM component package of the new version developed.
When at least two matched download addresses are obtained, the management server can send a control instruction to the source server corresponding to the download address according to any one of the download addresses.
For example, when the management server receives first request information sent by the first terminal, a first control instruction is sent to the source server according to attribute information of a first NPM package contained in the first request information, so as to instruct the source server to create a virtual running environment for the first NPM package with a new version according to the first control instruction.
And when the management server receives second request information sent by the second terminal or the first terminal, sending a second control instruction to the source server according to the attribute information of the second NPM component package contained in the second request information so as to instruct the source server to create a virtual running environment for the second NPM component package with the new version according to the second control instruction.
S203: the source server creates a virtual running environment according to the control instruction sent by the management server, and returns a first notification message to the management server, wherein the first notification message comprises an identification of the virtual running environment.
In this embodiment, S203 is the same as S102 in the previous embodiment, and please refer to the description related to S102 in the previous embodiment, which is not repeated here.
Wherein, the source server executes S204 when the virtual running environment is successfully created according to the control instruction.
S204: the management server stores the unique identifier, the second version number contained in the first notification message and the identifier of the virtual running environment in an associated mode according to the first notification message, and returns a second notification message to the terminal according to the terminal identifier carried by the request information; the second notification information includes at least a download address of the component package of the first version number, the second version number.
In this embodiment, S204 is different from the previous embodiment S103 in that the management server stores the unique identifier of the NPM package, the first version number, the second version number, and the identifier of the virtual running environment in association, and the second notification message sent by the management server to the terminal includes the download address of the NPM package of the first version number and the second version number of the NPM package.
Optionally, the second notification message may include a download address of the NPM component package of the first version number, an identification of the virtual execution environment associated with the second version number. The download address of the NPM package of the first version number is used to download the NPM package of the first version and determine an access address of a target source server corresponding to the identifier of the virtual running environment. Typically, the source server storing the NPM package of the first version number and the target server corresponding to the identity of the virtual execution environment associated with the second version number are the same source server.
It will be appreciated that when the source server storing the NPM package of the first version number and the target server corresponding to the identifier of the virtual execution environment associated with the second version number are different source servers, the second notification message may further include the access address of the target source server corresponding to the identifier of the virtual execution environment associated with the second version number
When receiving a second notification message sent by the management server, the terminal downloads the NPM component package according to the download address of the NPM component package with the first version number in the second notification message, so that a developer can develop the NPM component package with the second version based on the NPM with the first version number, set the new version number of the NPM package newly developed as the second version number, and can develop the NPM component package with the second version based on the NPM with the first version number through the interaction interface and trigger an uploading instruction. And the terminal acquires the NPM component package of the second version uploaded by the developer and sends the NPM component package to the management server. The uploaded NPM component package includes a unique identification of the NPM component package and a second version number, and may also include a first version number of the NPM component package.
It can be understood that when the source server receives the control instruction sent by the management server and fails to create the virtual running environment according to the control instruction, a third notification message is returned to the management server; the third notification message is used for identifying failure of creating the virtual running environment and notifying the management server of replacing the source server, so that when the management server obtains at least two download addresses matched with the attribute information of the NPM component package of the first version, the replacement download address sends a control instruction for indicating the source server corresponding to the download address to create the virtual running environment.
S205: and the management server receives the component package uploaded by the terminal after downloading the component package of the first version number according to the downloading address, and operates the uploaded component package in a target virtual operation environment according to the unique identifier, the association relation of the second version number and the identifier of the virtual operation environment and the attribute information of the uploaded component package.
When the management server acquires the NPM package uploaded by the terminal, according to the association relation of the unique identifier of the NPM package, the second version number and the identifier of the virtual operation environment, the management server acquires the identifier of the target virtual operation environment which is matched with the unique identifier contained in the attribute information of the NPM package uploaded by the terminal and the second version number, determines the target source server to which the virtual operation environment belongs according to the identifier of the target virtual operation environment, establishes communication connection with the target source server according to the access address of the target source server, and stores the uploaded NPM package of the second version into the target virtual operation environment in the target source server, and operates the uploaded NPM package in the target virtual operation environment for testing.
In another embodiment, when the second notification message may include the download address of the NPM component package of the first version number, the identification of the virtual execution environment associated with the second version number, S206 may be further included after S204: the target source server receives the component package uploaded by the terminal according to the second notification message, and operates the uploaded component package in a target virtual operation environment according to the unique identifier, the second version number, the association relation among the identifiers of the virtual operation environment and the attribute information carried by the uploaded component package; the uploaded package is developed based on the package of the first version; the target source server is a source server that creates a virtual execution environment corresponding to the identification of the virtual execution environment associated with the second version number.
When receiving a second notification message sent by the management server, the terminal downloads the package of the first version number according to the download address of the NPM package of the first version number contained in the second notification message, so that a developer develops the package of the first version number on the basis of the NPM of the first version number, sets the new version number of the new developed NPM package as a second version number, and can develop the NPM package of the second version on the basis of the NPM of the first version number through the interaction interface and trigger an uploading instruction.
In an embodiment, when the source server storing the NPM package of the first version and the source server creating the virtual running environment of the NPM package of the second version are the same server, when the terminal detects an upload instruction triggered by the developer, the terminal may access the target source server according to the download address of the NPM package of the first version number, upload the NPM package of the new version uploaded by the developer to the target source server, and notify the target source server to store the NPM package of the second version according to the identifier of the virtual running environment associated with the second version number included in the second notification message. The uploaded NPM component package includes a unique identification of the NPM component package and a second version number, and may also include a first version number of the NPM component package.
In another embodiment, when the source server storing the NPM package of the first version and the source server creating the virtual running environment of the NPM package of the second version are different servers, when the terminal detects the uploading instruction triggered by the developer, the terminal obtains the access address of the target source server corresponding to the identifier of the virtual running environment included in the second notification message according to the request to the management server, so that the management server can determine the target source server corresponding to the identifier of the virtual running environment included in the second notification message according to the identifier of the virtual running environment created by each source server, and therefore the access address of the target source server is returned to the terminal.
When the terminal obtains the access address of the source server corresponding to the identifier of the virtual running environment which is associated with the second version number, the terminal accesses the target source server according to the access address of the target source server and uploads the NPM component package newly developed by the developer to the target source server. The NPM component package carries attribute information, wherein the attribute information comprises a unique identifier and a second version number of the NPM component package, and the NPM component package also carries an identifier of a virtual running environment associated with the second version number.
When the target source server acquires the NPM component package uploaded by the terminal, the uploaded NPM component package is stored into a target virtual operation environment corresponding to the carried virtual operation environment identifier, so that the NPM component package is operated and tested in the target virtual operation environment.
Optionally, in order to fully utilize the resources in the source server, avoiding that the virtual running environment that does not need to continue to run the NPM component package occupies the system resources, after S205 or S206, S207 may further include: when the management server detects that the uploaded package is tested, a deletion notification is sent to the source server according to the identifier of the virtual running environment corresponding to the uploaded package; the deletion notification is used for deleting the virtual running environment corresponding to the identifier of the virtual running environment.
For example, when detecting a notification message triggered by a terminal and used for identifying that the test of the uploaded component package is completed (the notification message can be generated by a developer triggering the terminal), the management server determines the identification of the virtual running environment matched with the component package according to the second version information of the component package carried by the notification message, and sends a deletion notification to the source server creating the matched virtual running environment according to the identification of the matched virtual running environment, so that when the source server receives the deletion notification, the source server deletes the corresponding virtual running environment according to the identification of the virtual running environment contained in the deletion notification.
In another embodiment, when the NPM package running in the virtual running environment is preset with a test time, the source server may delete the virtual running environment that improves the running environment for the NPM package when detecting that the current time reaches an end time corresponding to the test time.
According to the embodiment of the invention, when parallel development and testing are required to be carried out on the NPM component package, a control instruction is sent to the source server storing the NPM component package through the management server according to the request information sent by the terminal, and the source server is controlled to create a virtual operation environment for the NPM component package so as to operate and test the NPM component package with a new version in the virtual operation environment. By creating a virtual running environment in an original deployed source server according to actual demands, the development and test of multiple sets of parallel running environment supporting NPM component packages can be realized in one source server without adding a new source server, and the hardware cost and maintenance cost required by deploying the new source server can be saved.
It should be understood that the sequence number of each step in the foregoing embodiment does not mean that the execution sequence of each process should be determined by the function and the internal logic, and should not limit the implementation process of the embodiment of the present invention.
Fig. 4 is a schematic diagram of a server according to an embodiment of the present invention. As shown in fig. 4, the server 4 of this embodiment includes: a processor 40, a memory 41 and a computer program 42 stored in the memory 41 and executable on the processor 40. The steps of the method embodiment of the management node package manager of each server described above are implemented when the processor 40 executes the computer program 42, for example, for a management server, the processor 40 executes steps S101, S103-S104 shown in fig. 2, and for an origin server, the processor 40 executes step S102 shown in fig. 2.
Illustratively, the computer program 42 may be partitioned into one or more units that are stored in the memory 41 and executed by the processor 40 to complete the present invention. The one or more elements may be a series of computer program instruction segments capable of performing a specific function describing the execution of the computer program 42 in the server 4. For example, the computer program 42 may be divided into a script execution unit, an acquisition unit, a merging unit, and a generation unit, each unit specifically functioning as described above.
The server may include, but is not limited to, a processor 40, a memory 41. It will be appreciated by those skilled in the art that fig. 4 is merely an example of a server 4 and is not meant to be limiting as to the server 4, and may include more or fewer components than shown, or may combine certain components, or different components, e.g., the server may also include an input-output server, a network access server, a bus, etc.
The processor 40 may be a central processing unit (Central Processing Unit, CPU), other general purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), off-the-shelf programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 41 may be an internal storage unit of the server 4, such as a hard disk or a memory of the server 4. The memory 41 may be an external storage server of the server 4, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like, which are provided on the server 4. Further, the memory 41 may also include both an internal storage unit of the server 4 and an external storage server. The memory 41 is used for storing the computer program as well as other programs and data required by the server. The memory 41 may also be used for temporarily storing data that has been output or is to be output.
The above embodiments are only for illustrating the technical solution of the present invention, and not for limiting the same; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention, and are intended to be included in the scope of the present invention.

Claims (8)

1. A method of managing component packages of a node package manager, comprising:
the management server obtains request information sent by a terminal, and sends a control instruction to a source server storing a component package according to attribute information of the component package of a node package manager NPM contained in the request information, and the method comprises the following steps: the management server acquires request information sent by a terminal, and creates a second version number for a component package of a node package manager NPM according to a preset version naming strategy and attribute information of the component package contained in the request information; sending a control instruction to the source server storing the component package; the control instruction includes the attribute information; the attribute information comprises a unique identifier of the component package, a current first version number and the second version number;
The source server creates a virtual running environment according to the control instruction sent by the management server, and returns a first notification message to the management server, wherein the first notification message comprises an identifier of the virtual running environment;
the management server stores the attribute information and the identifier of the virtual running environment in an associated mode according to the first notification message, and returns a second notification message to the terminal according to the terminal identifier carried by the request information; the second notification message includes at least a download address of the component package of the first version number, including: the management server stores the unique identifier, the second version number contained in the first notification message and the identifier of the virtual running environment in an associated mode according to the first notification message, and returns a second notification message to the terminal according to the terminal identifier carried by the request information; the second notification message at least comprises a download address of the component package of the first version number and the second version number;
the management server receives the package uploaded by the terminal after downloading the package of the first version number according to the download address, and operates the uploaded package in a target virtual operation environment according to the association relationship between the attribute information and the identifier of the virtual operation environment and the attribute information of the uploaded package, and the management server comprises the following steps: and the management server receives the component package uploaded by the terminal after downloading the component package of the first version number according to the downloading address, and operates the uploaded component package in a target virtual operation environment according to the unique identifier, the association relation of the second version number and the identifier of the virtual operation environment and the attribute information of the uploaded component package.
2. The method of claim 1, wherein the second notification message further comprises an identification of the virtual execution environment associated with the second version number;
the management server stores the unique identifier, the second version number and the identifier of the virtual running environment in an associated mode according to the first notification message, and after returning a second notification message to the terminal according to the terminal identifier carried by the request information, the management server further comprises:
the target source server receives the component package uploaded by the terminal according to the second notification message, and operates the uploaded component package in a target virtual operation environment according to the unique identifier, the second version number, the association relation among the identifiers of the virtual operation environment and the attribute information carried by the uploaded component package; the uploaded package is developed based on the first version package.
3. The method according to claim 1 or 2, further comprising:
the source server returns a third notification message to the management server when receiving a control instruction sent by the management server and failing to create a virtual running environment according to the control instruction; the third notification message is used for identifying failure in creating the virtual running environment and notifying the management server of replacing the source server.
4. The method according to claim 1 or 2, wherein the management server receives a package uploaded by the terminal after downloading the package of the first version number according to the download address, and runs the uploaded package in a target virtual running environment according to the attribute information, the association relationship of the identifier of the virtual running environment, and the attribute information of the uploaded package, and further comprising:
when the management server detects that the uploaded component package is tested, a deletion notification is sent to the source server according to the identifier of the virtual running environment corresponding to the uploaded component package; the deletion notification is used for deleting the virtual running environment corresponding to the identifier of the virtual running environment.
5. A system for managing component packages of a node package manager, comprising a management server, an origin server and at least one terminal;
the management server acquires request information sent by a terminal, and sends a control instruction to a source server storing a component package according to attribute information of the component package of a node package manager NPM contained in the request information; the control instruction includes the attribute information; the attribute information comprises a unique identifier of the component package and a current first version number;
The source server creates a virtual running environment according to the control instruction sent by the management server, and returns a first notification message to the management server, wherein the first notification message comprises an identifier of the virtual running environment;
the management server stores the attribute information and the identifier of the virtual running environment in an associated mode according to the first notification message, and returns a second notification message to the terminal according to the terminal identifier carried by the request information; the second notification message includes at least a download address of the component package of the first version number;
the management server receives the component package uploaded by the terminal after downloading the component package of the first version number according to the downloading address, and operates the uploaded component package in a target virtual operation environment according to the association relation of the attribute information and the identifier of the virtual operation environment and the attribute information of the uploaded component package;
the management server is specifically configured to:
acquiring request information sent by a terminal, and creating a second version number for a component package according to a preset version naming strategy and attribute information of the component package of a node package manager NPM contained in the request information;
Sending a control instruction to the source server storing the component package; the control instruction includes the unique identification and the second version number;
storing the unique identifier, the second version number contained in the first notification message and the identifier of the virtual running environment in an associated mode according to the first notification message, and returning a second notification message to the terminal according to the terminal identifier carried by the request information; the second notification message at least comprises a download address of the component package of the first version number and the second version number;
and receiving an uploaded component package of the terminal after downloading the component package of the first version number according to the downloading address, and operating the uploaded component package in a target virtual operating environment according to the unique identifier, the association relation of the second version number and the identifier of the virtual operating environment and the attribute information of the uploaded component package.
6. The system of claim 5, wherein the second notification message further comprises an identification of the virtual execution environment associated with the second version number;
the target source server is used for: receiving an assembly package uploaded by the terminal according to the second notification message, and operating the uploaded assembly package in a target virtual operation environment according to the unique identifier, the association relation among the second version number and the identifiers of the virtual operation environment and attribute information carried by the uploaded assembly package; the uploaded package is developed based on the package of the first version; the target source server is a source server that creates a virtual execution environment corresponding to the identification of the virtual execution environment associated with the second version number.
7. The system of claim 5 or 6, wherein the origin server is further configured to: when a control instruction sent by the management server is received and the creation of the virtual running environment according to the control instruction fails, returning a third notification message to the management server; the third notification message is used for identifying failure in creating the virtual running environment and notifying the management server of replacing the source server.
8. The system of claim 5 or 6, wherein the management server is further configured to: when the completion of the test of the uploaded component package is detected, a deletion notification is sent to the source server according to the identifier of the virtual running environment corresponding to the uploaded component package; the deletion notification is used for deleting the virtual running environment corresponding to the identifier of the virtual running environment.
CN201811017082.5A 2018-09-03 2018-09-03 Method and system for managing component package of node package manager Active CN109375946B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811017082.5A CN109375946B (en) 2018-09-03 2018-09-03 Method and system for managing component package of node package manager

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811017082.5A CN109375946B (en) 2018-09-03 2018-09-03 Method and system for managing component package of node package manager

Publications (2)

Publication Number Publication Date
CN109375946A CN109375946A (en) 2019-02-22
CN109375946B true CN109375946B (en) 2023-11-03

Family

ID=65404153

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811017082.5A Active CN109375946B (en) 2018-09-03 2018-09-03 Method and system for managing component package of node package manager

Country Status (1)

Country Link
CN (1) CN109375946B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111294397A (en) * 2020-01-21 2020-06-16 北京乐学帮网络技术有限公司 npm packet management method, device, electronic equipment and storage medium
CN113377424B (en) * 2021-06-23 2022-08-02 支付宝(杭州)信息技术有限公司 Installation package processing method, device and equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6976059B1 (en) * 2000-07-20 2005-12-13 International Business Machines Corporation System and method to provide applets using a server based virtual machine
WO2007113533A1 (en) * 2006-03-31 2007-10-11 British Telecommunications Public Limited Company Xml-based transfer and a local storage of java objects
CN104093046A (en) * 2013-04-01 2014-10-08 云联(北京)信息技术有限公司 Video inserting system and method based on cloud game
WO2016078431A1 (en) * 2014-11-21 2016-05-26 中兴通讯股份有限公司 Policy file synchronous management method, policy synchronous server and management device
EP3296865A1 (en) * 2016-09-16 2018-03-21 Powell Software SAS Collaborative development of a web based service

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2007113542A1 (en) * 2006-03-31 2007-10-11 British Telecommunications Public Limited Company Server computer component
US20090183182A1 (en) * 2008-01-10 2009-07-16 Microsoft Corporation Dynamic Composition of Virtualized Applications
US9690566B2 (en) * 2013-03-14 2017-06-27 Oracle International Corporation System and method for virtual assembly patching in a cloud environment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6976059B1 (en) * 2000-07-20 2005-12-13 International Business Machines Corporation System and method to provide applets using a server based virtual machine
WO2007113533A1 (en) * 2006-03-31 2007-10-11 British Telecommunications Public Limited Company Xml-based transfer and a local storage of java objects
CN104093046A (en) * 2013-04-01 2014-10-08 云联(北京)信息技术有限公司 Video inserting system and method based on cloud game
WO2016078431A1 (en) * 2014-11-21 2016-05-26 中兴通讯股份有限公司 Policy file synchronous management method, policy synchronous server and management device
EP3296865A1 (en) * 2016-09-16 2018-03-21 Powell Software SAS Collaborative development of a web based service

Also Published As

Publication number Publication date
CN109375946A (en) 2019-02-22

Similar Documents

Publication Publication Date Title
CN108551487B (en) Application deployment method, device, server and storage medium of PaaS platform
CN108566290B (en) Service configuration management method, system, storage medium and server
CN101571809B (en) Implementation method of plug-in registration and device thereof
CN111182089B (en) Container cluster system, method and device for accessing big data assembly and server
CN112422702A (en) CDN back-to-source method, system and computer equipment
CN110365724B (en) Task processing method and device and electronic equipment
WO2019056187A1 (en) Application deployment method, apparatus and system
CN108540509B (en) Processing method and device of terminal browser, server and intelligent terminal
CN112769706B (en) Componentized routing method and system
CN109104368B (en) Connection request method, device, server and computer readable storage medium
CN112799688A (en) Method and device for installing software package in container application, computer equipment and medium
CN109375946B (en) Method and system for managing component package of node package manager
CN111930396B (en) Upgrading method of communication module in 4G router based on notify mechanism
CN112702195A (en) Gateway configuration method, electronic device and computer readable storage medium
CN113141405A (en) Service access method, middleware system, electronic device, and storage medium
CN111694639A (en) Method and device for updating address of process container and electronic equipment
CN113419818B (en) Basic component deployment method, device, server and storage medium
CN114328097A (en) File monitoring method and device, electronic equipment and storage medium
CN111831567B (en) Application test environment configuration method, device, system and medium
CN112905197A (en) Information processing method, device and system, electronic equipment and storage medium
CN112732265A (en) Data processing method and related device
CN112702441B (en) Container-based access data processing method, device, system and storage medium
CN114827177A (en) Deployment method and device of distributed file system and electronic equipment
CN110661852B (en) Service processing method and device in cloud environment
CN110266762B (en) Data uploading method, system, device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right

Effective date of registration: 20231010

Address after: No. 28-2 Xiyuan 1st Road, Xiyong Street, Gaoxin District, Shapingba District, Chongqing, 401332

Applicant after: Shunwei (Chongqing) Technology Co.,Ltd.

Address before: 518000 Room 202, block B, aerospace micromotor building, No.7, Langshan No.2 Road, Xili street, Nanshan District, Shenzhen City, Guangdong Province

Applicant before: Shenzhen LIAN intellectual property service center

Effective date of registration: 20231010

Address after: 518000 Room 202, block B, aerospace micromotor building, No.7, Langshan No.2 Road, Xili street, Nanshan District, Shenzhen City, Guangdong Province

Applicant after: Shenzhen LIAN intellectual property service center

Address before: 518000 Room 201, building A, No. 1, Qian Wan Road, Qianhai Shenzhen Hong Kong cooperation zone, Shenzhen, Guangdong (Shenzhen Qianhai business secretary Co., Ltd.)

Applicant before: PING AN PUHUI ENTERPRISE MANAGEMENT Co.,Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant