On the backend (aka. the server-side), CodeStream runs a number of services to provide all the functionality needed for the clients. The default development environment will use the codestream broadcaster with outbound mail disabled.
-
Mac or Linux computer using zsh or bash.
-
Docker Desktop which we'll use to provide MongoDB.
-
Make sure you are authenticated with vault!, i.e.
newrelic-vault us login -method=okta username=<username> totp=<otp>
- If you plan to enable outbound email, make sure you have a working
AWS session to the CodeStream development account. If this requires
use of the
AWS_*
environment variables and you plan to launch from the debugger, ensure they're defined in the appropriate block in.vscode/launch.json
.
For local development we use docker compose to only run mongodb. You will need to run the api-server locally via your IDE or command line.
-
Clone and setup faker-service-gateway. Faker service gateway will handle SSL and proxy requests to the api-server.
-
Clone the codestream-server repo.
-
Start up the docker container for MongoDB via docker compose.
docker compose up mongodb -d
-
Install dependencies
npm run install:all
If you have been running mongodb 4 in docker compose you will need to delete the mongodb volume to get a clean start for mongodb 5, otherwise mongo will exit shortly after startup. This will delete all the data in your local docker mongodb instance.
docker compose down --volumes
docker compose up mongodb -d
With a fresh database you will need to run ./start-api-server.sh -init-db-only
before being able to run api-server from the IDE.
- Setup and start up the api-server without docker. The default
behavior is to initialize the database and disable outbound
email queueing.
./start-api-server.sh [-init-db-only | -no-db | -enable-mailout | -mock-mode ]
-
Review the pre-reqs above to ensure you set any additional vars needed for your use case.
.vscode/launch.json
has some comments to help. -
Select any of the the
api_srv.js
run configurations from vscode or jetbrains.
Point your CodeStream extension to https://localhost.newrelic.com:12079. You should be able to login and see o11y.
Develop to your heart's content!!!! We love pull-requests.
Not working right now :(. Check back later.
As usual, make sure you are authenticated with vault.
Start the api server - use -mock-mode
flag if needed
./start-api-server.sh [-init-db-only | -no-db | -enable-mailout | -mock-mode ]
In a separate terminal, source testMode.sh (this will also set CS_API_MOCK_MODE=1)
. ./testMode.sh
then run the tests
cd api_server
npm run test