diff --git a/README.md b/README.md index 7c19f0250db4c4698b3aa08d4e03869897d105ce..33457e01fa7325c2f1b6e5d9495b9636eec3244b 100644 --- a/README.md +++ b/README.md @@ -1,42 +1,66 @@ -# Sunbird Program Service +# Installing Contribution/Program Service on Local Laptop or Desktop -### Prerequisites: Postgres, Node v12+ +## Pre-requisites -## Run Locally +Before you install program service on your laptop, examine your environment and gather data to ensure an optimal installation experience. Review the [details](https://app.gitbook.com/o/-Mi9QwJlsfb7xuxTBc0J/s/SjljYc0PyD64vGgDlMl4/use/system-requirements) to ensure that the environment has the necessary resources and compliant target systems to successfully install and run Program Service. -Clone the project -```bash - https://github.com/Sunbird-Ed/program-service.git -``` +## Project Setup -Go to the project directory -```bash - cd program-service -``` -Install Git Submodules to make use of -https://github.com/project-sunbird/sunbird-js-utils.git -```bash - git submodule init - git submodule update -``` +1. Clone the project + - Fork the [main source code repository](https://github.com/Sunbird-Ed/program-service) + - Clone the forked repository and add main source code repository as upstream -Install dependencies -```bash - cd src/ - npm install -``` + ```console + git clone {SSH URL of FORKED REPOSITORY} + cd {PROJECT-FOLDER} + git remote add upstream git@github.com:Sunbird-Ed/program-service.git + git fetch upstream + git checkout -b {LOCAL-BRANCH-NAME} upstream/{LATEST BRANCH} + ``` + > ***Note***: Stable versions of the program service are available via tags for each release, and the master branch contains latest stable release. For latest stable release [refer](https://github.com/Sunbird-Ed/program-service/branches) -Set the env variable in `<project-folder>/src/envVariables.js` -```bash - baseURL: process.env.dock_base_url || 'http://dock.sunbirded.org', - SUNBIRD_URL: process.env.sunbird_base_url || 'https://dev.sunbirded.org', - SUNBIRD_PORTAL_API_AUTH_TOKEN: process.env.sunbird_api_auth_token -``` +2. Install Git Submodules to make use of https://github.com/project-sunbird/sunbird-js-utils.git + + ```console + cd {PROJECT-FOLDER} + git submodule init + git submodule update + ``` +3. Install required dependencies + + ```console + cd {PROJECT-FOLDER}/src + npm install + ``` -Start the server -```bash +4. Configuring the Environment + - Open the file `{PROJECT-FOLDER}/src/envVariables.js` in any available text editor and update the contents of the file so that it contains exactly the following values + + ```console + const envVariables = { + baseURL: process.env.dock_base_url || <'https://<host for adopter's instance'>, + SUNBIRD_URL: process.env.sunbird_base_url || <'https://<host for adopter's instance'>, + .... + config: { + user: process.env.sunbird_program_db_user || "<postgress user>", + host: process.env.sunbird_program_db_host || "localhost", + database: process.env.sunbird_program_db_name || 'sunbird_programs', + password: process.env.sunbird_program_db_password || '<postgress password>', + .... + }, + } + ``` + + > Once the file is updated with appropriate values, then you can proceed with running the application + +### Running Application + +1. Run the following command in the **{PROJECT-FOLDER}/src** folder + +```console node app.js ``` -the node app will run on `http://localhost:6000` + +2. The local HTTP server is launched at `http://localhost:6000` > Note: To create Postgres table in the local db use the `<project-folder>/programs.sql`