A client facing REST layer to proxy RSong requests to RSongs Rholang contracts.
RSong is implemented as a combination of multiple microservices and their interactions. These microservices are:
- acq, this is the RSong Acquisition service responsible for Acquiring assets
- proxy, RSong Proxy provides RChain rnode REST layer
- microbatch, tbd
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system
git clone git@github.com:rchain/rsong.git
cd rsong
sbt compile
To run the project locally:
- set the environment variables
- run the docker
Alternatively you may build and run the project from source code.
To run the project locally, configure your environment variables:
##
export LOCAL_GRPC='localhost'
export GCP_GRPC='dd.dd.dd.dd'
export AWS_GRPC='dd.dd.dd.dd'
export DOCKER_GRPC='172.17.0.2'
export HTTP_PORT=9000
export GRPC_SERVER=$LOCAL_GRPC
export GRPC_PORT_INTERNAL=40404
export GRPC_PORT_EXTERNAL=40401
export PRD_K8='http://prd-rchain.com'
export DEV_K8='http://dev-rchain.com'
export LOCAL_K8='http://localhost'
export HOST_URL=$LOCAL_K8
You may consider using direnv to manage projects environment variables
Circle CI build process publishes the rsong-proxy docker image to docker hub. To run the image:
sccripts/docker-run.sh
sbt clean compile run
## to create a local dokcer image
sbt clean compile docker:stage docker:publishLocal
docker images | grep 'rsong-proxy'
tests are:
- unit tests
- integration tests
sbt clean test
- configure .envrc for both rsong-proxy and rsong-acquisition are configured for the same node instance
- execute rsong-acquisition to migrate the song data to node
- build rsong-proxy and run integration tests
cd ../rsong-acquisition
## make sure rsong-acquisition & rsong-proxy are using the same node
sbt clean compile universal:packageBin
cd target/universal && unzip ./rsong-acquisition-1.2-SNAPSHOT && cd rsong-acquisition-1.2-SNAPSHOT
./bin/rsong-acquisition
Integration tests are run by the python script rsong-int-tests.py.
The scripts assumes requests is installed.
sbt clean compile run
## from a different terminal:
./scripts/rsong-int-tests.py localhost:9000
host='localhost:9000'
## create a new user
curl -X POST $host/v1/user/<user_id>
## retrieve user object
curl $host/v1/user/<user_id>
## retrive a user's song
curl -v GET $host/v1/song/song1?userId=123 | jq
## retrive user's songs
curl -v GET $host/v1/song\?userId=user123\&perPage=10\&page=1 | jq
curl GET $host/v1/song/song1?userId=123 | jq
- rnode
- rsong-proxy
rnode is build from the latest rchain dev branch deployed to GCP. This is a single instance at this time.
rsong-proxy runs on kubernetes-cluster on GCP See deployment-prd-spec for more detail