Marina Service
We've created an empty service structure to show you the setup and workflow with Canaveral.
The top level directory of your repository should be set up like this:
README.md
: this file contains a textual description of the repository..circleci/
: this directory contains CircleCI'sconfig.yml
file.hooks/
: this directory, if present, can contain ad hoc scripts that customize your build.package/
: add yourDockerfile
underpackage/docker/
to build a docker image. (Note: You can refer to files and folders directly in yourDockerfile
because all files and folders underservices/
will be copied into the same folder as theDockerfile
during build.)services/
: this directory should have a subdirectory for eachservice
, e.g.services/my-service/
. Each subdirectory (often there is only one) would contain the definition (source and tests) for the service.blueprint.json
: this file, if present, contains instructions for Canaveral to deploy the service.common/
: this directory contains common go util functions.config/
: this directory holds the deployment configuration files, helm chart configuration etc.errors/
: this directory holds rpc_errors.go, Marina service errors and Interface Types.grpc/
: this directory has all the new entity servies which are served by gRPC RPC framework.marina/
: this directory holds the Main service, init, metric functions.protos/
: this directory holds all *.proto definitions for the entities.proxy/
: this directory all proxy RPC work. Proxy all Catalog RPC's and delegate to Catalog service.task/
: this directory hold the base task and task realted infrastructure for Marina service.test/
: this directory contains test scripts etc.utils/
: this directory contains util code.
Belows setup guide is actively updated at https://confluence.eng.nutanix.com:8443/display/~rajesh.battala/Marina+Content+Management+System+Service
https://confluence.eng.nutanix.com:8443/display/~rajesh.battala/Marina+Setup+Guide+for+MAC
- go v1.19+
- protoc: libprotoc 3.6.1
- protoc-gen-go v1.5.2
- protoc-gen-go-grpc v1.1.0
- protoc-gen-grpc-gateway v2.4.0
- mockery v2.15.0
- gotestsum v1.9.0+
- go install gotest.tools/gotestsum@latest
- brew commands to install the packages in MAC:
- brew install protobuf
- brew install protoc-gen-go
- brew install protoc-gen-go-grpc
- brew install mockery
Make sure above the repo is checkout, above dependencies are installed. set the following as per your user and env in .bashrc [shell rc file]
- export GIT_TOKEN = "your github token"
- export CANAVERAL_ARTIFACTORY_USERNAME = "your email id"
- export CANAVERAL_ARTIFACTORY_PASSWORD = "your api key"
- export GOPRIVATE="github.com/nutanix-core,github.com/nutanix"
- export GONOSUMDB="github.com/nutanix-core,github.com/nutanix"
- export GONOPROXY="github.com/nutanix-core,github.com/nutanix"
execute all Make cmds at repo Top level dir.
make build-protos
To build protos present in protos folder.
go mod vendor
to sync the vendor folder/ update dependencies.
make server
To build Marina server binary. marina_server binary file will be created.
make unit-tests
To run the tests
- Disable IPTables in PC. (sudo service iptables stop)
- In your local box, add entry in /etc/hosts to resolve pcip to
ex:
10.33.112.233 pcip
./marina_server
to run server from the binary file. orgo run marina/*.go
to build code and run the marina server.
- In PC, stop catalog service. Create catalog.gflags under /home/nutanix/config/
- add/set gflags "--catalog_port=9202"
./marina_server --proxyrpc_port=2007 --legacycatalog_port=9202
to run server from the binary file. orgo run marina/*.go --proxyrpc_port=2007 --legacycatalog_port=9202
to build code and run the marina server.
Install Docker tools in your box. docker --version
Docker version 20.10.12, build e91ed57
cmd should be working.
docker build -t marina_service:v1 -f package/docker/Dockerfile
This will build a docker image.
GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o marina_server marina/*.go
cmd will build and generate binary with PC arch type.- Copy the
marina_server
to PC and run it in PC. nohup ./marina_server_task_proxy --proxyrpc_port=2007 --legacycatalog_port=9202 &
Marina Deployment in PC using MSP platform [Running Marina server in PC using MSP (CMSP should be enabled in PC)]
- build the docker image from above cmd.
docker save <image id> > marina.tar
dump the image to tar file.scp marina.tar nutanix@pcip:
copy marina.tar to PCscp config/marina-deployment.yaml nutanix@pcip:
- Login to PC and perform below actions.
mspctl cluster kubeconfig > k.cfg && export KUBECONFIG=/home/nutanix/k.cfg
kubectl get all
to make sure kubernetes is working fine.docker load < marina.tar
To load the docker image to PC.docker images
to fetch the Image id of the loaded image.docker tag <image id> msp-registry.catalog.cluster.local:5001/marina-cms:v1
to tag the Image with name "marina-cms:v1"docker push msp-registry.catalog.cluster.local:5001/marina-cms:v1
to push the image to repo.mspctl application apply marina -c catalog -f marina-deployment.yaml
to deploy Marina service using MSP service.kubectl get all
to check if the pod got deployed for the Marina service- Marina service now runs as container in PC with above process.
mspctl application delete marina -c catalog -f marina-deployment.yaml
to delete the Application.
kubectl exec --stdin --tty <marina-podname> -- "/bin/sh"
login to Marina container.
[cms-marina] (https://nutanix.slack.com/archives/C02PWJBD5LM)
- Specify your preferred
CANAVERAL_BUILD_SYSTEM
(default is noop) - Specify your preferred
CANAVERAL_PACKAGE_TOOLS
(use "docker" if deploying a docker image, use "noop" if no packaging is needed) - [OPTIONAL] Specify the target
DOCKERFILE_NAME
to use (default is Dockerfile)
You'll be able to monitor the build at circleci.canaveral-corp.us-west-2.aws
To use Canaveral for deployment, blueprint.json
should be placed at the top level of the repo. Spec for the blueprint can be found at Canaveral Blueprint Spec.
Questions, issues or suggestions? Reach us at https://nutanix.slack.com/messages/canaveral-onboarding/.