Note that all deployment strategies below require the use of Docker.
When the simple standalone deployment below is used, it will construct a DSS sandbox environment consisting of:
- A DSS instance, consisting of:
- A single CockroachDB node running in insecure mode via docker, communicating on port 26257 internally and exposing a web admin console on port 8080 externally
- gRPC backend listening by default on port 8081
internally, configured to
- Connect to a CockroachDB node (implicitly port 26257)
- Validate access tokens with the auth2.pem public key
- Expect access tokens to specify an
aud
oflocalhost
- HTTPS gateway listening on port 8082 externally and directing requests translated into gRPC to port 8081 internally
- A Dummy OAuth server exposing an endpoint at http://localhost:8085/token externally to generate dummy JWT access tokens that validate against the auth2.pem public key
- Install Docker
- Install docker-compose
Simply execute ./run_locally.sh
. This will build the required
Docker images if necessary and then construct the system described above.
When this system is active (log messages stop being generated), the following endpoints will be available:
- Dummy OAuth Server: http://localhost:8085/token
- DSS HTTP Gateway Server: http://localhost:8082/healthy
- CockroachDB web UI: http://localhost:8080
In a different window, run ./check_dss.sh
to run a
demonstration RID query on the system. The expected output is an empty list of
ISAs (no ISAs have been announced).
To perform more complicated actions manually, see the Postman collection in this folder (use with Postman).
To stop the system, just press ctrl-c or cmd-c.
run_locally.sh
can also run in debugging mode, which enables
debugging the gRPC backend code line by line with your favorite IDE. It is a very
straightforward process with just 2 steps:
Step 1
Run run_locally.sh debug
, we will see the local-dss-grpc-backend starts with the
DEBUG MODE: on, and the API server is listening at port : 4000.
local-dss-grpc-backend_1 | Debug Mode: on
local-dss-scd-bootstrapper_1 | Allowing time for CRDB node to come up...
local-dss-grpc-backend_1 | API server listening at: [::]:4000
Step 2 (One Time Effort)
Add a remote debug configuration with your favorite IDE. Here we use IntelliJ / GoLand as an example:
-
Click
Edit Configuration
in the dropdown list right next to the 'bug' icon. -
Add a new
Go Remote
configuration. -
Set the Host as
localhost
and Port as4000
, clickOK
.
Enjoy!
All Set, let's start the debug configuration created in the step 1 and we are able
to debug any request sent to the local DSS endpoints hosted at localhost:8082
.
run_locally.sh
is a thin wrapper around a docker-compose
command and all the docker-compose
verbs may be passed to run_locally.sh
.
The default verb is up
, but, e.g., the system can be removed entirely with
run_locally.sh down
. See all docker-compose
verbs
here.
Specifically, after changing code for one or more of the services, make sure to
execute run_locally.sh build
to incorporate the new changes into the local
deployment images. Make sure to restart the local system to reflect changes to
the local deployment images.
If one or more of the necessary ports are not available, identify the process
using a port with lsof -i tcp:8080
.