Skip to main content

deploy

Document description:

  1. Deployment process
    2. Verify successful deployment

Deploy Engine Server service

Clone the Project Repository

First, use Git to clone the Engine Server codebase to your machine

git clone https://github.com/glitternetwork/engine-server
cd engine-server

Install Go dependencies

Engine Server uses Go Modules to manage dependencies. First, make sure you are in the project root directory, then run the following command to install dependencies:

go mod tidy

Modify the configuration file

Currently we support 3 data sources: bleve, mysql, milvus, you can see the data storage section for details. You need to configure your data source connection information in the configuration file so that Engine Server can access your data; we provide a sample configuration file: /etc/app.example.toml, you can copy this file and modify the database configuration item according to your situation

cp etc/app.example.toml etc/engine-server/config.toml
vim etc/engine-server/config.toml

Configuration file example

# mysql data source
[[database]]
name = "eng_test"
engine = "mysql"
[database.config]
dsn = "root:root@tcp(127.0.0.1:3306)/default?charset=utf8mb4&parseTime=True&loc=Local"

# bleve data source
[[database]]
name = "library"
engine = "bleve"
[database.config]
host = "http://localhost:8095"
timeout = "1s"

# milvus data source
[[database]]
name = "vec"
engine = "milvus"
[database.config]
endpoint = "localhost:19530"
dail_timeout = "3s"
[database.rate_limit]
max_qps=1
# embedding provider config
[[database.config.embedding_provider]]
name="BAAI/bge-m3"
endpoint="http://127.0.0.1:5000/embeddings"
timeout = "3s"
default=true

[rpc_server]
addr = ":50051"

[http_server]
addr = ":8080"
[http_server.ip_rate_limit]
request_limit=10
window_length="1m"

[log]
level = "debug"
file_name = "./data/log/glitter_engine_server.log"
format = "text"

Running the Application

Build and run the binary

cd cmd
go build -o engine-server .
cd ..
./cmd/engine-server -config_path=./etc/engine-server/config.toml run

You can also manage engine-server through systemd, create a configuration file /etc/systemd/system/engine-server.service, add the following configuration, then use systemctl start engine-server to start the service

[Unit]
Description=engine server
Requires=network-online.target
After=network-online.target

[Service]
Restart=on-failure
User=root
Group=root
PermissionsStartOnly=true
WorkingDirectory=/root/engine-server
ExecStart=/root/engine-server/cmd/engine-server run
ExecReload=/bin/kill -HUP $MAINPID
KillSignal=SIGTERM
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=engine-server.log
LimitNOFILE=4096
[Install]
WantedBy=multi-user.target

Verify Engine Server

curl --location 'http://localhost:8080/api/v1/databases'

response

{
"databases": [
{
"name": "eng_test",
"description": ""
},
{
"name": "library",
"description": ""
}
]
}