# Building and Running CPS Locally ## Building Java Archive only Following command builds all Java components to `cps-application/target/cps-application-x.y.z-SNAPSHOT.jar` JAR file without generating any docker images: ```bash mvn clean install -Pcps-docker -Pncmp-docker -Pcps-ncmp-docker -Djib.skip ``` ## Building Java Archive and Docker Images * Following command builds the JAR file and also generates the Docker image for all CPS components: ```bash mvn clean install -Pcps-docker -Pncmp-docker -Pcps-ncmp-docker ``` * Following command builds the JAR file and generates the Docker image for specified CPS component: (with `` being one of `cps-docker`, `ncmp-docker` or `cps-ncmp-docker`): ```bash mvn clean install -P ``` ## Running Docker Containers `docker-compose/docker-compose.yml` contains the base services required to run CPS and NCMP. This deployment can also be used for KPI test. Please run the following command from `docker-compose` folder: ```bash docker-compose up -d or docker-compose --profile tracing up -d ``` `docker-compose/dmi-services.yml` contains the DMI services including SDNC and PNF Simulator. This deployment is required for the CSIT test. ```bash docker-compose -f docker-compose.yml -f dmi-services.yml up -d ``` To deploy services that are required for Endurance test, please use the following command: ```bash docker-compose --project-name endurance --env-file env/endurance.env up -d ``` To stop any deployment, please replace `up -d` flag with `down` in the above commands. ### Running from Jar Archive Following command starts the application using JAR file: ```bash DB_HOST=localhost DB_USERNAME=cps DB_PASSWORD=cps \ DMI_USERNAME=cpsuser DMI_PASSWORD=cpsr0cks! \ java -jar cps-application/target/cps-application-x.y.z-SNAPSHOT.jar ``` ### Running from IntelliJ IDE Here are the steps to run or debug the application from Intellij: 1. Enable the desired maven profile form Maven Tool Window 2. Run a configuration from `Run -> Edit configurations` with following settings: * `Environment variables`: `DB_HOST=localhost;DB_USERNAME=cps;DB_PASSWORD=cps DMI_USERNAME=cpsuser DMI_PASSWORD=cpsr0cks!` ## Accessing services Swagger UI and Open API specifications are available to discover service endpoints and send requests. * `http://localhost:/swagger-ui.html` * `http://localhost:/api-docs/cps-core/openapi.yaml` * `http://localhost:/api-docs/cps-ncmp/openapi.yaml` * `http://localhost:/api-docs/cps-ncmp/openapi-inventory.yaml` with is being either `8080` if running the plain Java build or retrieved using following command if running from `docker-compose`: ```bash docker inspect \ --format='{{range $p, $conf := .NetworkSettings.Ports}} {{$p}} -> {{(index $conf 0).HostPort}} {{end}}' \ ``` Enjoy CPS!