The Database Analytics Assistant is a tool with a web interface designed to assist users in obtaining insights from their MySQL databases using natural language questions. By leveraging the power of OpenAI's API, users can easily ask questions about their data, and the assistant will provide answers based on the information stored in the database.
- Go 1.20
- A MySQL database
- An OpenAI API key
- Clone the repository:
git clone https://github.com/erdum/golang-analytics-assistant-api.git
- Navigate to the project src directory:
cd golang-analytics-assistant-api/src
- Rename config.example.yaml to config.yaml
mv config.example.yaml config.yaml
- Put your OpenAI api key and your database credentials inside config.yaml file
- Build the executable:
go build -o ../app
This will create an executable named app in the root directory. You can now run the app executable and it will start the application on port :80
If you want to run this application on production follow the above installation step than before executing the app executable make a service on the server so it will run as a normal service
- create a file called DBAnalytics.service in this directory /lib/systemd/system
sudo vim /lib/systemd/system/DBAnalytics.service
- paste this text into the file
[Unit]
Description=DBAnalytics tool with web interface
[Install]
WantedBy=multi-user.target
[Service]
Type=simple
User=root
PermissionsStartOnly=true
ExecStart=absolute_path_to_app_executable
Restart=on-failure
TimeoutSec=600
Important
Put the absolute path of the app executable right after ExecStart=
- now you can start the service
service DBAnalytics.service start
This project is licensed under the MIT License.