In order to run this project, you need to have certain prerequisites set up on your machine. These prerequisites include:
To run the project, follow these steps:
-
Open the terminal in the project directory and run the command
go mod tidy
to ensure that all required dependencies are installed. -
Then, run the command
swag init
to initialize Swagger and generate the necessary API documentation. -
Open Docker on your machine or a similar application to ensure that it is working properly. Then, open the terminal in the project repository and run
docker compose up
. -
Once the containers are started and running, run the command
make run
in the project terminal to start the project.
The project will run on localhost:9007
. To access the Swagger documentation click here.
By following these steps, the project will be up and running, and you will be able to access the API documentation through Swagger.
To access the GoDoc documentation, first install GoDoc on your machine. Open a terminal and type:
go get golang.org/x/tools/cmd/godoc
Then run the following command in the repository terminal:
godoc -http=:6060
GoDoc will run on localhost:6060
. To access the GoDoc documentation, just click here.
The MySQL used in the Docker Compose file isn't compatible with Apple's M1 and M2 chips. To make it work, perform the following modifications:
Create the variable FEATWS_API_MYSQL_URI and set the path as follows:
FEATWS_API_MYSQL_URI=api:api@tcp(localhost:3307)/api
In the Docker Compose file, it is necessary to change MySQL to MariaDB. Only the "db" section in the docker-compose file needs to be modified.
db:
image: mariadb
restart: always
ports:
- 3307:3306
volumes:
- ./data/mysql:/var/lib/mysql:rw
user: mysql
environment:
MARIADB_ROOT_PASSWORD: "root"
MARIADB_DATABASE: "api"
MARIADB_USER: "api"
MARIADB_PASSWORD: "api"
TELEMETRY_HTTPCLIENT_TLS: "false"
TELEMETRY_EXPORTER_JAEGER_AGENT_HOST: "localhost"
TELEMETRY_ENVIRONMENT: local