The pz-gateway project handles all user-facing requests to Piazza via REST endpoints. The purpose of this component is to allow for external users to be able to interact with Piazza data, services, events, and other core Piazza functionality.
Before building and running the pz-gateway project, please ensure that the following components are available and/or installed, as necessary:
- Java (JDK for building/developing, otherwise JRE is fine)
- Maven (v3 or later)
- Git (for checking out repository source)
- Eclipse, or any maven-supported IDE
- RabbitMQ
- ElasticSearch
- Amazon S3 bucket access
- Access to Nexus is required to build
Ensure that the nexus url environment variable ARTIFACT_STORAGE_URL
is set:
$ export ARTIFACT_STORAGE_URL={Artifact Storage URL}
For additional details on prerequisites, please refer to the Piazza Developer's Guide Core Overview or Piazza Gateway sections. Also refer to the prerequisites for using Piazza section for additional details.
Create the directory the repository must live in, and clone the git repository:
$ mkdir -p {PROJECT_DIR}/src/github.com/venicegeo
$ cd {PROJECT_DIR}/src/github.com/venicegeo
$ git clone [email protected]:venicegeo/pz-gateway.git
$ cd pz-gateway
Note: In the above commands, replace {PROJECT_DIR} with the local directory path for where the project source is to be installed.
As noted in the Requirements section, to build and run this project, RabbitMQ, ElasticSearch, and S3 Buckets are required. The application.properties
file controls URL information for these components it connects to - check if any port or host information needs to change for certain components. Since the Gateway proxies to all internal Piazza components, then depending on what you are attempting to debug locally, you may need to set one or many of these parameters. For example, if you are debugging pz-ingest
as well, then you would change the ingest.url
property in application.properties
to your own local machine.
To edit the port that the service is running on, edit the server.port
property.
To build and run the Gateway service locally, pz-gateway can be run using Eclipse any maven-supported IDE. Alternatively, pz-gateway can be run through command line interface (CLI), by navigating to the project directory and run:
$ mvn clean install -U spring-boot:run
With optional parameters:
$ java -jar target/piazza-gateway-1.0.0.jar --jobmanager.prefix=localhost --servicecontroller.port=8088 --servicecontroller.prefix=localhost --servicecontroller.protocol=http --ingest.url=http://localhost:8084 --access.url=http://localhost:8085
This will run a Tomcat server locally with the Gateway service running on port 8081.
Note: This Maven build depends on having access to the
Piazza-Group
repository as defined in thepom.xml
file. If your Maven configuration does not specify credentials to this Repository, this Maven build will fail.