The CodeStream API Service is lovely.
- Install the dev_tools tookkit here.
- Install mongo - this is available as a dev_tools sandbox or you can install any version. Instructions for the mongo sandbox are here.
- Make sure you can access the CodeStream network via the VPN.
- Review how we manage our server configurations. If you have any custom alterations to the standard configuration, you will need to be familiar with the procedures in this document.
- If you're using dev_tools on your own computer, bring it up to date
(
dt-selfupdate -y). You don't need to do this if you're using a managed EC2 instance. - Update your secrets (
dt-update-secrets -y). - Select a codestream configuration to use (details documented
here). To get up and running quickly, this
command will select out-of-the-box 'codestream-cloud' as your configuration.
$ echo codestream-cloud > ~/.codestream/config/codestream-cfg-default.local - Open a new terminal window
- Choose a name for your mongo sandbox. The default is
mongo(which this documentation will assume). Load your dev_tools mongo sandbox if you're using one and start the mongo service.If using your own mongo installation, make sure it's running and accessible without credentials on localhost (the default mongo connect url is$ dt-load mongo $ mdb-service startmongodb://localhost/codestream). - Install the api sandbox (only specify
-Iif you are not using or have not loaded a dev_tools mongo sandbox). A default api sandbox name ofapiis assumed in some tools so we'll use it here (though you can change it):dt-sb-new-sandbox -yCD [-I] -t cs_server -n api -O sb.info.api - Load your api sandbox:
$ dt-load api - Create a playground for setting up future terminals with your mongo + api
sandboxes. This will create one called
api.$ dt-sb-create-playground -t $CS_API_TOP/sandbox/playgrounds/default.template - If you haven't already, install the mailin and mailout sandboxes.
- Load all of your sandboxes into one shell and create a
csplayground for your codestream-cloud configuration.$ dt-load mongo $ dt-load api $ dt-load mailin $ dt-load mailout $ dt-sb-create-playground -t $CS_API_TOP/sandbox/playgrounds/cloud-dev.template
-
To setup a new terminal's environment for the API
$ dt-load-playground api [--start | --stop]optional --start will load the sandboxes and start the services.
optional --stop will load the sandboxes and shutdown the services.
-
To control the mongo service (if mongo is a sandbox):
$ mdb-service -
To run the API in the foreground with one worker:
$ cd $CS_API_TOP $ bin/ensure-indexes.js $ bin/api_server.js --one_worker -
To control the api service using the init script
$ cs_api-service -
To see the api sandbox commands
$ cs_api-help -
To see the api sandbox environment variables
$ cs_api-vars -
To run the api_server with a debugger, add an
--inspectargument before the executable .js file as such:node --inspect bin/api_server.js --one_workeror
nodemon -e js,hbs --inspect bin/api_server.js --one_workerThen, in VS Code, run the
Node: Debuggertask. You'll want to attach to the process running on port9230when prompted.
The unified configuration file
OnPrem development configuration