|  | 
| 1 | 1 | # CodeStream Backend Services | 
| 2 | 2 | 
 | 
| 3 |  | -On the backend, CodeStream requires several services to provide all the | 
| 4 |  | -functionality needed for the clients. Different configurations are supported | 
| 5 |  | -most natably the use of the broadcaster and rabbitMQ for On-Prem vs. PubNub and | 
| 6 |  | -AWS SQS for CodeStream Cloud. This repo contains all the code for these | 
| 7 |  | -services. | 
|  | 3 | +On the backend (aka. the server-side), CodeStream runs a number of services to | 
|  | 4 | +provide all the functionality needed for the clients. The default development | 
|  | 5 | +environment will use the codestream broadcaster and rabbitMQ. Mail services | 
|  | 6 | +are disabled by default. | 
|  | 7 | +## Development Setup | 
| 8 | 8 | 
 | 
| 9 |  | -## Installation & Setup Using dev_tools | 
| 10 |  | - | 
| 11 |  | -Installation for development on the CodeStream network. | 
|  | 9 | +_Note: CodeStream employees may prefer to use the dev_tools sandbox as it will | 
|  | 10 | +provide most of the ancillary resources you'll need. [Details | 
|  | 11 | +here](docs/codestream-sandbox-setup.md)._ | 
| 12 | 12 | 
 | 
