General idea: Vue project is versioned on Gitlab. It is planned to pull the Vue project code of Gitlab directly from Linux server, and then package and deploy it through script command with one click

1. On the Linux server, nodeJS, git, and nginx are installed

  • NPM: yum install nodejs
  • Yum install git
  • # yum install nginx

2. Configure the SSH key.

Set the user name and email

  • Git config –global user.name git config –global user.name
  • Git config –global user.email

Generate an SSH key:

  • Run the ssh-keygen -t rsa -c “mailbox” command.
  • Press Enter and you will see the file id_rsa.pub in this directory

  • Open to copy the content, then go to gitLab background, add SSH key, save

  • Then go to the Linux server and git Clone our Vue project. The following figure shows that the clone project has been successfully completed

3. Deploy the Vue project

  1. First run NPM install in the root directory of the Vue project and install the dependency
  2. Then run NPM run build to package the next project and generate a dist folder
  3. Modify the nginx.conf file to point to the dist folder for our Vue project

  1. Restart the nginx
  2. To facilitate deployment, create a sh script and create update.sh as follows:
    • git pull
    • npm install
    • npm run build
  3. You can then run sh update.sh to update the deployment project

Please point out any omissions