First, build the environment

  • node.js
  • Terminal emulation software similar to Zen Term Lite (for MAC) (why use this, later)
  • Already purchased cloud server (this article is based on Ali Cloud)
  • The pagoda environment

1. This paper introduces the installation of the pagoda in Linux environment. At present, Ali Cloud server can choose the pagoda panel to be created automatically during initialization

2. The simplest deployment will be completed with the help of The Pagoda panel. Later Jenkins will be updated to realize automatic deployment with nGINx

Start deployment

1. Step 1 – Configure your own cloud server

Open the console and create an instance (emphasis here!! Remember your password)

Note the public IP address of the cloud server

2. Install pagoda environment for your cloud server (Linux system)

Download terminal simulation software, I use xShell, there are several, here do not repeat

– What is terminal software

Through the Internet to the remote host security connection and its innovative design and features to help users in the extremely complex network environment for work and simulation.

Xshell can directly access servers in different systems on the remote end on the Windows interface, enabling users to control terminals remotely.

Zen Term Lite has the same functionality as xShell

– Why use terminal software

1,!! Actually, the remote connection of ali cloud console is very slow to download things (or my network is not good), in fact, the interface looks uncomfortable to me 🙂

2. Isn’t it sweet to avoid opening web pages and remote operation through APP for each configuration? (Manual dog head)

– How to use it

  • Open your cloud server console, find the firewall, and add new rules inside the firewall

  • Choose a port you like (or baidu below commonly used port, do not occupy the default port 🙁

  • Open the terminal simulation software, select a new session, and enter the information

    Conversation name: At your pleasure

    Host address: the previous public network address

    User name: Usually root

    Port: the port just opened by the firewall

  • Click Connect and you will be asked to enter a password. The second password is the instance password that you created (you can also configure the password in the property-Authentication section, so you will not be allowed to enter the password in the future).

Three, the installation of pagoda

  • Enter in the connected terminal

yum install -y wget && wget -O install.sh http://download.bt.cn/install/install.sh && sh install.sh

Then press Enter to download, wait for a while, there will be a midway to let you confirm once, brainless Y is finished

  • 2. After downloading, you can see username and password

It also includes the pagodas access address http://your domain name or IP :8888. The pagodas are installed

Open the pagoda and install the PM2

  • Find a suitable folder in the file (recommend to put in the WWW directory) upload and unzip

  • Find the PM2 manager in Software Management and install it

  • When the installation is complete, click Settings and then click Add

  • You can see the port number in the created project. This port number is the one you set up in your Node project

  • Click Map to map the project with the domain name. When accessing the project, the domain name + port number can be accessed directly. Of course, it can also be accessed without mapping

  • In the left pane, you can select the version of Node that works for you,

  • You can also install the modules you need in module Management. Here I have Express and Mongoose (used in the project).

5. Open the terminal software again

Use node-version and NPM –version to check whether node and NPM are installed

If the version number is not displayed, you will need to install Node for the server. If it is, skip this section

methods

Enter ls command in terminal, find a suitable folder under home CD enter

  • Input wget to https://nodejs.org/dist/v10.15.1/node-v10.15.1-linux-x64.tar.xz and enter, version and operating system is optional, of course, the specific version of the node’s official website, please check

  • After downloading, unzip tar.xz into.tar

    Xz - d node - v10.15.1 - Linux - x64. Tar. Xz

    The installation package has changed to Node-v10.15.1-linux-x64.tar

  • Unpack the tar packages

    The tar XVF - node - v10.15.1 - Linux - x64. Tar

    After decompressing, the node-v10.15.1-linux-x64 folder will appear in the current path

    Remember to remove unnecessary packages to reduce server stress

  • Check whether there are node and NPM folders in the bin directory

    CD go to the node-v10.15.1-linux-x64 folder, find the bin file and check whether node and NPM are used

  • Perform soft connection if available

    Type the command

    Ln -s/path /bin/npm /usr/local/bin/ln -s/path /bin/node /usr/local/bin/copy to clipboardErrorCopiedCopy to clipboardErrorCopiedCopy the code

    For example,

    Ln -s /software/node-v10.15.1- Linux -x64/bin/npm /usr/local/bin/ln -s /software/node-v10.15.1- Linux -x64/bin/node /usr/local/bin/ Copy to clipboardErrorCopiedCopy to clipboardErrorCopiedCopy the code
  • In this case, run node-version and NPM –version again to check whether node and NPM are installed

Install dependencies for your own projects

Open the terminal simulation software, use LS and CD into their own project folder

Install package.json dependencies using NPM install

Finally, use pm2 start. /bin/ WWW to run your project

Configure ports

Open the pagoda, find the port (range: 3000-3500) of the security group on the far left, and click OK

Open your server console again, add new rules inside the firewall, open ports 3000 to 3500 (port range 3000/3500) and click Add

7. Finally, restart the project

Again in terminal use ls+ CD to go to your project directory

Using pm2 restart. /bin/ WWW your Node project is now deployed on the server

You can use IP + port number + route you define to access your written interface