| 13 | 13 | ### Prerequisites | 
| 14 |  | -1. Install the dev_tools tookkit | 
| 15 |  | -   [here](https://github.com/teamcodestream/dev_tools). | 
| 16 |  | -1. Install mongo - this is available as a dev_tools sandbox or you can install | 
| 17 |  | -   any version. Instructions for the mongo sandbox are | 
| 18 |  | -   [here](https://github.com/teamcodestream/mongodb_tools). | 
| 19 |  | -1. Make sure you can access the CodeStream network via the VPN. | 
| 20 |  | -1. Review how we manage our [server configurations](api_server/README.unified-cfg-file.md). | 
| 21 |  | -   If you have any custom alterations to the standard configuration, you will | 
| 22 |  | -   need to be familiar with the procedures in this document. | 
|  | 14 | + | 
|  | 15 | +1. Mac or Linux computer using zsh or bash. | 
|  | 16 | + | 
|  | 17 | +1. Official CodeStream builds (CI) use Nodejs 12.14.1 with npm 6.13.4 | 
|  | 18 | + | 
|  | 19 | +1. [Docker Desktop](https://www.docker.com/products/docker-desktop) which we'll | 
|  | 20 | +   use to provide MongoDB and a pre-configured RabbitMQ. | 
|  | 21 | + | 
|  | 22 | +If you do not wish to use docker, you'll need to provide both of these services: | 
|  | 23 | + | 
|  | 24 | +1. MongoDB 3.4.9 with `mongodb://localhost/codestream` providing full access to | 
|  | 25 | +   create collections and indexes in the `codestream` database. If you're | 
|  | 26 | +   willing to run docker, the instructions below will show you how to install a | 
|  | 27 | +   MongoDB docker container. | 
|  | 28 | + | 
|  | 29 | +1. RabbitMQ 3.7.x with the delayed message exchange plugin. You'll also need to | 
|  | 30 | +   create a codestream user with access. [Notes here](api_server/docs/rabbitmq.md). | 
| 23 | 31 | 
 | 
| 24 | 32 | ### Installation | 
| 25 |  | -1. If you're using dev_tools on your own computer, bring it up to date | 
| 26 |  | -   (`dt-selfupdate -y`). You don't need to do this if you're using a managed EC2 | 
| 27 |  | -   instance. | 
| 28 |  | -1. Update your secrets (`dt-update-secrets -y`). | 
| 29 |  | -1. Select a codestream configuration to use (details documented | 
| 30 |  | -   [here](README.unified-cfg-file.md)). To get up and running quickly, this | 
| 31 |  | -   command will select out-of-the-box 'codestream-cloud' as your configuration. | 
| 32 |  | -	``` | 
| 33 |  | -	$ echo codestream-cloud > ~/.codestream/config/codestream-cfg-default.local | 
| 34 |  | -	``` | 
| 35 |  | -1. Open a new terminal window | 
| 36 |  | -1. Load your dev_tools mongo sandbox into your shell if you're using one and | 
| 37 |  | -   start the mongo service. | 
| 38 |  | -	``` | 
| 39 |  | -	$ dt-load mongo | 
| 40 |  | -	$ mdb-service start | 
| 41 |  | -	``` | 
| 42 |  | -   If using your own mongo installation, make sure it's running and accessible | 
| 43 |  | -   without credentials on **localhost** (the default mongo connect url assumes | 
| 44 |  | -   `mongodb://localhost/codestream`). | 
| 45 |  | -1. Install the codestream-server repo (only specify `-I` if you are *not* using | 
| 46 |  | -   or have not loaded a dev_tools mongo sandbox). Select a name for your backend | 
| 47 |  | -   sandbox (we'll use `csbe`): | 
| 48 |  | -	``` | 
| 49 |  | -	dt-sb-new-sandbox -yCD -t cs_server -n csbe | 
| 50 |  | -	``` | 
| 51 |  | -1. Load your codestream backend sandbox: | 
| 52 |  | -	``` | 
| 53 |  | -	$ dt-load csbe | 
| 54 |  | -	``` | 
| 55 |  | -1. Create a playground for setting up future terminals with your mongo + csbe | 
| 56 |  | -   sandboxes. This will create a playground with a default name of `csbe` (not | 
| 57 |  | -   to be confused with the **csbe** sandbox). | 
| 58 |  | -	``` | 
| 59 |  | -	$ dt-sb-create-playground -t $CSBE_TOP/sandbox/playgrounds/default.template | 
| 60 |  | -	``` | 
| 61 |  | - | 
| 62 |  | -You are ready to go.  From this point forward use the following command to setup | 
| 63 |  | -new shells for codestream backend development: | 
| 64 |  | -``` | 
| 65 |  | -$ dt-load-playground csbe | 
| 66 |  | -``` | 
| 67 |  | - | 
| 68 |  | -## Installation & Setup without dev_tools | 
| 69 |  | - | 
| 70 |  | -To be written | 
| 71 | 33 | 
 | 
|  | 34 | +1. Fork the | 
|  | 35 | +   [codestream-server](https://github.com/teamcodestream/codestream-server) repo | 
|  | 36 | +   and clone it. | 
|  | 37 | + | 
|  | 38 | +1. Setup your shell's environment | 
|  | 39 | +   ``` | 
|  | 40 | +   cd codestream-server | 
|  | 41 | +   source dev-env.sh     # custom settings go in .sandbox-config.sh | 
|  | 42 | +   ``` | 
|  | 43 | + | 
|  | 44 | +1. Install all the node modules | 
|  | 45 | +   ``` | 
|  | 46 | +   npm run install:all | 
|  | 47 | +   ``` | 
|  | 48 | + | 
|  | 49 | +1. Install the rabbitmq docker container pre-configured for codestream (the | 
|  | 50 | +   container name will be csrabbitmq) | 
|  | 51 | +   ``` | 
|  | 52 | +   npm run run:docker:csrabbitmq | 
|  | 53 | +   ``` | 
|  | 54 | + | 
|  | 55 | +1. Create a docker volume for mongo and launch the mongodb docker container. | 
|  | 56 | +   The docker volume will ensure the data persists beyond the lifespan of the | 
|  | 57 | +   container. | 
|  | 58 | +   ``` | 
|  | 59 | +   npm run run:docker:csmongo | 
|  | 60 | +   ``` | 
|  | 61 | + | 
|  | 62 | +1. In a separate shell, source in the `dev-env.sh` environment and start up the | 
|  | 63 | +   api service. It will repeatedly try to connect to the broadcaster. That's ok. | 
|  | 64 | +   Move on once you've started it. | 
|  | 65 | +   ``` | 
|  | 66 | +   source dev-env.sh | 
|  | 67 | +   npm run start:api | 
|  | 68 | +   ``` | 
|  | 69 | + | 
|  | 70 | +1. In a another separate shell, source in the `dev-env.sh` environment and start | 
|  | 71 | +   up the broadcaster service. | 
|  | 72 | +   ``` | 
|  | 73 | +   source dev-env.sh | 
|  | 74 | +   npm run start:broadcaster | 
|  | 75 | +   ``` | 
|  | 76 | + | 
|  | 77 | +1. If you want to use or work on the onprem admin UI, that will need two more | 
|  | 78 | +   shells. This first one will run webpack and rebuild the bundle file as your | 
|  | 79 | +   files change. | 
|  | 80 | +   ``` | 
|  | 81 | +   source dev-env.sh | 
|  | 82 | +   npm run start:opadm | 
|  | 83 | +   ``` | 
|  | 84 | + | 
|  | 85 | +1. The inbound email service is disabled in the default config. | 
|  | 86 | +   ``` | 
|  | 87 | +   source dev-env.sh | 
|  | 88 | +   npm run start:mailin | 
|  | 89 | +   ``` | 
|  | 90 | + | 
|  | 91 | +1. The outbound email service is also disabled in the default config. | 
|  | 92 | +   ``` | 
|  | 93 | +   source dev-env.sh | 
|  | 94 | +   npm run start:mailout | 
|  | 95 | +   ``` | 
|  | 96 | + | 
|  | 97 | +Point your CodeStream extension to http://localhost:12000. You should be able to | 
|  | 98 | +register and create codemarks. The onprem admin console is at http://localhost:12002 | 
|  | 99 | + | 
|  | 100 | +Develop to your heart's content!!!!  We _love_ pull-requests. | 
0 commit comments