1 # Building and running CPS locally
3 ## Building Java Archive only
5 Following command builds all Java components to `cps-application/target/cps-application-x.y.z-SNAPSHOT.jar` JAR file
6 without generating any docker images:
9 mvn clean install -Pcps-docker -Pxnf-docker -Pcps-xnf-docker -Djib.skip
12 ## Building Java Archive and Docker images
14 * Following command builds the JAR file and also generates the Docker image for all CPS components:
17 mvn clean install -Pcps-docker -Pxnf-docker -Pcps-xnf-docker -Dnexus.repository=
20 * Following command builds the JAR file and generates the Docker image for specified CPS component:
21 (with `<docker-profile>` being one of `cps-docker`, `xnf-docker` or `cps-xnf-docker`):
24 mvn clean install -P<docker-profile> -Dnexus.repository=
27 ## Running Docker containers
29 `docker-compose/docker-compose.yml` file is provided to be run with `docker-compose` tool and images previously built.
30 It starts both Postgres database and CPS services.
32 1. Edit `docker-compose.yml` and uncomment desired service to be deployed, by default `cps-and-nf-proxy`
33 is enabled. You can comment it and uncomment `cps-standalone` or `nf-proxy-standalone`.
34 2. Execute following command from `docker-compose` folder:
37 VERSION=x.y.z-SNAPSHOT DB_HOST=dbpostgresql DB_USERNAME=cps DB_PASSWORD=cps docker-compose up -d
40 ## Running or debugging Java built code
42 Before running CPS, a Postgres database instance needs to be started. This can be done with following
46 docker run --name postgres -p 5432:5432 -d \
47 -e POSTGRES_DB=cpsdb -e POSTGRES_USER=cps -e POSTGRES_PASSWORD=cps \
51 Then CPS can be started either using a Java Archive previously built or directly from Intellij IDE.
53 ### Running from Jar Archive
55 Following command starts the application using JAR file:
58 DB_HOST=localhost DB_USERNAME=cps DB_PASSWORD=cps \
59 java -classpath cps-application/target/cps-application-x.y.z-SNAPSHOT.jar:docker-compose \
60 org.springframework.boot.loader.JarLauncher
63 ### Running from IntelliJ IDE
65 Here are the steps to run or debug the application from Intellij:
67 1. Enable the desired maven profile form Maven Tool Window
68 2. Run a configuration from `Run -> Edit configurations` with following settings:
69 * `Working directory`: docker-compose folder, e.g. `$ProjectFileDir$/docker-compose`
70 * `Environment variables`: `DB_HOST=localhost;DB_USERNAME=cps;DB_PASSWORD=cps`
74 Swagger UI and Open API specifications are available to discover service endpoints and send requests.
76 * `http://localhost:<port-number>/swagger-ui/index.html`
77 * `http://localhost:<port-number>/v3/api-docs?group=cps-docket`
79 with <port-number> being either `8080` if running the plain Java build or retrieved using following command
80 if running from `docker-compose`:
84 --format='{{range $p, $conf := .NetworkSettings.Ports}} {{$p}} -> {{(index $conf 0).HostPort}} {{end}}' \
85 <cps-docker-container>