-
Install Node.js and NPM (https://nodejs.org/en/download/)
-
Install webpack (https://webpack.js.org/guides/installation/)
#!/bin/bash
$ npm install --global webpack
-
Install Mongo (https://docs.mongodb.com/manual/administration/install-community/)
-
Start Mongo instance
-
Install Elastic Search (https://www.elastic.co/guide/en/elastic-stack-get-started/7.5/get-started-elastic-stack.html#install-elasticsearch)
-
Start Elastic Search instance
-
(Optional) Install Docker (https://docs.docker.com/v17.12/install/)
- If you want to build and deploy in a container
- Install dependencies
#!/bin/bash
$ npm install
- In the root of the project, create
.env
file, save it in the root of the project and set your environment variables.
#!/bin/bash
# fill in the blanks
$ API_URL=<FILL IN THE BLANK>
$ echo -e 'API_URL='$API_URL'\n' > .env
- In the root of the project, create
.env.server
file, save it in the root of the project and set your environment variables.
#!/bin/bash
# fill in the blanks
$ DB_HOST=<FILL IN THE BLANK>
$ DB_USER=<FILL IN THE BLANK>
$ DB_NAME=<FILL IN THE BLANK>
$ ES_HOST=<FILL IN THE BLANK>
$ echo -e 'DB_HOST='${DB_HOST}'\nDB_USER='${DB_USER}'\nDB_NAME='${DB_NAME}'\nES_HOST='${ES_HOST}'\n' > .env.server
- For testing purposes, create
.env.test
and.env.server.test
and fill in the test environment setup like above.
- Start service
#!/bin/bash
$ npm start
Environment Variable | Example |
---|---|
API_URL | http://127.0.0.1:3001 |
Environment Variable | Example |
---|---|
DB_HOST | 127.0.0.1:3000 |
DB_USER | usename:password |
DB_NAME | csc302 |
ES_HOST | http://127.0.0.1:9200 |
# .env
API_URL=127.0.0.1:3001
# .env.server
DB_HOST=127.0.0.1:3000
DB_USER=admin:password
DB_NAME=csc302
ES_HOST=http://127.0.0.1:9200
- From root of the project, run
#!/bin/bash
$ ./docker-run.sh {Optional: Name of image} {Optional: Database host} {Optional: ElasticSearch Host}
#!/bin/bash
$ ./docker-compose.sh
#!/bin/bash
$ ./docker-elastic-local.sh