Installation

Installation

The following describes how to install the environment.

Environment Configuration

Download the Source Code

Please go to the Release Page (opens in a new tab) to get the latest version and unzip it.

(Not Recommend) If you want to use the version under development you can clone the repository.

git clone https://github.com/anzai249/CyberGui.git

Database

Highly recommend MySQL >= 5.7, and the development environment uses 8.0 version, lower version may means unstability. If you use >= 8.0, please use mysql_native_password password encryption.

Database Settings

Please use ./service/cybergui.sql to create your database and database name you will see it below.

Read more: secret.json

Create a secret.json at ./service/, here is the content:

secret.json
{
  "mysql": {
    "dev": {
      "username": "root",
      "password": "root",
      "name": "cybergui",
      "host": "127.0.0.1"
    },
    "prod": {
      "username": "root",
      "password": "root",
      "name": "cybergui",
      "host": "127.0.0.1"
    }
  },
  "password": "admin",
  "https": true,
  "serverPort": 1106,
  "key": "path/to/your.key",
  "cert": "path/to/your.pem",
  "review": false
}

Attention, dev contains the information of development environment, prodcontains the information of production environment, name is your database name, host is your database host, default port 3306.

username and password, these two are your database username and password.

It is recommended to switch on https connection to server and specify the path to your SSL certificate.

password outside is your admin password in order to answer questions and delete questions or so.

Frontend Configuration

Read more: settings.json

Please edit settings.json at ./src/:

settings.json
{
    "images": {
        "avatar": "",
        "logo_big": "",
        "logo_small": ""
    },
    "others": {
        "colors": [
            "#c3cfe2"
        ],
        "defaultLanguage": "zhcn",
        "review": false
    },
    "theme": {
        "primaryColor": "#8a2be2",
        "primaryColorHover": "#8a2be2"
    }
}

images

avatar is the avatar of the host of the website, logo_big is the desktop logo of the website (top left), logo_small is the mobile logo of the website.

others

colors contains a random color list of these anonymous questioners' avatar background, you can add more colors you want.

defaultLanguage default language of the website, currently supports othersdefaultlanguage.

review If you think the questions need your review before showing, please set it to true, and don't forget to set review in secret.json.

theme

You can set theme color of the website.

Compile and Deploy

Recommend Node.js version 16.x.

Run this at the source code directory:

npm install

Compile and minify for production:

npm run build

And then you can check ./dist/ to discover the files you compiled.

Run Server

Install pm2 globally:

npm install pm2 -g

Run this at ./service/:

pm2 start server.js