-
Notifications
You must be signed in to change notification settings - Fork 24
Dev environment setup (local)
ros-ocp-backend is written in go 1.19. To download go run below commands below steps.
# wget https://go.dev/dl/go1.19.5.linux-amd64.tar.gz
# sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.19.5.linux-amd64.tar.gz
# sudo echo "export PATH=$PATH:/usr/local/go/bin" >> /etc/profile
# source /etc/profile
# go version
# git clone https://github.com/RedHatInsights/ros-ocp-backend.git
Update /etc/hosts
127.0.0.1 kafka
127.0.0.1 minio
Install librdkafka and librdkafka-devel packages
# dnf install -y librdkafka librdkafka-devel
ros-ocp-backend dependence on few services like Kafka, Ingress, Kruize etc. Before starting ros-ocp-backend we first need to start all other services inside docker container.
# cd scripts
# docker-compose up
Note - If you are unable to pull image from quay.io then try to login quay.io using docker login quay.io
and run docker-compose up
again.
# make db-migrate
# make run-processor
# make upload-msg-to-rosocp
Watch the kafka consumer for a message to arrive
# docker-compose exec kafka kafka-console-consumer --topic=platform.upload.rosocp --bootstrap-server=localhost:29092
You will see something like this in the consumer terminal.
{"request_id": "uuid1234", "b64_identity": "test", "metadata": {"account": "123", "org_id": "345", "source_id": "111", "cluster_id": "222"}, "files": ["http://s3.amazonaws.com/bucket_name/rosocp/ros-usage.csv"]}
Instead of using make upload-msg-to-rosocp
one can send a custom json message to platform.upload.rosocp
with the help of kafka-console-producer using the below command.
# docker-compose exec kafka kafka-console-producer --topic platform.upload.rosocp --broker-list localhost:29092
To get recommendations after sending data to local ros-ocp-backend use below command.
# make get-recommendations start_date=<YYYY-MM-DD>
else default start_date = 1970-01-01
Epoch date used in UNIX and POSIX systems
ROS-OCP uses golangci-lint for code linting:
# make lint
For running unit tests use below command
# make test
Patches to fix bugs or add new features are always appreciated. If you are going to work on a specific issue, make sure github issue OR JIRA issue ticket is open for the change you are going to submit.
-
Create a fork of ros-ocp-backend repo in your github account
-
Create a feature/topic branch
# git checkout -b <branchName>
-
Make changes and commit. Please reference the issue number this commit addresses via “Refs” or “Fixes” in the commit message.
# git add <modifiedFile(s)> # git commit -m 'Fixes #<bug> - <message>'
-
Push topic branch to your fork
# git push origin <branchName>