From d1793ddc33d4ccbbf652d5423bc800dba737b769 Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Wed, 26 Nov 2025 16:26:36 +0530 Subject: [PATCH 01/63] Add SQL scripts for creating distributed tables and environment configuration for survey project --- .../distributionColumns.sql | 14 +++ .../envs/survey_project_creation_env | 91 +++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 documentation/3.4.0/distribution-columns/survey-project-creation/distributionColumns.sql create mode 100644 documentation/3.4.0/dockerized/envs/survey_project_creation_env diff --git a/documentation/3.4.0/distribution-columns/survey-project-creation/distributionColumns.sql b/documentation/3.4.0/distribution-columns/survey-project-creation/distributionColumns.sql new file mode 100644 index 00000000..aeba7135 --- /dev/null +++ b/documentation/3.4.0/distribution-columns/survey-project-creation/distributionColumns.sql @@ -0,0 +1,14 @@ + +SELECT create_distributed_table('certificate_base_templates', 'tenant_code'); +SELECT create_distributed_table('comments', 'resource_id'); +SELECT create_distributed_table('entities', 'tenant_code'); +SELECT create_distributed_table('entity_types', 'tenant_code'); +SELECT create_distributed_table('forms', 'tenant_code'); +SELECT create_distributed_table('organization_extensions', 'tenant_code'); +SELECT create_distributed_table('resources', 'tenant_code'); +SELECT create_distributed_table('review_stages', 'tenant_code'); +SELECT create_distributed_table('reviews', 'tenant_code'); +SELECT create_distributed_table('activities', 'object_id'); +SELECT create_distributed_table('organization_configs', 'tenant_code'); +SELECT create_distributed_table('rollouts', 'tenant_code'); +SELECT create_distributed_table('program_resource_mapping', 'tenant_code'); \ No newline at end of file diff --git a/documentation/3.4.0/dockerized/envs/survey_project_creation_env b/documentation/3.4.0/dockerized/envs/survey_project_creation_env new file mode 100644 index 00000000..556b04c8 --- /dev/null +++ b/documentation/3.4.0/dockerized/envs/survey_project_creation_env @@ -0,0 +1,91 @@ +ACCESS_TOKEN_EXPIRY=30m +ACCESS_TOKEN_SECRET=hsghasghjab1273JHajnbabsjdj1273981273jhajksdh8y3123yhjkah812398yhjqwe7617237yuhdhhdqwu271 +API_DOC_URL=/scp/api-doc +APPLICATION_BASE_URL=/scp/ +APPLICATION_ENV=development +APPLICATION_HOST=localhost +APPLICATION_PORT=6001 +AUTH_CONFIG_FILE_PATH=config.json +AUTH_METHOD=native +AUTH_TOKEN_HEADER_NAME=x-auth-token +BROWSE_EXISTING_END_POINT=v1/internal/getAllPublishedResources +CLEAR_INTERNAL_CACHE=scpinternal +#Cloud storage details +CLOUD_ENDPOINT=cloud_storage_endpoint +CLOUD_STORAGE=gcp/aws/azure +CLOUD_STORAGE_ACCOUNTNAME=cloud_storage_account_name +CLOUD_STORAGE_BUCKETNAME=bucket_name_of_scp +CLOUD_STORAGE_PROVIDER=gcp/aws/azure +CLOUD_STORAGE_REGION=cloud_storage_region +CLOUD_STORAGE_SECRET=cloud_storage_secret_key +CLOUD_STORAGE_BUCKET_TYPE=public +PUBLIC_ASSET_BUCKETNAME=scp-public-assets +CONSUMPTION_SERVICE=elevate +CONSUMPTION_SERVICE_BASE_URL=/project/ +CONSUMPTION_SERVICE_DOWNLOADBLE_URL=v1/cloud-services/files/download +CONSUMPTION_SERVICE_ENTITY_MANAGEMENT_BASE_URL=/entity-management/ +CONSUMPTION_SERVICE_PRESIGNED_URL=v1/cloud-services/files/preSignedUrls +DEFAULT_ADMIN_ROLE=admin +DEFAULT_CONTENT_CREATOR_ROLE=content_creator +DEFAULT_DATA_MANAGERS=program_manager +DEFAULT_ORGANIZATION_CODE=default_code +DEFAULT_ORG_ADMIN_ROLE=org_admin +DEFAULT_ORG_ID=default_code +DEFAULT_PROGRAM_DESIGNER_ROLES=program_designer +DEFAULT_PROGRAM_MANAGERS=program_manager +DEFAULT_REVIEWER_ROLE=reviewer +DEFAULT_ROLLOUT_ROLES=rollout_manager +DEFAULT_TENANT_CODE=default +DEV_DATABASE_URL=postgres://postgres:postgres@citus_master:5432/scp +DISABLE_LOG=false +ENABLE_ENTITY_TAGGING_IN_PROJECTS=false +ENABLE_OBSERVATION_IN_PROJECTS=true +ENABLE_TASK_START_END_DATE_IN_PROJECTS=false +ENTITY_MANAGEMENT_SERVICE_NAME=/entity-management/ +ERROR_LOG_LEVEL=silly +HIGHEST_IN_ENTITY_HIERARCHY=state +INTERFACE_SERVICE_HOST=http://interface:3569 +INTERNAL_ACCESS_TOKEN=Fqn0m0HQ0gXydRtBCg5l +INTERNAL_CACHE_EXP_TIME=86400 +IS_AUTH_TOKEN_BEARER=false +KAFKA_COMMUNICATIONS_ON_OFF=ON +KAFKA_GROUP_ID=scp +KAFKA_URL=kafka:9092 +MAX_BODY_LENGTH_FOR_UPLOAD=5242880 +MAX_PROJECT_TASK_COUNT=10 +MAX_RESOURCE_NOTE_LENGTH=200 +MIN_APPROVAL=1 +MONGODB_URL=mongodb://mongodb:27017/saas_elevate_project +MONGO_DB_MODE=individual +NOTIFICATION_KAFKA_TOPIC=qa.notification +OBSERVATION_DEEP_LINK_REGEX=^https://qa.elevate-ml.shikshalokam.org/view/observation/[a-f0-9]{32}$ +ORGANIZATION_LIST_ENDPOINT=v1/organization/list +ORGANIZATION_READ_ENDPOINT=v1/organization/read +ORG_ID_HEADER_NAME=organization-id +PROGRAM_META_INFO_KEYS=state,recommendedFor +PROGRAM_PUBLISH_KAFKA_TOPIC=qa.programpublish +PROJECT_DEEP_LINK_URL=https://qa.elevate-ml.shikshalokam.org/view/project/ +PROJECT_MONGO_DB_URL=mongodb://localhost:27018/saas_elevate_project +PROJECT_PUBLISH_END_POINT=v1/scp/publishTemplateAndTasks +PROJECT_PUBLISH_KAFKA_TOPIC=qa.projectpublish +PROJECT_REFLECTION_TASK_REDIRECT_URL=https://qa.elevate-mitra.shikshalokam.org/mohini/sso?flow=guest-mi-story +PROJECT_SERVICE_BASE_URL=/project/ +REDIS_HOST=redis://localhost:6379 +RESOURCE_AUTO_SAVE_TIMER=30000 +RESOURCE_KAFKA_PUSH_ON_OFF=ON +RESOURCE_TYPES=project,observation,observation_with_rubric,survey,program +REVIEW_REQUIRED=true +REVIEW_REQUIRED_AFTER_PUBLISH=true +REVIEW_TYPE=SEQUENTIAL +ROLLOUT_PUBLISH_KAFKA_TOPIC=qa.rolloutpublish +SESSION_VERIFICATION_METHOD=user_service_authenticated +SHOW_REVIEWER_LIST=true +SURVEY_MONGO_DB_URL=mongodb://localhost:27018/saas_elevate_samiksha +SURVEY_SERVICE_BASE_URL=/survey/ +TENANT_ID_HEADER_NAME=tenant-id +USER_LIST_ENDPOINT=v1/account/search +USER_PROFILE_DETAILS_ENDPOINT=v1/user/read +USER_SERVICE_BASE_URL=/user/ +USER_SERVICE_HOST=http://localhost:3567 +USER_SERVICE_ORG_UPDATE_TOPIC=qa.organizationEvent +USER_SERVICE_TENANT_CREATION_TOPIC=qa.tenantEvent From 96fbaacbba12a4848c4e7819ca165329c8bc9a47 Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Wed, 26 Nov 2025 19:47:12 +0530 Subject: [PATCH 02/63] Add integrated deployment setup for Projects Service with Self Creation Portal --- README.md | 55 +++++++++++++++++++ .../envs/survey_project_creation_env | 36 ++++++------ 2 files changed, 73 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index a757287e..2c7e95c3 100644 --- a/README.md +++ b/README.md @@ -140,6 +140,61 @@ Go to the detailed Windows Native setup guide: **SETUP_SCP_DOCKER_UBUNTU.md** + + +
+ 2. macOS Setup +
+Go to the detailed macOS Docker setup guide: **SETUP_SCP_DOCKER_MACOS.md** +
+ +
+ 3. Windows Setup +
+Go to the detailed Windows Docker setup guide: **SETUP_SCP_DOCKER_WINDOWS.md** +
+ +
+ +#### II. Native Setup (PM2 Managed Services) + +
+ 1. Ubuntu Setup +
+Go to the detailed Ubuntu Native setup guide: **SETUP_SCP_NATIVE_UBUNTU.md** +
+ +
+ 2. macOS Setup +
+Go to the detailed macOS Native setup guide: **SETUP_SCP_NATIVE_MACOS.md** +
+ +
+ 3. Windows Setup +
+Go to the detailed Windows Native setup guide: **SETUP_SCP_NATIVE_WINDOWS.md** +
+ + + +--- + ## 📖 Related Documentation & Tools ### Versioning & Documentation Links diff --git a/documentation/3.4.0/dockerized/envs/survey_project_creation_env b/documentation/3.4.0/dockerized/envs/survey_project_creation_env index 556b04c8..24d2d9eb 100644 --- a/documentation/3.4.0/dockerized/envs/survey_project_creation_env +++ b/documentation/3.4.0/dockerized/envs/survey_project_creation_env @@ -1,5 +1,5 @@ ACCESS_TOKEN_EXPIRY=30m -ACCESS_TOKEN_SECRET=hsghasghjab1273JHajnbabsjdj1273981273jhajksdh8y3123yhjkah812398yhjqwe7617237yuhdhhdqwu271 +ACCESS_TOKEN_SECRET=bsj82AHBxahusub12yexlashsbxAXADHBlaj API_DOC_URL=/scp/api-doc APPLICATION_BASE_URL=/scp/ APPLICATION_ENV=development @@ -12,12 +12,12 @@ BROWSE_EXISTING_END_POINT=v1/internal/getAllPublishedResources CLEAR_INTERNAL_CACHE=scpinternal #Cloud storage details CLOUD_ENDPOINT=cloud_storage_endpoint -CLOUD_STORAGE=gcp/aws/azure -CLOUD_STORAGE_ACCOUNTNAME=cloud_storage_account_name -CLOUD_STORAGE_BUCKETNAME=bucket_name_of_scp -CLOUD_STORAGE_PROVIDER=gcp/aws/azure -CLOUD_STORAGE_REGION=cloud_storage_region -CLOUD_STORAGE_SECRET=cloud_storage_secret_key +CLOUD_STORAGE=aws +CLOUD_STORAGE_ACCOUNTNAME=project-scp-storage +CLOUD_STORAGE_BUCKETNAME=scp-uploads-prod +CLOUD_STORAGE_PROVIDER=aws +CLOUD_STORAGE_REGION=us-west-2 +CLOUD_STORAGE_SECRET=AKIAIOSFODNN7EXAMPLE CLOUD_STORAGE_BUCKET_TYPE=public PUBLIC_ASSET_BUCKETNAME=scp-public-assets CONSUMPTION_SERVICE=elevate @@ -55,37 +55,37 @@ MAX_BODY_LENGTH_FOR_UPLOAD=5242880 MAX_PROJECT_TASK_COUNT=10 MAX_RESOURCE_NOTE_LENGTH=200 MIN_APPROVAL=1 -MONGODB_URL=mongodb://mongodb:27017/saas_elevate_project +MONGODB_URL=mongodb://mongodb:27017/elevate-project MONGO_DB_MODE=individual NOTIFICATION_KAFKA_TOPIC=qa.notification -OBSERVATION_DEEP_LINK_REGEX=^https://qa.elevate-ml.shikshalokam.org/view/observation/[a-f0-9]{32}$ +OBSERVATION_DEEP_LINK_REGEX=^https://portal/view/observation/[a-f0-9]{32}$ ORGANIZATION_LIST_ENDPOINT=v1/organization/list ORGANIZATION_READ_ENDPOINT=v1/organization/read ORG_ID_HEADER_NAME=organization-id PROGRAM_META_INFO_KEYS=state,recommendedFor PROGRAM_PUBLISH_KAFKA_TOPIC=qa.programpublish -PROJECT_DEEP_LINK_URL=https://qa.elevate-ml.shikshalokam.org/view/project/ -PROJECT_MONGO_DB_URL=mongodb://localhost:27018/saas_elevate_project +PROJECT_DEEP_LINK_URL=https://portal/view/project/ +PROJECT_MONGO_DB_URL=mongodb://mongodb:27017/elevate-project PROJECT_PUBLISH_END_POINT=v1/scp/publishTemplateAndTasks PROJECT_PUBLISH_KAFKA_TOPIC=qa.projectpublish -PROJECT_REFLECTION_TASK_REDIRECT_URL=https://qa.elevate-mitra.shikshalokam.org/mohini/sso?flow=guest-mi-story +PROJECT_REFLECTION_TASK_REDIRECT_URL=https://elevate-mitra.shikshalokam.org/mohini/sso?flow=guest-mi-story PROJECT_SERVICE_BASE_URL=/project/ -REDIS_HOST=redis://localhost:6379 +REDIS_HOST=redis://redis:6379 RESOURCE_AUTO_SAVE_TIMER=30000 RESOURCE_KAFKA_PUSH_ON_OFF=ON RESOURCE_TYPES=project,observation,observation_with_rubric,survey,program REVIEW_REQUIRED=true REVIEW_REQUIRED_AFTER_PUBLISH=true REVIEW_TYPE=SEQUENTIAL -ROLLOUT_PUBLISH_KAFKA_TOPIC=qa.rolloutpublish +ROLLOUT_PUBLISH_KAFKA_TOPIC=dev.rolloutpublish SESSION_VERIFICATION_METHOD=user_service_authenticated SHOW_REVIEWER_LIST=true -SURVEY_MONGO_DB_URL=mongodb://localhost:27018/saas_elevate_samiksha +SURVEY_MONGO_DB_URL=mongodb://mongodb:27017/elevate-samiksha SURVEY_SERVICE_BASE_URL=/survey/ TENANT_ID_HEADER_NAME=tenant-id USER_LIST_ENDPOINT=v1/account/search USER_PROFILE_DETAILS_ENDPOINT=v1/user/read USER_SERVICE_BASE_URL=/user/ -USER_SERVICE_HOST=http://localhost:3567 -USER_SERVICE_ORG_UPDATE_TOPIC=qa.organizationEvent -USER_SERVICE_TENANT_CREATION_TOPIC=qa.tenantEvent +USER_SERVICE_HOST=http://interface:3569 +USER_SERVICE_ORG_UPDATE_TOPIC=dev.organizationEvent +USER_SERVICE_TENANT_CREATION_TOPIC=dev.tenantEvent \ No newline at end of file From 141c7d5998a038cd43ef7846f7c88f99ec376354 Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Wed, 26 Nov 2025 20:07:26 +0530 Subject: [PATCH 03/63] Add README for Dockerized setup of Projects Service on Ubuntu --- .../3.4.0/setup/docker/scp/ubuntu/README.md | 253 ++++++++++++++++++ 1 file changed, 253 insertions(+) create mode 100644 documentation/3.4.0/setup/docker/scp/ubuntu/README.md diff --git a/documentation/3.4.0/setup/docker/scp/ubuntu/README.md b/documentation/3.4.0/setup/docker/scp/ubuntu/README.md new file mode 100644 index 00000000..5f428b55 --- /dev/null +++ b/documentation/3.4.0/setup/docker/scp/ubuntu/README.md @@ -0,0 +1,253 @@ +
+ +# Projects Service + + + + + +![GitHub package.json version (subfolder of monorepo)](https://img.shields.io/github/package-json/v/ELEVATE-Project/mentoring?filename=src%2Fpackage.json) +[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT) + + + + +
+The Project building block facilitates the creation and engagement with micro-improvement projects. + +
+
+ +# Supported Operating Systems + +- **Ubuntu (Recommended: Version 20 and above)** + +# Setup Options + +> Note : This guide outlines two setup methods, detailed below. For a quick, beginner-friendly setup and walkthrough of services, it is recommended to use the Dockerized Services & Dependencies setup with the Docker- + + Compose file. + +## Dockerized Services & Dependencies + +Expectation: By diligently following the outlined steps, you will successfully establish a fully operational Project application setup, including both the portal and backend services. + +## Prerequisites + +To set up the Project application, ensure you have Docker and Docker Compose installed on your system. For Ubuntu users, detailed installation instructions for both can be found in the documentation here: [How To Install and Use Docker Compose on Ubuntu](https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-compose-on-ubuntu-20-04). To install and use Nodejs in Ubuntu machine, you can follow instructions here: [How To Install Nodejs in Ubuntu](https://nodejs.org/en/download/package-manager). + +## Installation + +**Create project Directory:** Establish a directory titled **project**. + +> Example Command: `mkdir project && cd project/` + +> Note: All commands are run from the project directory. + +## Operating Systems: Linux + +> **Caution:** Before proceeding, please ensure that the ports given here are available and open. It is essential to verify their availability prior to moving forward. You can run below command in your terminal to check this + +``` +for port in 3000 3001 3002 6000 5001 4000 9092 5432 7007 2181 2707 3569 6001; do + if lsof -iTCP:$port -sTCP:LISTEN &>/dev/null; then + echo "Port $port is in use" + else + echo "Port $port is available" + fi +done +``` + +1. **Download and execute main setup script:** Execute the following command in your terminal from the project directory. + ``` + curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh && chmod +x setup_project.sh && sudo ./setup_project.sh + ``` + +> Note : The script will download all the essential files and launch the services in Docker. Once all services are successfully up and running, you can proceed to the next steps. + +> **General Instructions :** + +1. All containers which are part of the docker-compose can be gracefully stopped by pressing Ctrl + c in the same terminal where the services are running. + +2. All docker containers can be stopped and removed by using below command. + +``` +sudo ./docker-compose-down.sh +``` + +3. All services and dependencies can be started using below command. + +``` +sudo ./docker-compose-up.sh +``` + +**Keep the current terminal session active, and kindly open a new terminal window within the project directory.** + +**After successfully completing this, please move to the next section: [Enable Citus Extension](#enable-citus-extension-optional)** + +## Enable Citus Extension (Optional) + +User management service comes with this bundle relies on PostgreSQL as its core database system. To boost performance and scalability, users can opt to enable the Citus extension. This transforms PostgreSQL into a distributed database, spreading data across multiple nodes to handle large datasets more efficiently as demand grows. + +For more information, refer **[Citus Data](https://www.citusdata.com/)**. + +To enable the Citus extension for user services, follow these steps. + +1. Create a sub-directory named `user` and download `distributionColumns.sql` into it. (Skip this for linux) + ``` + mkdir user && curl -o ./user/distributionColumns.sql -JL https://github.com/ELEVATE-Project/project-service/raw/main/documentation/3.4.0/distribution-columns/user/distributionColumns.sql + ``` +2. Create a sub-directory named `survey-project-creation` and download `distributionColumns.sql` into it. (Skip this for linux) + ``` + mkdir scp && curl -o ./survey-project-creation/distributionColumns.sql -JL https://github.com/ELEVATE-Project/project-service/raw/main/documentation/3.4.0/distribution-columns/survey-project-creation/distributionColumns.sql +3. Set up the citus_setup file by following the steps given below. + + 1. Enable Citus and set distribution columns for `user` database by running the `citus_setup.sh`with the following arguments. + + ``` + sudo ./citus_setup.sh user postgres://postgres:postgres@citus_master:5432/user + ``` +4. Set up the citus_setup file by following the steps given below. + + 1. Enable Citus and set distribution columns for `survey-project-creation` database by running the `citus_setup.sh`with the following arguments. + + ``` + sudo ./citus_setup.sh survey-project-creation postgres://postgres:postgres@citus_master:5432/scp + ``` +## Persistence Of Database Data In Docker Container (Optional) + +To ensure the persistence of database data when running `docker compose down`, it is necessary to modify the `docker-compose-project.yml` file according to the steps given below: + +1. **Modification Of The `docker-compose-project.yml` File:** + + Begin by opening the `docker-compose-project.yml` file. Locate the section pertaining to the Citus and mongo container and proceed to uncomment the volume specification. This action is demonstrated in the snippet provided below: + + ```yaml + mongo: + image: 'mongo:4.4.14' + restart: 'always' + ports: + - '27017:27017' + networks: + - project_net + volumes: + - mongo-data:/data/db + logging: + driver: none + + citus: + image: citusdata/citus:11.2.0 + container_name: 'citus_master' + ports: + - 5432:5432 + volumes: + - citus-data:/var/lib/postgresql/data + ``` + +2. **Uncommenting Volume Names Under The Volumes Section:** + + Next, navigate to the volumes section of the file and proceed to uncomment the volume names as illustrated in the subsequent snippet: + + ```yaml + networks: + elevate_net: + external: false + + volumes: + citus-data: + mongo-data: + ``` + +By implementing these adjustments, the configuration ensures that when the `docker-compose down` command is executed, the database data is securely stored within the specified volumes. Consequently, this data will be retained and remain accessible, even after the containers are terminated and subsequently reinstated using the `docker-compose up` command. + +## Sample User Accounts Generation + +During the initial setup of Project services with the default configuration, you may encounter issues creating new accounts through the regular SignUp flow on the project portal. This typically occurs because the default SignUp process includes OTP verification to prevent abuse. Until the notification service is configured correctly to send actual emails, you will not be able to create new accounts. + +In such cases, you can generate sample user accounts using the steps below. This allows you to explore the Project services and portal immediately after setup. + +> **Warning:** Use this generator only immediately after the initial system setup and before any normal user accounts are created through the portal. It should not be used under any circumstances thereafter. + +``` +sudo ./insert_sample_data.sh user postgres://postgres:postgres@citus_master:5432/user +``` + +After successfully running the script mentioned above, the following user accounts will be created and available for login: + +| Email ID | Password | Role | +| ---------------------- | ---------- | ----------------------- | +| mallanagouda@gmail.com | Password1@ | State Education Officer | +| prajwal@gmail.com | Password1@ | State Education Officer | +| vishnu@gmail.com | Password1@ | State Education Officer | +| priyanka@gmail.com | Password1@ | Program Designer | +| adithya@gmail.com | Password1@ | Content Creator | +| praveen@gmail.com | Password1@ | Reviewer | + + + + +## Default Forms Creation for Portal Configuration + +This step inserts configuration forms into MongoDB, enabling or disabling features and fields on portal pages. + +#### Insert Forms Data into Database + +``` +curl -OJL https://github.com/ELEVATE-Project/project-service/raw/main/documentation/1.0.0/dockerized/scripts/mac-linux/import_forms_mongo.sh && chmod +x import_forms_mongo.sh && sudo ./import_forms_mongo.sh mongodb://mongo:27017/elevate-project +``` + +## Explore the Consumption Portal + +Once the services are up and the front-end app bundle is built successfully, navigate to **[localhost:7007](http://localhost:7007/)** to access the Project app. + +> **Warning:** In this setup, features such as **Sign-Up, Project Certificate, Project Sharing, and Project PDF Report** will not be available because cloud storage credentials have been masked in the environment files for security reasons. + +## Default Forms Creation for Self Creation Portal Configuration + +This step inserts configuration forms into postgres, enabling or disabling features and fields on portal pages. + +#### Insert Forms Data into Database + +``` +curl -OJL https://github.com/ELEVATE-Project/project-service/raw/main/documentation/3.4.0/dockerized/scripts/scp/ubuntu/import_forms_postgres.sh && chmod +x import_forms_postgres.sh && sudo ./import_forms_postgres.sh postgres://postgres:postgres@citus_master:5432/scp +``` + +## Explore the Self Creation Portal + +Once the services are up and the front-end app bundle is built successfully, navigate to **[localhost:1819](http://localhost:1819/)** to access the Creation app. + +> **Warning:** In this setup, features such as **Sign-Up, Resource Creation** will not be available because cloud storage credentials have been masked in the environment files for security reasons. Before runs the docker compose file please update this with actual cloud credentials + +## Postman Collections + +- [Projects Service](https://github.com/ELEVATE-Project/project-service/tree/main/api-doc) + +- [Surevy Project Creation Service](https://github.com/ELEVATE-Project/survey-project-creation-service/tree/release-1.0.0/src/api-doc) + +# Team + + + + + +# Open Source Dependencies + +Several open source dependencies that have aided Projects's development: + +![NodeJS](https://img.shields.io/badge/node.js-6DA55F?style=for-the-badge&logo=node.js&logoColor=white) +![Apache Kafka](https://img.shields.io/badge/Apache%20Kafka-000?style=for-the-badge&logo=apachekafka) +![Redis](https://img.shields.io/badge/redis-%23DD0031.svg?style=for-the-badge&logo=redis&logoColor=white) +![Jest](https://img.shields.io/badge/-jest-%23C21325?style=for-the-badge&logo=jest&logoColor=white) +![Git](https://img.shields.io/badge/git-%23F05033.svg?style=for-the-badge&logo=git&logoColor=white) From f4d1a0f1897a9fbc1184a6021180f482b21a4906 Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Wed, 26 Nov 2025 20:14:01 +0530 Subject: [PATCH 04/63] Add setup scripts and sample data for Dockerized Projects Service --- .../scripts/scp/ubuntu/citus_setup.sh | 106 +++++++++ .../scripts/scp/ubuntu/docker-compose-down.sh | 16 ++ .../scripts/scp/ubuntu/docker-compose-up.sh | 16 ++ .../scripts/scp/ubuntu/entity_sampleData.js | 224 ++++++++++++++++++ .../scripts/scp/ubuntu/insert_sample_data.sh | 36 +++ .../scripts/scp/ubuntu/replace_volume_path.sh | 21 ++ .../scripts/scp/ubuntu/setup_project.sh | 91 +++++++ 7 files changed, 510 insertions(+) create mode 100644 documentation/3.4.0/dockerized/scripts/scp/ubuntu/citus_setup.sh create mode 100644 documentation/3.4.0/dockerized/scripts/scp/ubuntu/docker-compose-down.sh create mode 100644 documentation/3.4.0/dockerized/scripts/scp/ubuntu/docker-compose-up.sh create mode 100644 documentation/3.4.0/dockerized/scripts/scp/ubuntu/entity_sampleData.js create mode 100755 documentation/3.4.0/dockerized/scripts/scp/ubuntu/insert_sample_data.sh create mode 100644 documentation/3.4.0/dockerized/scripts/scp/ubuntu/replace_volume_path.sh create mode 100644 documentation/3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh diff --git a/documentation/3.4.0/dockerized/scripts/scp/ubuntu/citus_setup.sh b/documentation/3.4.0/dockerized/scripts/scp/ubuntu/citus_setup.sh new file mode 100644 index 00000000..861094d4 --- /dev/null +++ b/documentation/3.4.0/dockerized/scripts/scp/ubuntu/citus_setup.sh @@ -0,0 +1,106 @@ +#!/bin/bash + +# Exit on error +set -e + +# Ensure correct number of arguments are provided +if [ $# -lt 2 ]; then + echo "Error: Folder name and database URL not provided. Usage: $0 " + exit 1 +fi + +# Use the provided folder name +FOLDER_NAME="$1" + +# Check if folder exists +if [ ! -d "$FOLDER_NAME" ]; then + echo "Error: Folder '$FOLDER_NAME' not found." + exit 1 +fi + +# Use the provided database URL +DEV_DATABASE_URL="$2" + +# Extract database credentials and connection details using awk for portability +DB_USER=$(echo $DEV_DATABASE_URL | awk -F '[:@/]' '{print $4}') +DB_PASSWORD=$(echo $DEV_DATABASE_URL | awk -F '[:@/]' '{print $5}') +DB_HOST=$(echo $DEV_DATABASE_URL | awk -F '[:@/]' '{print $6}') +DB_PORT=$(echo $DEV_DATABASE_URL | awk -F '[:@/]' '{split($7,a,"/"); print a[1]}') +DB_NAME=$(echo $DEV_DATABASE_URL | awk -F '/' '{print $NF}') + +# Log database variables +echo "Extracted Database Variables:" +echo "DB_USER: $DB_USER" +echo "DB_PASSWORD: $DB_PASSWORD" +echo "DB_HOST: $DB_HOST" +echo "DB_PORT: $DB_PORT" +echo "DB_NAME: $DB_NAME" + +# Define the container name (same as DB_HOST) +CONTAINER_NAME="$DB_HOST" + +# Wait for Docker container to be up +echo "Waiting for Docker container '$CONTAINER_NAME' to be up..." +while ! docker inspect "$CONTAINER_NAME" &>/dev/null; do + echo "Waiting for container..." + sleep 1 +done +echo "Container is now up." + +# Wait for PostgreSQL to be ready to accept connections +echo "Waiting for PostgreSQL on '$DB_HOST:$DB_PORT' to accept connections..." +until docker exec "$CONTAINER_NAME" bash -c "pg_isready -h localhost -p $DB_PORT -U $DB_USER"; do + echo "Waiting for database to be ready..." + sleep 1 +done +echo "Database is ready." + +# Function to check if the database exists +check_database() { + docker exec "$CONTAINER_NAME" bash -c "PGPASSWORD='$DB_PASSWORD' psql -h localhost -U $DB_USER -p $DB_PORT -lqt | cut -d \| -f 1 | grep -qw '$DB_NAME'" +} + +echo "Checking existence of database '$DB_NAME'..." +until check_database; do + echo "Database '$DB_NAME' does not exist, waiting..." + sleep 5 +done +echo "Database '$DB_NAME' exists, proceeding with script." + +# Retrieve and prepare SQL file operations +DISTRIBUTION_COLUMNS_FILE="$FOLDER_NAME/distributionColumns.sql" +if [ ! -f "$DISTRIBUTION_COLUMNS_FILE" ]; then + echo "Error: distributionColumns.sql not found in folder '$FOLDER_NAME'." + exit 1 +fi +echo "Copying distributionColumns.sql to container '$CONTAINER_NAME'..." +docker cp "$DISTRIBUTION_COLUMNS_FILE" "$CONTAINER_NAME:/distributionColumns.sql" + +echo "Creating Citus extension in the database..." +docker exec --user "$DB_USER" "$CONTAINER_NAME" bash -c "PGPASSWORD='$DB_PASSWORD' psql -h localhost -U $DB_USER -d $DB_NAME -p $DB_PORT -c 'CREATE EXTENSION IF NOT EXISTS citus;'" + +# Function to check if table exists +check_table() { + local table=$1 + local exists=$(docker exec "$CONTAINER_NAME" bash -c "PGPASSWORD='$DB_PASSWORD' psql -h localhost -U $DB_USER -d $DB_NAME -p $DB_PORT -t -c \"SELECT EXISTS(SELECT 1 FROM pg_tables WHERE schemaname = 'public' AND tablename = '$table');\"") + exists=$(echo "$exists" | tr -d '[:space:]') # Trim whitespace + echo "Debug: exists result for table $table = '$exists'" # Debug line + [[ "$exists" == "t" ]] # Checking specifically for 't' +} + +# Execute the SQL file with checks for table existence +echo "Creating distribution columns..." +while IFS= read -r line; do + if [[ $line =~ create_distributed_table\(\'([^\']+)\', ]]; then + table="${BASH_REMATCH[1]}" + echo "Checking existence of table '$table'..." + until check_table "$table"; do + echo "Table '$table' does not exist, waiting..." + sleep 1 + done + echo "Table '$table' exists, executing: $line" + docker exec --user "$DB_USER" "$CONTAINER_NAME" bash -c "PGPASSWORD='$DB_PASSWORD' psql -h localhost -U $DB_USER -d $DB_NAME -p $DB_PORT -c \"$line\"" + fi +done <"$DISTRIBUTION_COLUMNS_FILE" + +echo "Citus extension setup complete." \ No newline at end of file diff --git a/documentation/3.4.0/dockerized/scripts/scp/ubuntu/docker-compose-down.sh b/documentation/3.4.0/dockerized/scripts/scp/ubuntu/docker-compose-down.sh new file mode 100644 index 00000000..7237a2b0 --- /dev/null +++ b/documentation/3.4.0/dockerized/scripts/scp/ubuntu/docker-compose-down.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# Get the directory of the shell script +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Set environment variables +export notification_env="$SCRIPT_DIR/notification_env" +export scheduler_env="$SCRIPT_DIR/scheduler_env" +export project_env="$SCRIPT_DIR/project_env" +export users_env="$SCRIPT_DIR/user_env" +export interface_env="$SCRIPT_DIR/interface_env" +export entity_management_env="$SCRIPT_DIR/entity_management_env" +export survey_project_creation_env="$SCRIPT_DIR/survey_project_creation_env" + +# Run docker-compose +docker-compose -f "$SCRIPT_DIR/docker-compose-project.yml" down \ No newline at end of file diff --git a/documentation/3.4.0/dockerized/scripts/scp/ubuntu/docker-compose-up.sh b/documentation/3.4.0/dockerized/scripts/scp/ubuntu/docker-compose-up.sh new file mode 100644 index 00000000..972bf3db --- /dev/null +++ b/documentation/3.4.0/dockerized/scripts/scp/ubuntu/docker-compose-up.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# Get the directory of the shell script +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Set environment variables +export notification_env="$SCRIPT_DIR/notification_env" +export scheduler_env="$SCRIPT_DIR/scheduler_env" +export project_env="$SCRIPT_DIR/project_env" +export users_env="$SCRIPT_DIR/user_env" +export interface_env="$SCRIPT_DIR/interface_env" +export entity_management_env="$SCRIPT_DIR/entity_management_env" +export survey_project_creation_env="$SCRIPT_DIR/survey_project_creation_env" + +# Run docker-compose +docker-compose -f "$SCRIPT_DIR/docker-compose-project.yml" up \ No newline at end of file diff --git a/documentation/3.4.0/dockerized/scripts/scp/ubuntu/entity_sampleData.js b/documentation/3.4.0/dockerized/scripts/scp/ubuntu/entity_sampleData.js new file mode 100644 index 00000000..aebc1cfc --- /dev/null +++ b/documentation/3.4.0/dockerized/scripts/scp/ubuntu/entity_sampleData.js @@ -0,0 +1,224 @@ +const { ObjectId } = require('mongodb') + +let entityType = [ + { + _id: new ObjectId('6825914b97b5680013e6a140'), + profileForm: [], + profileFields: [], + types: [], + callResponseTypes: [], + isObservable: true, + immediateChildrenEntityType: ['district'], + createdBy: '49', + updatedBy: '49', + deleted: false, + isDeleted: false, + name: 'state', + toBeMappedToParentEntities: true, + tenantId: 'shikshalokam', + updatedAt: new Date('2025-05-15T07:01:31.680Z'), + createdAt: new Date('2025-05-15T07:01:31.680Z'), + __v: 0, + orgId: 'sl', + }, + { + _id: new ObjectId('6825915197b5680013e6a142'), + profileForm: [], + profileFields: [], + types: [], + callResponseTypes: [], + isObservable: true, + immediateChildrenEntityType: ['district'], + createdBy: '49', + updatedBy: '49', + deleted: false, + isDeleted: false, + name: 'district', + toBeMappedToParentEntities: true, + tenantId: 'shikshalokam', + updatedAt: new Date('2025-05-15T07:01:37.892Z'), + createdAt: new Date('2025-05-15T07:01:37.892Z'), + __v: 0, + orgId: 'sl', + }, + { + _id: new ObjectId('682591cc97b5680013e6a15c'), + profileForm: [], + profileFields: [], + types: [], + callResponseTypes: [], + isObservable: true, + immediateChildrenEntityType: ['district'], + createdBy: '49', + updatedBy: '49', + deleted: false, + isDeleted: false, + name: 'professional_role', + toBeMappedToParentEntities: true, + tenantId: 'shikshalokam', + updatedAt: new Date('2025-05-15T07:03:40.376Z'), + createdAt: new Date('2025-05-15T07:03:40.376Z'), + __v: 0, + orgId: 'sl', + }, + { + _id: new ObjectId('682591d397b5680013e6a15e'), + profileForm: [], + profileFields: [], + types: [], + callResponseTypes: [], + isObservable: true, + immediateChildrenEntityType: ['district'], + createdBy: '49', + updatedBy: '49', + deleted: false, + isDeleted: false, + name: 'professional_subroles', + toBeMappedToParentEntities: true, + tenantId: 'shikshalokam', + updatedAt: new Date('2025-05-15T07:03:47.062Z'), + createdAt: new Date('2025-05-15T07:03:47.062Z'), + __v: 0, + orgId: 'sl', + }, + +] + +let entities = [ + { + _id: new ObjectId('6852c86c7248c20014b38a4d'), + metaInformation: { + targetedEntityTypes: [], + externalId: '16', + name: 'Tripura', + }, + childHierarchyPath: ['district', 'block', 'cluster', 'school'], + createdBy: '20', + updatedBy: '20', + deleted: false, + entityTypeId: new ObjectId('6825914b97b5680013e6a140'), + entityType: 'state', + registryDetails: { + code: '16', + locationId: '16', + }, + tenantId: 'shikshalokam', + orgId: 'sl', + updatedAt: new Date('2025-06-18T14:29:00.266Z'), + createdAt: new Date('2025-06-18T14:08:44.438Z'), + __v: 0, + groups: { + district: [new ObjectId('6852c8ae7248c20014b38a57')], + }, + }, + { + _id: new ObjectId('6852c8ae7248c20014b38a57'), + metaInformation: { + targetedEntityTypes: [], + externalId: 'westTripura', + name: 'West Tripura', + }, + childHierarchyPath: ['block', 'cluster', 'school'], + createdBy: '20', + updatedBy: '20', + deleted: false, + entityTypeId: new ObjectId('6825915197b5680013e6a142'), + entityType: 'district', + registryDetails: { + code: 'westTripura', + locationId: 'westTripura', + }, + tenantId: 'shikshalokam', + orgId: 'sl', + updatedAt: new Date('2025-06-18T14:27:43.218Z'), + createdAt: new Date('2025-06-18T14:09:50.337Z'), + __v: 0, + groups: { + block: [ + new ObjectId('6852c8de7248c20014b38a9d'), + new ObjectId('6852c8de7248c20014b38a9e'), + new ObjectId('6852c8de7248c20014b38a9f'), + new ObjectId('6852c8de7248c20014b38aa0'), + new ObjectId('6852c8de7248c20014b38aa1'), + new ObjectId('6852c8de7248c20014b38aa2'), + new ObjectId('6852c8de7248c20014b38aa3'), + new ObjectId('6852c8de7248c20014b38aa4'), + new ObjectId('6852c8de7248c20014b38aa5'), + new ObjectId('6852c8de7248c20014b38aa6'), + new ObjectId('6852c8de7248c20014b38aa7'), + new ObjectId('6852c8de7248c20014b38aa8'), + ], + }, + }, + { + _id: new ObjectId('68876746b19aea00144c2af9'), + metaInformation: { + targetedEntityTypes: [ + { + entityTypeId: '6825915197b5680013e6a142', + entityType: 'district', + }, + ], + externalId: 'Facilitator', + name: 'Facilitator', + }, + childHierarchyPath: ['professional_role', 'professional_subroles'], + createdBy: '1', + updatedBy: '1', + deleted: false, + entityTypeId: new ObjectId('682591cc97b5680013e6a15c'), + entityType: 'professional_role', + registryDetails: { + locationId: 'Facilitator', + code: 'Facilitator', + }, + userId: '1', + tenantId: 'shikshalokam', + orgId: 'tan90', + updatedAt: new Date('2025-07-28T12:08:56.065Z'), + createdAt: new Date('2025-07-28T12:04:22.011Z'), + __v: 0, + groups: { + professional_subroles: [new ObjectId('688767deb19aea00144c2b08')], + }, + }, + { + _id: new ObjectId('688767deb19aea00144c2b08'), + metaInformation: { + targetedEntityTypes: [ + { + entityType: 'Handbook1_Activity', + entityTypeId: '688762feb19aea00144c2a81', + }, + { + entityType: 'Handbook2_Activity', + entityTypeId: '68887766b19aea00144c3631', + }, + ], + externalId: 'facilitator', + name: 'Facilitator', + }, + childHierarchyPath: ['professional_subroles'], + createdBy: '1', + updatedBy: '1', + deleted: false, + entityTypeId: new ObjectId('682591d397b5680013e6a15e'), + entityType: 'professional_subroles', + registryDetails: { + locationId: 'facilitator', + code: 'facilitator', + }, + userId: '1', + tenantId: 'shikshalokam', + orgId: 'tan90', + updatedAt: new Date('2025-07-29T07:28:05.355Z'), + createdAt: new Date('2025-07-28T12:06:54.072Z'), + __v: 0, + }, + +] + +module.exports = { + entities, + entityType, +} diff --git a/documentation/3.4.0/dockerized/scripts/scp/ubuntu/insert_sample_data.sh b/documentation/3.4.0/dockerized/scripts/scp/ubuntu/insert_sample_data.sh new file mode 100755 index 00000000..64da00ee --- /dev/null +++ b/documentation/3.4.0/dockerized/scripts/scp/ubuntu/insert_sample_data.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (1, 'Rahul R B', 'a0db5e0a39ee13db7fc5d1309e637f2c', false, '{8,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default','53bc5d0ff0c53bee460c08b8afe087455050dc7529a2f1d4f7319c0da653a7e4','+91', NULL);" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (2, 'Prajwal C S', 'c4113be1bc2cef51981a6ec687302e42fc4f87f4dfac4276584844d9e3e0f5ae', false, '{8,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default','53bc5d0ff0c53bee460c08b8afe087455050dc7529a2f1d4f7319c0da653a767','+91', NULL);" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (3, 'Vishnu V P', '1092be87fd483fce1deba56c8cdefa79bed4f70a4b110fc4e7947c57aacff219', false, '{8,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default','53bc5d0ff0c53bee460c08b8afe087455050dc7529a2f1d4f7319c0da653a7e0','+91', NULL);" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (4, 'Mallanagouda R B', 'e5fc674d4b1a54c6cf772485e3bca6f7ae14b60de32b9f0cd9f955ee469345bc', false, '{8,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default','53bc5d0ff0c53bee460c08b8afe087455050dc7529a2f1d4f7319c0da653a700','+91', NULL);" + +# --- 2. INSERT INTO public.user_organizations --- +# FIXES: +# - Quoted the organization_code and tenant_code variables. +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_organizations (user_id,organization_code, tenant_code, created_at, updated_at, deleted_at) VALUES (1, 'default_code', 'default', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_organizations (user_id,organization_code, tenant_code, created_at, updated_at, deleted_at) VALUES (2, 'default_code', 'default', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_organizations (user_id,organization_code, tenant_code, created_at, updated_at, deleted_at) VALUES (3, 'default_code', 'default', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_organizations (user_id,organization_code, tenant_code, created_at, updated_at, deleted_at) VALUES (4, 'default_code', 'default', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" + +# --- 3. INSERT INTO public.user_organization_roles --- +# FIXES: +# - Quoted the organization_code and tenant_code variables. +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 2, 'default_code', 1, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 3, 'default_code', 8, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 2, 'default_code', 8, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 4, 'default_code', 8, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" + +# --- 4. INSERT INTO public.entity_types --- +# FIXES: +# - Quoted the JSON value for the 'meta' column. +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.entity_types (id, value, label, status, created_by, updated_by, allow_filtering, data_type, organization_id, parent_id, has_entities, allow_custom_entities, model_names, created_at, updated_at, deleted_at, meta, external_entity_type, required, regex, tenant_code,organization_code) VALUES (5, 'state', 'State', 'ACTIVE', 0, 0, true, 'STRING', 1, NULL, true, true, '{User}', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, '{\"service\": \"entity-management-service\",\"endPoint\": \"v1/entities/find\"}', true, false, NULL,'default', 'default_code');" + +# --- 5. UPDATES and SEQUENCES --- +psql -h localhost -p 5432 -U postgres -d user -c "UPDATE public.entity_types SET status = 'INACTIVE' WHERE id = 3;" +psql -h localhost -p 5432 -U postgres -d user -c "SELECT nextval('users_id_seq'::regclass) FROM public.users;" +psql -h localhost -p 5432 -U postgres -d user -c "SELECT nextval('users_credentials_id_seq'::regclass) FROM public.users_credentials;" +psql -h localhost -p 5432 -U postgres -d user -c "SELECT NULL;" + + + diff --git a/documentation/3.4.0/dockerized/scripts/scp/ubuntu/replace_volume_path.sh b/documentation/3.4.0/dockerized/scripts/scp/ubuntu/replace_volume_path.sh new file mode 100644 index 00000000..e427fe5e --- /dev/null +++ b/documentation/3.4.0/dockerized/scripts/scp/ubuntu/replace_volume_path.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# Define the path of your docker-compose file +DOCKER_COMPOSE_FILE="docker-compose-project.yml" + +# Check if the Docker Compose file exists +if [ ! -f "$DOCKER_COMPOSE_FILE" ]; then + echo "Error: Docker Compose file '$DOCKER_COMPOSE_FILE' does not exist." + exit 1 +fi + +# Get the current directory path +CURRENT_DIR=$(pwd) + +# Escape the current directory path to be used in a sed expression +ESCAPED_CURRENT_DIR=$(printf '%s\n' "$CURRENT_DIR" | sed -e 's/[\/&]/\\&/g') + +# Use sed to replace the path leading up to 'env.js' in the docker-compose file +# The pattern ensures that it only replaces the path component up to ':/usr/src/app/www/assets/env/env.js' +sed -i -e "s|/[^:]*\(\/env\.js\):/usr/src/app/www/assets/env/env.js|$ESCAPED_CURRENT_DIR\1:/usr/src/app/www/assets/env/env.js|" "$DOCKER_COMPOSE_FILE" +echo "Updated volume path for 'env.js' in $DOCKER_COMPOSE_FILE" \ No newline at end of file diff --git a/documentation/3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh b/documentation/3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh new file mode 100644 index 00000000..c64bb8c5 --- /dev/null +++ b/documentation/3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh @@ -0,0 +1,91 @@ +#!/bin/bash + +# Logging function +log() { + echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" >> setup_log.txt +} + +# Step 1: Download Docker Compose file +log "Downloading Docker Compose file..." +curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/dockerFiles/stand-alone/docker-compose-project.yml +log "Docker Compose file downloaded." + +# Step 2: Download environment files +log "Downloading environment files..." +curl -L \ + -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/envs/interface_env \ + -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/envs/entity_management_env \ + -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/envs/project_env \ + -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/envs/notification_env \ + -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/envs/scheduler_env \ + -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/envs/user_env \ + -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/envs/env.js +log "Environment files downloaded." + +# Step 3: Download replace_volume_path.sh script +log "Downloading replace_volume_path.sh script..." +curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/1.0.0/dockerized/scripts/mac-linux/replace_volume_path.sh +log "replace_volume_path.sh script downloaded." + +# Step 4: Make replace_volume_path.sh executable +log "Making replace_volume_path.sh executable..." +chmod +x replace_volume_path.sh +log "Made replace_volume_path.sh executable." + +# Step 5: Run replace_volume_path.sh script +log "Running replace_volume_path.sh script..." +./replace_volume_path.sh +log "replace_volume_path.sh script executed." + +# Step 6: Download additional scripts +log "Downloading docker-compose scripts..." +curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/scripts/scp/ubuntu/docker-compose-up.sh +curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/scripts/scp/ubuntu/docker-compose-down.sh +log "docker-compose scripts downloaded." + +# Step 7: Make the scripts executable +log "Making docker-compose scripts executable..." +chmod +x docker-compose-up.sh +chmod +x docker-compose-down.sh +log "Made docker-compose scripts executable." + +# Step 8: Create user directory and download SQL file +log "Creating user directory and downloading distributionColumns.sql..." +mkdir -p user && curl -o ./user/distributionColumns.sql -JL https://github.com/ELEVATE-Project/project-service/raw/refs/heads/setupGuideSCP/documentation/3.4.0/distribution-columns/user/distributionColumns.sql +log "User directory created and distributionColumns.sql downloaded." + +# Step 9: Download and make citus_setup.sh executable +log "Downloading citus_setup.sh..." +curl -OJL https://github.com/ELEVATE-Project/project-service/raw/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/scripts/mac-linux/citus_setup.sh +chmod +x citus_setup.sh + +# Step 10: Create sample-data directory and download SQL file +log "Creating sample-data directory and downloading sampleData.sql..." +mkdir -p sample-data/user && \ +curl -L https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/sample-data/mac-linux/user/sampleData.sql -o sample-data/user/sampleData.sql +log "Sample-data directory created and sampleData.sql downloaded." + + +# Install MongoDB driver (usually needed if connecting directly to MongoDB/Citus) +npm install mongodb + +# Install Mongoose (Object Data Modeling library, if the scripts use it) +npm install mongoose + +# Step 11: Download additional scripts to add data +log "Downloading sample data scripts..." +curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/entity_sampleData.js +curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/project_sampleData.js +curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/insert_sample_solutions.js +curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/insert_sample_data.sh +log "sample data scripts downloaded." + + +log "Downloading config.json file..." +curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/config.json +log "config.json file is downloaded." + +# Step 13: Run docker-compose-up.sh script +log "Running docker-compose-up.sh script..." +./docker-compose-up.sh +log "docker-compose-up.sh script executed." From 63f19abe060cf1a55e6812b7e12c27a30a40112f Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Wed, 26 Nov 2025 20:25:19 +0530 Subject: [PATCH 05/63] Add Docker Compose file and update setup script for SCP deployment --- .../scp/docker-compose-project.yml | 246 ++++++++++++++++++ .../scripts/scp/ubuntu/setup_project.sh | 4 +- .../sample-data/mac-linux/user/sampleData.sql | 5 + 3 files changed, 253 insertions(+), 2 deletions(-) create mode 100644 documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml diff --git a/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml b/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml new file mode 100644 index 00000000..13cb88cc --- /dev/null +++ b/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml @@ -0,0 +1,246 @@ +version: '3' +services: + zookeeper: + image: 'confluentinc/cp-zookeeper:7.3.0' + ports: + - '2181:2181' + environment: + - ALLOW_ANONYMOUS_LOGIN=yes + - ZOOKEEPER_CLIENT_PORT=2181 + - ZOOKEEPER_TICK_TIME=2000 + networks: + - project_net + kafka: + image: 'confluentinc/cp-kafka:7.3.0' + ports: + - '9092:9092' + environment: + KAFKA_BROKER_ID: 1 + KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 + KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:29092,PLAINTEXT_HOST://0.0.0.0:9092 + KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092 + KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT + KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT + KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 + depends_on: + - zookeeper + healthcheck: + test: kafka-topics --bootstrap-server localhost:9092 --list || exit 1 + interval: 10s + timeout: 5s + retries: 9 + networks: + - project_net + redis: + image: 'redis:7.0.0' + restart: 'always' + expose: + - 6379 + healthcheck: + test: ['CMD', 'redis-cli', 'ping'] + interval: 10s + timeout: 5s + retries: 5 + networks: + - project_net + project: + image: shikshalokamqa/elevate-project-service:3.3.6.1 + container_name: project + ports: + - '6000:6000' + environment: + - MONGODB_URL=mongodb://mongo:27017/elevate-project + env_file: + - ./project_env + depends_on: + - mongo + - kafka + volumes: + - ./config.json:/opt/projects/config.json + networks: + - project_net + entity_management: + image: shikshalokamqa/elevate-entity-management:3.3.13.1 + ports: + - '5001:5001' + env_file: + - ./entity_management_env + depends_on: + - mongo + volumes: + - ./config.json:/var/src/config.json + networks: + - project_net + user: + image: shikshalokamqa/elevate-user:3.3.24 + ports: + - '3001:3001' + command: > + bash -c "echo 'Waiting for PostgreSQL on citus_master:5432 to accept connections...' && + while ! timeout 1 bash -c 'cat < /dev/null > /dev/tcp/citus_master/5432' 2> /dev/null; do + echo 'Waiting for citus_master to be ready...'; + sleep 1; + done; + echo 'Database is ready.'; + npm run db:init && npm run db:seed:all && + (echo 'Running nodeee' && nodemon app.js &) && + (while ! curl -sSf http://user:3001 > /dev/null; do + sleep 1; + done && echo 'Service is up' && + /bin/bash -c 'cd scripts && echo Running user service scripts && node insertDefaultOrg.js && node viewsScript.js && node -r module-alias/register uploadSampleCSV.js'); + tail -f /dev/null" + depends_on: + - kafka + - citus + - redis + - scheduler + environment: + - DEV_DATABASE_URL=postgres://postgres:postgres@citus_master:5432/user + - KAFKA_URL=kafka:29092 + - REDIS_HOST=redis://redis:6379 + volumes: + - ./user:/usr/src/app + networks: + - project_net + env_file: + - ./user_env + + notification: + image: shikshalokamqa/elevate-notification:2.6.1 + ports: + - '3002:3002' + command: > + bash -c "echo 'Waiting for PostgreSQL on citus_master:5432 to accept connections...' && + while ! timeout 1 bash -c 'cat < /dev/null > /dev/tcp/citus_master/5432' 2> /dev/null; do + echo 'Waiting for citus_master to be ready...'; + sleep 1; + done; + echo 'Database is ready.'; + npm run db:init && nodemon app.js" + depends_on: + - kafka + - citus + environment: + - KAFKA_HOST=kafka:9092 + - DEV_DATABASE_URL=postgres://postgres:postgres@citus_master:5432/notification + networks: + - project_net + # env_file: + # - ./notification_env + + scheduler: + image: shikshalokamqa/elevate-scheduler:2.6.1 + ports: + - '4000:4000' + command: ['nodemon', 'app.js'] + # environment: + # - KAFKA_URL=kafka:9092 + depends_on: + kafka: + condition: service_healthy + redis: + condition: service_started + networks: + - project_net + env_file: + - ./scheduler_env + interface: + # Update with latest image + # build: ./interface-service + image: shikshalokamqa/elevate-interface:3.3.2 + ports: + - '3569:3569' + command: ['node', 'app.js'] + networks: + - project_net + env_file: + - ./interface_env + citus: + image: citusdata/citus:11.2.0 + container_name: 'citus_master' + ports: + - 5432:5432 + expose: + - 5432 + environment: &AUTH + POSTGRES_USER: '${POSTGRES_USER:-postgres}' + POSTGRES_PASSWORD: '${POSTGRES_PASSWORD:-postgres}' + PGUSER: '${POSTGRES_USER:-postgres}' + PGPASSWORD: '${POSTGRES_PASSWORD:-postgres}' + POSTGRES_DB: 'postgres' + POSTGRES_HOST_AUTH_METHOD: '${POSTGRES_HOST_AUTH_METHOD:-trust}' + POSTGRES_LOG_STATEMENT: 'all' # Enable query logging (set to 'all' for all queries) + networks: + - project_net + #volumes: + # - citus-data:/var/lib/postgresql/data + pgadmin: + image: dpage/pgadmin4 + container_name: elevate-pgadmin + restart: always + ports: + - '5500:80' + environment: + - PGADMIN_DEFAULT_EMAIL=user@shikshalokam.org + - PGADMIN_DEFAULT_PASSWORD=password + networks: + - project_net + # logging: + # driver: none + + # Mongo config + mongo: + image: 'mongo:4.4.14' + container_name: project_mongo_1 + restart: 'always' + ports: + - '27017:27017' + networks: + - project_net + # volumes: + # - mongo-data:/data/db + # logging: + # driver: none + + # Gotenberg config + gotenberg: + image: gotenberg/gotenberg:latest + container_name: gotenberg + ports: + - '3003:3000' + networks: + - project_net + restart: 'always' + + portal: + image: shikshalokamqa/elevate-project-obervation-pwa:3.4.0 + container_name: portal + ports: + - '7007:7007' + volumes: + - /home/user4/Workspace/Docker Image/env.js:/usr/src/app/www/assets/env/env.js + command: > + /bin/bash -c "ionic build --prod && ionic serve --host 0.0.0.0" + networks: + - project_net + survey-project-creation-service: + build: ./survey-project-creation-service + container_name: survey-project-creation-service + ports: + - '6001:6001' + command: > + bash -c "cp /var/src/config.sample.json /var/src/config.json 2>/dev/null || true && nodemon app.js" + env_file: + - ./survey_project_creation_env + depends_on: + - kafka + - citus + - redis + networks: + - project_net +networks: + project_net: + external: false +#volumes: +# mongo-data: +# citus-data: diff --git a/documentation/3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh b/documentation/3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh index c64bb8c5..1884caa8 100644 --- a/documentation/3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh +++ b/documentation/3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh @@ -7,7 +7,7 @@ log() { # Step 1: Download Docker Compose file log "Downloading Docker Compose file..." -curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/dockerFiles/stand-alone/docker-compose-project.yml +curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml log "Docker Compose file downloaded." # Step 2: Download environment files @@ -24,7 +24,7 @@ log "Environment files downloaded." # Step 3: Download replace_volume_path.sh script log "Downloading replace_volume_path.sh script..." -curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/1.0.0/dockerized/scripts/mac-linux/replace_volume_path.sh +curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/scripts/scp/ubuntu/replace_volume_path.sh log "replace_volume_path.sh script downloaded." # Step 4: Make replace_volume_path.sh executable diff --git a/documentation/3.4.0/sample-data/mac-linux/user/sampleData.sql b/documentation/3.4.0/sample-data/mac-linux/user/sampleData.sql index 9744d2fe..48620b41 100644 --- a/documentation/3.4.0/sample-data/mac-linux/user/sampleData.sql +++ b/documentation/3.4.0/sample-data/mac-linux/user/sampleData.sql @@ -1,3 +1,8 @@ +INSERT INTO public.user_roles (id, title, user_type, status, created_at, updated_at, deleted_at, visibility, organization_id, label) VALUES (8, 'state_education_officer', 0, 'ACTIVE', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, 'PUBLIC', 1, 'State Education Officer'); +INSERT INTO public.user_roles (id, title, user_type, status, created_at, updated_at, deleted_at, visibility, organization_id, label) VALUES (9, 'content_creator', 0, 'ACTIVE', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, 'PUBLIC', 1, 'Content Creator'); +INSERT INTO public.user_roles (id, title, user_type, status, created_at, updated_at, deleted_at, visibility, organization_id, label) VALUES (10, 'reviewer', 0, 'ACTIVE', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, 'PUBLIC', 1, 'Reviewer'); +INSERT INTO public.user_roles (id, title, user_type, status, created_at, updated_at, deleted_at, visibility, organization_id, label) VALUES (11, 'program_designer', 0, 'ACTIVE', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, 'PUBLIC', 1, 'Program Designer'); +INSERT INTO public.user_roles (id, title, user_type, status, created_at, updated_at, deleted_at, visibility, organization_id, label) VALUES (12, 'program_manager', 0, 'ACTIVE', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, 'PUBLIC', 1, 'Program Manager'); INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (1, 'Rahul R B', 'a0db5e0a39ee13db7fc5d1309e637f2c', false, '{8,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default','53bc5d0ff0c53bee460c08b8afe087455050dc7529a2f1d4f7319c0da653a7e4','+91', NULL); INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (2, 'Prajwal C S', 'c4113be1bc2cef51981a6ec687302e42fc4f87f4dfac4276584844d9e3e0f5ae', false, '{8,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default','53bc5d0ff0c53bee460c08b8afe087455050dc7529a2f1d4f7319c0da653a767','+91', NULL); INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (3, 'Vishnu V P', '1092be87fd483fce1deba56c8cdefa79bed4f70a4b110fc4e7947c57aacff219', false, '{8,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default','53bc5d0ff0c53bee460c08b8afe087455050dc7529a2f1d4f7319c0da653a7e0','+91', NULL); From 2b8ac67d7ab744c62be6075db25e9ce9c68263e4 Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Wed, 26 Nov 2025 20:27:49 +0530 Subject: [PATCH 06/63] updated the citus scp --- documentation/3.4.0/setup/docker/scp/ubuntu/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/3.4.0/setup/docker/scp/ubuntu/README.md b/documentation/3.4.0/setup/docker/scp/ubuntu/README.md index 5f428b55..a42c35f8 100644 --- a/documentation/3.4.0/setup/docker/scp/ubuntu/README.md +++ b/documentation/3.4.0/setup/docker/scp/ubuntu/README.md @@ -103,7 +103,7 @@ To enable the Citus extension for user services, follow these steps. ``` 2. Create a sub-directory named `survey-project-creation` and download `distributionColumns.sql` into it. (Skip this for linux) ``` - mkdir scp && curl -o ./survey-project-creation/distributionColumns.sql -JL https://github.com/ELEVATE-Project/project-service/raw/main/documentation/3.4.0/distribution-columns/survey-project-creation/distributionColumns.sql + mkdir survey-project-creation && curl -o ./survey-project-creation/distributionColumns.sql -JL https://github.com/ELEVATE-Project/project-service/raw/main/documentation/3.4.0/distribution-columns/survey-project-creation/distributionColumns.sql 3. Set up the citus_setup file by following the steps given below. 1. Enable Citus and set distribution columns for `user` database by running the `citus_setup.sh`with the following arguments. From 2beb5ca3ff4ae04ba5fbb25155542bc6a8194694 Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Thu, 27 Nov 2025 16:00:04 +0530 Subject: [PATCH 07/63] Update README.md to enhance clarity and structure - Changed the heading for Supported Operating Systems from H1 to H2 for better hierarchy. - Removed redundant section on Setup Options and streamlined the introduction to Dockerized Services & Dependencies. --- .../scp/ubuntu/import_forms_postgres.sh | 0 .../scp/ubuntu/insert_sample_solutions.js | 56 + .../scripts/scp/ubuntu/project_sampleData.js | 1612 +++++++++++++++++ .../3.4.0/setup/docker/scp/ubuntu/README.md | 8 +- 4 files changed, 1669 insertions(+), 7 deletions(-) create mode 100644 documentation/3.4.0/dockerized/scripts/scp/ubuntu/import_forms_postgres.sh create mode 100644 documentation/3.4.0/dockerized/scripts/scp/ubuntu/insert_sample_solutions.js create mode 100644 documentation/3.4.0/dockerized/scripts/scp/ubuntu/project_sampleData.js diff --git a/documentation/3.4.0/dockerized/scripts/scp/ubuntu/import_forms_postgres.sh b/documentation/3.4.0/dockerized/scripts/scp/ubuntu/import_forms_postgres.sh new file mode 100644 index 00000000..e69de29b diff --git a/documentation/3.4.0/dockerized/scripts/scp/ubuntu/insert_sample_solutions.js b/documentation/3.4.0/dockerized/scripts/scp/ubuntu/insert_sample_solutions.js new file mode 100644 index 00000000..82a616ce --- /dev/null +++ b/documentation/3.4.0/dockerized/scripts/scp/ubuntu/insert_sample_solutions.js @@ -0,0 +1,56 @@ +const { MongoClient } = require('mongodb') + +const url = 'mongodb://localhost:27017/' // MongoDB URL +const dbName = 'elevate-project' +const dbName2 = 'elevate-entity' +const entityData = require('./entity_sampleData.js') +const projectData = require('./project_sampleData.js') + +async function insertData(collectionName, dataFile, curretDB = dbName) { + const client = new MongoClient(url) + + try { + // Connect to MongoDB + await client.connect() + console.log(`Connected to MongoDB for ${collectionName}`) + + const db = client.db(curretDB) + const collection = db.collection(collectionName) + + // Read the data from the file + const data = dataFile + + if (!data) { + await client.close() + return + } + + const result = await collection.insertMany(data) + //console.log(`Inserted ${result.insertedCount} documents into ${collectionName}`); + } finally { + await client.close() + } +} + +async function main({ dataToBeInserted }) { + await insertData('entities', dataToBeInserted.entities, dbName2) + await insertData('entityTypes', dataToBeInserted.entityType, dbName2) + await insertData('programs', dataToBeInserted.programData) + await insertData('solutions', dataToBeInserted.solutionData) + await insertData('projectTemplates', dataToBeInserted.projectTemplatesData) + await insertData('projectTemplateTasks', dataToBeInserted.projectTemplateTasksData) + await insertData('certificateTemplates', dataToBeInserted.certificateTemplatesData) + await insertData('certificateBaseTemplates', dataToBeInserted.certificateBaseTemplatesData) + await insertData('projectCategories', dataToBeInserted.projectCategoriesData) +} + +main({ dataToBeInserted: entityData }) + .then(() => { + console.log('Entity data populated successfully.') + }) + .catch(console.error) +main({ dataToBeInserted: projectData }) + .then(() => { + console.log('project data populated successfully.') + }) + .catch(console.error) diff --git a/documentation/3.4.0/dockerized/scripts/scp/ubuntu/project_sampleData.js b/documentation/3.4.0/dockerized/scripts/scp/ubuntu/project_sampleData.js new file mode 100644 index 00000000..84184d27 --- /dev/null +++ b/documentation/3.4.0/dockerized/scripts/scp/ubuntu/project_sampleData.js @@ -0,0 +1,1612 @@ +const { ObjectId } = require('mongodb') + +let solutionData = [ + { + _id: new ObjectId('68ee4bb3fb9bee08b93b6d68'), + resourceType: ['Improvement Project Solution'], + language: ['English'], + keywords: ['Improvement Project'], + concepts: [], + themes: [], + flattenedThemes: [], + entities: [], + registry: [], + isRubricDriven: false, + enableQuestionReadOut: false, + captureGpsLocationAtQuestionLevel: false, + isAPrivateProgram: false, + allowMultipleAssessemts: false, + isDeleted: false, + pageHeading: 'Domains', + minNoOfSubmissionsRequired: 1, + rootOrganisations: [], + createdFor: [], + submissionLevel: 'USER', + availableForPrivateConsumption: true, + parentEntityKey: null, + deleted: false, + programExternalId: 'Testing_for_prTGCEBGFFRYVBDFGJ7DGDGF12SDFGHJ345CVBNMDRGYY', + entityType: 'school', + externalId: 'PROJ19099023DGHG789SDASDFGHR4567-1760447411369-PROJECT-SOLUTION', + name: 'pro with obsasatask oct 8 facilitator only 2nd', + description: 'To construct a wired car using a DPDT switch.', + isReusable: false, + startDate: new Date('2025-09-09T00:00:00.000Z'), + endDate: new Date('2026-09-09T18:29:59.000Z'), + subType: 'improvementProject', + type: 'improvementProject', + programId: new ObjectId('68ee4b79fb9bee08b93b6d34'), + programName: 'custom observation as a task check on oct 14th facilitator', + programDescription: 'custom observation as a task check on oct 14th facilitator', + status: 'active', + tenantId: 'shikshalokam', + orgId: 'tan90', + updatedAt: new Date('2025-10-14T13:11:17.993Z'), + createdAt: new Date('2025-10-14T13:10:11.897Z'), + __v: 0, + scope: { + professional_role: ['68876746b19aea00144c2af9'], + professional_subroles: ['688767deb19aea00144c2b08'], + organizations: ['tan90'], + state: ['6852c86c7248c20014b38a4d'], + district: ['6852c8ae7248c20014b38a57'], + block: ['ALL'], + cluster: ['ALL'], + school: ['ALL'], + }, + projectTemplateId: new ObjectId('68ee4bb3fb9bee08b93b6d70'), + updatedBy: '1', + author: '1', + creator: 'Nevil', + certificateTemplateId: new ObjectId('68ee4bf5fb9bee08b93b6d97'), + link: 'f8a8e9ba397a29cf75ad5057db6cb7f9', + }, + { + _id: new ObjectId('68e8c635201642091e014914'), + resourceType: ['Improvement Project Solution'], + language: ['English'], + keywords: ['Improvement Project'], + concepts: [], + themes: [], + flattenedThemes: [], + entities: [], + registry: [], + isRubricDriven: false, + enableQuestionReadOut: false, + captureGpsLocationAtQuestionLevel: false, + isAPrivateProgram: false, + allowMultipleAssessemts: false, + isDeleted: false, + pageHeading: 'Domains', + minNoOfSubmissionsRequired: 1, + rootOrganisations: [], + createdFor: [], + submissionLevel: 'USER', + availableForPrivateConsumption: true, + parentEntityKey: null, + deleted: false, + programExternalId: 'Testing_for_prTGCEBGFFRYVBDFGJ7DGDGF123456', + entityType: 'school', + externalId: 'PROJ190909764HJHF123FGHHcvvbgd-1760085557008-PROJECT-SOLUTION', + name: 'Testing Project For LED IMP facilitator only', + description: 'To construct a wired car using a DPDT switch.', + isReusable: false, + startDate: new Date('2025-09-09T00:00:00.000Z'), + endDate: new Date('2026-09-09T18:29:59.000Z'), + subType: 'improvementProject', + type: 'improvementProject', + programId: new ObjectId('68e8c284201642091e0148c1'), + programName: 'custom observation as a task check on oct 10th facilitator', + programDescription: 'custom observation as a task check on oct 10th facilitator', + status: 'active', + tenantId: 'shikshalokam', + orgId: 'tan90', + updatedAt: new Date('2025-10-10T08:40:22.617Z'), + createdAt: new Date('2025-10-10T08:39:17.519Z'), + __v: 0, + scope: { + professional_role: ['68876746b19aea00144c2af9'], + professional_subroles: ['688767deb19aea00144c2b08'], + organizations: ['tan90'], + state: ['6852c86c7248c20014b38a4d'], + district: ['6852c8ae7248c20014b38a57'], + block: ['ALL'], + cluster: ['ALL'], + school: ['ALL'], + }, + projectTemplateId: new ObjectId('68e8c635201642091e01491c'), + updatedBy: '1', + author: '1', + creator: 'Nevil', + certificateTemplateId: new ObjectId('68e8c676201642091e014943'), + link: '178ac1fdff5b367ef3335ce0e1665a6c', + }, + { + _id: new ObjectId('68c98d9538aee0086ee61096'), + resourceType: ['Improvement Project Solution'], + language: ['English'], + keywords: ['Improvement Project'], + concepts: [], + themes: [], + flattenedThemes: [], + entities: [], + registry: [], + isRubricDriven: false, + enableQuestionReadOut: false, + captureGpsLocationAtQuestionLevel: false, + isAPrivateProgram: false, + allowMultipleAssessemts: false, + isDeleted: false, + pageHeading: 'Domains', + minNoOfSubmissionsRequired: 1, + rootOrganisations: [], + createdFor: [], + submissionLevel: 'USER', + availableForPrivateConsumption: true, + parentEntityKey: null, + deleted: false, + programExternalId: 'ProgramTestKey1', + entityType: 'school', + externalId: 'ProjectIdtestKey1-1758039445176-PROJECT-SOLUTION', + name: 'Project name sep 16 9 30', + description: + 'Gathers insights from teachers regarding available resources, training needs, and challenges faced in classrooms.', + isReusable: false, + startDate: new Date('2025-07-29T18:30:00.000Z'), + endDate: new Date('2026-01-30T18:29:59.000Z'), + subType: 'improvementProject', + type: 'improvementProject', + programId: new ObjectId('68c98d8f38aee0086ee61070'), + programName: 'Program name is sep 16 9 30', + programDescription: 'Description of the Program', + status: 'active', + tenantId: 'shikshalokam', + orgId: 'tan90', + updatedAt: new Date('2025-09-16T16:17:25.599Z'), + createdAt: new Date('2025-09-16T16:17:25.472Z'), + __v: 0, + scope: { + professional_role: ['ALL'], + professional_subroles: ['ALL'], + organizations: ['tan90'], + state: ['ALL'], + district: ['ALL'], + block: ['ALL'], + cluster: ['ALL'], + school: ['ALL'], + }, + projectTemplateId: new ObjectId('68c98d9538aee0086ee6109e'), + }, + { + _id: new ObjectId('68d3b9a72ba17cc3cb238821'), + resourceType: ['Improvement Project Solution'], + language: ['English'], + keywords: ['Improvement Project'], + concepts: [], + themes: [], + flattenedThemes: [], + entities: [], + registry: [], + isRubricDriven: false, + enableQuestionReadOut: false, + captureGpsLocationAtQuestionLevel: false, + isAPrivateProgram: false, + allowMultipleAssessemts: false, + isDeleted: false, + pageHeading: 'Domains', + minNoOfSubmissionsRequired: 1, + rootOrganisations: [], + createdFor: [], + submissionLevel: 'USER', + availableForPrivateConsumption: true, + parentEntityKey: null, + deleted: false, + programExternalId: 'SUP_as_a_task_test_sept_24_1500', + entityType: 'school', + externalId: 'DPDTSCH012025-1758706081315-PROJECT-SOLUTION', + name: 'project sup test with obs or sur tasks sep 23 1520', + description: 'To construct a wired car using a DPDT switch.', + isReusable: false, + startDate: new Date('2025-07-29T18:30:00.000Z'), + endDate: new Date('2025-12-30T18:29:59.000Z'), + subType: 'improvementProject', + type: 'improvementProject', + programId: new ObjectId('68d3b9681e09f9b5b1e0693d'), + programName: 'SUP_as_a_task_test_sept_24_1500', + programDescription: 'This is the description of the program.', + status: 'active', + tenantId: 'shikshalokam', + orgId: 'tan90', + updatedAt: new Date('2025-09-24T09:28:19.783Z'), + createdAt: new Date('2025-09-24T09:28:07.900Z'), + __v: 0, + scope: { + professional_role: ['ALL'], + professional_subroles: ['688767deb19aea00144c2b08'], + organizations: ['tan90'], + state: ['ALL'], + district: ['ALL', '6852c8ae7248c20014b38a57'], + block: ['ALL'], + cluster: ['ALL'], + school: ['ALL'], + }, + projectTemplateId: new ObjectId('68d3b9a92ba17cc3cb238829'), + updatedBy: '1', + author: '1', + creator: 'Nevil', + link: 'a0acc357edbcf3287e9767d20a7d9f12', + }, +] + +let programData = [ + { + _id: new ObjectId('68ee4b79fb9bee08b93b6d34'), + resourceType: ['program'], + language: ['English'], + keywords: ['CBSE', 'SQAA'], + concepts: [], + components: [ + { + _id: new ObjectId('68ee4bb3fb9bee08b93b6d68'), + order: 1, + }, + ], + isAPrivateProgram: false, + isDeleted: false, + requestForPIIConsent: true, + rootOrganisations: [], + createdFor: [], + deleted: false, + status: 'active', + owner: '1', + createdBy: '1', + updatedBy: '1', + externalId: 'Testing_for_prTGCEBGFFRYVBDFGJ7DGDGF12SDFGHJ345CVBNMDRGYY', + name: 'custom observation as a task check on oct 14th facilitator', + description: 'custom observation as a task check on oct 14th facilitator', + startDate: new Date('2025-09-08T18:30:00.000Z'), + endDate: new Date('2026-09-09T18:29:59.000Z'), + imageCompression: { + quality: 10, + }, + metaInformation: { + state: ['Tripura'], + recommendedFor: ['Facilitator'], + }, + tenantId: 'shikshalokam', + orgId: 'tan90', + updatedAt: new Date('2025-10-14T13:18:46.936Z'), + createdAt: new Date('2025-10-14T13:09:13.649Z'), + __v: 0, + scope: { + professional_role: ['68876746b19aea00144c2af9'], + professional_subroles: ['688767deb19aea00144c2b08'], + organizations: ['tan90'], + state: ['6852c86c7248c20014b38a4d'], + district: ['6852c8ae7248c20014b38a57'], + block: ['ALL'], + cluster: ['ALL'], + school: ['ALL'], + }, + }, + { + _id: new ObjectId('68e8c284201642091e0148c1'), + resourceType: ['program'], + language: ['English'], + keywords: ['CBSE', 'SQAA'], + concepts: [], + components: [ + { + _id: new ObjectId('68e8c635201642091e014914'), + order: 1, + }, + ], + isAPrivateProgram: false, + isDeleted: false, + requestForPIIConsent: true, + rootOrganisations: [], + createdFor: [], + deleted: false, + status: 'active', + owner: '1', + createdBy: '1', + updatedBy: '1', + externalId: 'Testing_for_prTGCEBGFFRYVBDFGJ7DGDGF123456', + name: 'custom observation as a task check on oct 10th facilitator', + description: 'custom observation as a task check on oct 10th facilitator', + startDate: new Date('2025-09-08T18:30:00.000Z'), + endDate: new Date('2026-09-09T18:29:59.000Z'), + imageCompression: { + quality: 10, + }, + metaInformation: { + state: ['Tripura'], + recommendedFor: ['Facilitator'], + }, + tenantId: 'shikshalokam', + orgId: 'tan90', + updatedAt: new Date('2025-10-10T08:44:35.535Z'), + createdAt: new Date('2025-10-10T08:23:32.295Z'), + __v: 0, + scope: { + professional_role: ['68876746b19aea00144c2af9'], + professional_subroles: ['688767deb19aea00144c2b08'], + organizations: ['tan90'], + state: ['6852c86c7248c20014b38a4d'], + district: ['6852c8ae7248c20014b38a57'], + block: ['ALL'], + cluster: ['ALL'], + school: ['ALL'], + }, + }, + { + _id: new ObjectId('68c98d8f38aee0086ee61070'), + resourceType: ['program'], + language: ['English'], + keywords: [], + concepts: [], + components: [ + { + _id: new ObjectId('68c98d9538aee0086ee61096'), + order: 1, + }, + ], + isAPrivateProgram: false, + isDeleted: false, + requestForPIIConsent: true, + rootOrganisations: [], + createdFor: [], + deleted: false, + status: 'active', + owner: '1', + createdBy: '1', + updatedBy: '1', + externalId: 'ProgramTestKey1', + name: 'Program name is sep 16 9 30', + description: 'Description of the Program', + metaInformation: { + state: ['Tripura'], + recommendedFor: ['functionaries-officials', 'teacher-educators-coordinators'], + }, + imageCompression: { + quality: 10, + }, + startDate: new Date('2025-07-29T18:30:00.000Z'), + endDate: new Date('2026-01-30T18:29:59.000Z'), + tenantId: 'shikshalokam', + orgId: 'tan90', + updatedAt: new Date('2025-09-16T17:06:14.752Z'), + createdAt: new Date('2025-09-16T16:17:19.239Z'), + __v: 0, + scope: { + professional_role: ['68876746b19aea00144c2af9'], + professional_subroles: ['688767deb19aea00144c2b08'], + organizations: ['tan90'], + state: ['6852c86c7248c20014b38a4d'], + district: ['6852c8ae7248c20014b38a57'], + block: ['ALL'], + cluster: ['ALL'], + school: ['ALL'], + }, + }, + { + _id: new ObjectId('68d3b9681e09f9b5b1e0693d'), + resourceType: ['program'], + language: ['English'], + keywords: [], + concepts: [], + components: [ + { + _id: new ObjectId('68d3b9a72ba17cc3cb238821'), + order: 1, + }, + ], + isAPrivateProgram: false, + isDeleted: false, + requestForPIIConsent: true, + rootOrganisations: [], + createdFor: [], + deleted: false, + status: 'active', + owner: '1', + createdBy: '1', + updatedBy: '1', + externalId: 'SUP_as_a_task_test_sept_24_1500', + name: 'SUP_as_a_task_test_sept_24_1500 oct 3', + description: 'This is the description of the program.', + metaInformation: { + state: ['Tripura'], + recommendedFor: ['functionaries-officials'], + }, + imageCompression: { + quality: 10, + }, + startDate: new Date('2025-07-29T18:30:00.000Z'), + endDate: new Date('2025-12-30T18:29:59.000Z'), + tenantId: 'shikshalokam', + orgId: 'tan90', + updatedAt: new Date('2025-10-03T09:20:39.907Z'), + createdAt: new Date('2025-09-24T09:27:04.322Z'), + __v: 0, + scope: { + professional_role: ['68876746b19aea00144c2af9'], + professional_subroles: ['688767deb19aea00144c2b08'], + organizations: ['tan90'], + state: ['6852c86c7248c20014b38a4d'], + district: ['6852c8ae7248c20014b38a57'], + block: ['ALL'], + cluster: ['ALL'], + school: ['ALL'], + }, + }, +] + +let projectTemplatesData = [ + { + _id: new ObjectId('68ee4bb3fb9bee08b93b6d70'), + description: 'To construct a wired car using a DPDT switch.', + concepts: [''], + keywords: ['Science, Activity Based Learning, STEM Education, STEM Lab, DPDT Switch Car'], + isDeleted: false, + recommendedFor: ['Learner'], + tasks: [ + new ObjectId('68ee4bb4fb9bee08b93b6d7a'), + new ObjectId('68ee4bb4fb9bee08b93b6d7e'), + new ObjectId('68ee4bb4fb9bee08b93b6d82'), + new ObjectId('68ee4bb4fb9bee08b93b6d86'), + ], + createdBy: '1', + updatedBy: '1', + learningResources: [], + isReusable: false, + taskSequence: [ + 'DPDTSC-HandBook-1-2025-Task1-1760447411369-1760447411984', + 'DPDTSC-HandBook-1-2025-Task2-1760447411369', + 'DPDTSC-HandBook-1-2025-Task3-1760447411369', + 'DPDTSC-HandBook-1-2025-Task4-1760447411369', + 'DPDTSC-HandBook-1-2025-Task5-1760447411369', + ], + averageRating: 0, + noOfRatings: 0, + ratings: { + 1: 0, + 2: 0, + 3: 0, + 4: 0, + 5: 0, + }, + importCount: 0, + evidences: [], + isPrivate: false, + hasSpotlight: false, + hasStory: false, + text: [], + visibility: 'CURRENT', + visibleToOrganizations: ['tan90'], + deleted: false, + title: 'pro with obsasatask oct 8 facilitator only 2nd', + externalId: 'PROJ19099023DGHG789SDASDFGHR4567-1760447411369_IMPORTED', + categories: [ + { + _id: new ObjectId('685ae6a0cb7c7200145dadae'), + externalId: 'teachers', + name: 'teachers', + }, + ], + entityType: '', + taskCreationForm: '', + durationInDays: 365, + metaInformation: { + testimonials: [], + goal: 'TEMP', + rationale: '', + primaryAudience: '', + duration: '1 year', + successIndicators: '', + risks: '', + approaches: '', + }, + status: 'published', + tenantId: 'shikshalokam', + orgId: 'tan90', + updatedAt: new Date('2025-10-14T13:11:17.899Z'), + createdAt: new Date('2025-10-14T13:10:11.630Z'), + __v: 0, + solutionId: new ObjectId('68ee4bb3fb9bee08b93b6d68'), + solutionExternalId: 'PROJ19099023DGHG789SDASDFGHR4567-1760447411369-PROJECT-SOLUTION', + programId: new ObjectId('68ee4b79fb9bee08b93b6d34'), + programExternalId: 'Testing_for_prTGCEBGFFRYVBDFGJ7DGDGF12SDFGHJ345CVBNMDRGYY', + parentTemplateId: new ObjectId('68ee4bb3fb9bee08b93b6d4c'), + certificateTemplateId: new ObjectId('68ee4bf5fb9bee08b93b6d97'), + }, + { + _id: new ObjectId('68e8c635201642091e01491c'), + description: 'To construct a wired car using a DPDT switch.', + concepts: [''], + keywords: ['Science, Activity Based Learning, STEM Education, STEM Lab, DPDT Switch Car'], + isDeleted: false, + recommendedFor: ['Learner'], + tasks: [ + new ObjectId('68e8c635201642091e014926'), + new ObjectId('68e8c635201642091e01492a'), + new ObjectId('68e8c635201642091e01492e'), + new ObjectId('68e8c635201642091e014932'), + ], + createdBy: '1', + updatedBy: '1', + learningResources: [], + isReusable: false, + taskSequence: [ + 'DPDTSC-HandBook-1-2025-Task1-1760085557008-1760085557606', + 'DPDTSC-HandBook-1-2025-Task2-1760085557008', + 'DPDTSC-HandBook-1-2025-Task3-1760085557008', + 'DPDTSC-HandBook-1-2025-Task4-1760085557008', + 'DPDTSC-HandBook-1-2025-Task5-1760085557008', + ], + averageRating: 0, + noOfRatings: 0, + ratings: { + 1: 0, + 2: 0, + 3: 0, + 4: 0, + 5: 0, + }, + importCount: 0, + evidences: [], + isPrivate: false, + hasSpotlight: false, + hasStory: false, + text: [], + visibility: 'CURRENT', + visibleToOrganizations: ['tan90'], + deleted: false, + title: 'Testing Project For LED IMP facilitator only', + externalId: 'PROJ190909764HJHF123FGHHcvvbgd-1760085557008_IMPORTED', + categories: [ + { + _id: new ObjectId('685ae6a0cb7c7200145dadae'), + externalId: 'teachers', + name: 'teachers', + }, + ], + entityType: '', + taskCreationForm: '', + durationInDays: 365, + metaInformation: { + testimonials: [], + goal: 'TEMP', + rationale: '', + primaryAudience: '', + duration: '1 year', + successIndicators: '', + risks: '', + approaches: '', + }, + status: 'published', + tenantId: 'shikshalokam', + orgId: 'tan90', + updatedAt: new Date('2025-10-10T08:40:22.544Z'), + createdAt: new Date('2025-10-10T08:39:17.260Z'), + __v: 0, + solutionId: new ObjectId('68e8c635201642091e014914'), + solutionExternalId: 'PROJ190909764HJHF123FGHHcvvbgd-1760085557008-PROJECT-SOLUTION', + programId: new ObjectId('68e8c284201642091e0148c1'), + programExternalId: 'Testing_for_prTGCEBGFFRYVBDFGJ7DGDGF123456', + parentTemplateId: new ObjectId('68e8c635201642091e0148f8'), + certificateTemplateId: new ObjectId('68e8c676201642091e014943'), + }, + { + _id: new ObjectId('68c98d9538aee0086ee6109e'), + description: + 'Gathers insights from teachers regarding available resources, training needs, and challenges faced in classrooms.', + concepts: [''], + keywords: ['Science, Activity Based Learning, STEM Education, STEM Lab, DPDT Switch Car'], + isDeleted: false, + recommendedFor: [''], + tasks: [ + new ObjectId('68c98d9538aee0086ee610a2'), + new ObjectId('68c98d9538aee0086ee610a6'), + new ObjectId('68c98d9538aee0086ee610aa'), + ], + createdBy: '1', + updatedBy: '1', + learningResources: [], + isReusable: false, + taskSequence: [ + 'Task1-1758039445176', + 'Task2-1758039445176', + 'Task3-1758039445176', + 'Task4-1758039445176', + 'Task5-1758039445176', + ], + averageRating: 0, + noOfRatings: 0, + ratings: { + 1: 0, + 2: 0, + 3: 0, + 4: 0, + 5: 0, + }, + importCount: 0, + evidences: [], + isPrivate: false, + hasSpotlight: false, + hasStory: false, + text: [], + deleted: false, + title: 'Project name sep 16 9 30', + externalId: 'ProjectIdtestKey1-1758039445176_IMPORTED', + categories: [ + { + _id: new ObjectId('685ae6a0cb7c7200145dadae'), + externalId: 'teachers', + name: 'teachers', + }, + ], + entityType: '', + taskCreationForm: '', + durationInDays: 365, + metaInformation: { + testimonials: [], + goal: 'TEMP', + rationale: '', + primaryAudience: '', + duration: '1 year', + successIndicators: '', + risks: '', + approaches: '', + }, + status: 'published', + tenantId: 'shikshalokam', + orgId: 'tan90', + updatedAt: new Date('2025-09-16T16:17:25.596Z'), + createdAt: new Date('2025-09-16T16:17:25.301Z'), + __v: 0, + solutionId: new ObjectId('68c98d9538aee0086ee61096'), + solutionExternalId: 'ProjectIdtestKey1-1758039445176-PROJECT-SOLUTION', + programId: new ObjectId('68c98d8f38aee0086ee61070'), + programExternalId: 'ProgramTestKey1', + parentTemplateId: new ObjectId('68c98d9538aee0086ee6107a'), + }, + { + _id: new ObjectId('68d3b9a92ba17cc3cb238829'), + description: 'To construct a wired car using a DPDT switch.', + concepts: [''], + keywords: ['Science, Activity Based Learning, STEM Education, STEM Lab, DPDT Switch Car'], + isDeleted: false, + recommendedFor: ['Learner'], + tasks: [ + new ObjectId('68d3b9ad2ba17cc3cb238837'), + new ObjectId('68d3b9ad2ba17cc3cb23883b'), + new ObjectId('68d3b9ae2ba17cc3cb23883f'), + ], + createdBy: '1', + updatedBy: '1', + learningResources: [], + isReusable: false, + taskSequence: [ + 'DPDTSC-HandBook-1/2025-Task1-1758706081315-1758706089304', + 'DPDTSC-HandBook-1/2025-Task2-1758706081315', + 'DPDTSC-HandBook-1/2025-Task3-1758706081315', + 'DPDTSC-HandBook-1/2025-Task4-1758706081315', + 'DPDTSC-HandBook-1/2025-Task5-1758706081315', + ], + averageRating: 0, + noOfRatings: 0, + ratings: { + 1: 0, + 2: 0, + 3: 0, + 4: 0, + 5: 0, + }, + importCount: 0, + evidences: [], + isPrivate: false, + hasSpotlight: false, + hasStory: false, + text: [], + deleted: false, + title: 'project sup test with obs or sur tasks sep 23 1520', + externalId: 'DPDTSCH012025-1758706081315_IMPORTED', + categories: [ + { + _id: new ObjectId('685ae6a0cb7c7200145dadae'), + externalId: 'teachers', + name: 'teachers', + }, + ], + entityType: '', + taskCreationForm: '', + durationInDays: 365, + metaInformation: { + testimonials: [], + goal: 'TEMP', + rationale: '', + primaryAudience: '', + duration: '1 year', + successIndicators: '', + risks: '', + approaches: '', + }, + status: 'published', + tenantId: 'shikshalokam', + orgId: 'tan90', + updatedAt: new Date('2025-09-24T09:28:14.561Z'), + createdAt: new Date('2025-09-24T09:28:03.404Z'), + __v: 0, + solutionId: new ObjectId('68d3b9a72ba17cc3cb238821'), + solutionExternalId: 'DPDTSCH012025-1758706081315-PROJECT-SOLUTION', + programId: new ObjectId('68d3b9681e09f9b5b1e0693d'), + programExternalId: 'SUP_as_a_task_test_sept_24_1500', + parentTemplateId: new ObjectId('68d3b9a32ba17cc3cb238805'), + }, +] + +let projectTemplateTasksData = [ + { + _id: new ObjectId('68ee4bb4fb9bee08b93b6d7a'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [ + { + name: 'Activity Steps (Video)', + link: 'https://youtu.be/MNvM_H9zD3Y?si=BdfslSzCkmDCggih', + app: 'projectService', + id: 'MNvM_H9zD3Y?si=BdfslSzCkmDCggih', + }, + ], + deleted: false, + type: 'content', + projectTemplateId: new ObjectId('68ee4bb3fb9bee08b93b6d70'), + projectTemplateExternalId: 'PROJ19099023DGHG789SDASDFGHR4567-1760447411369_IMPORTED', + name: 'Watch the Activity Video', + externalId: 'DPDTSC-HandBook-1-2025-Task2-1760447411369-1760447412188', + description: '', + sequenceNumber: '2', + tenantId: 'shikshalokam', + orgId: 'tan90', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '01/08/2025', + endDate: '31/12/2025', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-10-14T13:10:12.192Z'), + createdAt: new Date('2025-10-14T13:10:11.805Z'), + __v: 0, + }, + { + _id: new ObjectId('68ee4bb4fb9bee08b93b6d7e'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [], + deleted: false, + type: 'simple', + projectTemplateId: new ObjectId('68ee4bb3fb9bee08b93b6d70'), + projectTemplateExternalId: 'PROJ19099023DGHG789SDASDFGHR4567-1760447411369_IMPORTED', + name: 'Conduct the Activity with students', + externalId: 'DPDTSC-HandBook-1-2025-Task3-1760447411369-1760447412197', + description: '', + sequenceNumber: '3', + tenantId: 'shikshalokam', + orgId: 'tan90', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '01/08/2025', + endDate: '31/12/2025', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-10-14T13:10:12.202Z'), + createdAt: new Date('2025-10-14T13:10:11.813Z'), + __v: 0, + }, + { + _id: new ObjectId('68ee4bb4fb9bee08b93b6d82'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [ + { + name: 'learn', + link: 'https://drive.google.com/file/d/1HOaFxlahxEzc5HOeFqVTw3V_yszmHFbZ/view?usp=drive_link', + app: 'projectService', + id: 'view?usp=drive_link', + }, + ], + deleted: false, + type: 'content', + projectTemplateId: new ObjectId('68ee4bb3fb9bee08b93b6d70'), + projectTemplateExternalId: 'PROJ19099023DGHG789SDASDFGHR4567-1760447411369_IMPORTED', + name: 'Conduct the Activity Assessment', + externalId: 'DPDTSC-HandBook-1-2025-Task4-1760447411369-1760447412206', + description: '', + sequenceNumber: '4', + tenantId: 'shikshalokam', + orgId: 'tan90', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '01/08/2025', + endDate: '31/12/2025', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-10-14T13:10:12.210Z'), + createdAt: new Date('2025-10-14T13:10:11.825Z'), + __v: 0, + }, + { + _id: new ObjectId('68ee4bb4fb9bee08b93b6d86'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [ + { + name: 'walking', + link: 'https://drive.google.com/file/d/1eGLKxFb9BaeroTeIOlXoO8XCxyah7fM9/view?usp=sharing', + app: 'projectService', + id: 'view?usp=sharing', + }, + ], + deleted: false, + type: 'content', + projectTemplateId: new ObjectId('68ee4bb3fb9bee08b93b6d70'), + projectTemplateExternalId: 'PROJ19099023DGHG789SDASDFGHR4567-1760447411369_IMPORTED', + name: "Log into the scanner app and scan the OMR sheets (check that the students' names are appearing on scanning the OMR)", + externalId: 'DPDTSC-HandBook-1-2025-Task5-1760447411369-1760447412214', + description: '', + sequenceNumber: '5', + tenantId: 'shikshalokam', + orgId: 'tan90', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '01/08/2025', + endDate: '31/12/2025', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-10-14T13:10:12.218Z'), + createdAt: new Date('2025-10-14T13:10:11.833Z'), + __v: 0, + }, + { + _id: new ObjectId('68e8c635201642091e014926'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [ + { + name: 'Activity Steps (Video)', + link: 'https://youtu.be/MNvM_H9zD3Y?si=BdfslSzCkmDCggih', + app: 'projectService', + id: 'MNvM_H9zD3Y?si=BdfslSzCkmDCggih', + }, + ], + deleted: false, + type: 'content', + projectTemplateId: new ObjectId('68e8c635201642091e01491c'), + projectTemplateExternalId: 'PROJ190909764HJHF123FGHHcvvbgd-1760085557008_IMPORTED', + name: 'Watch the Activity Video', + externalId: 'DPDTSC-HandBook-1-2025-Task2-1760085557008-1760085557809', + description: '', + sequenceNumber: '2', + tenantId: 'shikshalokam', + orgId: 'tan90', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '01/08/2026', + endDate: '31/12/2026', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-10-10T08:39:17.813Z'), + createdAt: new Date('2025-10-10T08:39:17.430Z'), + __v: 0, + }, + { + _id: new ObjectId('68e8c635201642091e01492a'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [], + deleted: false, + type: 'simple', + projectTemplateId: new ObjectId('68e8c635201642091e01491c'), + projectTemplateExternalId: 'PROJ190909764HJHF123FGHHcvvbgd-1760085557008_IMPORTED', + name: 'Conduct the Activity with students', + externalId: 'DPDTSC-HandBook-1-2025-Task3-1760085557008-1760085557818', + description: '', + sequenceNumber: '3', + tenantId: 'shikshalokam', + orgId: 'tan90', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '01/08/2027', + endDate: '31/12/2027', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-10-10T08:39:17.822Z'), + createdAt: new Date('2025-10-10T08:39:17.439Z'), + __v: 0, + }, + { + _id: new ObjectId('68e8c635201642091e01492e'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [ + { + name: 'learn', + link: 'https://drive.google.com/file/d/1HOaFxlahxEzc5HOeFqVTw3V_yszmHFbZ/view?usp=drive_link', + app: 'projectService', + id: 'view?usp=drive_link', + }, + ], + deleted: false, + type: 'content', + projectTemplateId: new ObjectId('68e8c635201642091e01491c'), + projectTemplateExternalId: 'PROJ190909764HJHF123FGHHcvvbgd-1760085557008_IMPORTED', + name: 'Conduct the Activity Assessment', + externalId: 'DPDTSC-HandBook-1-2025-Task4-1760085557008-1760085557827', + description: '', + sequenceNumber: '4', + tenantId: 'shikshalokam', + orgId: 'tan90', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '01/08/2028', + endDate: '31/12/2028', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-10-10T08:39:17.831Z'), + createdAt: new Date('2025-10-10T08:39:17.449Z'), + __v: 0, + }, + { + _id: new ObjectId('68e8c635201642091e014932'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [ + { + name: 'walking', + link: 'https://drive.google.com/file/d/1eGLKxFb9BaeroTeIOlXoO8XCxyah7fM9/view?usp=sharing', + app: 'projectService', + id: 'view?usp=sharing', + }, + ], + deleted: false, + type: 'content', + projectTemplateId: new ObjectId('68e8c635201642091e01491c'), + projectTemplateExternalId: 'PROJ190909764HJHF123FGHHcvvbgd-1760085557008_IMPORTED', + name: "Log into the scanner app and scan the OMR sheets (check that the students' names are appearing on scanning the OMR)", + externalId: 'DPDTSC-HandBook-1-2025-Task5-1760085557008-1760085557835', + description: '', + sequenceNumber: '5', + tenantId: 'shikshalokam', + orgId: 'tan90', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '01/08/2029', + endDate: '31/12/2029', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-10-10T08:39:17.840Z'), + createdAt: new Date('2025-10-10T08:39:17.458Z'), + __v: 0, + }, + { + _id: new ObjectId('68c98d9538aee0086ee610a2'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [ + { + name: 'Activity Manual (PDF)', + link: 'https://docs.google.com/document/d/1NCUdj9nPAz82sPV5q2BJ8At31sFJdSDwocrDCh_g7W0/edit?tab=t.0', + app: 'projectService', + id: 'edit?tab=t.0', + }, + ], + deleted: false, + type: 'content', + projectTemplateId: new ObjectId('68c98d9538aee0086ee6109e'), + projectTemplateExternalId: 'ProjectIdtestKey1-1758039445176_IMPORTED', + name: 'Review the Activity Manual', + externalId: 'Task1-1758039445176-1758039445561', + description: '', + sequenceNumber: '1', + tenantId: 'shikshalokam', + orgId: 'tan90', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '28/07/2025', + endDate: '30/01/2026', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-09-16T16:17:25.564Z'), + createdAt: new Date('2025-09-16T16:17:25.375Z'), + __v: 0, + }, + { + _id: new ObjectId('68c98d9538aee0086ee610a6'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [ + { + name: 'Activity Steps (Video)', + link: 'https://youtu.be/MNvM_H9zD3Y?si=BdfslSzCkmDCggih', + app: 'projectService', + id: 'MNvM_H9zD3Y?si=BdfslSzCkmDCggih', + }, + ], + deleted: false, + type: 'content', + projectTemplateId: new ObjectId('68c98d9538aee0086ee6109e'), + projectTemplateExternalId: 'ProjectIdtestKey1-1758039445176_IMPORTED', + name: 'Watch the Activity Video', + externalId: 'Task2-1758039445176-1758039445567', + description: '', + sequenceNumber: '2', + tenantId: 'shikshalokam', + orgId: 'tan90', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '29/07/2025', + endDate: '30/01/2027', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-09-16T16:17:25.571Z'), + createdAt: new Date('2025-09-16T16:17:25.386Z'), + __v: 0, + }, + { + _id: new ObjectId('68c98d9538aee0086ee610aa'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [], + deleted: false, + type: 'simple', + projectTemplateId: new ObjectId('68c98d9538aee0086ee6109e'), + projectTemplateExternalId: 'ProjectIdtestKey1-1758039445176_IMPORTED', + name: 'Conduct the Activity with students', + externalId: 'Task3-1758039445176-1758039445575', + description: '', + sequenceNumber: '3', + tenantId: 'shikshalokam', + orgId: 'tan90', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '30/07/2025', + endDate: '30/01/2028', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-09-16T16:17:25.579Z'), + createdAt: new Date('2025-09-16T16:17:25.396Z'), + __v: 0, + }, + { + _id: new ObjectId('68d3b9ad2ba17cc3cb238837'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [], + deleted: false, + type: 'simple', + projectTemplateId: new ObjectId('68d3b9a92ba17cc3cb238829'), + projectTemplateExternalId: 'DPDTSCH012025-1758706081315_IMPORTED', + name: 'Conduct the Activity with students', + externalId: 'DPDTSC-HandBook-1/2025-Task3-1758706081315-1758706093343', + description: '', + sequenceNumber: '3', + tenantId: 'shikshalokam', + orgId: 'tan90', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '30/07/2025', + endDate: '30/12/2025', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-09-24T09:28:13.534Z'), + createdAt: new Date('2025-09-24T09:28:06.227Z'), + __v: 0, + }, + { + _id: new ObjectId('68d3b9ad2ba17cc3cb23883b'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [ + { + name: 'Activity Assessment (PDF)', + link: 'https://sunbirdsaaspublic.blob.core.windows.net/content/content/assets/do_2143687931908833281255/dpdt-switch-car.pdf', + app: 'projectService', + id: 'dpdt-switch-car.pdf', + }, + { + name: 'Activity OMR Sheet (PDF)', + link: 'https://drive.google.com/file/d/1-f7Tg8bmZd-xlcxlhfOcf2ZO6vpc6qkH/view', + app: 'projectService', + id: 'view', + }, + ], + deleted: false, + type: 'content', + projectTemplateId: new ObjectId('68d3b9a92ba17cc3cb238829'), + projectTemplateExternalId: 'DPDTSCH012025-1758706081315_IMPORTED', + name: 'Conduct the Activity Assessment', + externalId: 'DPDTSC-HandBook-1/2025-Task4-1758706081315-1758706093849', + description: '', + sequenceNumber: '4', + tenantId: 'shikshalokam', + orgId: 'tan90', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '30/07/2025', + endDate: '30/12/2025', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-09-24T09:28:13.967Z'), + createdAt: new Date('2025-09-24T09:28:06.583Z'), + __v: 0, + }, + { + _id: new ObjectId('68d3b9ae2ba17cc3cb23883f'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [], + deleted: false, + type: 'simple', + projectTemplateId: new ObjectId('68d3b9a92ba17cc3cb238829'), + projectTemplateExternalId: 'DPDTSCH012025-1758706081315_IMPORTED', + name: "Log into the scanner app and scan the OMR sheets (check that the students' names are appearing on scanning the OMR)", + externalId: 'DPDTSC-HandBook-1/2025-Task5-1758706081315-1758706094241', + description: '', + sequenceNumber: '5', + tenantId: 'shikshalokam', + orgId: 'tan90', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '30/07/2025', + endDate: '30/12/2025', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-09-24T09:28:14.374Z'), + createdAt: new Date('2025-09-24T09:28:07.083Z'), + __v: 0, + }, +] + +let certificateTemplatesData = [ + { + _id: new ObjectId('68ee4bf5fb9bee08b93b6d97'), + status: 'active', + deleted: false, + criteria: { + validationText: 'Complete validation message', + expression: 'C1&&(C3||C4||C5||C6)', + conditions: { + C1: { + validationText: 'Submit your project.', + expression: 'C1', + conditions: { + C1: { + scope: 'project', + key: 'status', + operator: '==', + value: 'submitted', + }, + }, + }, + C3: { + expression: 'C1', + conditions: { + C1: { + scope: 'task', + key: 'attachments', + function: 'count', + filter: { + key: 'type', + value: 'all', + }, + operator: '>=', + value: 2, + taskDetails: ['68ee4bb3fb9bee08b93b6d53'], + }, + }, + validationText: 'Add 2 evidence for any task', + }, + C4: { + expression: 'C1', + conditions: { + C1: { + scope: 'task', + key: 'attachments', + function: 'count', + filter: { + key: 'type', + value: 'all', + }, + operator: '>=', + value: 2, + taskDetails: ['68ee4bb3fb9bee08b93b6d57'], + }, + }, + }, + C5: { + expression: 'C1', + conditions: { + C1: { + scope: 'task', + key: 'attachments', + function: 'count', + filter: { + key: 'type', + value: 'all', + }, + operator: '>=', + value: 2, + taskDetails: ['68ee4bb3fb9bee08b93b6d5b'], + }, + }, + }, + C6: { + expression: 'C1', + conditions: { + C1: { + scope: 'task', + key: 'attachments', + function: 'count', + filter: { + key: 'type', + value: 'all', + }, + operator: '>=', + value: 2, + taskDetails: ['68ee4bb3fb9bee08b93b6d63'], + }, + }, + }, + }, + }, + issuer: { + name: 'Tan90', + }, + solutionId: new ObjectId('68ee4bb3fb9bee08b93b6d68'), + programId: new ObjectId('68ee4b79fb9bee08b93b6d34'), + baseTemplateId: new ObjectId('68c008dfd113c30c11f1aca2'), + tenantId: 'shikshalokam', + orgId: 'tan90', + updatedAt: new Date('2025-10-14T13:11:17.793Z'), + createdAt: new Date('2025-10-14T13:11:17.628Z'), + __v: 0, + templateUrl: + 'certificate/aa8529e3-6754-4432-a669-72b73d358e2f/1/7042c718-a1bf-43e3-b296-586de247a440/68ee4bf5fb9bee08b93b6d97/14-9-2025-1760447477692_Dowloaded.svg', + }, + { + _id: new ObjectId('68e8c676201642091e014943'), + status: 'active', + deleted: false, + criteria: { + validationText: 'Complete validation message', + expression: 'C1&&(C3||C4||C5||C6||C7)', + conditions: { + C1: { + validationText: 'Submit your project.', + expression: 'C1', + conditions: { + C1: { + scope: 'project', + key: 'status', + operator: '==', + value: 'submitted', + }, + }, + }, + C3: { + expression: 'C1', + conditions: { + C1: { + scope: 'task', + key: 'attachments', + function: 'count', + filter: { + key: 'type', + value: 'all', + }, + operator: '>=', + value: 2, + taskDetails: ['68e8c635201642091e0148ff'], + }, + }, + validationText: 'Add 2 evidence for any task', + }, + C4: { + expression: 'C1', + conditions: { + C1: { + scope: 'task', + key: 'attachments', + function: 'count', + filter: { + key: 'type', + value: 'all', + }, + operator: '>=', + value: 2, + taskDetails: ['68e8c635201642091e014903'], + }, + }, + }, + C5: { + expression: 'C1', + conditions: { + C1: { + scope: 'task', + key: 'attachments', + function: 'count', + filter: { + key: 'type', + value: 'all', + }, + operator: '>=', + value: 2, + taskDetails: ['68e8c635201642091e014907'], + }, + }, + }, + C6: { + expression: 'C1', + conditions: { + C1: { + scope: 'task', + key: 'attachments', + function: 'count', + filter: { + key: 'type', + value: 'all', + }, + operator: '>=', + value: 2, + taskDetails: ['68e8c635201642091e01490b'], + }, + }, + }, + C7: { + expression: 'C1', + conditions: { + C1: { + scope: 'task', + key: 'attachments', + function: 'count', + filter: { + key: 'type', + value: 'all', + }, + operator: '>=', + value: 2, + taskDetails: ['68e8c635201642091e01490f'], + }, + }, + }, + }, + }, + issuer: { + name: 'Tan90', + }, + solutionId: new ObjectId('68e8c635201642091e014914'), + programId: new ObjectId('68e8c284201642091e0148c1'), + baseTemplateId: new ObjectId('68c008dfd113c30c11f1aca2'), + tenantId: 'shikshalokam', + orgId: 'tan90', + updatedAt: new Date('2025-10-10T08:40:22.454Z'), + createdAt: new Date('2025-10-10T08:40:22.298Z'), + __v: 0, + templateUrl: + 'certificate/0bcc856d-0145-448c-8188-300ca3f3250e/1/58cfdf3c-f1a2-4a94-bbb5-21dcd7286913/68e8c676201642091e014943/10-9-2025-1760085622353_Dowloaded.svg', + }, +] + +let certificateBaseTemplatesData = [ + { + _id: new ObjectId('68c008dfd113c30c11f1aca2'), + deleted: false, + code: 'onelogo_onesign', + name: 'onelogo_onesign', + url: 'certificate/ef2058a1-92e0-4a63-af5f-b712f992bf90/1/81fc35ad-9519-4ec4-87bb-6cef64b940f0/9-8-2025-1757415647754_sl_s1l1.svg', + tenantId: 'shikshalokam', + orgId: 'slorg', + updatedAt: new Date('2025-09-09T11:00:47.878Z'), + createdAt: new Date('2025-09-09T11:00:47.878Z'), + __v: 0, + }, +] + +let projectCategoriesData = [ + { + _id: new ObjectId('685ae6a0cb7c7200145dadae'), + createdBy: 'SYSTEM', + updatedBy: 'SYSTEM', + isDeleted: false, + isVisible: true, + status: 'active', + icon: '', + noOfProjects: 361, + evidences: [], + deleted: false, + name: 'teachers', + externalId: 'teachers', + tenantId: 'shikshalokam', + orgId: 'slorg', + updatedAt: new Date('2025-06-24T17:55:44.720Z'), + createdAt: new Date('2025-06-24T17:55:44.720Z'), + __v: 0, + }, +] +module.exports = { + solutionData, + programData, + projectTemplatesData, + projectTemplateTasksData, + certificateTemplatesData, + certificateBaseTemplatesData, + projectCategoriesData, +} diff --git a/documentation/3.4.0/setup/docker/scp/ubuntu/README.md b/documentation/3.4.0/setup/docker/scp/ubuntu/README.md index a42c35f8..00adbb1c 100644 --- a/documentation/3.4.0/setup/docker/scp/ubuntu/README.md +++ b/documentation/3.4.0/setup/docker/scp/ubuntu/README.md @@ -22,16 +22,10 @@ The Project building block facilitates the creation and engagement with micro-im
-# Supported Operating Systems +## Supported Operating Systems - **Ubuntu (Recommended: Version 20 and above)** -# Setup Options - -> Note : This guide outlines two setup methods, detailed below. For a quick, beginner-friendly setup and walkthrough of services, it is recommended to use the Dockerized Services & Dependencies setup with the Docker- - - Compose file. - ## Dockerized Services & Dependencies Expectation: By diligently following the outlined steps, you will successfully establish a fully operational Project application setup, including both the portal and backend services. From 4554df8f26651ea48e0febb91926b53d2e68a6d9 Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Thu, 27 Nov 2025 16:07:50 +0530 Subject: [PATCH 08/63] added scp env --- .../3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/documentation/3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh b/documentation/3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh index 1884caa8..aedc319b 100644 --- a/documentation/3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh +++ b/documentation/3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh @@ -19,6 +19,7 @@ curl -L \ -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/envs/notification_env \ -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/envs/scheduler_env \ -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/envs/user_env \ + -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/envs/survey_project_creation_env \ -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/envs/env.js log "Environment files downloaded." From b1a9238652b5108bbf6f6e913804ff8b202b9a38 Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Thu, 27 Nov 2025 16:15:15 +0530 Subject: [PATCH 09/63] Update setup_project.sh to create survey-project-creation directory and download SQL file --- .../dockerized/scripts/scp/ubuntu/setup_project.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/documentation/3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh b/documentation/3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh index aedc319b..4aee6b49 100644 --- a/documentation/3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh +++ b/documentation/3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh @@ -55,12 +55,17 @@ log "Creating user directory and downloading distributionColumns.sql..." mkdir -p user && curl -o ./user/distributionColumns.sql -JL https://github.com/ELEVATE-Project/project-service/raw/refs/heads/setupGuideSCP/documentation/3.4.0/distribution-columns/user/distributionColumns.sql log "User directory created and distributionColumns.sql downloaded." -# Step 9: Download and make citus_setup.sh executable +# Step 9: Create survey-project-creation directory and download SQL file +log "Creating survey-project-creation directory and downloading distributionColumns.sql..." +mkdir -p survey-project-creation && curl -o ./survey-project-creation/distributionColumns.sql -JL https://github.com/ELEVATE-Project/project-service/raw/refs/heads/setupGuideSCP/documentation/3.4.0/distribution-columns/survey-project-creation/distributionColumns.sql +log "survey-project-creation directory created and distributionColumns.sql downloaded." + +# Step 10: Download and make citus_setup.sh executable log "Downloading citus_setup.sh..." curl -OJL https://github.com/ELEVATE-Project/project-service/raw/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/scripts/mac-linux/citus_setup.sh chmod +x citus_setup.sh -# Step 10: Create sample-data directory and download SQL file +# Step 11: Create sample-data directory and download SQL file log "Creating sample-data directory and downloading sampleData.sql..." mkdir -p sample-data/user && \ curl -L https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/sample-data/mac-linux/user/sampleData.sql -o sample-data/user/sampleData.sql @@ -73,7 +78,7 @@ npm install mongodb # Install Mongoose (Object Data Modeling library, if the scripts use it) npm install mongoose -# Step 11: Download additional scripts to add data +# Step 12: Download additional scripts to add data log "Downloading sample data scripts..." curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/entity_sampleData.js curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/project_sampleData.js @@ -86,7 +91,7 @@ log "Downloading config.json file..." curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/config.json log "config.json file is downloaded." -# Step 13: Run docker-compose-up.sh script +# Step 14: Run docker-compose-up.sh script log "Running docker-compose-up.sh script..." ./docker-compose-up.sh log "docker-compose-up.sh script executed." From 5742ebcce2f775ae952848a4b7e925b3b2fa82a2 Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Thu, 27 Nov 2025 16:33:54 +0530 Subject: [PATCH 10/63] Add cloning of survey-project-creation-service repository in setup_project.sh --- .../3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/documentation/3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh b/documentation/3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh index 4aee6b49..250e1ae3 100644 --- a/documentation/3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh +++ b/documentation/3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh @@ -91,6 +91,10 @@ log "Downloading config.json file..." curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/config.json log "config.json file is downloaded." +log "Cloning survey-project-creation-service repository..." +git clone -b release-1.0.0 https://github.com/ELEVATE-Project/survey-project-creation-service.git +log "survey-project-creation-service repository cloned." + # Step 14: Run docker-compose-up.sh script log "Running docker-compose-up.sh script..." ./docker-compose-up.sh From fdc86e465953705b44e3071350f7f93aacfb5acd Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Thu, 27 Nov 2025 16:52:10 +0530 Subject: [PATCH 11/63] Update README.md to include port 27017 in the availability check --- documentation/3.4.0/setup/docker/scp/ubuntu/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/3.4.0/setup/docker/scp/ubuntu/README.md b/documentation/3.4.0/setup/docker/scp/ubuntu/README.md index 00adbb1c..cc4ca719 100644 --- a/documentation/3.4.0/setup/docker/scp/ubuntu/README.md +++ b/documentation/3.4.0/setup/docker/scp/ubuntu/README.md @@ -47,7 +47,7 @@ To set up the Project application, ensure you have Docker and Docker Compose ins > **Caution:** Before proceeding, please ensure that the ports given here are available and open. It is essential to verify their availability prior to moving forward. You can run below command in your terminal to check this ``` -for port in 3000 3001 3002 6000 5001 4000 9092 5432 7007 2181 2707 3569 6001; do +for port in 3000 3001 3002 6000 5001 4000 9092 5432 7007 2181 2707 3569 6001 27017; do if lsof -iTCP:$port -sTCP:LISTEN &>/dev/null; then echo "Port $port is in use" else From 99511b35a73f46b026ed3be1688246130d07002d Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Thu, 27 Nov 2025 17:01:59 +0530 Subject: [PATCH 12/63] Fix command syntax in user service startup script in docker-compose --- .../3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml b/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml index 13cb88cc..8a36a0e0 100644 --- a/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml +++ b/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml @@ -87,7 +87,7 @@ services: (while ! curl -sSf http://user:3001 > /dev/null; do sleep 1; done && echo 'Service is up' && - /bin/bash -c 'cd scripts && echo Running user service scripts && node insertDefaultOrg.js && node viewsScript.js && node -r module-alias/register uploadSampleCSV.js'); + /bin/bash -c 'cd scripts && echo Running user service scripts && node insertDefaultOrg.js && node -r module-alias/register uploadSampleCSV.js'); tail -f /dev/null" depends_on: - kafka From a916a1ba0fd59d64bf4603365c9a00ba1196c0d8 Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Thu, 27 Nov 2025 17:09:34 +0530 Subject: [PATCH 13/63] Enhance Kafka readiness check in survey-project-creation service startup command --- .../dockerFiles/scp/docker-compose-project.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml b/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml index 8a36a0e0..9a291bce 100644 --- a/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml +++ b/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml @@ -229,13 +229,23 @@ services: ports: - '6001:6001' command: > - bash -c "cp /var/src/config.sample.json /var/src/config.json 2>/dev/null || true && nodemon app.js" + bash -c "cp /var/src/config.sample.json /var/src/config.json 2>/dev/null || true && + echo 'Waiting for Kafka to be ready...' && + while ! timeout 1 bash -c 'cat < /dev/null > /dev/tcp/kafka/9092' 2> /dev/null; do + echo 'Waiting for Kafka...'; + sleep 2; + done; + echo 'Kafka is ready.' && + nodemon app.js" env_file: - ./survey_project_creation_env depends_on: - - kafka - - citus - - redis + kafka: + condition: service_healthy + citus: + condition: service_started + redis: + condition: service_healthy networks: - project_net networks: From 40b86abdadf1fa58ccc99bc72665afc41302fe2e Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Thu, 27 Nov 2025 17:15:39 +0530 Subject: [PATCH 14/63] Add environment variables and volume for survey-project-creation-service in docker-compose --- .../dockerized/dockerFiles/scp/docker-compose-project.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml b/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml index 9a291bce..cd127de6 100644 --- a/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml +++ b/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml @@ -237,6 +237,10 @@ services: done; echo 'Kafka is ready.' && nodemon app.js" + environment: + - KAFKA_URL=kafka:9092 + - DEV_DATABASE_URL=postgres://postgres:postgres@citus_master:5432/scp + - REDIS_HOST=redis://redis:6379 env_file: - ./survey_project_creation_env depends_on: @@ -246,6 +250,8 @@ services: condition: service_started redis: condition: service_healthy + volumes: + - ./survey-project-creation-service/src/:/var/src networks: - project_net networks: From e7883764a687f555094c3461cffb9a97b18b4d9b Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Tue, 2 Dec 2025 16:22:48 +0530 Subject: [PATCH 15/63] Add environment configuration files and setup scripts for ELEVATE-Project - Created `survey_project_creation_env` and `user_env` for environment variables. - Added dependency check script `check-dependencies.sh` to verify required services. - Implemented installation script `install-dependencies.sh` for setting up Node.js, Kafka, Redis, Citus, MongoDB, and Gotenberg. - Developed uninstallation script `uninstall-dependencies.sh` for removing installed services. - Included database creation script `create-databases.sh` for setting up PostgreSQL databases. - Added configuration files `configProject.json` and `configSCP.json` for user authentication. - Documented the setup process in `README.md` for clarity on installation and configuration steps. --- .../3.4.0/native/envs/scp/elevate_portal_env | 48 +++ .../native/envs/scp/entity_management_env | 23 ++ .../3.4.0/native/envs/scp/interface_env | 26 ++ .../3.4.0/native/envs/scp/notification_env | 14 + .../native/envs/scp/observation_portal_env | 4 + .../scp/observation_survey_projects_pwa_env | 18 + .../3.4.0/native/envs/scp/project_env | 47 +++ .../3.4.0/native/envs/scp/scheduler_env | 13 + .../envs/scp/survey_project_creation_env | 91 +++++ documentation/3.4.0/native/envs/scp/user_env | 81 +++++ .../scripts/scp/ubuntu/check-dependencies.sh | 139 ++++++++ .../scripts/scp/ubuntu/configProject.json | 11 + .../native/scripts/scp/ubuntu/configSCP.json | 11 + .../scripts/scp/ubuntu/create-databases.sh | 16 + .../scp/ubuntu/install-dependencies.sh | 206 +++++++++++ .../scp/ubuntu/uninstall-dependencies.sh | 131 +++++++ .../3.4.0/setup/native/scp/ubuntu/README.md | 334 ++++++++++++++++++ 17 files changed, 1213 insertions(+) create mode 100644 documentation/3.4.0/native/envs/scp/elevate_portal_env create mode 100644 documentation/3.4.0/native/envs/scp/entity_management_env create mode 100644 documentation/3.4.0/native/envs/scp/interface_env create mode 100644 documentation/3.4.0/native/envs/scp/notification_env create mode 100644 documentation/3.4.0/native/envs/scp/observation_portal_env create mode 100644 documentation/3.4.0/native/envs/scp/observation_survey_projects_pwa_env create mode 100644 documentation/3.4.0/native/envs/scp/project_env create mode 100644 documentation/3.4.0/native/envs/scp/scheduler_env create mode 100644 documentation/3.4.0/native/envs/scp/survey_project_creation_env create mode 100644 documentation/3.4.0/native/envs/scp/user_env create mode 100644 documentation/3.4.0/native/scripts/scp/ubuntu/check-dependencies.sh create mode 100644 documentation/3.4.0/native/scripts/scp/ubuntu/configProject.json create mode 100644 documentation/3.4.0/native/scripts/scp/ubuntu/configSCP.json create mode 100644 documentation/3.4.0/native/scripts/scp/ubuntu/create-databases.sh create mode 100644 documentation/3.4.0/native/scripts/scp/ubuntu/install-dependencies.sh create mode 100644 documentation/3.4.0/native/scripts/scp/ubuntu/uninstall-dependencies.sh create mode 100644 documentation/3.4.0/setup/native/scp/ubuntu/README.md diff --git a/documentation/3.4.0/native/envs/scp/elevate_portal_env b/documentation/3.4.0/native/envs/scp/elevate_portal_env new file mode 100644 index 00000000..14b3959f --- /dev/null +++ b/documentation/3.4.0/native/envs/scp/elevate_portal_env @@ -0,0 +1,48 @@ +AUTH_API_TOKEN= "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJPc3NtSUhXaW1NMDN2MUxsVnFvNHBqaS0ydEMwTGhLY0o5dmtwQTlJZV9zIn0.eyJleHAiOjE3MzI4NjE5ODcsImlhdCI6MTczMjc3NTU4NywianRpIjoiOTM5NWM4N2QtOTliYy00YTRkLWIyNTUtNDQ4NjFhYTBjYWE2IiwiaXNzIjoiaHR0cHM6Ly9xYS5wcmF0aGFtdGVhY2hlcmFwcC50ZWtkaW5leHQuY29tL2F1dGgvcmVhbG1zL3ByYXRoYW0iLCJhdWQiOiJhY2NvdW50Iiwic3ViIjoiY2IwN2RlNjItZWM0Yy00YmRlLWI5YjYtOWIwZjM3OWMwMTExIiwidHlwIjoiQmVhcmVyIiwiYXpwIjoicHJhdGhhbSIsInNlc3Npb25fc3RhdGUiOiI2MzQ0ZWZjNS05NmUwLTQyNzYtYjViYi1hNTcyMGI0YzVmYjkiLCJhY3IiOiIxIiwiYWxsb3dlZC1vcmlnaW5zIjpbIi8qIl0sInJlYWxtX2FjY2VzcyI6eyJyb2xlcyI6WyJvZmZsaW5lX2FjY2VzcyIsInVtYV9hdXRob3JpemF0aW9uIiwiZGVmYXVsdC1yb2xlcy1wcmF0aGFtIl19LCJyZXNvdXJjZV9hY2Nlc3MiOnsiYWNjb3VudCI6eyJyb2xlcyI6WyJtYW5hZ2UtYWNjb3VudCIsIm1hbmFnZS1hY2NvdW50LWxpbmtzIiwidmlldy1wcm9maWxlIl19fSwic2NvcGUiOiJlbWFpbCBwcm9maWxlIiwic2lkIjoiNjM0NGVmYzUtOTZlMC00Mjc2LWI1YmItYTU3MjBiNGM1ZmI5IiwiZW1haWxfdmVyaWZpZWQiOmZhbHNlLCJuYW1lIjoiUmFqbmlzaCIsInByZWZlcnJlZF91c2VybmFtZSI6InJham5pc2g5ODc2MSIsImdpdmVuX25hbWUiOiJSYWpuaXNoIiwiZmFtaWx5X25hbWUiOiIifQ.OpTwdzG8sWhVK_VY6iAYy1klR2cfSLn2gYCqgnu9FJi4zTjPY-B0d8F--cEPVGZ4HdJiSZnGvfOgalICPKxthG-HfYR-cwznGWJVfte4HsvL5UbteOq5KDT3lsyzUkScgQ0bTKztSsePdhU2ctAGXv52DtPK8u7xWkKD6GYDeQCIHJlFS2JgR9v50d6Mva-stvtDRS7LEFgoes1hKQ0_k_C-5g1w7Rh084XJQC7tPmczap_Q-RqI-jkJZvUl_cAJK6NppZArSFA0AePkY-0_pZKBx82nBJbho2IETMIa7KzvnhdRCtjP0ynoTY-YJ4eL3jYhmIJ5DzWj3FpOZkrpSw" +AWS_ACCESS_KEY_ID= "AWS_ACCESS_KEY_ID" +AWS_ACCESS_SECRET_KEY= "AWS_ACCESS_SECRET_KEY" +AWS_BUCKET_NAME= "qa-knowlg-inquiry" +AWS_REGION= "ap-south-1" +BASE_URL= "https://qa-middleware.tekdinext.com" +NEXT_API_BASE_URL= "https://middleware.prathamdigital.org" +NEXT_PRIVATE_LOCAL_WEBPACK= "true" +NEXT_PUBLIC_AUTH= "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiI5dndaeklzS3U0ZzRjSWxoZnE1MWQ2SlR1d0w4dktlZCJ9.4jPaZhi9dHMzqqoZAZvfD5t5QPAVAuWOr9SDf1apZb8" +NEXT_PUBLIC_BASE_URL= "https://dev.elevate-apis.shikshalokam.org" +NEXT_PUBLIC_BASE_URL_ENTITY= "https://shiksha-dev-interface.tekdinext.com/entity-management" +NEXT_PUBLIC_BASE_URL_READ= "https://saas-dev-interface.tekdinext.com" +NEXT_PUBLIC_BASE_URL_SCHEMA= "https://qa-interface.prathamdigital.org" +NEXT_PUBLIC_CHANNEL_ID= "scp-channel" +NEXT_PUBLIC_CLIENT_ID= "implementation" +NEXT_PUBLIC_CLIENT_SECRET= "3e92df83-a773-4e3e-89c6-3a9afe81211a" +NEXT_PUBLIC_CLOUD_STORAGE_URL= "https://qa-knowlg-inquiry.s3-ap-south-1.amazonaws.com/" +NEXT_PUBLIC_CONTENT= "http://localhost:8000/shikshalokam/content" +NEXT_PUBLIC_CONTENT_FRAMEWORK_ID= "level1arning-framework" +NEXT_PUBLIC_DELETE_USER= "/api/user/v1/block" +NEXT_PUBLIC_FORGOT_PASSWORD= "https://dev.sunbirdsaas.com/recover/identify/account" +NEXT_PUBLIC_FRAMEWORK_ID= "shiksha-fw" +NEXT_PUBLIC_GENRATE_OTP= "/api/otp/v2/generate" +NEXT_PUBLIC_GRANT_TYPE= "password" +NEXT_PUBLIC_LOCATION_SEARCH= "/api/data/v1/location/search" +NEXT_PUBLIC_LOGINPAGE= "https://dev.elevate-apis.shikshalokam.org/" +NEXT_PUBLIC_LOGIN_PATH= "/auth/realms/sunbird/protocol/openid-connect/token" +NEXT_PUBLIC_NEW_REGISTRATION= "/interface/v1/account/create" +NEXT_PUBLIC_ORGID= "1" +NEXT_PUBLIC_PROGRAM_BASE_URL= "https://dev.elevate-sandbox.shikshalokam.org" +NEXT_PUBLIC_PWA= "http://localhost:8000/shikshalokam/pwa" +NEXT_PUBLIC_READ_USER= "/api/user/v1/search" +NEXT_PUBLIC_REGISTRATION= "http://localhost:8000/shikshalokam/registration/newUser" +NEXT_PUBLIC_SEARCH_LOCATION= "/interface/v1/user/locations/search" +NEXT_PUBLIC_SEND_OTP= "/api/otp/v1/generate" +NEXT_PUBLIC_SHIKSHAGRAHA_BASEPATH= "/shikshalokam" +NEXT_PUBLIC_SSUNBIRD_BASE_URL= "https://saas-qa.tekdinext.com/interface/v1" +NEXT_PUBLIC_SSUNBIRD_HIERARCHY_PATH= "/api/course/v1/" +NEXT_PUBLIC_TELEMETRY_URL= "https://qa.prathamteacherapp.tekdinext.com/telemetry" +NEXT_PUBLIC_TENANT_ID= "ef99949b-7f3a-4a5f-806a-e67e683e38f3" +NEXT_PUBLIC_TRACKING_BASE_URL= "https://shiksha2-dev.tekdinext.com/tracking" +NEXT_PUBLIC_UPDATE_USER= "/api/framework/v1/update" +NEXT_PUBLIC_VERIFT_OTP= "/api/otp/v2/verify" +NEXT_PUBLIC_VERIFY_OTP= "/api/otp/v1/verify" +created_time= "2025-06-18T08:50:04.71092372Z" +custom_metadata= "null" +destroyed= "false" +version= "5" \ No newline at end of file diff --git a/documentation/3.4.0/native/envs/scp/entity_management_env b/documentation/3.4.0/native/envs/scp/entity_management_env new file mode 100644 index 00000000..c8b99600 --- /dev/null +++ b/documentation/3.4.0/native/envs/scp/entity_management_env @@ -0,0 +1,23 @@ +APPLICATION_PORT = 5001 +APPLICATION_ENV ="development" +APPLICATION_BASE_URL='/entity-management/' +INTERNAL_ACCESS_TOKEN =xahusub12yexlashsbxAXADHBlaj +ACCESS_TOKEN_SECRET=bsj82AHBxahusub12yexlashsbxAXADHBlaj +MONGODB_URL=mongodb://localhost:27017/elevate-entity +AUTH_METHOD = native +USER_SERVICE_URL = http://localhost:3569 +USER_SERVICE_BASE_URL=/user +KAFKA_HEALTH_CHECK_TOPIC=test +SERVICE_NAME = elevate-entity-service +API_DOC_URL="http://localhost:3569/entity-management/api-doc" +APPLICATION_HOST=localhost +IS_AUTH_TOKEN_BEARER="false" +ADMIN_ACCESS_TOKEN=rwwee3$123 +ADMIN_TOKEN_HEADER_NAME="admin-auth-token" +INTERFACE_SERVICE_URL=http://localhost:3569 +KAFKA_HEALTH_CHECK_TOPIC = entity-health-check-topic-check +KAFKA_COMMUNICATIONS_ON_OFF = ON +KAFKA_URL = kafka:9092 +KAFKA_COMMUNICATIONS_ON_OFF = ON +KAFKA_GROUP_ID = entity +HEALTH_CHECK_DEBUG_MODE = true \ No newline at end of file diff --git a/documentation/3.4.0/native/envs/scp/interface_env b/documentation/3.4.0/native/envs/scp/interface_env new file mode 100644 index 00000000..d12c7e5d --- /dev/null +++ b/documentation/3.4.0/native/envs/scp/interface_env @@ -0,0 +1,26 @@ +API_DOC_URL=/interface/api-doc +APPLICATION_ENV=development +APPLICATION_PORT=3569 +ELEVATE_NOTIFICATION_KAFKA_BROKERS=10.148.0.38:9092 +ELEVATE_NOTIFICATION_KAFKA_GROUP_ID=dev.mentoring +ELEVATE_NOTIFICATION_KAFKA_TOPIC=dev.notification +ENTITY_SERVICE_BASE_URL=http://localhost:5001 +INSTALLED_PACKAGES=elevate-mentoring elevate-survey-observation@1.0.1 elevate-self-creation-portal +MENTORING_SERVICE_BASE_URL=http://localhost:7101 +NOTIFICATION_SERVICE_BASE_URL=http://localhost:7201 +PROJECT_SERVICE_BASE_URL=http://localhost:6000 +RATE_LIMITER_ENABLED=true +RATE_LIMITER_GENERAL_LIMIT=500 +RATE_LIMITER_NUMBER_OF_PROXIES=3 +RATE_LIMITER_PUBLIC_LOW_LIMIT=5 +REQUIRED_BASE_PACKAGES=elevate-mentoring elevate-project elevate-survey-observation self-creation-portal +REQUIRED_PACKAGES=elevate-mentoring@1.2.90 elevate-survey-observation@1.0.22 elevate-project@1.1.53 shiksha-notification@1.1.3 elevate-self-creation-portal@1.0.70 +ROUTE_CONFIG_JSON_URLS_PATHS=https://raw.githubusercontent.com/ELEVATE-Project/utils/refs/heads/develop/interface-routes/elevate-routes.json +SAAS_NOTIFICATION_BASE_URL=interface/v1/notification/send-raw +SAAS_NOTIFICATION_SEND_EMAIL_ROUTE=interface/v1/notification/send-raw +SAMIKSHA_SERVICE_BASE_URL=http://localhost:5007 +SCHEDULER_SERVICE_BASE_URL=http://localhost:7401 +SELF-CREATION-PORTAL_SERVICE_BASE_URL=http://localhost:6001 +SUPPORTED_HTTP_TYPES=GET POST PUT PATCH DELETE +SURVEY_SERVICE_BASE_URL=http://localhost:5007 +USER_SERVICE_BASE_URL=http://localhost:3001 \ No newline at end of file diff --git a/documentation/3.4.0/native/envs/scp/notification_env b/documentation/3.4.0/native/envs/scp/notification_env new file mode 100644 index 00000000..ce2f2d64 --- /dev/null +++ b/documentation/3.4.0/native/envs/scp/notification_env @@ -0,0 +1,14 @@ +API_DOC_URL=/api-doc +APPLICATION_BASE_URL=/notification/ +APPLICATION_ENV=development +APPLICATION_PORT=3002 +DEV_DATABASE_URL=postgres://postgres:postgres@localhost:5432/notification +DISABLE_LOG=false +ENABLE_LOG=true +ERROR_LOG_LEVEL=silly +INTERNAL_ACCESS_TOKEN=qwertyhdgffs +KAFKA_GROUP_ID=notification +KAFKA_HOST=localhost:9092 +KAFKA_TOPIC=develop.notifications +SENDGRID_API_KEY=SG.asd9f87a9s8d7f. +SENDGRID_FROM_MAIL=no-reply@some.org \ No newline at end of file diff --git a/documentation/3.4.0/native/envs/scp/observation_portal_env b/documentation/3.4.0/native/envs/scp/observation_portal_env new file mode 100644 index 00000000..50d7ba42 --- /dev/null +++ b/documentation/3.4.0/native/envs/scp/observation_portal_env @@ -0,0 +1,4 @@ +window["env"] = { + production: true, + surveyBaseURL:"https://qa.elevate-apis.shikshalokam.org" +} \ No newline at end of file diff --git a/documentation/3.4.0/native/envs/scp/observation_survey_projects_pwa_env b/documentation/3.4.0/native/envs/scp/observation_survey_projects_pwa_env new file mode 100644 index 00000000..156e3796 --- /dev/null +++ b/documentation/3.4.0/native/envs/scp/observation_survey_projects_pwa_env @@ -0,0 +1,18 @@ +window["env"] = { + production: true, + baseURL: 'https://qa.elevate-apis.shikshalokam.org', + // baseURL: 'https://saas-qa.tekdinext.com', + capabilities: 'all', + restrictedPages: ['DOWNLOADS','AUTH_PAGES'], + unauthorizedRedirectUrl: "/", + isAuthBypassed: true, + profileRedirectPath: "/profile-edit", + showHeader: true, + config:{ + logoPath:'assets/images/logo.png', + faviconPath:'assets/icons/elevate-logo.png', + title:"Elevate", + redirectUrl:"/home" + }, + hostPath:'/ml/' +}; \ No newline at end of file diff --git a/documentation/3.4.0/native/envs/scp/project_env b/documentation/3.4.0/native/envs/scp/project_env new file mode 100644 index 00000000..3fa80eaf --- /dev/null +++ b/documentation/3.4.0/native/envs/scp/project_env @@ -0,0 +1,47 @@ +APPLICATION_PORT = 6000 +APPLICATION_ENV = development +ACCESS_TOKEN_SECRET=bsj82AHBxahusub12yexlashsbxAXADHBlaj +INTERNAL_ACCESS_TOKEN =xahusub12yexlashsbxAXADHBlaj +MONGODB_URL = mongodb://localhost:27017/elevate-project +KEYCLOAK_PUBLIC_KEY_PATH = keycloak-public-keys +KAFKA_COMMUNICATIONS_ON_OFF = ON +KAFKA_URL=localhost:9092 +KAFKA_GROUP_ID = projects +KAFKA_HEALTH_CHECK_TOPIC = project-health-check-topic-check +PROJECT_SUBMISSION_TOPIC=sl-improvement-project-submission-dev +SUBMISSION_TOPIC = Projectsubmissions +PROJECT_CERTIFICATE_TOPIC = generateProjectCertificate +ELEVATE_PROJECT_SERVICE_URL= 'http://localhost:6000' +SERVICE_NAME = project +USER_DELETE_TOPIC = deleteuser +TELEMETRY_TOPIC=telemetry.raw +ID = projectservice +TELEMETRY_ON_OFF=ON +USER_DELETE_ON_OFF=OFF +CLOUD_STORAGE=ON +TIMEZONE_DIFFRENECE_BETWEEN_LOCAL_TIME_AND_UTC = +05:30 +VALIDATE_ENTITIES = ON +APP_PORTAL_BASE_URL = "http://localhost:7007" +NO_OF_MINUTES = 30 +NO_OF_EXPIRY_TIME = 60 +DEFAULT_ORGANISATION_CODE = 1 +GOTENBERG_URL=http://localhost:3000 +API_DOC_URL="http://http://localhost:3569/project/api-doc" +INTERFACE_SERVICE_URL=http://localhost:3569 +USER_SERVICE_BASE_URL = "/user" +ENTITY_MANAGEMENT_SERVICE_BASE_URL = "/entity-management" +SURVEY_SERVICE_URL = http://localhost:4301/survey +CLOUD_STORAGE_PROVIDER=gcloud +CLOUD_STORAGE_ACCOUNTNAME=CLOUD_STORAGE_ACCOUNTNAME +CLOUD_STORAGE_SECRET="-----BEGIN PRIVATE KEY-----\n" +CLOUD_STORAGE_PROJECT =sl-dev-project +CLOUD_STORAGE_BUCKETNAME=mentoring-dev-storage-private +CLOUD_STORAGE_BUCKET_TYPE=private +ADMIN_ACCESS_TOKEN = N0DM5NAwwCN5KNXKJwlwu6c0nQQt6Rcl +ADMIN_AUTH_TOKEN = N0DM5NAwwCN5KNXKJwlwu6c0nQQt6Rcl +ADMIN_TOKEN_HEADER_NAME = 'admin-auth-token' +IS_AUTH_TOKEN_BEARER = false +AUTH_METHOD = native +REDIS_HOST=redis://127.0.0.1:6379 +USER_SERVICE_URL = http://localhost:3569 +RESOURCE_DELETION_TOPIC=RESOURCE_DELETION_TOPIC \ No newline at end of file diff --git a/documentation/3.4.0/native/envs/scp/scheduler_env b/documentation/3.4.0/native/envs/scp/scheduler_env new file mode 100644 index 00000000..07ffc681 --- /dev/null +++ b/documentation/3.4.0/native/envs/scp/scheduler_env @@ -0,0 +1,13 @@ +API_DOC_URL=/api-doc +APPLICATION_BASE_URL=/scheduler/ +APPLICATION_ENV=development +APPLICATION_PORT=4000 +DEFAULT_QUEUE=email +DISABLE_LOG=false +ENABLE_LOG=true +ERROR_LOG_LEVEL=silly +KAFKA_URL=localhost:9092 +NOTIFICATION_KAFKA_TOPIC=develop.notifications +REDIS_HOST=localhost +REDIS_PORT=6379 +MONGODB_URL="mongodb://localhost:27017/tl-cron-rest" \ No newline at end of file diff --git a/documentation/3.4.0/native/envs/scp/survey_project_creation_env b/documentation/3.4.0/native/envs/scp/survey_project_creation_env new file mode 100644 index 00000000..24d2d9eb --- /dev/null +++ b/documentation/3.4.0/native/envs/scp/survey_project_creation_env @@ -0,0 +1,91 @@ +ACCESS_TOKEN_EXPIRY=30m +ACCESS_TOKEN_SECRET=bsj82AHBxahusub12yexlashsbxAXADHBlaj +API_DOC_URL=/scp/api-doc +APPLICATION_BASE_URL=/scp/ +APPLICATION_ENV=development +APPLICATION_HOST=localhost +APPLICATION_PORT=6001 +AUTH_CONFIG_FILE_PATH=config.json +AUTH_METHOD=native +AUTH_TOKEN_HEADER_NAME=x-auth-token +BROWSE_EXISTING_END_POINT=v1/internal/getAllPublishedResources +CLEAR_INTERNAL_CACHE=scpinternal +#Cloud storage details +CLOUD_ENDPOINT=cloud_storage_endpoint +CLOUD_STORAGE=aws +CLOUD_STORAGE_ACCOUNTNAME=project-scp-storage +CLOUD_STORAGE_BUCKETNAME=scp-uploads-prod +CLOUD_STORAGE_PROVIDER=aws +CLOUD_STORAGE_REGION=us-west-2 +CLOUD_STORAGE_SECRET=AKIAIOSFODNN7EXAMPLE +CLOUD_STORAGE_BUCKET_TYPE=public +PUBLIC_ASSET_BUCKETNAME=scp-public-assets +CONSUMPTION_SERVICE=elevate +CONSUMPTION_SERVICE_BASE_URL=/project/ +CONSUMPTION_SERVICE_DOWNLOADBLE_URL=v1/cloud-services/files/download +CONSUMPTION_SERVICE_ENTITY_MANAGEMENT_BASE_URL=/entity-management/ +CONSUMPTION_SERVICE_PRESIGNED_URL=v1/cloud-services/files/preSignedUrls +DEFAULT_ADMIN_ROLE=admin +DEFAULT_CONTENT_CREATOR_ROLE=content_creator +DEFAULT_DATA_MANAGERS=program_manager +DEFAULT_ORGANIZATION_CODE=default_code +DEFAULT_ORG_ADMIN_ROLE=org_admin +DEFAULT_ORG_ID=default_code +DEFAULT_PROGRAM_DESIGNER_ROLES=program_designer +DEFAULT_PROGRAM_MANAGERS=program_manager +DEFAULT_REVIEWER_ROLE=reviewer +DEFAULT_ROLLOUT_ROLES=rollout_manager +DEFAULT_TENANT_CODE=default +DEV_DATABASE_URL=postgres://postgres:postgres@citus_master:5432/scp +DISABLE_LOG=false +ENABLE_ENTITY_TAGGING_IN_PROJECTS=false +ENABLE_OBSERVATION_IN_PROJECTS=true +ENABLE_TASK_START_END_DATE_IN_PROJECTS=false +ENTITY_MANAGEMENT_SERVICE_NAME=/entity-management/ +ERROR_LOG_LEVEL=silly +HIGHEST_IN_ENTITY_HIERARCHY=state +INTERFACE_SERVICE_HOST=http://interface:3569 +INTERNAL_ACCESS_TOKEN=Fqn0m0HQ0gXydRtBCg5l +INTERNAL_CACHE_EXP_TIME=86400 +IS_AUTH_TOKEN_BEARER=false +KAFKA_COMMUNICATIONS_ON_OFF=ON +KAFKA_GROUP_ID=scp +KAFKA_URL=kafka:9092 +MAX_BODY_LENGTH_FOR_UPLOAD=5242880 +MAX_PROJECT_TASK_COUNT=10 +MAX_RESOURCE_NOTE_LENGTH=200 +MIN_APPROVAL=1 +MONGODB_URL=mongodb://mongodb:27017/elevate-project +MONGO_DB_MODE=individual +NOTIFICATION_KAFKA_TOPIC=qa.notification +OBSERVATION_DEEP_LINK_REGEX=^https://portal/view/observation/[a-f0-9]{32}$ +ORGANIZATION_LIST_ENDPOINT=v1/organization/list +ORGANIZATION_READ_ENDPOINT=v1/organization/read +ORG_ID_HEADER_NAME=organization-id +PROGRAM_META_INFO_KEYS=state,recommendedFor +PROGRAM_PUBLISH_KAFKA_TOPIC=qa.programpublish +PROJECT_DEEP_LINK_URL=https://portal/view/project/ +PROJECT_MONGO_DB_URL=mongodb://mongodb:27017/elevate-project +PROJECT_PUBLISH_END_POINT=v1/scp/publishTemplateAndTasks +PROJECT_PUBLISH_KAFKA_TOPIC=qa.projectpublish +PROJECT_REFLECTION_TASK_REDIRECT_URL=https://elevate-mitra.shikshalokam.org/mohini/sso?flow=guest-mi-story +PROJECT_SERVICE_BASE_URL=/project/ +REDIS_HOST=redis://redis:6379 +RESOURCE_AUTO_SAVE_TIMER=30000 +RESOURCE_KAFKA_PUSH_ON_OFF=ON +RESOURCE_TYPES=project,observation,observation_with_rubric,survey,program +REVIEW_REQUIRED=true +REVIEW_REQUIRED_AFTER_PUBLISH=true +REVIEW_TYPE=SEQUENTIAL +ROLLOUT_PUBLISH_KAFKA_TOPIC=dev.rolloutpublish +SESSION_VERIFICATION_METHOD=user_service_authenticated +SHOW_REVIEWER_LIST=true +SURVEY_MONGO_DB_URL=mongodb://mongodb:27017/elevate-samiksha +SURVEY_SERVICE_BASE_URL=/survey/ +TENANT_ID_HEADER_NAME=tenant-id +USER_LIST_ENDPOINT=v1/account/search +USER_PROFILE_DETAILS_ENDPOINT=v1/user/read +USER_SERVICE_BASE_URL=/user/ +USER_SERVICE_HOST=http://interface:3569 +USER_SERVICE_ORG_UPDATE_TOPIC=dev.organizationEvent +USER_SERVICE_TENANT_CREATION_TOPIC=dev.tenantEvent \ No newline at end of file diff --git a/documentation/3.4.0/native/envs/scp/user_env b/documentation/3.4.0/native/envs/scp/user_env new file mode 100644 index 00000000..af029f35 --- /dev/null +++ b/documentation/3.4.0/native/envs/scp/user_env @@ -0,0 +1,81 @@ +ACCESS_TOKEN_EXPIRY='30m' +ACCESS_TOKEN_SECRET=bsj82AHBxahusub12yexlashsbxAXADHBlaj +API_DOC_URL=/user/api-doc +APP_NAME=MentorED +APPLICATION_ENV=development +APPLICATION_PORT=3001 +CLOUD_STORAGE_PROVIDER = aws +CLOUD_STORAGE_BUCKETNAME =mentoring-prod-storage-private +CLOUD_STORAGE_SECRET= CLOUD_STORAGE_SECRET +CLOUD_STORAGE_REGION =ap-south-1 +CLOUD_ENDPOINT =CLOUD_ENDPOINT +CLOUD_STORAGE_ACCOUNTNAME =CLOUD_STORAGE_ACCOUNTNAME +CLOUD_STORAGE_BUCKET_TYPE = private +PUBLIC_ASSET_BUCKETNAME=mentoring-prod-storage-private +AZURE_ACCOUNT_KEY='AZURE_ACCOUNT_KEY' +AZURE_ACCOUNT_NAME=elevatementoringaccount +CLEAR_INTERNAL_CACHE=userinternal +CLOUD_STORAGE=GCP +DEFAULT_AZURE_CONTAINER_NAME=mentoring-azure-private +DEFAULT_GCP_BUCKET_NAME=DEFAULT_GCP_BUCKET_NAME +ENABLE_EMAIL_OTP_VERIFICATION=false +ENABLE_LOG=true +GCP_PATH=gcp.json +GCP_PROJECT_ID=sl-project +INTERNAL_ACCESS_TOKEN=xahusub12yexlashsbxAXADHBlaj +INTERNAL_CACHE_EXP_TIME=86400 +IV=LHYOA5YnTonqcgrm15k3/Q== +KAFKA_GROUP_ID=mentoring +KAFKA_TOPIC= +KAFKA_URL= localhost:9092 +KEY=E/m3RD/aM3Ed3lLfYVcKizakG9R+bFybAPZSLjIP2hY= +MENTOR_SECRET_CODE=4567 +MONGODB_URL=mongodb://localhost:27017/elevate-users +NOTIFICATION_KAFKA_TOPIC=notifications +OTP_EMAIL_TEMPLATE_CODE=emailotp +OTP_EXP_TIME=86400 +RATING_KAFKA_TOPIC=mentor_rating +REDIS_HOST=redis://localhost:6379 +REFRESH_TOKEN_EXPIRY=183 +REFRESH_TOKEN_SECRET=371hkjkjady2y3ihdkajshdkiq23iuekw71yekhaskdvkvegavy23t78veqwexqvxveit6ttxyeeytt62tx236vv +REGISTRATION_EMAIL_TEMPLATE_CODE=registration +REGISTRATION_OTP_EMAIL_TEMPLATE_CODE=registrationotp +SALT_ROUNDS=10 + +DEFAULT_OCI_BUCKET_NAME=mentoring-oci-private +OCI_ACCESS_KEY_ID= 81a4c2553026982360af6b24497c489b0fea9436 +OCI_BUCKET_ENDPOINT=https://axgqmpkrpmt5.compat.objectstorage.ap-hyderabad-1.oraclecloud.com +OCI_BUCKET_REGION= ap-hyderabad-1 +OCI_SECRET_ACCESS_KEY='+U4O+CjiC6M/mOcGjYh7K/9XjfSdJ79OoLuQrABPOJ8=' +ERROR_LOG_LEVEL= silly +DISABLE_LOG= false +DEFAULT_ORGANISATION_CODE=default_code +DEV_DATABASE_URL=postgres://postgres:postgres@localhost:5432/users +ADMIN_SECRET_CODE=W5bF7gesuS0xsNWmpsKy +INVITEE_EMAIL_TEMPLATE_CODE="emailcode" +ADMIN_INVITEE_UPLOAD_EMAIL_TEMPLATE_CODE="coeadmin" +DEFAULT_QUEUE="defaultque" +MENTOR_INVITATION_EMAIL_TEMPLATE_CODE="mentorinvitationTemplateCode" +MENTEE_INVITATION_EMAIL_TEMPLATE_CODE="mentee invitationTemplateCode" +DEFAULT_ROLE="mentee" +SAMPLE_CSV_FILE_PATH="sample path" +ORG_ADMIN_INVITATION_EMAIL_TEMPLATE_CODE = "code5" +DEFAULT_ORG_ID = 1 +PORTAL_URL = "portaladdress" +SCHEDULER_SERVICE_HOST = "host" +SCHEDULER_SERVICE_BASE_URL = "/scheduler/" +REFRESH_VIEW_INTERVAL = 100000 +EMAIL_ID_ENCRYPTION_IV = 'a390328e496f025249a88384f318a536' +EMAIL_ID_ENCRYPTION_KEY = '9bbf4698e081176b4e38c3f04f9c0cff6ae80b1960e5ac868cc234ac8537aa66' +EMAIL_ID_ENCRYPTION_ALGORITHM = 'aes-256-cbc' +GENERIC_INVITATION_EMAIL_TEMPLATE_CODE = 'check_code' +EVENT_ORG_LISTENER_URLS = "sample url" +EVENT_ENABLE_ORG_EVENTS = false +DOWNLOAD_URL_EXPIRATION_DURATION = 300 +APPLICATION_HOST= "localhost" +CHANGE_PASSWORD_TEMPLATE_CODE = "change_password" +CAPTCHA_ENABLE = false +RECAPTCHA_SECRET_KEY= "6LfWEKYpAAAAAJS0eukS2Su_5vwlXRs5vPbC34W0" +ALLOWED_IDLE_TIME=1200000 +APPLICATION_BASE_URL="/user" +ENTITY_MANAGEMENT_SERVICE_BASE_URL="/" \ No newline at end of file diff --git a/documentation/3.4.0/native/scripts/scp/ubuntu/check-dependencies.sh b/documentation/3.4.0/native/scripts/scp/ubuntu/check-dependencies.sh new file mode 100644 index 00000000..db67da25 --- /dev/null +++ b/documentation/3.4.0/native/scripts/scp/ubuntu/check-dependencies.sh @@ -0,0 +1,139 @@ +#!/bin/bash + +# Define ANSI color codes for output formatting +GREEN='\033[0;32m' +RED='\033[0;31m' +NC='\033[0m' # No Color + +# Function to check Node.js installation +check_nodejs() { + if command -v node > /dev/null 2>&1; then + echo -e "${GREEN}Node.js is installed. Version: $(node --version)${NC}" + else + echo -e "${RED}Node.js is not installed.${NC}" + fi +} + +# Function to check Apache Kafka and Zookeeper installation +check_kafka() { + if [ -d "/opt/kafka" ]; then + echo -e "${GREEN}Kafka directory exists.${NC}" + else + echo -e "${RED}Kafka directory does not exist.${NC}" + fi + + if systemctl is-active --quiet zookeeper; then + echo -e "${GREEN}Zookeeper service is running.${NC}" + else + echo -e "${RED}Zookeeper service is not running.${NC}" + fi + + if systemctl is-active --quiet kafka; then + echo -e "${GREEN}Kafka service is running.${NC}" + else + echo -e "${RED}Kafka service is not running.${NC}" + fi +} + +# Function to check Redis installation and service status +check_redis() { + if command -v redis-server > /dev/null 2>&1; then + echo -e "${GREEN}Redis server is installed. Version: $(redis-server --version)${NC}" + else + echo -e "${RED}Redis server is not installed.${NC}" + return + fi + + if systemctl status redis-server.service &> /dev/null; then + echo -e "${GREEN}Redis service is running.${NC}" + else + echo -e "${RED}Redis service is not running or inactive.${NC}" + fi +} + +# Function to check Citus installation +check_citus() { + if sudo su - postgres -c "psql -p 9700 -c 'SELECT citus_version();'" &> /dev/null; then + echo -e "${GREEN}Citus is running on port 9700.${NC}" + else + echo -e "${RED}Citus is not running or not installed.${NC}" + fi +} + +# Function to check PM2 installation +check_pm2() { + if command -v pm2 > /dev/null 2>&1; then + echo -e "${GREEN}PM2 is installed. Version: $(pm2 -v)${NC}" + else + echo -e "${RED}PM2 is not installed.${NC}" + fi +} + +# Function to check PostgreSQL installation and service +check_postgres() { + if command -v psql > /dev/null 2>&1; then + echo -e "${GREEN}PostgreSQL is installed. Version: $(psql --version)${NC}" + else + echo -e "${RED}PostgreSQL is not installed.${NC}" + fi + + if systemctl is-active --quiet postgresql; then + echo -e "${GREEN}PostgreSQL service is running.${NC}" + else + echo -e "${RED}PostgreSQL service is not running.${NC}" + fi +} + +# Function to check MongoDB installation and service +check_mongo() { + if command -v mongod > /dev/null 2>&1; then + echo -e "${GREEN}MongoDB is installed. Version: $(mongod --version | head -n 1)${NC}" + else + echo -e "${RED}MongoDB is not installed.${NC}" + return + fi + + if systemctl is-active --quiet mongod; then + echo -e "${GREEN}MongoDB service is running.${NC}" + else + echo -e "${RED}MongoDB service is not running.${NC}" + fi +} + +# Function to check if Redis BullMQ is installed (in Node.js context) +check_bullmq() { + if npm list -g | grep -q bullmq; then + echo -e "${GREEN}Redis BullMQ is installed globally.${NC}" + else + echo -e "${RED}Redis BullMQ is not installed globally.${NC}" + fi +} + +# Function to check Gotenberg installation and service status +check_gotenberg() { + if command -v docker > /dev/null 2>&1; then + echo -e "${GREEN}Docker is installed. Version: $(docker --version)${NC}" + else + echo -e "${RED}Docker is not installed.${NC}" + return + fi + + if docker ps | grep -q gotenberg; then + echo -e "${GREEN}Gotenberg Docker container is running.${NC}" + else + echo -e "${RED}Gotenberg Docker container is not running.${NC}" + fi +} + +# Main execution flow of the script +echo "ELEVATE-Project Dependencies Status" + +check_nodejs +check_kafka +check_redis +check_pm2 +check_postgres +check_citus +check_mongo +# check_bullmq +check_gotenberg \ No newline at end of file diff --git a/documentation/3.4.0/native/scripts/scp/ubuntu/configProject.json b/documentation/3.4.0/native/scripts/scp/ubuntu/configProject.json new file mode 100644 index 00000000..b3d32b2f --- /dev/null +++ b/documentation/3.4.0/native/scripts/scp/ubuntu/configProject.json @@ -0,0 +1,11 @@ +{ + "authTokenUserInformation": { + "userId": "data.id", + "userName": "data.name", + "firstName": "data.name", + "organization_id": "data.organization_codes[0]", + "roles": "data.organizations[?code={{organization_id}}].roles", + "organizations": "data.organizations", + "tenant_id": "data.tenant_code" + } +} diff --git a/documentation/3.4.0/native/scripts/scp/ubuntu/configSCP.json b/documentation/3.4.0/native/scripts/scp/ubuntu/configSCP.json new file mode 100644 index 00000000..b3d32b2f --- /dev/null +++ b/documentation/3.4.0/native/scripts/scp/ubuntu/configSCP.json @@ -0,0 +1,11 @@ +{ + "authTokenUserInformation": { + "userId": "data.id", + "userName": "data.name", + "firstName": "data.name", + "organization_id": "data.organization_codes[0]", + "roles": "data.organizations[?code={{organization_id}}].roles", + "organizations": "data.organizations", + "tenant_id": "data.tenant_code" + } +} diff --git a/documentation/3.4.0/native/scripts/scp/ubuntu/create-databases.sh b/documentation/3.4.0/native/scripts/scp/ubuntu/create-databases.sh new file mode 100644 index 00000000..89d375a6 --- /dev/null +++ b/documentation/3.4.0/native/scripts/scp/ubuntu/create-databases.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# Run commands as the postgres user +sudo -u postgres psql -p 5432 -c "CREATE USER postgres WITH ENCRYPTED PASSWORD 'postgres';" + +# Create the user database and assign privileges +sudo -u postgres psql -p 5432 -c "CREATE DATABASE users;" +sudo -u postgres psql -p 5432 -d users -c "GRANT ALL PRIVILEGES ON DATABASE users TO postgres;" +sudo -u postgres psql -p 5432 -d users -c "GRANT ALL ON SCHEMA public TO postgres;" + +# Create the notification database and assign privileges +sudo -u postgres psql -p 5432 -c "CREATE DATABASE notification;" +sudo -u postgres psql -p 5432 -d notification -c "GRANT ALL PRIVILEGES ON DATABASE notification TO postgres;" +sudo -u postgres psql -p 5432 -d notification -c "GRANT ALL ON SCHEMA public TO postgres;" + +echo "Database setup complete." \ No newline at end of file diff --git a/documentation/3.4.0/native/scripts/scp/ubuntu/install-dependencies.sh b/documentation/3.4.0/native/scripts/scp/ubuntu/install-dependencies.sh new file mode 100644 index 00000000..6d6b50ba --- /dev/null +++ b/documentation/3.4.0/native/scripts/scp/ubuntu/install-dependencies.sh @@ -0,0 +1,206 @@ +#!/bin/bash + +echo "Starting the installation script..." + +# Function to install Node.js LTS +install_nodejs() { + echo "Installing Node.js version 20..." + curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - + sudo DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs + sudo DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential +} + + +# Function to install Kafka +install_kafka() { + echo "Installing Kafka..." + sudo DEBIAN_FRONTEND=noninteractive apt install -y openjdk-11-jdk + sudo wget https://archive.apache.org/dist/kafka/3.5.0/kafka_2.12-3.5.0.tgz -O kafka.tgz + sudo tar xzf kafka.tgz -C /opt + sudo mv /opt/kafka_2.12-3.5.0 /opt/kafka + + echo "Creating Zookeeper service..." + sudo bash -c 'cat > /etc/systemd/system/zookeeper.service << EOF +[Unit] +Description=Apache Zookeeper service +Documentation=http://zookeeper.apache.org +Requires=network.target remote-fs.target +After=network.target remote-fs.target + +[Service] +Type=simple +ExecStart=/opt/kafka/bin/zookeeper-server-start.sh /opt/kafka/config/zookeeper.properties +ExecStop=/opt/kafka/bin/zookeeper-server-stop.sh +Restart=on-abnormal + +[Install] +WantedBy=multi-user.target +EOF' + + echo "Creating Kafka service..." + sudo bash -c 'cat > /etc/systemd/system/kafka.service << EOF +[Unit] +Description=Apache Kafka Service +Documentation=http://kafka.apache.org/documentation.html +Requires=zookeeper.service + +[Service] +Type=simple +Environment="JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64" +ExecStart=/opt/kafka/bin/kafka-server-start.sh /opt/kafka/config/server.properties +ExecStop=/opt/kafka/bin/kafka-server-stop.sh + +[Install] +WantedBy=multi-user.target +EOF' + + sudo systemctl daemon-reload + sudo systemctl start zookeeper + sudo systemctl start kafka +} + +# Function to install Redis +install_redis() { + echo "Installing Redis..." + sudo apt update + sudo DEBIAN_FRONTEND=noninteractive apt install -y redis-server + sudo sed -i 's/^# *supervised .*/supervised systemd/' /etc/redis/redis.conf + sudo systemctl restart redis.service +} + +# Function to install Redis BullMQ (as a global Node.js package) +install_bullmq() { + echo "Installing Redis BullMQ..." + sudo npm install -g bullmq + echo "Redis BullMQ has been installed globally." +} + +# Function to install Citus +install_citus() { + echo "Installing Citus..." + + # Ensure the 'postgres' user exists + if ! id "postgres" &>/dev/null; then + echo "Creating postgres user..." + sudo useradd -m -s /bin/bash postgres + echo "postgres user created." + else + echo "postgres user already exists." + fi + + # Download and install the Citus repository setup script + curl https://install.citusdata.com/community/deb.sh | sudo bash + + # Install Citus along with PostgreSQL + sudo DEBIAN_FRONTEND=noninteractive apt-get install -y postgresql-16-citus-12.1 + + # Switch to the postgres user + sudo su - postgres <> ~/citus/postgresql.conf + + # Start the Citus server + pg_ctl -D ~/citus -o "-p 9700" -l ~/citus_logfile start + + # Create the Citus extension + psql -p 9700 -c "CREATE EXTENSION citus;" + + # Check the Citus version + PSQL_OUTPUT=\$(psql -p 9700 -c "select citus_version();") + echo "\$PSQL_OUTPUT" + +EOF +} + +# Function to install PM2 +install_pm2() { + echo "Installing PM2..." + sudo npm install pm2@latest -g +} + +# Function to install MongoDB +install_mongo() { + echo "Installing MongoDB 4.4.14..." + + # Import MongoDB public GPG key + wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add - + + # Create the MongoDB source list for Ubuntu (MongoDB 4.4) + echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu $(lsb_release -cs)/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list + + # Update apt and install MongoDB version 4.4.14 + sudo apt update + sudo DEBIAN_FRONTEND=noninteractive apt install -y mongodb-org=4.4.14 mongodb-org-server=4.4.14 mongodb-org-shell=4.4.14 mongodb-org-mongos=4.4.14 mongodb-org-tools=4.4.14 + + # Start and enable MongoDB service + sudo systemctl start mongod + sudo systemctl enable mongod + echo "MongoDB 4.4.14 has been installed and started." +} + + +# Function to install Gotenberg (via Docker) +install_gotenberg() { + echo "Installing Docker (required for Gotenberg)..." + + # Install Docker + sudo apt update + sudo DEBIAN_FRONTEND=noninteractive apt install -y docker.io + + # Start and enable Docker service + sudo systemctl start docker + sudo systemctl enable docker + + echo "Docker installed. Pulling Gotenberg Docker image..." + + # Pull and run Gotenberg Docker container + sudo docker pull gotenberg/gotenberg:7 + sudo docker run -d --name gotenberg -p 3000:3000 gotenberg/gotenberg:7 + + echo "Gotenberg has been installed and started on port 3000." +} + +# Function to display options +display_menu() { + echo "Please select an installation option:" + options=("Install Node.js" "Install Kafka" "Install Redis" "Install Citus" "Install PM2" "Install MongoDB" "Install Gotenberg" "Exit") + for i in ${!options[@]}; do + echo "$((i+1)). ${options[i]}" + done +} + +# Main menu +display_menu + +while true; do + read -p "Enter your choice (1-${#options[@]}): " choice + if (( choice > 0 && choice <= ${#options[@]} )); then + case $choice in + 1) install_nodejs ;; + 2) install_kafka ;; + 3) install_redis ;; + 4) install_citus ;; + 5) install_pm2 ;; + 6) install_mongo ;; + 7) install_gotenberg ;; + 8) echo "Exiting the installation script."; break ;; + *) echo "Invalid option. Please try again." ;; + esac + echo "Operation completed. Here are the next options:" + display_menu + else + echo "Invalid option. Please try again." + fi +done + +echo "Installation script completed." \ No newline at end of file diff --git a/documentation/3.4.0/native/scripts/scp/ubuntu/uninstall-dependencies.sh b/documentation/3.4.0/native/scripts/scp/ubuntu/uninstall-dependencies.sh new file mode 100644 index 00000000..32a30ce6 --- /dev/null +++ b/documentation/3.4.0/native/scripts/scp/ubuntu/uninstall-dependencies.sh @@ -0,0 +1,131 @@ +#!/bin/bash + +# Define color codes +RED='\033[0;31m' +GREEN='\033[0;32m' +NC='\033[0m' # No Color + +# Function to show the menu +show_menu() { + echo -e "${GREEN}Please choose an option to uninstall:${NC}" + echo "1) PM2" + echo "2) Node.js and npm" + echo "3) Kafka and Zookeeper" + echo "4) Redis" + echo "5) MongoDB" + echo "6) Citus and PostgreSQL" + echo "7) Gotenberg" + echo "8) Exit" + echo -e "${GREEN}Enter your choice [1-8]: ${NC}" +} + +# Function to uninstall PM2 +uninstall_pm2() { + echo -e "${RED}Uninstalling PM2...${NC}" + sudo npm uninstall -g pm2 +} + +# Function to uninstall Node.js and npm +uninstall_nodejs() { + echo -e "${RED}Uninstalling Node.js and npm...${NC}" + sudo apt-get remove -y nodejs + sudo apt-get purge -y nodejs + sudo apt-get autoremove -y +} + +# Function to uninstall Kafka and Zookeeper +uninstall_kafka_zookeeper() { + echo -e "${RED}Removing Kafka and Zookeeper...${NC}" + sudo systemctl stop kafka + sudo systemctl disable kafka + sudo systemctl stop zookeeper + sudo systemctl disable zookeeper + sudo rm /etc/systemd/system/kafka.service + sudo rm /etc/systemd/system/zookeeper.service + sudo rm -rf /opt/kafka + sudo systemctl daemon-reload +} + +# Function to uninstall Redis +uninstall_redis() { + echo -e "${RED}Uninstalling Redis...${NC}" + sudo systemctl stop redis + sudo systemctl disable redis + sudo apt-get remove -y redis-server + sudo apt-get purge -y redis-server + sudo apt-get autoremove -y +} + +# Function to uninstall Redis BullMQ +uninstall_bullmq() { + echo -e "${RED}Uninstalling Redis BullMQ...${NC}" + sudo npm uninstall -g bullmq + echo -e "${GREEN}Redis BullMQ has been uninstalled.${NC}" +} + +# Function to uninstall MongoDB +uninstall_mongodb() { + echo -e "${RED}Uninstalling MongoDB...${NC}" + sudo systemctl stop mongod + sudo systemctl disable mongod + sudo apt-get remove -y mongodb-org + sudo apt-get purge -y mongodb-org + sudo apt-get autoremove -y + sudo rm -rf /var/log/mongodb + sudo rm -rf /var/lib/mongodb + sudo rm /etc/apt/sources.list.d/mongodb-org-*.list + echo -e "${GREEN}MongoDB has been uninstalled.${NC}" +} + +# Function to uninstall Citus and PostgreSQL +uninstall_citus_postgresql() { + echo -e "${RED}Uninstalling Citus and PostgreSQL...${NC}" + sudo su - postgres -c "pg_ctl -D ~/citus stop" + sudo apt-get remove -y postgresql-16-citus-12.1 + sudo apt-get purge -y postgresql-16-citus-12.1 + sudo apt-get remove -y postgresql* + sudo apt-get purge -y postgresql* + sudo apt-get autoremove -y + sudo pkill -u postgres + sudo deluser --remove-home postgres +} + +# Function to uninstall Gotenberg +uninstall_gotenberg() { + echo -e "${RED}Uninstalling Gotenberg...${NC}" + + # Stop and remove the Gotenberg Docker container + sudo docker stop gotenberg + sudo docker rm gotenberg + + # Optionally uninstall Docker (if it's no longer needed) + echo -e "${GREEN}Do you also want to uninstall Docker? (y/n)${NC}" + read uninstall_docker + if [[ "$uninstall_docker" == "y" || "$uninstall_docker" == "Y" ]]; then + echo -e "${RED}Uninstalling Docker...${NC}" + sudo apt-get remove -y docker.io + sudo apt-get purge -y docker.io + sudo apt-get autoremove -y + sudo rm -rf /var/lib/docker + echo -e "${GREEN}Docker has been uninstalled.${NC}" + fi + echo -e "${GREEN}Gotenberg has been uninstalled.${NC}" +} + +# Main loop +while true; do + show_menu + read choice + case $choice in + 1) uninstall_pm2 ;; + 2) uninstall_nodejs ;; + 3) uninstall_kafka_zookeeper ;; + 4) uninstall_redis ;; + 5) uninstall_mongodb ;; + 6) uninstall_citus_postgresql ;; + 7) uninstall_gotenberg ;; + 8) echo -e "${GREEN}Exiting uninstallation process.${NC}"; exit ;; + *) echo -e "${RED}Invalid option, please try again.${NC}" ;; + esac + echo -e "${GREEN}Operation completed.${NC}" +done \ No newline at end of file diff --git a/documentation/3.4.0/setup/native/scp/ubuntu/README.md b/documentation/3.4.0/setup/native/scp/ubuntu/README.md new file mode 100644 index 00000000..3f393185 --- /dev/null +++ b/documentation/3.4.0/setup/native/scp/ubuntu/README.md @@ -0,0 +1,334 @@ +
+ +# Projects Service + + + + + +![GitHub package.json version (subfolder of monorepo)](https://img.shields.io/github/package-json/v/ELEVATE-Project/mentoring?filename=src%2Fpackage.json) +[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT) + + + + +
+The Project building block facilitates the creation and engagement with micro-improvement projects. + +
+
+ +# Native Setup - With Self Creation Portal + +## PM2 Managed Services & Natively Installed Dependencies + +### System Requirements + +- **Node.js®:** v20 +- **PostgreSQL:** 16 +- **Apache Kafka®:** 3.5.0 +- **MongoDB:** 4.4.14 +- **Gotenberg:** 8.5.0 +- **Redis:** 7.0.15 + +Expectation: Upon following the prescribed steps, you will achieve a fully operational ELEVATE-Project application setup. Both the portal and backend services are managed using PM2, with all dependencies installed natively on the host system. + +## Prerequisites + +Before setting up the following ELEVATE-Project application, dependencies given below should be installed and verified to be running. Refer to the steps given below to install them and verify. + +1. Download dependency management scripts: + + ``` + curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/scripts/scp/ubuntu/check-dependencies.sh && \ + curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/scripts/scp/ubuntu/install-dependencies.sh && \ + curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/scripts/scp/ubuntu/uninstall-dependencies.sh && \ + chmod +x check-dependencies.sh && \ + chmod +x install-dependencies.sh && \ + chmod +x uninstall-dependencies.sh + ``` + +2. Verify installed dependencies by running `check-dependencies.sh`: + + ``` + ./check-dependencies.sh + ``` + + > Note: Keep note of any missing dependencies. + +3. Install dependencies by running `install-dependencies.sh`: + ``` + ./install-dependencies.sh + ``` + > Note: Install all missing dependencies and use check-dependencies script to ensure everything is installed and running. +4. Uninstall dependencies by running `uninstall-dependencies.sh`: + + ``` + ./uninstall-dependencies.sh + ``` + + > Warning: Due to the destructive nature of the script (without further warnings), it should only be used during the initial setup of the dependencies. For example, Uninstalling PostgreSQL/Citus using script will lead to data loss. USE EXTREME CAUTION. + + > Warning: This script should only be used to uninstall dependencies that were installed via installation script in step 3. If same dependencies were installed using other methods, refrain from using this script. This script is provided in-order to reverse installation in-case issues arise from a bad install. + +## Installation + +1. **Create ELEVATE-Project Directory:** Create a directory named **ELEVATE-Project**. + + > Example Command: `mkdir ELEVATE-Project && cd ELEVATE-Project/` + +2. **Git Clone Services And Portal Repositories** + +``` +git clone -b release-1.0.0 https://github.com/ELEVATE-Project/survey-project-creation-service.git && \ + +git clone -b develop https://github.com/ELEVATE-Project/project-service.git && \ + +git clone -b develop https://github.com/ELEVATE-Project/entity-management.git && \ + +git clone -b develop https://github.com/ELEVATE-Project/user.git && \ + +git clone -b master https://github.com/ELEVATE-Project/notification.git && \ + +git clone -b main https://github.com/ELEVATE-Project/interface-service.git && \ + +git clone -b master https://github.com/ELEVATE-Project/scheduler.git && \ + +git clone -b release-3.4.0 https://github.com/ELEVATE-Project/observation-survey-projects-pwa && \ + +git clone -b releaase-1.1.0 https://github.com/ELEVATE-Project/elevate-portal && \ + +git clone -b release-3.4.0 https://github.com/ELEVATE-Project/observation-portal +``` + +3. **Install NPM Packages** + +``` +cd survey-project-creation-service/src && npm install && cd ../ && \ +cd project-service && npm install && cd ../ && \ +cd entity-management/src && npm install && cd ../.. && \ +cd user/src && npm install && cd ../.. && \ +cd entity-management\src && npm install && cd ..\.. && \ +cd notification/src && npm install && cd ../.. && \ +cd interface-service/src && npm install && cd ../.. && \ +cd scheduler/src && npm install && cd ../.. && \ +cd observation-survey-projects-pwa && npm install --force && cd .. && \ +cd observation-portal && npm install --force && cd .. && \ +cd elevate-portal && npm install --force && cd .. +``` + +4. **Download Environment Files** + +``` +curl -L -o project-service/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/envs/scp/survey_project_creation_env && \ + +curl -L -o project-service/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/envs/scp/project_env && \ + +curl -L -o entity-management/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/envs/scp/entity_management_env && \ + +curl -L -o user/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/envs/scp/user_env && \ + +curl -L -o notification/src/.env https://github.com/ELEVATE-Project/project-service/raw/refs/heads/main/documentation/3.4.0/native/envs/scp/notification_env && \ + +curl -L -o interface-service/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/3.4.0/native/envs/scp/interface_env && \ + +curl -L -o scheduler/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/envs/scp/scheduler_env && \ + +curl -L -o observation-survey-projects-pwa/src/assets/env/env.js https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/3.4.0/native/envs/scp/observation_survey_projects_pwa_env && \ + +curl -L -o elevate-portal/env.js https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/3.4.0/native/envs/scp/elevate_portal_env && \ + +curl -L -o observation-portal/src/assets/env/env.js https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/3.4.0/native/envs/scp/observation_portal_env +``` + +> **Note:** Modify the environment files as necessary for your deployment using any text editor, ensuring that the values are appropriate for your environment. The default values provided in the current files are functional and serve as a good starting point. Refer to the sample env files provided at the +[Survey Project Creation](https://github.com/ELEVATE-Project/survey-project-creation-service/blob/release-1.0.0/src/.env.sample), +[Project](https://github.com/ELEVATE-Project/project-service/blob/main/.env.sample), [User](https://github.com/ELEVATE-Project/user/blob/master/src/.env.sample), [Notification](https://github.com/ELEVATE-Project/notification/blob/master/src/.env.sample), [Scheduler](https://github.com/ELEVATE-Project/scheduler/blob/master/src/.env.sample), [Interface](https://github.com/ELEVATE-Project/interface-service/blob/main/src/.env.sample) and [Entity-Management](https://github.com/ELEVATE-Project/entity-management/blob/main/src/.env.sample) repositories for reference. + +> **Caution:** While the default values in the downloaded environment files enable the ELEVATE-Project Application to operate, certain features may not function correctly or could be impaired unless the adopter-specific environment variables are properly configured. + +> **Important:** As mentioned in the above linked document, the **User SignUp** functionality may be compromised if key environment variables are not set correctly during deployment. If you opt to skip this setup, consider using the sample user account generator detailed in the `Sample User Accounts Generation` section of this document. + +5. **Attaching Config File** + + ``` + curl -L -o project-service/config.json https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/scripts/scp/ubuntu/configSCP.json && \ + + curl -L -o project-service/config.json https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/scripts/scp/ubuntu/configProject.json && \ + + curl -L -o entity-management/src/config.json https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/scripts/scp/ubuntu/configProject.json + ``` + +6. **Create Databases** + + 1. Download `create-databases.sh` Script File: + + ``` + curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/scripts/stand-alone/ubuntu/create-databases.sh + ``` + + 2. Make the executable by running the following command: + + ``` + chmod +x create-databases.sh + ``` + + 3. Run the script file: + + ``` + ./create-databases.sh + ``` + +7. **Run Migrations To Create Tables** + + ``` + cd user/src && npx sequelize-cli db:migrate && cd ../.. && \ + cd notification/src && npx sequelize-cli db:migrate && cd ../.. + ``` + +8. **Enabling Citus And Setting Distribution Columns (Optional)** + + To boost performance and scalability, users can opt to enable the Citus extension. This transforms PostgreSQL into a distributed database, spreading data across multiple nodes to handle large datasets more efficiently as demand grows. + + > NOTE: Currently only available for Linux based operation systems. + + 1. Download user `distributionColumns.sql` file. + + ``` + curl -o ./user/distributionColumns.sql -JL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/distribution-columns/user/distributionColumns.sql + + ``` + + 2. Set up the `citus_setup` file by following the steps given below. + + 1. Download the `citus_setup.sh` file: + + ``` + curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/scripts/linux/citus_setup.sh + ``` + + 2. Make the setup file executable by running the following command: + + ``` + chmod +x citus_setup.sh + ``` + + 3. Enable Citus and set distribution columns for `user` database by running the `citus_setup.sh`with the following arguments. + ``` + ./citus_setup.sh user postgres://postgres:postgres@localhost:9700/users + ``` + +9. **Insert Initial Data** + + 1. Download `entity-project-sample-data.sh` Script File: + + ``` + curl -o project_entity_sample_data.sh https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/scripts/stand-alone/ubuntu/project_entity_sample_data.sh && \ + chmod +x project_entity_sample_data.sh && \ + ./project_entity_sample_data.sh + ``` + +10. **Insert Forms Data into Database** + + ``` + curl -s https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/scripts/linux/import_forms.js | node + ``` + +11. **Start The Services** + + Following the steps given below, 2 instances of each ELEVATE-Project backend service will be deployed and be managed by PM2 process manager. + + ``` + (cd project-service && pm2 start app.js --name project-service && cd -) && \ + (cd entity-management/src && pm2 start app.js --name entity-management && cd -) && \ + (cd user/src && pm2 start app.js --name user && cd -) && \ + (cd notification/src && pm2 start app.js --name notification && cd -) && \ + (cd interface-service/src && pm2 start app.js --name interface && cd -) && \ + (cd scheduler/src && pm2 start app.js --name scheduler && cd -) + ``` + +12. **Run Service Scripts** + + ``` + cd user/src/scripts && node insertDefaultOrg.js && node viewsScript.js && cd ../../.. + ``` + +13. **Start The Portal** + + ELEVATE-Project portal utilizes Ionic for building the browser bundle, follow the steps given below to install them and start the portal. + + 1. Install the Ionic framework: + + ``` + npm install -g ionic + ``` + + 2. Install the Ionic client: + + ``` + npm install -g @ionic/cli + ``` + + 3. Navigate to `observation-survey-projects-pwa` directory: + + ``` + cd observation-survey-projects-pwa + ``` + + 4. Run the project on your local system using the following command: + + ``` + ionic serve + ``` + + Navigate to http://localhost:8100 to access the ELEVATE-Project Portal. + +## Sample User Accounts Generation + +During the initial setup of ELEVATE-Project services with the default configuration, you may encounter issues creating new accounts through the regular SignUp flow on the ELEVATE-Project portal. This typically occurs because the default SignUp process includes OTP verification to prevent abuse. Until the notification service is configured correctly to send actual emails, you will not be able to create new accounts. + +In such cases, you can generate sample user accounts using the steps below. This allows you to explore the ELEVATE-Project services and portal immediately after setup. + +> **Warning:** Use this generator only immediately after the initial system setup and before any normal user accounts are created through the portal. It should not be used under any circumstances thereafter. + +``` +curl -o insert_sample_data.sh https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/scripts/stand-alone/ubuntu/insert_sample_data.sh && \ +chmod +x insert_sample_data.sh && \ +./insert_sample_data.sh +``` + +After successfully running the script mentioned above, the following user accounts will be created and available for login: + +| Email ID | Password | Role | +| ---------------------- | ---------- | ----------------------- | +| mallanagouda@gmail.com | Password1@ | State Education Officer | +| prajwal@gmail.com | Password1@ | State Education Officer | +| vishnu@gmail.com | Password1@ | State Education Officer | + +## Postman Collections + +- [Projects Service](https://github.com/ELEVATE-Project/project-service/tree/main/api-doc) + +## Adding New Projects to the System + +With implementation scripts, you can seamlessly add new projects to the system. Once a project is successfully added, it becomes visible on the portal, ready for use and interaction. For a comprehensive guide on setting up and using the implementation script, please refer to the [documentation here](https://github.com/ELEVATE-Project/project-service/tree/main/Project-Service-implementation-Script). + +# Team + + + + + +# Open Source Dependencies + +Several open source dependencies that have aided Projects's development: + +![NodeJS](https://img.shields.io/badge/node.js-6DA55F?style=for-the-badge&logo=node.js&logoColor=white) +![Apache Kafka](https://img.shields.io/badge/Apache%20Kafka-000?style=for-the-badge&logo=apachekafka) +![Redis](https://img.shields.io/badge/redis-%23DD0031.svg?style=for-the-badge&logo=redis&logoColor=white) +![Jest](https://img.shields.io/badge/-jest-%23C21325?style=for-the-badge&logo=jest&logoColor=white) +![Git](https://img.shields.io/badge/git-%23F05033.svg?style=for-the-badge&logo=git&logoColor=white) From c6b4bc1dce66bbe1fff2405e2861d3dbc63be490 Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Tue, 2 Dec 2025 18:04:06 +0530 Subject: [PATCH 16/63] Add sample data insertion script and update README for survey project creation service --- .../scripts/scp/ubuntu/insert_sample_data.sh | 42 +++++++++++++++++++ .../3.4.0/setup/native/scp/ubuntu/README.md | 34 +++++++++++++-- 2 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 documentation/3.4.0/native/scripts/scp/ubuntu/insert_sample_data.sh diff --git a/documentation/3.4.0/native/scripts/scp/ubuntu/insert_sample_data.sh b/documentation/3.4.0/native/scripts/scp/ubuntu/insert_sample_data.sh new file mode 100644 index 00000000..a1054c76 --- /dev/null +++ b/documentation/3.4.0/native/scripts/scp/ubuntu/insert_sample_data.sh @@ -0,0 +1,42 @@ +#!/bin/bash +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (1, 'Rahul R B', 'a0db5e0a39ee13db7fc5d1309e637f2c', false, '{8,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default','53bc5d0ff0c53bee460c08b8afe087455050dc7529a2f1d4f7319c0da653a7e4','+91', NULL);" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (2, 'Prajwal C S', 'c4113be1bc2cef51981a6ec687302e42fc4f87f4dfac4276584844d9e3e0f5ae', false, '{8,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default','53bc5d0ff0c53bee460c08b8afe087455050dc7529a2f1d4f7319c0da653a767','+91', NULL);" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (3, 'Vishnu V P', '1092be87fd483fce1deba56c8cdefa79bed4f70a4b110fc4e7947c57aacff219', false, '{8,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default','53bc5d0ff0c53bee460c08b8afe087455050dc7529a2f1d4f7319c0da653a7e0','+91', NULL);" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (4, 'Mallanagouda R B', 'e5fc674d4b1a54c6cf772485e3bca6f7ae14b60de32b9f0cd9f955ee469345bc', false, '{8,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default','53bc5d0ff0c53bee460c08b8afe087455050dc7529a2f1d4f7319c0da653a700','+91', NULL);" + +# --- 2. INSERT INTO public.user_organizations --- +# FIXES: +# - Quoted the organization_code and tenant_code variables. +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organizations (user_id,organization_code, tenant_code, created_at, updated_at, deleted_at) VALUES (1, 'default_code', 'default', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organizations (user_id,organization_code, tenant_code, created_at, updated_at, deleted_at) VALUES (2, 'default_code', 'default', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organizations (user_id,organization_code, tenant_code, created_at, updated_at, deleted_at) VALUES (3, 'default_code', 'default', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organizations (user_id,organization_code, tenant_code, created_at, updated_at, deleted_at) VALUES (4, 'default_code', 'default', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" + + +sudo -u postgres psql -p 5432 -d user -c " +UPDATE public.tenants +SET meta = '{ + \"factors\": [\"professional_role\", \"professional_subroles\"], + \"observableEntityKeys\": [\"professional_subroles\"], + \"optional_factors\": [\"state\", \"district\", \"block\", \"cluster\", \"school\"], + \"validationExcludedScopeKeys\": [\"language\", \"gender\"], + \"portalSignInUrl\": \"https://shikshagrah-qa.tekdinext.com/register\" +}' +WHERE code = 'default'; +" + + +# FIXES: +# - Quoted the organization_code and tenant_code variables. +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 2, 'default_code', 1, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 3, 'default_code', 2, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 2, 'default_code', 3, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 4, 'default_code', 3, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" + + +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.entity_types (id, value, label, status, created_by, updated_by, allow_filtering, data_type, organization_id, parent_id, has_entities, allow_custom_entities, model_names, created_at, updated_at, deleted_at, meta, external_entity_type, required, regex) VALUES (4, 'state', 'State', 'ACTIVE', 0, 0, true, 'STRING', 1, NULL, true, true, '{User}', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, NULL, true, false, NULL);" +sudo -u postgres psql -p 5432 -d users -c "UPDATE public.entity_types SET status = 'INACTIVE' WHERE id = 3;" +sudo -u postgres psql -p 5432 -d users -c "SELECT nextval('users_id_seq'::regclass) FROM public.users;" +sudo -u postgres psql -p 5432 -d users -c "SELECT nextval('users_credentials_id_seq'::regclass) FROM public.users_credentials;" +sudo -u postgres psql -p 5432 -d users -c "UPDATE role_permission_mapping SET role_title = 'state_education_officer' WHERE role_title = 'mentor';" +sudo -u postgres psql -p 5432 -d users -c "SELECT NULL;" diff --git a/documentation/3.4.0/setup/native/scp/ubuntu/README.md b/documentation/3.4.0/setup/native/scp/ubuntu/README.md index 3f393185..31e0070e 100644 --- a/documentation/3.4.0/setup/native/scp/ubuntu/README.md +++ b/documentation/3.4.0/setup/native/scp/ubuntu/README.md @@ -124,7 +124,7 @@ cd elevate-portal && npm install --force && cd .. 4. **Download Environment Files** ``` -curl -L -o project-service/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/envs/scp/survey_project_creation_env && \ +curl -L -o survey-project-creation-service/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/envs/scp/survey_project_creation_env && \ curl -L -o project-service/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/envs/scp/project_env && \ @@ -156,7 +156,7 @@ curl -L -o observation-portal/src/assets/env/env.js https://raw.githubuserconten 5. **Attaching Config File** ``` - curl -L -o project-service/config.json https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/scripts/scp/ubuntu/configSCP.json && \ + curl -L -o survey-project-creation-service/src/config.json https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/scripts/scp/ubuntu/configSCP.json && \ curl -L -o project-service/config.json https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/scripts/scp/ubuntu/configProject.json && \ @@ -168,7 +168,7 @@ curl -L -o observation-portal/src/assets/env/env.js https://raw.githubuserconten 1. Download `create-databases.sh` Script File: ``` - curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/scripts/stand-alone/ubuntu/create-databases.sh + curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/scripts/scp/ubuntu/create-databases.sh ``` 2. Make the executable by running the following command: @@ -187,6 +187,7 @@ curl -L -o observation-portal/src/assets/env/env.js https://raw.githubuserconten ``` cd user/src && npx sequelize-cli db:migrate && cd ../.. && \ + cd survey-project-creation-service/src && npx sequelize-cli db:migrate && cd ../.. && \ cd notification/src && npx sequelize-cli db:migrate && cd ../.. ``` @@ -220,8 +221,30 @@ curl -L -o observation-portal/src/assets/env/env.js https://raw.githubuserconten 3. Enable Citus and set distribution columns for `user` database by running the `citus_setup.sh`with the following arguments. ``` ./citus_setup.sh user postgres://postgres:postgres@localhost:9700/users + 3. Download survey-project-creation-service `distributionColumns.sql` file. + + ``` + curl -o ./survey-project-creation-service/distributionColumns.sql -JL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/distribution-columns/survey-project-creation/distributionColumns.sql + + ``` + 2. Set up the `citus_setup` file by following the steps given below. + + 1. Download the `citus_setup.sh` file: + + ``` + curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/scripts/linux/citus_setup.sh ``` + 2. Make the setup file executable by running the following command: + + ``` + chmod +x citus_setup.sh + ``` + + 3. Enable Citus and set distribution columns for `scp` database by running the `citus_setup.sh`with the following arguments. + ``` + ./citus_setup.sh survey-project-creation-service postgres://postgres:postgres@localhost:9700/scp + 9. **Insert Initial Data** 1. Download `entity-project-sample-data.sh` Script File: @@ -308,11 +331,16 @@ After successfully running the script mentioned above, the following user accoun | mallanagouda@gmail.com | Password1@ | State Education Officer | | prajwal@gmail.com | Password1@ | State Education Officer | | vishnu@gmail.com | Password1@ | State Education Officer | +| priyanka@gmail.com | Password1@ | Program Designer | +| adithya@gmail.com | Password1@ | Content Creator | +| praveen@gmail.com | Password1@ | Reviewer | ## Postman Collections - [Projects Service](https://github.com/ELEVATE-Project/project-service/tree/main/api-doc) +- [Surevy Project Creation Service](https://github.com/ELEVATE-Project/survey-project-creation-service/tree/release-1.0.0/src/api-doc) + ## Adding New Projects to the System With implementation scripts, you can seamlessly add new projects to the system. Once a project is successfully added, it becomes visible on the portal, ready for use and interaction. For a comprehensive guide on setting up and using the implementation script, please refer to the [documentation here](https://github.com/ELEVATE-Project/project-service/tree/main/Project-Service-implementation-Script). From 4eddd5e80369a4b456bc61698a3158ef71c93455 Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Tue, 2 Dec 2025 18:06:55 +0530 Subject: [PATCH 17/63] Update README with new script URLs for setupGuideSCP --- .../3.4.0/setup/native/scp/ubuntu/README.md | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/documentation/3.4.0/setup/native/scp/ubuntu/README.md b/documentation/3.4.0/setup/native/scp/ubuntu/README.md index 31e0070e..22ce300d 100644 --- a/documentation/3.4.0/setup/native/scp/ubuntu/README.md +++ b/documentation/3.4.0/setup/native/scp/ubuntu/README.md @@ -44,9 +44,9 @@ Before setting up the following ELEVATE-Project application, dependencies given 1. Download dependency management scripts: ``` - curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/scripts/scp/ubuntu/check-dependencies.sh && \ - curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/scripts/scp/ubuntu/install-dependencies.sh && \ - curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/scripts/scp/ubuntu/uninstall-dependencies.sh && \ + curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/scripts/scp/ubuntu/check-dependencies.sh && \ + curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/scripts/scp/ubuntu/install-dependencies.sh && \ + curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/scripts/scp/ubuntu/uninstall-dependencies.sh && \ chmod +x check-dependencies.sh && \ chmod +x install-dependencies.sh && \ chmod +x uninstall-dependencies.sh @@ -124,19 +124,19 @@ cd elevate-portal && npm install --force && cd .. 4. **Download Environment Files** ``` -curl -L -o survey-project-creation-service/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/envs/scp/survey_project_creation_env && \ +curl -L -o survey-project-creation-service/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/envs/scp/survey_project_creation_env && \ -curl -L -o project-service/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/envs/scp/project_env && \ +curl -L -o project-service/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/envs/scp/project_env && \ -curl -L -o entity-management/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/envs/scp/entity_management_env && \ +curl -L -o entity-management/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/envs/scp/entity_management_env && \ -curl -L -o user/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/envs/scp/user_env && \ +curl -L -o user/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/envs/scp/user_env && \ curl -L -o notification/src/.env https://github.com/ELEVATE-Project/project-service/raw/refs/heads/main/documentation/3.4.0/native/envs/scp/notification_env && \ curl -L -o interface-service/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/3.4.0/native/envs/scp/interface_env && \ -curl -L -o scheduler/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/envs/scp/scheduler_env && \ +curl -L -o scheduler/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/envs/scp/scheduler_env && \ curl -L -o observation-survey-projects-pwa/src/assets/env/env.js https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/3.4.0/native/envs/scp/observation_survey_projects_pwa_env && \ @@ -156,11 +156,11 @@ curl -L -o observation-portal/src/assets/env/env.js https://raw.githubuserconten 5. **Attaching Config File** ``` - curl -L -o survey-project-creation-service/src/config.json https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/scripts/scp/ubuntu/configSCP.json && \ + curl -L -o survey-project-creation-service/src/config.json https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/scripts/scp/ubuntu/configSCP.json && \ - curl -L -o project-service/config.json https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/scripts/scp/ubuntu/configProject.json && \ + curl -L -o project-service/config.json https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/scripts/scp/ubuntu/configProject.json && \ - curl -L -o entity-management/src/config.json https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/scripts/scp/ubuntu/configProject.json + curl -L -o entity-management/src/config.json https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/scripts/scp/ubuntu/configProject.json ``` 6. **Create Databases** @@ -168,7 +168,7 @@ curl -L -o observation-portal/src/assets/env/env.js https://raw.githubuserconten 1. Download `create-databases.sh` Script File: ``` - curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/scripts/scp/ubuntu/create-databases.sh + curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/scripts/scp/ubuntu/create-databases.sh ``` 2. Make the executable by running the following command: @@ -200,7 +200,7 @@ curl -L -o observation-portal/src/assets/env/env.js https://raw.githubuserconten 1. Download user `distributionColumns.sql` file. ``` - curl -o ./user/distributionColumns.sql -JL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/distribution-columns/user/distributionColumns.sql + curl -o ./user/distributionColumns.sql -JL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/distribution-columns/user/distributionColumns.sql ``` @@ -224,7 +224,7 @@ curl -L -o observation-portal/src/assets/env/env.js https://raw.githubuserconten 3. Download survey-project-creation-service `distributionColumns.sql` file. ``` - curl -o ./survey-project-creation-service/distributionColumns.sql -JL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/distribution-columns/survey-project-creation/distributionColumns.sql + curl -o ./survey-project-creation-service/distributionColumns.sql -JL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/distribution-columns/survey-project-creation/distributionColumns.sql ``` 2. Set up the `citus_setup` file by following the steps given below. @@ -250,7 +250,7 @@ curl -L -o observation-portal/src/assets/env/env.js https://raw.githubuserconten 1. Download `entity-project-sample-data.sh` Script File: ``` - curl -o project_entity_sample_data.sh https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/scripts/stand-alone/ubuntu/project_entity_sample_data.sh && \ + curl -o project_entity_sample_data.sh https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/scripts/stand-alone/ubuntu/project_entity_sample_data.sh && \ chmod +x project_entity_sample_data.sh && \ ./project_entity_sample_data.sh ``` @@ -319,7 +319,7 @@ In such cases, you can generate sample user accounts using the steps below. This > **Warning:** Use this generator only immediately after the initial system setup and before any normal user accounts are created through the portal. It should not be used under any circumstances thereafter. ``` -curl -o insert_sample_data.sh https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/scripts/stand-alone/ubuntu/insert_sample_data.sh && \ +curl -o insert_sample_data.sh https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/scripts/stand-alone/ubuntu/insert_sample_data.sh && \ chmod +x insert_sample_data.sh && \ ./insert_sample_data.sh ``` From 05c09a20522eb887d5a2682f0f52d8c415ec64db Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Tue, 2 Dec 2025 18:39:45 +0530 Subject: [PATCH 18/63] Update environment configuration for local development and adjust README setup instructions --- .../envs/scp/survey_project_creation_env | 8 +++--- .../3.4.0/setup/native/scp/ubuntu/README.md | 25 ++----------------- 2 files changed, 6 insertions(+), 27 deletions(-) diff --git a/documentation/3.4.0/native/envs/scp/survey_project_creation_env b/documentation/3.4.0/native/envs/scp/survey_project_creation_env index 24d2d9eb..9d1304b2 100644 --- a/documentation/3.4.0/native/envs/scp/survey_project_creation_env +++ b/documentation/3.4.0/native/envs/scp/survey_project_creation_env @@ -36,7 +36,7 @@ DEFAULT_PROGRAM_MANAGERS=program_manager DEFAULT_REVIEWER_ROLE=reviewer DEFAULT_ROLLOUT_ROLES=rollout_manager DEFAULT_TENANT_CODE=default -DEV_DATABASE_URL=postgres://postgres:postgres@citus_master:5432/scp +DEV_DATABASE_URL=postgres://postgres:postgres@localhost:5432/scp DISABLE_LOG=false ENABLE_ENTITY_TAGGING_IN_PROJECTS=false ENABLE_OBSERVATION_IN_PROJECTS=true @@ -50,12 +50,12 @@ INTERNAL_CACHE_EXP_TIME=86400 IS_AUTH_TOKEN_BEARER=false KAFKA_COMMUNICATIONS_ON_OFF=ON KAFKA_GROUP_ID=scp -KAFKA_URL=kafka:9092 +KAFKA_URL=localhost:9092 MAX_BODY_LENGTH_FOR_UPLOAD=5242880 MAX_PROJECT_TASK_COUNT=10 MAX_RESOURCE_NOTE_LENGTH=200 MIN_APPROVAL=1 -MONGODB_URL=mongodb://mongodb:27017/elevate-project +MONGODB_URL=mongodb://localhost:27017/elevate-project MONGO_DB_MODE=individual NOTIFICATION_KAFKA_TOPIC=qa.notification OBSERVATION_DEEP_LINK_REGEX=^https://portal/view/observation/[a-f0-9]{32}$ @@ -70,7 +70,7 @@ PROJECT_PUBLISH_END_POINT=v1/scp/publishTemplateAndTasks PROJECT_PUBLISH_KAFKA_TOPIC=qa.projectpublish PROJECT_REFLECTION_TASK_REDIRECT_URL=https://elevate-mitra.shikshalokam.org/mohini/sso?flow=guest-mi-story PROJECT_SERVICE_BASE_URL=/project/ -REDIS_HOST=redis://redis:6379 +REDIS_HOST=redis://localhost:6379 RESOURCE_AUTO_SAVE_TIMER=30000 RESOURCE_KAFKA_PUSH_ON_OFF=ON RESOURCE_TYPES=project,observation,observation_with_rubric,survey,program diff --git a/documentation/3.4.0/setup/native/scp/ubuntu/README.md b/documentation/3.4.0/setup/native/scp/ubuntu/README.md index 22ce300d..0cf2f8a2 100644 --- a/documentation/3.4.0/setup/native/scp/ubuntu/README.md +++ b/documentation/3.4.0/setup/native/scp/ubuntu/README.md @@ -85,34 +85,24 @@ Before setting up the following ELEVATE-Project application, dependencies given ``` git clone -b release-1.0.0 https://github.com/ELEVATE-Project/survey-project-creation-service.git && \ - git clone -b develop https://github.com/ELEVATE-Project/project-service.git && \ - git clone -b develop https://github.com/ELEVATE-Project/entity-management.git && \ - git clone -b develop https://github.com/ELEVATE-Project/user.git && \ - git clone -b master https://github.com/ELEVATE-Project/notification.git && \ - git clone -b main https://github.com/ELEVATE-Project/interface-service.git && \ - git clone -b master https://github.com/ELEVATE-Project/scheduler.git && \ - git clone -b release-3.4.0 https://github.com/ELEVATE-Project/observation-survey-projects-pwa && \ - git clone -b releaase-1.1.0 https://github.com/ELEVATE-Project/elevate-portal && \ - git clone -b release-3.4.0 https://github.com/ELEVATE-Project/observation-portal ``` 3. **Install NPM Packages** ``` -cd survey-project-creation-service/src && npm install && cd ../ && \ +cd survey-project-creation-service/src && npm install && cd ../.. && \ cd project-service && npm install && cd ../ && \ cd entity-management/src && npm install && cd ../.. && \ cd user/src && npm install && cd ../.. && \ -cd entity-management\src && npm install && cd ..\.. && \ cd notification/src && npm install && cd ../.. && \ cd interface-service/src && npm install && cd ../.. && \ cd scheduler/src && npm install && cd ../.. && \ @@ -124,24 +114,15 @@ cd elevate-portal && npm install --force && cd .. 4. **Download Environment Files** ``` -curl -L -o survey-project-creation-service/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/envs/scp/survey_project_creation_env && \ - +curl -L -o survey-project-creation-service/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/envs/scp/survey_project_creation_env && \ curl -L -o project-service/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/envs/scp/project_env && \ - curl -L -o entity-management/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/envs/scp/entity_management_env && \ - curl -L -o user/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/envs/scp/user_env && \ - curl -L -o notification/src/.env https://github.com/ELEVATE-Project/project-service/raw/refs/heads/main/documentation/3.4.0/native/envs/scp/notification_env && \ - curl -L -o interface-service/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/3.4.0/native/envs/scp/interface_env && \ - curl -L -o scheduler/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/envs/scp/scheduler_env && \ - curl -L -o observation-survey-projects-pwa/src/assets/env/env.js https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/3.4.0/native/envs/scp/observation_survey_projects_pwa_env && \ - curl -L -o elevate-portal/env.js https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/3.4.0/native/envs/scp/elevate_portal_env && \ - curl -L -o observation-portal/src/assets/env/env.js https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/3.4.0/native/envs/scp/observation_portal_env ``` @@ -157,9 +138,7 @@ curl -L -o observation-portal/src/assets/env/env.js https://raw.githubuserconten ``` curl -L -o survey-project-creation-service/src/config.json https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/scripts/scp/ubuntu/configSCP.json && \ - curl -L -o project-service/config.json https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/scripts/scp/ubuntu/configProject.json && \ - curl -L -o entity-management/src/config.json https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/scripts/scp/ubuntu/configProject.json ``` From 8490d596ab50461b2e0615d251b9be441381f568 Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Tue, 2 Dec 2025 18:42:31 +0530 Subject: [PATCH 19/63] Add new configFile.json and update README for project service setup --- .../{configProject.json => configFile.json} | 0 .../native/scripts/scp/ubuntu/configSCP.json | 248 +++++++++++++++++- .../3.4.0/setup/native/scp/ubuntu/README.md | 4 +- 3 files changed, 240 insertions(+), 12 deletions(-) rename documentation/3.4.0/native/scripts/scp/ubuntu/{configProject.json => configFile.json} (100%) diff --git a/documentation/3.4.0/native/scripts/scp/ubuntu/configProject.json b/documentation/3.4.0/native/scripts/scp/ubuntu/configFile.json similarity index 100% rename from documentation/3.4.0/native/scripts/scp/ubuntu/configProject.json rename to documentation/3.4.0/native/scripts/scp/ubuntu/configFile.json diff --git a/documentation/3.4.0/native/scripts/scp/ubuntu/configSCP.json b/documentation/3.4.0/native/scripts/scp/ubuntu/configSCP.json index b3d32b2f..a2dcc74a 100644 --- a/documentation/3.4.0/native/scripts/scp/ubuntu/configSCP.json +++ b/documentation/3.4.0/native/scripts/scp/ubuntu/configSCP.json @@ -1,11 +1,239 @@ { - "authTokenUserInformation": { - "userId": "data.id", - "userName": "data.name", - "firstName": "data.name", - "organization_id": "data.organization_codes[0]", - "roles": "data.organizations[?code={{organization_id}}].roles", - "organizations": "data.organizations", - "tenant_id": "data.tenant_code" - } -} + "authTokenUserInformation": { + "id": "data.id", + "name": "data.name", + "organization_code": "data.organization_codes[0]", + "organization_id": "data.organization_ids[0]", + "organizations": "data.organizations", + "roles": "data.organizations[?code={{organization_code}}].roles", + "tenant_code": "data.tenant_code" + }, + "targeting_criteria": { + "factors": [ + { + "api": { + "base_name": "entity-management", + "data_key": "result.data", + "endpoint": "v1/entities/entityListBasedOnEntityType", + "method": "GET", + "query_params": { + "entityType": "state", + "limit": "{$limit}", + "page": "{$page}", + "paginate": true + }, + "service": "entity-service" + }, + "default": null, + "depends_on": null, + "key": "state", + "mandatory": true, + "multi_select": true, + "order": 1, + "type": "selection" + }, + { + "api": { + "base_name": "entity-management", + "data_key": "result.data", + "endpoint": "v1/entities/subEntityListBasedOnRoleAndLocation", + "method": "GET", + "path_params": { + "stateId": "{$state._id}" + }, + "query_params": { + "limit": "{$limit}", + "page": "{$page}", + "paginate": true + }, + "service": "entity-service" + }, + "default": null, + "depends_on": [ + "state" + ], + "key": "entityType", + "mandatory": true, + "multi_select": true, + "order": 2, + "type": "selection" + }, + { + "api": { + "base_name": "entity-management", + "data_key": "result.data", + "endpoint": "v1/entities/entityListBasedOnEntityType", + "method": "GET", + "query_params": { + "entityType": "professional_role", + "limit": "{$limit}", + "page": "{$page}", + "paginate": true + }, + "service": "entity-service" + }, + "default": null, + "depends_on": null, + "key": "professional_role", + "mandatory": true, + "multi_select": true, + "order": 3, + "type": "selection" + }, + { + "api": { + "base_name": "entity-management", + "data_key": "result.data", + "endpoint": "v1/entities/entityListBasedOnEntityType", + "method": "GET", + "query_params": { + "entityType": "professional_subroles", + "limit": "{$limit}", + "page": "{$page}", + "paginate": true + }, + "service": "entity-service" + }, + "default": null, + "depends_on": [ + "professional_role" + ], + "key": "professional_subroles", + "mandatory": true, + "multi_select": true, + "order": 4, + "type": "selection" + }, + { + "api": { + "base_name": "entity-management", + "data_key": "result.data", + "endpoint": "v1/entities/subEntityList", + "method": "GET", + "path_params": { + "stateId": "{$state._id}" + }, + "query_params": { + "limit": "{$limit}", + "page": "{$page}", + "paginate": true, + "parentInfoRequired": true, + "type": "district" + }, + "service": "entity-service" + }, + "default": null, + "depends_on": [ + "state" + ], + "key": "district", + "mandatory": true, + "multi_select": true, + "order": 5, + "type": "selection" + }, + { + "api": { + "base_name": "entity-management", + "data_key": "result.data", + "endpoint": "v1/entities/subEntityList", + "method": "GET", + "path_params": { + "stateId": "{$state._id}" + }, + "query_params": { + "limit": "{$limit}", + "page": "{$page}", + "paginate": true, + "parentInfoRequired": true, + "type": "block" + }, + "service": "entity-service" + }, + "default": null, + "depends_on": [ + "district" + ], + "key": "block", + "mandatory": true, + "multi_select": true, + "order": 6, + "type": "selection" + }, + { + "api": { + "base_name": "entity-management", + "data_key": "result.data", + "endpoint": "v1/entities/subEntityList", + "method": "GET", + "path_params": { + "stateId": "{$state._id}" + }, + "query_params": { + "limit": "{$limit}", + "page": "{$page}", + "paginate": true, + "parentInfoRequired": true, + "type": "cluster" + }, + "service": "entity-service" + }, + "default": null, + "depends_on": [ + "block" + ], + "key": "cluster", + "mandatory": true, + "multi_select": true, + "order": 7, + "type": "selection" + }, + { + "api": { + "base_name": "entity-management", + "data_key": "result.data", + "endpoint": "v1/entities/subEntityList", + "method": "GET", + "path_params": { + "stateId": "{$state._id}" + }, + "query_params": { + "limit": "{$limit}", + "page": "{$page}", + "paginate": true, + "parentInfoRequired": true, + "type": "school" + }, + "service": "entity-service" + }, + "default": null, + "depends_on": [ + "cluster" + ], + "key": "school", + "mandatory": true, + "multi_select": true, + "order": 8, + "type": "selection" + } + ], + "ui_config": { + "tabs": [ + { + "fields": [ + "state", + "entityType", + "professional_role", + "professional_subroles", + "district", + "block", + "cluster", + "school" + ], + "id": "location", + "name": "Location" + } + ] + } + } +} \ No newline at end of file diff --git a/documentation/3.4.0/setup/native/scp/ubuntu/README.md b/documentation/3.4.0/setup/native/scp/ubuntu/README.md index 0cf2f8a2..db97690b 100644 --- a/documentation/3.4.0/setup/native/scp/ubuntu/README.md +++ b/documentation/3.4.0/setup/native/scp/ubuntu/README.md @@ -138,8 +138,8 @@ curl -L -o observation-portal/src/assets/env/env.js https://raw.githubuserconten ``` curl -L -o survey-project-creation-service/src/config.json https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/scripts/scp/ubuntu/configSCP.json && \ - curl -L -o project-service/config.json https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/scripts/scp/ubuntu/configProject.json && \ - curl -L -o entity-management/src/config.json https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/scripts/scp/ubuntu/configProject.json + curl -L -o project-service/config.json https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/scripts/scp/ubuntu/configFile.json && \ + curl -L -o entity-management/src/config.json https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/scripts/scp/ubuntu/configFile.json ``` 6. **Create Databases** From 9be45431b6455ad4c59481e9178a120c76151063 Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Tue, 2 Dec 2025 18:51:16 +0530 Subject: [PATCH 20/63] Update database creation script and enhance README with cloud environment key instructions --- .../3.4.0/native/scripts/scp/ubuntu/create-databases.sh | 5 +++++ documentation/3.4.0/setup/native/scp/ubuntu/README.md | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/documentation/3.4.0/native/scripts/scp/ubuntu/create-databases.sh b/documentation/3.4.0/native/scripts/scp/ubuntu/create-databases.sh index 89d375a6..bf9d6a5f 100644 --- a/documentation/3.4.0/native/scripts/scp/ubuntu/create-databases.sh +++ b/documentation/3.4.0/native/scripts/scp/ubuntu/create-databases.sh @@ -8,6 +8,11 @@ sudo -u postgres psql -p 5432 -c "CREATE DATABASE users;" sudo -u postgres psql -p 5432 -d users -c "GRANT ALL PRIVILEGES ON DATABASE users TO postgres;" sudo -u postgres psql -p 5432 -d users -c "GRANT ALL ON SCHEMA public TO postgres;" +# Create the scp database and assign privileges +sudo -u postgres psql -p 5432 -c "CREATE DATABASE scp;" +sudo -u postgres psql -p 5432 -d scp -c "GRANT ALL PRIVILEGES ON DATABASE scp TO postgres;" +sudo -u postgres psql -p 5432 -d scp -c "GRANT ALL ON SCHEMA public TO postgres;" + # Create the notification database and assign privileges sudo -u postgres psql -p 5432 -c "CREATE DATABASE notification;" sudo -u postgres psql -p 5432 -d notification -c "GRANT ALL PRIVILEGES ON DATABASE notification TO postgres;" diff --git a/documentation/3.4.0/setup/native/scp/ubuntu/README.md b/documentation/3.4.0/setup/native/scp/ubuntu/README.md index db97690b..520410fa 100644 --- a/documentation/3.4.0/setup/native/scp/ubuntu/README.md +++ b/documentation/3.4.0/setup/native/scp/ubuntu/README.md @@ -132,7 +132,9 @@ curl -L -o observation-portal/src/assets/env/env.js https://raw.githubuserconten > **Caution:** While the default values in the downloaded environment files enable the ELEVATE-Project Application to operate, certain features may not function correctly or could be impaired unless the adopter-specific environment variables are properly configured. -> **Important:** As mentioned in the above linked document, the **User SignUp** functionality may be compromised if key environment variables are not set correctly during deployment. If you opt to skip this setup, consider using the sample user account generator detailed in the `Sample User Accounts Generation` section of this document. +> **Important:** +> - The Self Creation Portal heavily depends on the cloud, and most of the data is stored there. So please update the cloud-related environment keys with the actual values before proceeding further. +- As mentioned in the above linked document, the **User SignUp** functionality may be compromised if key environment variables are not set correctly during deployment. If you opt to skip this setup, consider using the sample user account generator detailed in the `Sample User Accounts Generation` section of this document. 5. **Attaching Config File** From 75cba7d93509ffc060bfce764136761f1a2f27fe Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Tue, 2 Dec 2025 19:05:27 +0530 Subject: [PATCH 21/63] Add mentoring service URL to user environment and update README for script URLs --- documentation/3.4.0/native/envs/scp/user_env | 1 + documentation/3.4.0/setup/native/scp/ubuntu/README.md | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/documentation/3.4.0/native/envs/scp/user_env b/documentation/3.4.0/native/envs/scp/user_env index af029f35..23ecf03a 100644 --- a/documentation/3.4.0/native/envs/scp/user_env +++ b/documentation/3.4.0/native/envs/scp/user_env @@ -57,6 +57,7 @@ ADMIN_INVITEE_UPLOAD_EMAIL_TEMPLATE_CODE="coeadmin" DEFAULT_QUEUE="defaultque" MENTOR_INVITATION_EMAIL_TEMPLATE_CODE="mentorinvitationTemplateCode" MENTEE_INVITATION_EMAIL_TEMPLATE_CODE="mentee invitationTemplateCode" +MENTORING_SERVICE_URL=http://localhost:7201 DEFAULT_ROLE="mentee" SAMPLE_CSV_FILE_PATH="sample path" ORG_ADMIN_INVITATION_EMAIL_TEMPLATE_CODE = "code5" diff --git a/documentation/3.4.0/setup/native/scp/ubuntu/README.md b/documentation/3.4.0/setup/native/scp/ubuntu/README.md index 520410fa..db38ca9d 100644 --- a/documentation/3.4.0/setup/native/scp/ubuntu/README.md +++ b/documentation/3.4.0/setup/native/scp/ubuntu/README.md @@ -118,11 +118,11 @@ curl -L -o survey-project-creation-service/src/.env https://raw.githubuserconten curl -L -o project-service/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/envs/scp/project_env && \ curl -L -o entity-management/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/envs/scp/entity_management_env && \ curl -L -o user/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/envs/scp/user_env && \ -curl -L -o notification/src/.env https://github.com/ELEVATE-Project/project-service/raw/refs/heads/main/documentation/3.4.0/native/envs/scp/notification_env && \ -curl -L -o interface-service/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/3.4.0/native/envs/scp/interface_env && \ +curl -L -o notification/src/.env https://github.com/ELEVATE-Project/project-service/raw/refs/heads/setupGuideSCP/documentation/3.4.0/native/envs/scp/notification_env && \ +curl -L -o interface-service/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/envs/scp/interface_env && \ curl -L -o scheduler/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/envs/scp/scheduler_env && \ -curl -L -o observation-survey-projects-pwa/src/assets/env/env.js https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/3.4.0/native/envs/scp/observation_survey_projects_pwa_env && \ -curl -L -o elevate-portal/env.js https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/3.4.0/native/envs/scp/elevate_portal_env && \ +curl -L -o observation-survey-projects-pwa/src/assets/env/env.js https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/envs/scp/observation_survey_projects_pwa_env && \ +curl -L -o elevate-portal/env.js https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/envs/scp/elevate_portal_env && \ curl -L -o observation-portal/src/assets/env/env.js https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/3.4.0/native/envs/scp/observation_portal_env ``` From 129af6e2133bd48c150e1dcf61d7467956b98348 Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Tue, 2 Dec 2025 19:23:40 +0530 Subject: [PATCH 22/63] Update README with instructions for uploading certificate templates and inserting default entities for education sector --- documentation/3.4.0/setup/native/scp/ubuntu/README.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/documentation/3.4.0/setup/native/scp/ubuntu/README.md b/documentation/3.4.0/setup/native/scp/ubuntu/README.md index db38ca9d..3b761d42 100644 --- a/documentation/3.4.0/setup/native/scp/ubuntu/README.md +++ b/documentation/3.4.0/setup/native/scp/ubuntu/README.md @@ -227,8 +227,15 @@ curl -L -o observation-portal/src/assets/env/env.js https://raw.githubuserconten ./citus_setup.sh survey-project-creation-service postgres://postgres:postgres@localhost:9700/scp 9. **Insert Initial Data** - - 1. Download `entity-project-sample-data.sh` Script File: + 1. Once you update the cloud credentials in the survey-project-creation-service environment, please run the script below to upload the certificate base templates to the cloud. + ``` + cd survey-project-creation-service/src/scripts && node uploadCertificateBaseTemplate.js && cd ../../ + ``` + 2. If you are using the Self Creation Portal for the education sector, please run the script below to insert the relevant entities into the survey-project-creation-service database. + ``` + cd survey-project-creation-service/src/scripts && node addDefaultEntitiesForEducationSector.js && cd ../../ + ``` + 3. Download `entity-project-sample-data.sh` Script File: ``` curl -o project_entity_sample_data.sh https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/scripts/stand-alone/ubuntu/project_entity_sample_data.sh && \ From fe90213b61e8b577fa91e7ebab023132e4a7b6f4 Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Tue, 2 Dec 2025 19:24:35 +0530 Subject: [PATCH 23/63] Fix directory navigation in README for uploading certificate templates and inserting default entities --- documentation/3.4.0/setup/native/scp/ubuntu/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/documentation/3.4.0/setup/native/scp/ubuntu/README.md b/documentation/3.4.0/setup/native/scp/ubuntu/README.md index 3b761d42..7f571e02 100644 --- a/documentation/3.4.0/setup/native/scp/ubuntu/README.md +++ b/documentation/3.4.0/setup/native/scp/ubuntu/README.md @@ -229,11 +229,11 @@ curl -L -o observation-portal/src/assets/env/env.js https://raw.githubuserconten 9. **Insert Initial Data** 1. Once you update the cloud credentials in the survey-project-creation-service environment, please run the script below to upload the certificate base templates to the cloud. ``` - cd survey-project-creation-service/src/scripts && node uploadCertificateBaseTemplate.js && cd ../../ + cd survey-project-creation-service/src/scripts && node uploadCertificateBaseTemplate.js && cd ../../../ ``` 2. If you are using the Self Creation Portal for the education sector, please run the script below to insert the relevant entities into the survey-project-creation-service database. ``` - cd survey-project-creation-service/src/scripts && node addDefaultEntitiesForEducationSector.js && cd ../../ + cd survey-project-creation-service/src/scripts && node addDefaultEntitiesForEducationSector.js && cd ../../../ ``` 3. Download `entity-project-sample-data.sh` Script File: From d07d65403d8e2105264cb5516950d26ac32478bc Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Tue, 2 Dec 2025 19:31:08 +0530 Subject: [PATCH 24/63] Fix command sequence in README for running service scripts --- documentation/3.4.0/setup/native/scp/ubuntu/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/3.4.0/setup/native/scp/ubuntu/README.md b/documentation/3.4.0/setup/native/scp/ubuntu/README.md index 7f571e02..c64dc931 100644 --- a/documentation/3.4.0/setup/native/scp/ubuntu/README.md +++ b/documentation/3.4.0/setup/native/scp/ubuntu/README.md @@ -265,7 +265,7 @@ curl -L -o observation-portal/src/assets/env/env.js https://raw.githubuserconten 12. **Run Service Scripts** ``` - cd user/src/scripts && node insertDefaultOrg.js && node viewsScript.js && cd ../../.. + cd user/src/scripts && node insertDefaultOrg.js && cd ../../.. ``` 13. **Start The Portal** From 43b796e93d71f48206a667df6104b9bf4ecdbbda Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Thu, 4 Dec 2025 10:54:28 +0530 Subject: [PATCH 25/63] Update environment configurations to standardize MongoDB URLs and enhance README with service start instructions --- .../3.4.0/native/envs/scp/entity_management_env | 2 +- .../native/envs/scp/observation_survey_projects_pwa_env | 3 +-- documentation/3.4.0/native/envs/scp/project_env | 2 +- .../3.4.0/native/envs/scp/survey_project_creation_env | 6 +++--- documentation/3.4.0/setup/native/scp/ubuntu/README.md | 9 ++------- 5 files changed, 8 insertions(+), 14 deletions(-) diff --git a/documentation/3.4.0/native/envs/scp/entity_management_env b/documentation/3.4.0/native/envs/scp/entity_management_env index c8b99600..aaf45d4f 100644 --- a/documentation/3.4.0/native/envs/scp/entity_management_env +++ b/documentation/3.4.0/native/envs/scp/entity_management_env @@ -3,7 +3,7 @@ APPLICATION_ENV ="development" APPLICATION_BASE_URL='/entity-management/' INTERNAL_ACCESS_TOKEN =xahusub12yexlashsbxAXADHBlaj ACCESS_TOKEN_SECRET=bsj82AHBxahusub12yexlashsbxAXADHBlaj -MONGODB_URL=mongodb://localhost:27017/elevate-entity +MONGODB_URL=mongodb://localhost:27017/entity AUTH_METHOD = native USER_SERVICE_URL = http://localhost:3569 USER_SERVICE_BASE_URL=/user diff --git a/documentation/3.4.0/native/envs/scp/observation_survey_projects_pwa_env b/documentation/3.4.0/native/envs/scp/observation_survey_projects_pwa_env index 156e3796..6dc12a6a 100644 --- a/documentation/3.4.0/native/envs/scp/observation_survey_projects_pwa_env +++ b/documentation/3.4.0/native/envs/scp/observation_survey_projects_pwa_env @@ -1,7 +1,6 @@ window["env"] = { production: true, - baseURL: 'https://qa.elevate-apis.shikshalokam.org', - // baseURL: 'https://saas-qa.tekdinext.com', + baseURL: 'http://localhost:3569', //interface url capabilities: 'all', restrictedPages: ['DOWNLOADS','AUTH_PAGES'], unauthorizedRedirectUrl: "/", diff --git a/documentation/3.4.0/native/envs/scp/project_env b/documentation/3.4.0/native/envs/scp/project_env index 3fa80eaf..09d09564 100644 --- a/documentation/3.4.0/native/envs/scp/project_env +++ b/documentation/3.4.0/native/envs/scp/project_env @@ -2,7 +2,7 @@ APPLICATION_PORT = 6000 APPLICATION_ENV = development ACCESS_TOKEN_SECRET=bsj82AHBxahusub12yexlashsbxAXADHBlaj INTERNAL_ACCESS_TOKEN =xahusub12yexlashsbxAXADHBlaj -MONGODB_URL = mongodb://localhost:27017/elevate-project +MONGODB_URL = mongodb://localhost:27017/project KEYCLOAK_PUBLIC_KEY_PATH = keycloak-public-keys KAFKA_COMMUNICATIONS_ON_OFF = ON KAFKA_URL=localhost:9092 diff --git a/documentation/3.4.0/native/envs/scp/survey_project_creation_env b/documentation/3.4.0/native/envs/scp/survey_project_creation_env index 9d1304b2..f9cce313 100644 --- a/documentation/3.4.0/native/envs/scp/survey_project_creation_env +++ b/documentation/3.4.0/native/envs/scp/survey_project_creation_env @@ -55,7 +55,7 @@ MAX_BODY_LENGTH_FOR_UPLOAD=5242880 MAX_PROJECT_TASK_COUNT=10 MAX_RESOURCE_NOTE_LENGTH=200 MIN_APPROVAL=1 -MONGODB_URL=mongodb://localhost:27017/elevate-project +MONGODB_URL=mongodb://localhost:27017/project MONGO_DB_MODE=individual NOTIFICATION_KAFKA_TOPIC=qa.notification OBSERVATION_DEEP_LINK_REGEX=^https://portal/view/observation/[a-f0-9]{32}$ @@ -65,7 +65,7 @@ ORG_ID_HEADER_NAME=organization-id PROGRAM_META_INFO_KEYS=state,recommendedFor PROGRAM_PUBLISH_KAFKA_TOPIC=qa.programpublish PROJECT_DEEP_LINK_URL=https://portal/view/project/ -PROJECT_MONGO_DB_URL=mongodb://mongodb:27017/elevate-project +PROJECT_MONGO_DB_URL=mongodb://mongodb:27017/project PROJECT_PUBLISH_END_POINT=v1/scp/publishTemplateAndTasks PROJECT_PUBLISH_KAFKA_TOPIC=qa.projectpublish PROJECT_REFLECTION_TASK_REDIRECT_URL=https://elevate-mitra.shikshalokam.org/mohini/sso?flow=guest-mi-story @@ -80,7 +80,7 @@ REVIEW_TYPE=SEQUENTIAL ROLLOUT_PUBLISH_KAFKA_TOPIC=dev.rolloutpublish SESSION_VERIFICATION_METHOD=user_service_authenticated SHOW_REVIEWER_LIST=true -SURVEY_MONGO_DB_URL=mongodb://mongodb:27017/elevate-samiksha +SURVEY_MONGO_DB_URL=mongodb://mongodb:27017/survey SURVEY_SERVICE_BASE_URL=/survey/ TENANT_ID_HEADER_NAME=tenant-id USER_LIST_ENDPOINT=v1/account/search diff --git a/documentation/3.4.0/setup/native/scp/ubuntu/README.md b/documentation/3.4.0/setup/native/scp/ubuntu/README.md index c64dc931..9b11eb1e 100644 --- a/documentation/3.4.0/setup/native/scp/ubuntu/README.md +++ b/documentation/3.4.0/setup/native/scp/ubuntu/README.md @@ -254,6 +254,7 @@ curl -L -o observation-portal/src/assets/env/env.js https://raw.githubuserconten Following the steps given below, 2 instances of each ELEVATE-Project backend service will be deployed and be managed by PM2 process manager. ``` + (cd survey-project-creation-service/src && pm2 start app.js --name survey-project-creation-service && cd -) && \ (cd project-service && pm2 start app.js --name project-service && cd -) && \ (cd entity-management/src && pm2 start app.js --name entity-management && cd -) && \ (cd user/src && pm2 start app.js --name user && cd -) && \ @@ -262,13 +263,7 @@ curl -L -o observation-portal/src/assets/env/env.js https://raw.githubuserconten (cd scheduler/src && pm2 start app.js --name scheduler && cd -) ``` -12. **Run Service Scripts** - - ``` - cd user/src/scripts && node insertDefaultOrg.js && cd ../../.. - ``` - -13. **Start The Portal** +12. **Start The Portal** ELEVATE-Project portal utilizes Ionic for building the browser bundle, follow the steps given below to install them and start the portal. From 3b0e1b1021e8801ee07ab6e7231d7c918dc651be Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Thu, 4 Dec 2025 12:16:32 +0530 Subject: [PATCH 26/63] Add scripts for importing forms and inserting sample solutions, and update README with correct script URLs --- .../native/scripts/linux/import_forms.js | 51 +++++++++++++++++ .../scp/ubuntu/insert_sample_solutions.js | 56 +++++++++++++++++++ .../scp/ubuntu/project_entity_sample_data.sh | 53 ++++++++++++++++++ .../3.4.0/setup/native/scp/ubuntu/README.md | 4 +- 4 files changed, 162 insertions(+), 2 deletions(-) create mode 100644 documentation/3.4.0/native/scripts/linux/import_forms.js create mode 100644 documentation/3.4.0/native/scripts/scp/ubuntu/insert_sample_solutions.js create mode 100644 documentation/3.4.0/native/scripts/scp/ubuntu/project_entity_sample_data.sh diff --git a/documentation/3.4.0/native/scripts/linux/import_forms.js b/documentation/3.4.0/native/scripts/linux/import_forms.js new file mode 100644 index 00000000..700368d5 --- /dev/null +++ b/documentation/3.4.0/native/scripts/linux/import_forms.js @@ -0,0 +1,51 @@ +const mongoose = require('mongoose') +const axios = require('axios') + +// MongoDB URL and Collection +const mongoURL = 'mongodb://localhost:27017/project' +const collectionName = 'forms' + +// Connect to MongoDB +mongoose + .connect(mongoURL, { + useNewUrlParser: true, + useUnifiedTopology: true, + }) + .then(() => { + console.log('Connected to MongoDB') + }) + .catch((err) => { + console.error('Failed to connect to MongoDB', err) + }) + +// Define schema for forms collection (adjust fields based on JSON structure) +const formSchema = new mongoose.Schema({}, { strict: false }) +const Form = mongoose.model(collectionName, formSchema) + +// Fetch JSON data from URL and insert into MongoDB +async function fetchAndInsertData() { + try { + const response = await axios.get( + 'https://raw.githubusercontent.com/ELEVATE-Project/observation-survey-projects-pwa/refs/heads/release-2.0.0/forms.json' + ) + const data = response.data + + const modifiedData = data.map((form) => ({ + ...form, + organizationId: 1, + deleted: false, + version: 0, + })) + + // Insert modified data into the forms collection + await Form.insertMany(modifiedData) + console.log('Data inserted successfully') + } catch (error) { + console.error('Error fetching or inserting data:', error) + } finally { + mongoose.connection.close() + } +} + +// Execute the function +fetchAndInsertData() \ No newline at end of file diff --git a/documentation/3.4.0/native/scripts/scp/ubuntu/insert_sample_solutions.js b/documentation/3.4.0/native/scripts/scp/ubuntu/insert_sample_solutions.js new file mode 100644 index 00000000..82a616ce --- /dev/null +++ b/documentation/3.4.0/native/scripts/scp/ubuntu/insert_sample_solutions.js @@ -0,0 +1,56 @@ +const { MongoClient } = require('mongodb') + +const url = 'mongodb://localhost:27017/' // MongoDB URL +const dbName = 'elevate-project' +const dbName2 = 'elevate-entity' +const entityData = require('./entity_sampleData.js') +const projectData = require('./project_sampleData.js') + +async function insertData(collectionName, dataFile, curretDB = dbName) { + const client = new MongoClient(url) + + try { + // Connect to MongoDB + await client.connect() + console.log(`Connected to MongoDB for ${collectionName}`) + + const db = client.db(curretDB) + const collection = db.collection(collectionName) + + // Read the data from the file + const data = dataFile + + if (!data) { + await client.close() + return + } + + const result = await collection.insertMany(data) + //console.log(`Inserted ${result.insertedCount} documents into ${collectionName}`); + } finally { + await client.close() + } +} + +async function main({ dataToBeInserted }) { + await insertData('entities', dataToBeInserted.entities, dbName2) + await insertData('entityTypes', dataToBeInserted.entityType, dbName2) + await insertData('programs', dataToBeInserted.programData) + await insertData('solutions', dataToBeInserted.solutionData) + await insertData('projectTemplates', dataToBeInserted.projectTemplatesData) + await insertData('projectTemplateTasks', dataToBeInserted.projectTemplateTasksData) + await insertData('certificateTemplates', dataToBeInserted.certificateTemplatesData) + await insertData('certificateBaseTemplates', dataToBeInserted.certificateBaseTemplatesData) + await insertData('projectCategories', dataToBeInserted.projectCategoriesData) +} + +main({ dataToBeInserted: entityData }) + .then(() => { + console.log('Entity data populated successfully.') + }) + .catch(console.error) +main({ dataToBeInserted: projectData }) + .then(() => { + console.log('project data populated successfully.') + }) + .catch(console.error) diff --git a/documentation/3.4.0/native/scripts/scp/ubuntu/project_entity_sample_data.sh b/documentation/3.4.0/native/scripts/scp/ubuntu/project_entity_sample_data.sh new file mode 100644 index 00000000..74166247 --- /dev/null +++ b/documentation/3.4.0/native/scripts/scp/ubuntu/project_entity_sample_data.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# ---------------------------------------------------------------------- +# ELEVATE Project Data Setup Script +# +# This script performs the following actions: +# 1. Downloads sample data files from the ELEVATE-Project GitHub repository. +# 2. Installs the 'mongoose' package (required to run the sample scripts). +# 3. Executes the sample data insertion script using Node.js. +# ---------------------------------------------------------------------- + +# Exit immediately if a command exits with a non-zero status (ensures script stops on download failure) +set -e + +echo "Starting data setup script..." + +# --- 1. Define URL and Files --- +BASE_URL="https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/scripts/scp/ubuntu" + +ENTITY_FILE="entity_sampleData.js" +PROJECT_FILE="project_sampleData.js" +INSERT_SCRIPT="insert_sample_solutions.js" + +# --- 2. Download Files --- +echo "1. Downloading sample data files..." + +# Download entity_sampleData.js +curl -L "${BASE_URL}/${ENTITY_FILE}" -o "${ENTITY_FILE}" +echo "Downloaded ${ENTITY_FILE}" + +# Download project_sampleData.js +curl -L "${BASE_URL}/${PROJECT_FILE}" -o "${PROJECT_FILE}" +echo "Downloaded ${PROJECT_FILE}" + +# Download insert_sample_solutions.js (saved correctly to be run by node) +curl -L "${BASE_URL}/${INSERT_SCRIPT}" -o "${INSERT_SCRIPT}" +echo "Downloaded ${INSERT_SCRIPT}" + +# NOTE on Original Request: If you need to populate 'user/src/.env' with a specific file, +# you would add another 'curl' command here, but the file you linked was a JS script. + +# --- 3. Install Dependencies --- +echo "" +echo "2. Installing required Node packages (mongoose)..." +npm install mongoose +npm install mongodb + +# --- 4. Run Insertion Script --- +echo "" +echo "3. Running the sample data insertion script..." +node "${INSERT_SCRIPT}" + +echo "" +echo "--- Data setup complete! ---" \ No newline at end of file diff --git a/documentation/3.4.0/setup/native/scp/ubuntu/README.md b/documentation/3.4.0/setup/native/scp/ubuntu/README.md index 9b11eb1e..b7c5e23d 100644 --- a/documentation/3.4.0/setup/native/scp/ubuntu/README.md +++ b/documentation/3.4.0/setup/native/scp/ubuntu/README.md @@ -238,7 +238,7 @@ curl -L -o observation-portal/src/assets/env/env.js https://raw.githubuserconten 3. Download `entity-project-sample-data.sh` Script File: ``` - curl -o project_entity_sample_data.sh https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/scripts/stand-alone/ubuntu/project_entity_sample_data.sh && \ + curl -o project_entity_sample_data.sh https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/scripts/scp/ubuntu/project_entity_sample_data.sh && \ chmod +x project_entity_sample_data.sh && \ ./project_entity_sample_data.sh ``` @@ -246,7 +246,7 @@ curl -L -o observation-portal/src/assets/env/env.js https://raw.githubuserconten 10. **Insert Forms Data into Database** ``` - curl -s https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/scripts/linux/import_forms.js | node + curl -s https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/3.4.0/native/scripts/linux/import_forms.js | node ``` 11. **Start The Services** From 3378f662658f1cf513d6ad7ff247e25e618d6a98 Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Thu, 4 Dec 2025 12:21:01 +0530 Subject: [PATCH 27/63] Refactor code structure for improved readability and maintainability --- .../scripts/scp/ubuntu/entity_sampleData.js | 222 +++ .../scp/ubuntu/insert_sample_solutions.js | 4 +- .../scripts/scp/ubuntu/project_sampleData.js | 1612 +++++++++++++++++ 3 files changed, 1836 insertions(+), 2 deletions(-) create mode 100644 documentation/3.4.0/native/scripts/scp/ubuntu/entity_sampleData.js create mode 100644 documentation/3.4.0/native/scripts/scp/ubuntu/project_sampleData.js diff --git a/documentation/3.4.0/native/scripts/scp/ubuntu/entity_sampleData.js b/documentation/3.4.0/native/scripts/scp/ubuntu/entity_sampleData.js new file mode 100644 index 00000000..5c2bd2c8 --- /dev/null +++ b/documentation/3.4.0/native/scripts/scp/ubuntu/entity_sampleData.js @@ -0,0 +1,222 @@ +const { ObjectId } = require('mongodb') + +let entityType = [ + { + _id: new ObjectId('6825914b97b5680013e6a140'), + profileForm: [], + profileFields: [], + types: [], + callResponseTypes: [], + isObservable: true, + immediateChildrenEntityType: ['district'], + createdBy: '49', + updatedBy: '49', + deleted: false, + isDeleted: false, + name: 'state', + toBeMappedToParentEntities: true, + tenantId: 'default', + updatedAt: new Date('2025-05-15T07:01:31.680Z'), + createdAt: new Date('2025-05-15T07:01:31.680Z'), + __v: 0, + orgId: 'default_code', + }, + { + _id: new ObjectId('6825915197b5680013e6a142'), + profileForm: [], + profileFields: [], + types: [], + callResponseTypes: [], + isObservable: true, + immediateChildrenEntityType: ['district'], + createdBy: '49', + updatedBy: '49', + deleted: false, + isDeleted: false, + name: 'district', + toBeMappedToParentEntities: true, + tenantId: 'default', + updatedAt: new Date('2025-05-15T07:01:37.892Z'), + createdAt: new Date('2025-05-15T07:01:37.892Z'), + __v: 0, + orgId: 'default_code', + }, + { + _id: new ObjectId('682591cc97b5680013e6a15c'), + profileForm: [], + profileFields: [], + types: [], + callResponseTypes: [], + isObservable: true, + immediateChildrenEntityType: ['district'], + createdBy: '49', + updatedBy: '49', + deleted: false, + isDeleted: false, + name: 'professional_role', + toBeMappedToParentEntities: true, + tenantId: 'default', + updatedAt: new Date('2025-05-15T07:03:40.376Z'), + createdAt: new Date('2025-05-15T07:03:40.376Z'), + __v: 0, + orgId: 'default_code', + }, + { + _id: new ObjectId('682591d397b5680013e6a15e'), + profileForm: [], + profileFields: [], + types: [], + callResponseTypes: [], + isObservable: true, + immediateChildrenEntityType: ['district'], + createdBy: '49', + updatedBy: '49', + deleted: false, + isDeleted: false, + name: 'professional_subroles', + toBeMappedToParentEntities: true, + tenantId: 'default', + updatedAt: new Date('2025-05-15T07:03:47.062Z'), + createdAt: new Date('2025-05-15T07:03:47.062Z'), + __v: 0, + orgId: 'default_code', + }, +] + +let entities = [ + { + _id: new ObjectId('6852c86c7248c20014b38a4d'), + metaInformation: { + targetedEntityTypes: [], + externalId: '16', + name: 'Tripura', + }, + childHierarchyPath: ['district', 'block', 'cluster', 'school'], + createdBy: '20', + updatedBy: '20', + deleted: false, + entityTypeId: new ObjectId('6825914b97b5680013e6a140'), + entityType: 'state', + registryDetails: { + code: '16', + locationId: '16', + }, + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-06-18T14:29:00.266Z'), + createdAt: new Date('2025-06-18T14:08:44.438Z'), + __v: 0, + groups: { + district: [new ObjectId('6852c8ae7248c20014b38a57')], + }, + }, + { + _id: new ObjectId('6852c8ae7248c20014b38a57'), + metaInformation: { + targetedEntityTypes: [], + externalId: 'westTripura', + name: 'West Tripura', + }, + childHierarchyPath: ['block', 'cluster', 'school'], + createdBy: '20', + updatedBy: '20', + deleted: false, + entityTypeId: new ObjectId('6825915197b5680013e6a142'), + entityType: 'district', + registryDetails: { + code: 'westTripura', + locationId: 'westTripura', + }, + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-06-18T14:27:43.218Z'), + createdAt: new Date('2025-06-18T14:09:50.337Z'), + __v: 0, + groups: { + block: [ + new ObjectId('6852c8de7248c20014b38a9d'), + new ObjectId('6852c8de7248c20014b38a9e'), + new ObjectId('6852c8de7248c20014b38a9f'), + new ObjectId('6852c8de7248c20014b38aa0'), + new ObjectId('6852c8de7248c20014b38aa1'), + new ObjectId('6852c8de7248c20014b38aa2'), + new ObjectId('6852c8de7248c20014b38aa3'), + new ObjectId('6852c8de7248c20014b38aa4'), + new ObjectId('6852c8de7248c20014b38aa5'), + new ObjectId('6852c8de7248c20014b38aa6'), + new ObjectId('6852c8de7248c20014b38aa7'), + new ObjectId('6852c8de7248c20014b38aa8'), + ], + }, + }, + { + _id: new ObjectId('68876746b19aea00144c2af9'), + metaInformation: { + targetedEntityTypes: [ + { + entityTypeId: '6825915197b5680013e6a142', + entityType: 'district', + }, + ], + externalId: 'Facilitator', + name: 'Facilitator', + }, + childHierarchyPath: ['professional_role', 'professional_subroles'], + createdBy: '1', + updatedBy: '1', + deleted: false, + entityTypeId: new ObjectId('682591cc97b5680013e6a15c'), + entityType: 'professional_role', + registryDetails: { + locationId: 'Facilitator', + code: 'Facilitator', + }, + userId: '1', + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-07-28T12:08:56.065Z'), + createdAt: new Date('2025-07-28T12:04:22.011Z'), + __v: 0, + groups: { + professional_subroles: [new ObjectId('688767deb19aea00144c2b08')], + }, + }, + { + _id: new ObjectId('688767deb19aea00144c2b08'), + metaInformation: { + targetedEntityTypes: [ + { + entityType: 'Handbook1_Activity', + entityTypeId: '688762feb19aea00144c2a81', + }, + { + entityType: 'Handbook2_Activity', + entityTypeId: '68887766b19aea00144c3631', + }, + ], + externalId: 'facilitator', + name: 'Facilitator', + }, + childHierarchyPath: ['professional_subroles'], + createdBy: '1', + updatedBy: '1', + deleted: false, + entityTypeId: new ObjectId('682591d397b5680013e6a15e'), + entityType: 'professional_subroles', + registryDetails: { + locationId: 'facilitator', + code: 'facilitator', + }, + userId: '1', + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-07-29T07:28:05.355Z'), + createdAt: new Date('2025-07-28T12:06:54.072Z'), + __v: 0, + }, +] + +module.exports = { + entities, + entityType, +} diff --git a/documentation/3.4.0/native/scripts/scp/ubuntu/insert_sample_solutions.js b/documentation/3.4.0/native/scripts/scp/ubuntu/insert_sample_solutions.js index 82a616ce..4345782c 100644 --- a/documentation/3.4.0/native/scripts/scp/ubuntu/insert_sample_solutions.js +++ b/documentation/3.4.0/native/scripts/scp/ubuntu/insert_sample_solutions.js @@ -1,8 +1,8 @@ const { MongoClient } = require('mongodb') const url = 'mongodb://localhost:27017/' // MongoDB URL -const dbName = 'elevate-project' -const dbName2 = 'elevate-entity' +const dbName = 'project' +const dbName2 = 'entity' const entityData = require('./entity_sampleData.js') const projectData = require('./project_sampleData.js') diff --git a/documentation/3.4.0/native/scripts/scp/ubuntu/project_sampleData.js b/documentation/3.4.0/native/scripts/scp/ubuntu/project_sampleData.js new file mode 100644 index 00000000..6c815cb2 --- /dev/null +++ b/documentation/3.4.0/native/scripts/scp/ubuntu/project_sampleData.js @@ -0,0 +1,1612 @@ +const { ObjectId } = require('mongodb') + +let solutionData = [ + { + _id: new ObjectId('68ee4bb3fb9bee08b93b6d68'), + resourceType: ['Improvement Project Solution'], + language: ['English'], + keywords: ['Improvement Project'], + concepts: [], + themes: [], + flattenedThemes: [], + entities: [], + registry: [], + isRubricDriven: false, + enableQuestionReadOut: false, + captureGpsLocationAtQuestionLevel: false, + isAPrivateProgram: false, + allowMultipleAssessemts: false, + isDeleted: false, + pageHeading: 'Domains', + minNoOfSubmissionsRequired: 1, + rootOrganisations: [], + createdFor: [], + submissionLevel: 'USER', + availableForPrivateConsumption: true, + parentEntityKey: null, + deleted: false, + programExternalId: 'Testing_for_prTGCEBGFFRYVBDFGJ7DGDGF12SDFGHJ345CVBNMDRGYY', + entityType: 'school', + externalId: 'PROJ19099023DGHG789SDASDFGHR4567-1760447411369-PROJECT-SOLUTION', + name: 'pro with obsasatask oct 8 facilitator only 2nd', + description: 'To construct a wired car using a DPDT switch.', + isReusable: false, + startDate: new Date('2025-09-09T00:00:00.000Z'), + endDate: new Date('2026-09-09T18:29:59.000Z'), + subType: 'improvementProject', + type: 'improvementProject', + programId: new ObjectId('68ee4b79fb9bee08b93b6d34'), + programName: 'custom observation as a task check on oct 14th facilitator', + programDescription: 'custom observation as a task check on oct 14th facilitator', + status: 'active', + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-10-14T13:11:17.993Z'), + createdAt: new Date('2025-10-14T13:10:11.897Z'), + __v: 0, + scope: { + professional_role: ['68876746b19aea00144c2af9'], + professional_subroles: ['688767deb19aea00144c2b08'], + organizations: ['default_code'], + state: ['6852c86c7248c20014b38a4d'], + district: ['6852c8ae7248c20014b38a57'], + block: ['ALL'], + cluster: ['ALL'], + school: ['ALL'], + }, + projectTemplateId: new ObjectId('68ee4bb3fb9bee08b93b6d70'), + updatedBy: '1', + author: '1', + creator: 'Nevil', + certificateTemplateId: new ObjectId('68ee4bf5fb9bee08b93b6d97'), + link: 'f8a8e9ba397a29cf75ad5057db6cb7f9', + }, + { + _id: new ObjectId('68e8c635201642091e014914'), + resourceType: ['Improvement Project Solution'], + language: ['English'], + keywords: ['Improvement Project'], + concepts: [], + themes: [], + flattenedThemes: [], + entities: [], + registry: [], + isRubricDriven: false, + enableQuestionReadOut: false, + captureGpsLocationAtQuestionLevel: false, + isAPrivateProgram: false, + allowMultipleAssessemts: false, + isDeleted: false, + pageHeading: 'Domains', + minNoOfSubmissionsRequired: 1, + rootOrganisations: [], + createdFor: [], + submissionLevel: 'USER', + availableForPrivateConsumption: true, + parentEntityKey: null, + deleted: false, + programExternalId: 'Testing_for_prTGCEBGFFRYVBDFGJ7DGDGF123456', + entityType: 'school', + externalId: 'PROJ190909764HJHF123FGHHcvvbgd-1760085557008-PROJECT-SOLUTION', + name: 'Testing Project For LED IMP facilitator only', + description: 'To construct a wired car using a DPDT switch.', + isReusable: false, + startDate: new Date('2025-09-09T00:00:00.000Z'), + endDate: new Date('2026-09-09T18:29:59.000Z'), + subType: 'improvementProject', + type: 'improvementProject', + programId: new ObjectId('68e8c284201642091e0148c1'), + programName: 'custom observation as a task check on oct 10th facilitator', + programDescription: 'custom observation as a task check on oct 10th facilitator', + status: 'active', + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-10-10T08:40:22.617Z'), + createdAt: new Date('2025-10-10T08:39:17.519Z'), + __v: 0, + scope: { + professional_role: ['68876746b19aea00144c2af9'], + professional_subroles: ['688767deb19aea00144c2b08'], + organizations: ['default_code'], + state: ['6852c86c7248c20014b38a4d'], + district: ['6852c8ae7248c20014b38a57'], + block: ['ALL'], + cluster: ['ALL'], + school: ['ALL'], + }, + projectTemplateId: new ObjectId('68e8c635201642091e01491c'), + updatedBy: '1', + author: '1', + creator: 'Nevil', + certificateTemplateId: new ObjectId('68e8c676201642091e014943'), + link: '178ac1fdff5b367ef3335ce0e1665a6c', + }, + { + _id: new ObjectId('68c98d9538aee0086ee61096'), + resourceType: ['Improvement Project Solution'], + language: ['English'], + keywords: ['Improvement Project'], + concepts: [], + themes: [], + flattenedThemes: [], + entities: [], + registry: [], + isRubricDriven: false, + enableQuestionReadOut: false, + captureGpsLocationAtQuestionLevel: false, + isAPrivateProgram: false, + allowMultipleAssessemts: false, + isDeleted: false, + pageHeading: 'Domains', + minNoOfSubmissionsRequired: 1, + rootOrganisations: [], + createdFor: [], + submissionLevel: 'USER', + availableForPrivateConsumption: true, + parentEntityKey: null, + deleted: false, + programExternalId: 'ProgramTestKey1', + entityType: 'school', + externalId: 'ProjectIdtestKey1-1758039445176-PROJECT-SOLUTION', + name: 'Project name sep 16 9 30', + description: + 'Gathers insights from teachers regarding available resources, training needs, and challenges faced in classrooms.', + isReusable: false, + startDate: new Date('2025-07-29T18:30:00.000Z'), + endDate: new Date('2026-01-30T18:29:59.000Z'), + subType: 'improvementProject', + type: 'improvementProject', + programId: new ObjectId('68c98d8f38aee0086ee61070'), + programName: 'Program name is sep 16 9 30', + programDescription: 'Description of the Program', + status: 'active', + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-09-16T16:17:25.599Z'), + createdAt: new Date('2025-09-16T16:17:25.472Z'), + __v: 0, + scope: { + professional_role: ['ALL'], + professional_subroles: ['ALL'], + organizations: ['default_code'], + state: ['ALL'], + district: ['ALL'], + block: ['ALL'], + cluster: ['ALL'], + school: ['ALL'], + }, + projectTemplateId: new ObjectId('68c98d9538aee0086ee6109e'), + }, + { + _id: new ObjectId('68d3b9a72ba17cc3cb238821'), + resourceType: ['Improvement Project Solution'], + language: ['English'], + keywords: ['Improvement Project'], + concepts: [], + themes: [], + flattenedThemes: [], + entities: [], + registry: [], + isRubricDriven: false, + enableQuestionReadOut: false, + captureGpsLocationAtQuestionLevel: false, + isAPrivateProgram: false, + allowMultipleAssessemts: false, + isDeleted: false, + pageHeading: 'Domains', + minNoOfSubmissionsRequired: 1, + rootOrganisations: [], + createdFor: [], + submissionLevel: 'USER', + availableForPrivateConsumption: true, + parentEntityKey: null, + deleted: false, + programExternalId: 'SUP_as_a_task_test_sept_24_1500', + entityType: 'school', + externalId: 'DPDTSCH012025-1758706081315-PROJECT-SOLUTION', + name: 'project sup test with obs or sur tasks sep 23 1520', + description: 'To construct a wired car using a DPDT switch.', + isReusable: false, + startDate: new Date('2025-07-29T18:30:00.000Z'), + endDate: new Date('2025-12-30T18:29:59.000Z'), + subType: 'improvementProject', + type: 'improvementProject', + programId: new ObjectId('68d3b9681e09f9b5b1e0693d'), + programName: 'SUP_as_a_task_test_sept_24_1500', + programDescription: 'This is the description of the program.', + status: 'active', + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-09-24T09:28:19.783Z'), + createdAt: new Date('2025-09-24T09:28:07.900Z'), + __v: 0, + scope: { + professional_role: ['ALL'], + professional_subroles: ['688767deb19aea00144c2b08'], + organizations: ['default_code'], + state: ['ALL'], + district: ['ALL', '6852c8ae7248c20014b38a57'], + block: ['ALL'], + cluster: ['ALL'], + school: ['ALL'], + }, + projectTemplateId: new ObjectId('68d3b9a92ba17cc3cb238829'), + updatedBy: '1', + author: '1', + creator: 'Nevil', + link: 'a0acc357edbcf3287e9767d20a7d9f12', + }, +] + +let programData = [ + { + _id: new ObjectId('68ee4b79fb9bee08b93b6d34'), + resourceType: ['program'], + language: ['English'], + keywords: ['CBSE', 'SQAA'], + concepts: [], + components: [ + { + _id: new ObjectId('68ee4bb3fb9bee08b93b6d68'), + order: 1, + }, + ], + isAPrivateProgram: false, + isDeleted: false, + requestForPIIConsent: true, + rootOrganisations: [], + createdFor: [], + deleted: false, + status: 'active', + owner: '1', + createdBy: '1', + updatedBy: '1', + externalId: 'Testing_for_prTGCEBGFFRYVBDFGJ7DGDGF12SDFGHJ345CVBNMDRGYY', + name: 'custom observation as a task check on oct 14th facilitator', + description: 'custom observation as a task check on oct 14th facilitator', + startDate: new Date('2025-09-08T18:30:00.000Z'), + endDate: new Date('2026-09-09T18:29:59.000Z'), + imageCompression: { + quality: 10, + }, + metaInformation: { + state: ['Tripura'], + recommendedFor: ['Facilitator'], + }, + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-10-14T13:18:46.936Z'), + createdAt: new Date('2025-10-14T13:09:13.649Z'), + __v: 0, + scope: { + professional_role: ['68876746b19aea00144c2af9'], + professional_subroles: ['688767deb19aea00144c2b08'], + organizations: ['default_code'], + state: ['6852c86c7248c20014b38a4d'], + district: ['6852c8ae7248c20014b38a57'], + block: ['ALL'], + cluster: ['ALL'], + school: ['ALL'], + }, + }, + { + _id: new ObjectId('68e8c284201642091e0148c1'), + resourceType: ['program'], + language: ['English'], + keywords: ['CBSE', 'SQAA'], + concepts: [], + components: [ + { + _id: new ObjectId('68e8c635201642091e014914'), + order: 1, + }, + ], + isAPrivateProgram: false, + isDeleted: false, + requestForPIIConsent: true, + rootOrganisations: [], + createdFor: [], + deleted: false, + status: 'active', + owner: '1', + createdBy: '1', + updatedBy: '1', + externalId: 'Testing_for_prTGCEBGFFRYVBDFGJ7DGDGF123456', + name: 'custom observation as a task check on oct 10th facilitator', + description: 'custom observation as a task check on oct 10th facilitator', + startDate: new Date('2025-09-08T18:30:00.000Z'), + endDate: new Date('2026-09-09T18:29:59.000Z'), + imageCompression: { + quality: 10, + }, + metaInformation: { + state: ['Tripura'], + recommendedFor: ['Facilitator'], + }, + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-10-10T08:44:35.535Z'), + createdAt: new Date('2025-10-10T08:23:32.295Z'), + __v: 0, + scope: { + professional_role: ['68876746b19aea00144c2af9'], + professional_subroles: ['688767deb19aea00144c2b08'], + organizations: ['default_code'], + state: ['6852c86c7248c20014b38a4d'], + district: ['6852c8ae7248c20014b38a57'], + block: ['ALL'], + cluster: ['ALL'], + school: ['ALL'], + }, + }, + { + _id: new ObjectId('68c98d8f38aee0086ee61070'), + resourceType: ['program'], + language: ['English'], + keywords: [], + concepts: [], + components: [ + { + _id: new ObjectId('68c98d9538aee0086ee61096'), + order: 1, + }, + ], + isAPrivateProgram: false, + isDeleted: false, + requestForPIIConsent: true, + rootOrganisations: [], + createdFor: [], + deleted: false, + status: 'active', + owner: '1', + createdBy: '1', + updatedBy: '1', + externalId: 'ProgramTestKey1', + name: 'Program name is sep 16 9 30', + description: 'Description of the Program', + metaInformation: { + state: ['Tripura'], + recommendedFor: ['functionaries-officials', 'teacher-educators-coordinators'], + }, + imageCompression: { + quality: 10, + }, + startDate: new Date('2025-07-29T18:30:00.000Z'), + endDate: new Date('2026-01-30T18:29:59.000Z'), + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-09-16T17:06:14.752Z'), + createdAt: new Date('2025-09-16T16:17:19.239Z'), + __v: 0, + scope: { + professional_role: ['68876746b19aea00144c2af9'], + professional_subroles: ['688767deb19aea00144c2b08'], + organizations: ['default_code'], + state: ['6852c86c7248c20014b38a4d'], + district: ['6852c8ae7248c20014b38a57'], + block: ['ALL'], + cluster: ['ALL'], + school: ['ALL'], + }, + }, + { + _id: new ObjectId('68d3b9681e09f9b5b1e0693d'), + resourceType: ['program'], + language: ['English'], + keywords: [], + concepts: [], + components: [ + { + _id: new ObjectId('68d3b9a72ba17cc3cb238821'), + order: 1, + }, + ], + isAPrivateProgram: false, + isDeleted: false, + requestForPIIConsent: true, + rootOrganisations: [], + createdFor: [], + deleted: false, + status: 'active', + owner: '1', + createdBy: '1', + updatedBy: '1', + externalId: 'SUP_as_a_task_test_sept_24_1500', + name: 'SUP_as_a_task_test_sept_24_1500 oct 3', + description: 'This is the description of the program.', + metaInformation: { + state: ['Tripura'], + recommendedFor: ['functionaries-officials'], + }, + imageCompression: { + quality: 10, + }, + startDate: new Date('2025-07-29T18:30:00.000Z'), + endDate: new Date('2025-12-30T18:29:59.000Z'), + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-10-03T09:20:39.907Z'), + createdAt: new Date('2025-09-24T09:27:04.322Z'), + __v: 0, + scope: { + professional_role: ['68876746b19aea00144c2af9'], + professional_subroles: ['688767deb19aea00144c2b08'], + organizations: ['default_code'], + state: ['6852c86c7248c20014b38a4d'], + district: ['6852c8ae7248c20014b38a57'], + block: ['ALL'], + cluster: ['ALL'], + school: ['ALL'], + }, + }, +] + +let projectTemplatesData = [ + { + _id: new ObjectId('68ee4bb3fb9bee08b93b6d70'), + description: 'To construct a wired car using a DPDT switch.', + concepts: [''], + keywords: ['Science, Activity Based Learning, STEM Education, STEM Lab, DPDT Switch Car'], + isDeleted: false, + recommendedFor: ['Learner'], + tasks: [ + new ObjectId('68ee4bb4fb9bee08b93b6d7a'), + new ObjectId('68ee4bb4fb9bee08b93b6d7e'), + new ObjectId('68ee4bb4fb9bee08b93b6d82'), + new ObjectId('68ee4bb4fb9bee08b93b6d86'), + ], + createdBy: '1', + updatedBy: '1', + learningResources: [], + isReusable: false, + taskSequence: [ + 'DPDTSC-HandBook-1-2025-Task1-1760447411369-1760447411984', + 'DPDTSC-HandBook-1-2025-Task2-1760447411369', + 'DPDTSC-HandBook-1-2025-Task3-1760447411369', + 'DPDTSC-HandBook-1-2025-Task4-1760447411369', + 'DPDTSC-HandBook-1-2025-Task5-1760447411369', + ], + averageRating: 0, + noOfRatings: 0, + ratings: { + 1: 0, + 2: 0, + 3: 0, + 4: 0, + 5: 0, + }, + importCount: 0, + evidences: [], + isPrivate: false, + hasSpotlight: false, + hasStory: false, + text: [], + visibility: 'CURRENT', + visibleToOrganizations: ['default_code'], + deleted: false, + title: 'pro with obsasatask oct 8 facilitator only 2nd', + externalId: 'PROJ19099023DGHG789SDASDFGHR4567-1760447411369_IMPORTED', + categories: [ + { + _id: new ObjectId('685ae6a0cb7c7200145dadae'), + externalId: 'teachers', + name: 'teachers', + }, + ], + entityType: '', + taskCreationForm: '', + durationInDays: 365, + metaInformation: { + testimonials: [], + goal: 'TEMP', + rationale: '', + primaryAudience: '', + duration: '1 year', + successIndicators: '', + risks: '', + approaches: '', + }, + status: 'published', + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-10-14T13:11:17.899Z'), + createdAt: new Date('2025-10-14T13:10:11.630Z'), + __v: 0, + solutionId: new ObjectId('68ee4bb3fb9bee08b93b6d68'), + solutionExternalId: 'PROJ19099023DGHG789SDASDFGHR4567-1760447411369-PROJECT-SOLUTION', + programId: new ObjectId('68ee4b79fb9bee08b93b6d34'), + programExternalId: 'Testing_for_prTGCEBGFFRYVBDFGJ7DGDGF12SDFGHJ345CVBNMDRGYY', + parentTemplateId: new ObjectId('68ee4bb3fb9bee08b93b6d4c'), + certificateTemplateId: new ObjectId('68ee4bf5fb9bee08b93b6d97'), + }, + { + _id: new ObjectId('68e8c635201642091e01491c'), + description: 'To construct a wired car using a DPDT switch.', + concepts: [''], + keywords: ['Science, Activity Based Learning, STEM Education, STEM Lab, DPDT Switch Car'], + isDeleted: false, + recommendedFor: ['Learner'], + tasks: [ + new ObjectId('68e8c635201642091e014926'), + new ObjectId('68e8c635201642091e01492a'), + new ObjectId('68e8c635201642091e01492e'), + new ObjectId('68e8c635201642091e014932'), + ], + createdBy: '1', + updatedBy: '1', + learningResources: [], + isReusable: false, + taskSequence: [ + 'DPDTSC-HandBook-1-2025-Task1-1760085557008-1760085557606', + 'DPDTSC-HandBook-1-2025-Task2-1760085557008', + 'DPDTSC-HandBook-1-2025-Task3-1760085557008', + 'DPDTSC-HandBook-1-2025-Task4-1760085557008', + 'DPDTSC-HandBook-1-2025-Task5-1760085557008', + ], + averageRating: 0, + noOfRatings: 0, + ratings: { + 1: 0, + 2: 0, + 3: 0, + 4: 0, + 5: 0, + }, + importCount: 0, + evidences: [], + isPrivate: false, + hasSpotlight: false, + hasStory: false, + text: [], + visibility: 'CURRENT', + visibleToOrganizations: ['default_code'], + deleted: false, + title: 'Testing Project For LED IMP facilitator only', + externalId: 'PROJ190909764HJHF123FGHHcvvbgd-1760085557008_IMPORTED', + categories: [ + { + _id: new ObjectId('685ae6a0cb7c7200145dadae'), + externalId: 'teachers', + name: 'teachers', + }, + ], + entityType: '', + taskCreationForm: '', + durationInDays: 365, + metaInformation: { + testimonials: [], + goal: 'TEMP', + rationale: '', + primaryAudience: '', + duration: '1 year', + successIndicators: '', + risks: '', + approaches: '', + }, + status: 'published', + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-10-10T08:40:22.544Z'), + createdAt: new Date('2025-10-10T08:39:17.260Z'), + __v: 0, + solutionId: new ObjectId('68e8c635201642091e014914'), + solutionExternalId: 'PROJ190909764HJHF123FGHHcvvbgd-1760085557008-PROJECT-SOLUTION', + programId: new ObjectId('68e8c284201642091e0148c1'), + programExternalId: 'Testing_for_prTGCEBGFFRYVBDFGJ7DGDGF123456', + parentTemplateId: new ObjectId('68e8c635201642091e0148f8'), + certificateTemplateId: new ObjectId('68e8c676201642091e014943'), + }, + { + _id: new ObjectId('68c98d9538aee0086ee6109e'), + description: + 'Gathers insights from teachers regarding available resources, training needs, and challenges faced in classrooms.', + concepts: [''], + keywords: ['Science, Activity Based Learning, STEM Education, STEM Lab, DPDT Switch Car'], + isDeleted: false, + recommendedFor: [''], + tasks: [ + new ObjectId('68c98d9538aee0086ee610a2'), + new ObjectId('68c98d9538aee0086ee610a6'), + new ObjectId('68c98d9538aee0086ee610aa'), + ], + createdBy: '1', + updatedBy: '1', + learningResources: [], + isReusable: false, + taskSequence: [ + 'Task1-1758039445176', + 'Task2-1758039445176', + 'Task3-1758039445176', + 'Task4-1758039445176', + 'Task5-1758039445176', + ], + averageRating: 0, + noOfRatings: 0, + ratings: { + 1: 0, + 2: 0, + 3: 0, + 4: 0, + 5: 0, + }, + importCount: 0, + evidences: [], + isPrivate: false, + hasSpotlight: false, + hasStory: false, + text: [], + deleted: false, + title: 'Project name sep 16 9 30', + externalId: 'ProjectIdtestKey1-1758039445176_IMPORTED', + categories: [ + { + _id: new ObjectId('685ae6a0cb7c7200145dadae'), + externalId: 'teachers', + name: 'teachers', + }, + ], + entityType: '', + taskCreationForm: '', + durationInDays: 365, + metaInformation: { + testimonials: [], + goal: 'TEMP', + rationale: '', + primaryAudience: '', + duration: '1 year', + successIndicators: '', + risks: '', + approaches: '', + }, + status: 'published', + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-09-16T16:17:25.596Z'), + createdAt: new Date('2025-09-16T16:17:25.301Z'), + __v: 0, + solutionId: new ObjectId('68c98d9538aee0086ee61096'), + solutionExternalId: 'ProjectIdtestKey1-1758039445176-PROJECT-SOLUTION', + programId: new ObjectId('68c98d8f38aee0086ee61070'), + programExternalId: 'ProgramTestKey1', + parentTemplateId: new ObjectId('68c98d9538aee0086ee6107a'), + }, + { + _id: new ObjectId('68d3b9a92ba17cc3cb238829'), + description: 'To construct a wired car using a DPDT switch.', + concepts: [''], + keywords: ['Science, Activity Based Learning, STEM Education, STEM Lab, DPDT Switch Car'], + isDeleted: false, + recommendedFor: ['Learner'], + tasks: [ + new ObjectId('68d3b9ad2ba17cc3cb238837'), + new ObjectId('68d3b9ad2ba17cc3cb23883b'), + new ObjectId('68d3b9ae2ba17cc3cb23883f'), + ], + createdBy: '1', + updatedBy: '1', + learningResources: [], + isReusable: false, + taskSequence: [ + 'DPDTSC-HandBook-1/2025-Task1-1758706081315-1758706089304', + 'DPDTSC-HandBook-1/2025-Task2-1758706081315', + 'DPDTSC-HandBook-1/2025-Task3-1758706081315', + 'DPDTSC-HandBook-1/2025-Task4-1758706081315', + 'DPDTSC-HandBook-1/2025-Task5-1758706081315', + ], + averageRating: 0, + noOfRatings: 0, + ratings: { + 1: 0, + 2: 0, + 3: 0, + 4: 0, + 5: 0, + }, + importCount: 0, + evidences: [], + isPrivate: false, + hasSpotlight: false, + hasStory: false, + text: [], + deleted: false, + title: 'project sup test with obs or sur tasks sep 23 1520', + externalId: 'DPDTSCH012025-1758706081315_IMPORTED', + categories: [ + { + _id: new ObjectId('685ae6a0cb7c7200145dadae'), + externalId: 'teachers', + name: 'teachers', + }, + ], + entityType: '', + taskCreationForm: '', + durationInDays: 365, + metaInformation: { + testimonials: [], + goal: 'TEMP', + rationale: '', + primaryAudience: '', + duration: '1 year', + successIndicators: '', + risks: '', + approaches: '', + }, + status: 'published', + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-09-24T09:28:14.561Z'), + createdAt: new Date('2025-09-24T09:28:03.404Z'), + __v: 0, + solutionId: new ObjectId('68d3b9a72ba17cc3cb238821'), + solutionExternalId: 'DPDTSCH012025-1758706081315-PROJECT-SOLUTION', + programId: new ObjectId('68d3b9681e09f9b5b1e0693d'), + programExternalId: 'SUP_as_a_task_test_sept_24_1500', + parentTemplateId: new ObjectId('68d3b9a32ba17cc3cb238805'), + }, +] + +let projectTemplateTasksData = [ + { + _id: new ObjectId('68ee4bb4fb9bee08b93b6d7a'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [ + { + name: 'Activity Steps (Video)', + link: 'https://youtu.be/MNvM_H9zD3Y?si=BdfslSzCkmDCggih', + app: 'projectService', + id: 'MNvM_H9zD3Y?si=BdfslSzCkmDCggih', + }, + ], + deleted: false, + type: 'content', + projectTemplateId: new ObjectId('68ee4bb3fb9bee08b93b6d70'), + projectTemplateExternalId: 'PROJ19099023DGHG789SDASDFGHR4567-1760447411369_IMPORTED', + name: 'Watch the Activity Video', + externalId: 'DPDTSC-HandBook-1-2025-Task2-1760447411369-1760447412188', + description: '', + sequenceNumber: '2', + tenantId: 'default', + orgId: 'default_code', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '01/08/2025', + endDate: '31/12/2025', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-10-14T13:10:12.192Z'), + createdAt: new Date('2025-10-14T13:10:11.805Z'), + __v: 0, + }, + { + _id: new ObjectId('68ee4bb4fb9bee08b93b6d7e'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [], + deleted: false, + type: 'simple', + projectTemplateId: new ObjectId('68ee4bb3fb9bee08b93b6d70'), + projectTemplateExternalId: 'PROJ19099023DGHG789SDASDFGHR4567-1760447411369_IMPORTED', + name: 'Conduct the Activity with students', + externalId: 'DPDTSC-HandBook-1-2025-Task3-1760447411369-1760447412197', + description: '', + sequenceNumber: '3', + tenantId: 'default', + orgId: 'default_code', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '01/08/2025', + endDate: '31/12/2025', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-10-14T13:10:12.202Z'), + createdAt: new Date('2025-10-14T13:10:11.813Z'), + __v: 0, + }, + { + _id: new ObjectId('68ee4bb4fb9bee08b93b6d82'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [ + { + name: 'learn', + link: 'https://drive.google.com/file/d/1HOaFxlahxEzc5HOeFqVTw3V_yszmHFbZ/view?usp=drive_link', + app: 'projectService', + id: 'view?usp=drive_link', + }, + ], + deleted: false, + type: 'content', + projectTemplateId: new ObjectId('68ee4bb3fb9bee08b93b6d70'), + projectTemplateExternalId: 'PROJ19099023DGHG789SDASDFGHR4567-1760447411369_IMPORTED', + name: 'Conduct the Activity Assessment', + externalId: 'DPDTSC-HandBook-1-2025-Task4-1760447411369-1760447412206', + description: '', + sequenceNumber: '4', + tenantId: 'default', + orgId: 'default_code', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '01/08/2025', + endDate: '31/12/2025', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-10-14T13:10:12.210Z'), + createdAt: new Date('2025-10-14T13:10:11.825Z'), + __v: 0, + }, + { + _id: new ObjectId('68ee4bb4fb9bee08b93b6d86'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [ + { + name: 'walking', + link: 'https://drive.google.com/file/d/1eGLKxFb9BaeroTeIOlXoO8XCxyah7fM9/view?usp=sharing', + app: 'projectService', + id: 'view?usp=sharing', + }, + ], + deleted: false, + type: 'content', + projectTemplateId: new ObjectId('68ee4bb3fb9bee08b93b6d70'), + projectTemplateExternalId: 'PROJ19099023DGHG789SDASDFGHR4567-1760447411369_IMPORTED', + name: "Log into the scanner app and scan the OMR sheets (check that the students' names are appearing on scanning the OMR)", + externalId: 'DPDTSC-HandBook-1-2025-Task5-1760447411369-1760447412214', + description: '', + sequenceNumber: '5', + tenantId: 'default', + orgId: 'default_code', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '01/08/2025', + endDate: '31/12/2025', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-10-14T13:10:12.218Z'), + createdAt: new Date('2025-10-14T13:10:11.833Z'), + __v: 0, + }, + { + _id: new ObjectId('68e8c635201642091e014926'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [ + { + name: 'Activity Steps (Video)', + link: 'https://youtu.be/MNvM_H9zD3Y?si=BdfslSzCkmDCggih', + app: 'projectService', + id: 'MNvM_H9zD3Y?si=BdfslSzCkmDCggih', + }, + ], + deleted: false, + type: 'content', + projectTemplateId: new ObjectId('68e8c635201642091e01491c'), + projectTemplateExternalId: 'PROJ190909764HJHF123FGHHcvvbgd-1760085557008_IMPORTED', + name: 'Watch the Activity Video', + externalId: 'DPDTSC-HandBook-1-2025-Task2-1760085557008-1760085557809', + description: '', + sequenceNumber: '2', + tenantId: 'default', + orgId: 'default_code', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '01/08/2026', + endDate: '31/12/2026', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-10-10T08:39:17.813Z'), + createdAt: new Date('2025-10-10T08:39:17.430Z'), + __v: 0, + }, + { + _id: new ObjectId('68e8c635201642091e01492a'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [], + deleted: false, + type: 'simple', + projectTemplateId: new ObjectId('68e8c635201642091e01491c'), + projectTemplateExternalId: 'PROJ190909764HJHF123FGHHcvvbgd-1760085557008_IMPORTED', + name: 'Conduct the Activity with students', + externalId: 'DPDTSC-HandBook-1-2025-Task3-1760085557008-1760085557818', + description: '', + sequenceNumber: '3', + tenantId: 'default', + orgId: 'default_code', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '01/08/2027', + endDate: '31/12/2027', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-10-10T08:39:17.822Z'), + createdAt: new Date('2025-10-10T08:39:17.439Z'), + __v: 0, + }, + { + _id: new ObjectId('68e8c635201642091e01492e'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [ + { + name: 'learn', + link: 'https://drive.google.com/file/d/1HOaFxlahxEzc5HOeFqVTw3V_yszmHFbZ/view?usp=drive_link', + app: 'projectService', + id: 'view?usp=drive_link', + }, + ], + deleted: false, + type: 'content', + projectTemplateId: new ObjectId('68e8c635201642091e01491c'), + projectTemplateExternalId: 'PROJ190909764HJHF123FGHHcvvbgd-1760085557008_IMPORTED', + name: 'Conduct the Activity Assessment', + externalId: 'DPDTSC-HandBook-1-2025-Task4-1760085557008-1760085557827', + description: '', + sequenceNumber: '4', + tenantId: 'default', + orgId: 'default_code', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '01/08/2028', + endDate: '31/12/2028', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-10-10T08:39:17.831Z'), + createdAt: new Date('2025-10-10T08:39:17.449Z'), + __v: 0, + }, + { + _id: new ObjectId('68e8c635201642091e014932'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [ + { + name: 'walking', + link: 'https://drive.google.com/file/d/1eGLKxFb9BaeroTeIOlXoO8XCxyah7fM9/view?usp=sharing', + app: 'projectService', + id: 'view?usp=sharing', + }, + ], + deleted: false, + type: 'content', + projectTemplateId: new ObjectId('68e8c635201642091e01491c'), + projectTemplateExternalId: 'PROJ190909764HJHF123FGHHcvvbgd-1760085557008_IMPORTED', + name: "Log into the scanner app and scan the OMR sheets (check that the students' names are appearing on scanning the OMR)", + externalId: 'DPDTSC-HandBook-1-2025-Task5-1760085557008-1760085557835', + description: '', + sequenceNumber: '5', + tenantId: 'default', + orgId: 'default_code', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '01/08/2029', + endDate: '31/12/2029', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-10-10T08:39:17.840Z'), + createdAt: new Date('2025-10-10T08:39:17.458Z'), + __v: 0, + }, + { + _id: new ObjectId('68c98d9538aee0086ee610a2'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [ + { + name: 'Activity Manual (PDF)', + link: 'https://docs.google.com/document/d/1NCUdj9nPAz82sPV5q2BJ8At31sFJdSDwocrDCh_g7W0/edit?tab=t.0', + app: 'projectService', + id: 'edit?tab=t.0', + }, + ], + deleted: false, + type: 'content', + projectTemplateId: new ObjectId('68c98d9538aee0086ee6109e'), + projectTemplateExternalId: 'ProjectIdtestKey1-1758039445176_IMPORTED', + name: 'Review the Activity Manual', + externalId: 'Task1-1758039445176-1758039445561', + description: '', + sequenceNumber: '1', + tenantId: 'default', + orgId: 'default_code', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '28/07/2025', + endDate: '30/01/2026', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-09-16T16:17:25.564Z'), + createdAt: new Date('2025-09-16T16:17:25.375Z'), + __v: 0, + }, + { + _id: new ObjectId('68c98d9538aee0086ee610a6'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [ + { + name: 'Activity Steps (Video)', + link: 'https://youtu.be/MNvM_H9zD3Y?si=BdfslSzCkmDCggih', + app: 'projectService', + id: 'MNvM_H9zD3Y?si=BdfslSzCkmDCggih', + }, + ], + deleted: false, + type: 'content', + projectTemplateId: new ObjectId('68c98d9538aee0086ee6109e'), + projectTemplateExternalId: 'ProjectIdtestKey1-1758039445176_IMPORTED', + name: 'Watch the Activity Video', + externalId: 'Task2-1758039445176-1758039445567', + description: '', + sequenceNumber: '2', + tenantId: 'default', + orgId: 'default_code', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '29/07/2025', + endDate: '30/01/2027', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-09-16T16:17:25.571Z'), + createdAt: new Date('2025-09-16T16:17:25.386Z'), + __v: 0, + }, + { + _id: new ObjectId('68c98d9538aee0086ee610aa'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [], + deleted: false, + type: 'simple', + projectTemplateId: new ObjectId('68c98d9538aee0086ee6109e'), + projectTemplateExternalId: 'ProjectIdtestKey1-1758039445176_IMPORTED', + name: 'Conduct the Activity with students', + externalId: 'Task3-1758039445176-1758039445575', + description: '', + sequenceNumber: '3', + tenantId: 'default', + orgId: 'default_code', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '30/07/2025', + endDate: '30/01/2028', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-09-16T16:17:25.579Z'), + createdAt: new Date('2025-09-16T16:17:25.396Z'), + __v: 0, + }, + { + _id: new ObjectId('68d3b9ad2ba17cc3cb238837'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [], + deleted: false, + type: 'simple', + projectTemplateId: new ObjectId('68d3b9a92ba17cc3cb238829'), + projectTemplateExternalId: 'DPDTSCH012025-1758706081315_IMPORTED', + name: 'Conduct the Activity with students', + externalId: 'DPDTSC-HandBook-1/2025-Task3-1758706081315-1758706093343', + description: '', + sequenceNumber: '3', + tenantId: 'default', + orgId: 'default_code', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '30/07/2025', + endDate: '30/12/2025', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-09-24T09:28:13.534Z'), + createdAt: new Date('2025-09-24T09:28:06.227Z'), + __v: 0, + }, + { + _id: new ObjectId('68d3b9ad2ba17cc3cb23883b'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [ + { + name: 'Activity Assessment (PDF)', + link: 'https://sunbirdsaaspublic.blob.core.windows.net/content/content/assets/do_2143687931908833281255/dpdt-switch-car.pdf', + app: 'projectService', + id: 'dpdt-switch-car.pdf', + }, + { + name: 'Activity OMR Sheet (PDF)', + link: 'https://drive.google.com/file/d/1-f7Tg8bmZd-xlcxlhfOcf2ZO6vpc6qkH/view', + app: 'projectService', + id: 'view', + }, + ], + deleted: false, + type: 'content', + projectTemplateId: new ObjectId('68d3b9a92ba17cc3cb238829'), + projectTemplateExternalId: 'DPDTSCH012025-1758706081315_IMPORTED', + name: 'Conduct the Activity Assessment', + externalId: 'DPDTSC-HandBook-1/2025-Task4-1758706081315-1758706093849', + description: '', + sequenceNumber: '4', + tenantId: 'default', + orgId: 'default_code', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '30/07/2025', + endDate: '30/12/2025', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-09-24T09:28:13.967Z'), + createdAt: new Date('2025-09-24T09:28:06.583Z'), + __v: 0, + }, + { + _id: new ObjectId('68d3b9ae2ba17cc3cb23883f'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [], + deleted: false, + type: 'simple', + projectTemplateId: new ObjectId('68d3b9a92ba17cc3cb238829'), + projectTemplateExternalId: 'DPDTSCH012025-1758706081315_IMPORTED', + name: "Log into the scanner app and scan the OMR sheets (check that the students' names are appearing on scanning the OMR)", + externalId: 'DPDTSC-HandBook-1/2025-Task5-1758706081315-1758706094241', + description: '', + sequenceNumber: '5', + tenantId: 'default', + orgId: 'default_code', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '30/07/2025', + endDate: '30/12/2025', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-09-24T09:28:14.374Z'), + createdAt: new Date('2025-09-24T09:28:07.083Z'), + __v: 0, + }, +] + +let certificateTemplatesData = [ + { + _id: new ObjectId('68ee4bf5fb9bee08b93b6d97'), + status: 'active', + deleted: false, + criteria: { + validationText: 'Complete validation message', + expression: 'C1&&(C3||C4||C5||C6)', + conditions: { + C1: { + validationText: 'Submit your project.', + expression: 'C1', + conditions: { + C1: { + scope: 'project', + key: 'status', + operator: '==', + value: 'submitted', + }, + }, + }, + C3: { + expression: 'C1', + conditions: { + C1: { + scope: 'task', + key: 'attachments', + function: 'count', + filter: { + key: 'type', + value: 'all', + }, + operator: '>=', + value: 2, + taskDetails: ['68ee4bb3fb9bee08b93b6d53'], + }, + }, + validationText: 'Add 2 evidence for any task', + }, + C4: { + expression: 'C1', + conditions: { + C1: { + scope: 'task', + key: 'attachments', + function: 'count', + filter: { + key: 'type', + value: 'all', + }, + operator: '>=', + value: 2, + taskDetails: ['68ee4bb3fb9bee08b93b6d57'], + }, + }, + }, + C5: { + expression: 'C1', + conditions: { + C1: { + scope: 'task', + key: 'attachments', + function: 'count', + filter: { + key: 'type', + value: 'all', + }, + operator: '>=', + value: 2, + taskDetails: ['68ee4bb3fb9bee08b93b6d5b'], + }, + }, + }, + C6: { + expression: 'C1', + conditions: { + C1: { + scope: 'task', + key: 'attachments', + function: 'count', + filter: { + key: 'type', + value: 'all', + }, + operator: '>=', + value: 2, + taskDetails: ['68ee4bb3fb9bee08b93b6d63'], + }, + }, + }, + }, + }, + issuer: { + name: 'default_code', + }, + solutionId: new ObjectId('68ee4bb3fb9bee08b93b6d68'), + programId: new ObjectId('68ee4b79fb9bee08b93b6d34'), + baseTemplateId: new ObjectId('68c008dfd113c30c11f1aca2'), + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-10-14T13:11:17.793Z'), + createdAt: new Date('2025-10-14T13:11:17.628Z'), + __v: 0, + templateUrl: + 'certificate/aa8529e3-6754-4432-a669-72b73d358e2f/1/7042c718-a1bf-43e3-b296-586de247a440/68ee4bf5fb9bee08b93b6d97/14-9-2025-1760447477692_Dowloaded.svg', + }, + { + _id: new ObjectId('68e8c676201642091e014943'), + status: 'active', + deleted: false, + criteria: { + validationText: 'Complete validation message', + expression: 'C1&&(C3||C4||C5||C6||C7)', + conditions: { + C1: { + validationText: 'Submit your project.', + expression: 'C1', + conditions: { + C1: { + scope: 'project', + key: 'status', + operator: '==', + value: 'submitted', + }, + }, + }, + C3: { + expression: 'C1', + conditions: { + C1: { + scope: 'task', + key: 'attachments', + function: 'count', + filter: { + key: 'type', + value: 'all', + }, + operator: '>=', + value: 2, + taskDetails: ['68e8c635201642091e0148ff'], + }, + }, + validationText: 'Add 2 evidence for any task', + }, + C4: { + expression: 'C1', + conditions: { + C1: { + scope: 'task', + key: 'attachments', + function: 'count', + filter: { + key: 'type', + value: 'all', + }, + operator: '>=', + value: 2, + taskDetails: ['68e8c635201642091e014903'], + }, + }, + }, + C5: { + expression: 'C1', + conditions: { + C1: { + scope: 'task', + key: 'attachments', + function: 'count', + filter: { + key: 'type', + value: 'all', + }, + operator: '>=', + value: 2, + taskDetails: ['68e8c635201642091e014907'], + }, + }, + }, + C6: { + expression: 'C1', + conditions: { + C1: { + scope: 'task', + key: 'attachments', + function: 'count', + filter: { + key: 'type', + value: 'all', + }, + operator: '>=', + value: 2, + taskDetails: ['68e8c635201642091e01490b'], + }, + }, + }, + C7: { + expression: 'C1', + conditions: { + C1: { + scope: 'task', + key: 'attachments', + function: 'count', + filter: { + key: 'type', + value: 'all', + }, + operator: '>=', + value: 2, + taskDetails: ['68e8c635201642091e01490f'], + }, + }, + }, + }, + }, + issuer: { + name: 'default_code', + }, + solutionId: new ObjectId('68e8c635201642091e014914'), + programId: new ObjectId('68e8c284201642091e0148c1'), + baseTemplateId: new ObjectId('68c008dfd113c30c11f1aca2'), + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-10-10T08:40:22.454Z'), + createdAt: new Date('2025-10-10T08:40:22.298Z'), + __v: 0, + templateUrl: + 'certificate/0bcc856d-0145-448c-8188-300ca3f3250e/1/58cfdf3c-f1a2-4a94-bbb5-21dcd7286913/68e8c676201642091e014943/10-9-2025-1760085622353_Dowloaded.svg', + }, +] + +let certificateBaseTemplatesData = [ + { + _id: new ObjectId('68c008dfd113c30c11f1aca2'), + deleted: false, + code: 'onelogo_onesign', + name: 'onelogo_onesign', + url: 'certificate/ef2058a1-92e0-4a63-af5f-b712f992bf90/1/81fc35ad-9519-4ec4-87bb-6cef64b940f0/9-8-2025-1757415647754_sl_s1l1.svg', + tenantId: 'default', + orgId: 'slorg', + updatedAt: new Date('2025-09-09T11:00:47.878Z'), + createdAt: new Date('2025-09-09T11:00:47.878Z'), + __v: 0, + }, +] + +let projectCategoriesData = [ + { + _id: new ObjectId('685ae6a0cb7c7200145dadae'), + createdBy: 'SYSTEM', + updatedBy: 'SYSTEM', + isDeleted: false, + isVisible: true, + status: 'active', + icon: '', + noOfProjects: 361, + evidences: [], + deleted: false, + name: 'teachers', + externalId: 'teachers', + tenantId: 'default', + orgId: 'slorg', + updatedAt: new Date('2025-06-24T17:55:44.720Z'), + createdAt: new Date('2025-06-24T17:55:44.720Z'), + __v: 0, + }, +] +module.exports = { + solutionData, + programData, + projectTemplatesData, + projectTemplateTasksData, + certificateTemplatesData, + certificateBaseTemplatesData, + projectCategoriesData, +} From 4d18a43495219b02f7d6155b85fcfdbf8fea037d Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Thu, 4 Dec 2025 12:26:49 +0530 Subject: [PATCH 28/63] Add script for inserting sample data into entity and project databases --- .../scp/ubuntu/entity-project-sample-data.sh | 813 ++++++++++++++++++ 1 file changed, 813 insertions(+) create mode 100644 documentation/3.4.0/native/scripts/scp/ubuntu/entity-project-sample-data.sh diff --git a/documentation/3.4.0/native/scripts/scp/ubuntu/entity-project-sample-data.sh b/documentation/3.4.0/native/scripts/scp/ubuntu/entity-project-sample-data.sh new file mode 100644 index 00000000..43b77a80 --- /dev/null +++ b/documentation/3.4.0/native/scripts/scp/ubuntu/entity-project-sample-data.sh @@ -0,0 +1,813 @@ +#!/bin/bash + +clean_object_id() { + local object_id="$1" + + # Use parameter expansion to remove unwanted characters + cleaned_id="${object_id//ObjectId(/}" + cleaned_id="${cleaned_id//)/}" + cleaned_id="${cleaned_id//\'/}" + + echo "$cleaned_id" +} + + +MONGO_HOST=localhost +MONGO_PORT=27017 + +# Entity database details +ENTITY_SERVICE_DB_NAME="entity" +ENTITY_TYPE_COLLECTION="entityTypes" +ENTITIES_COLLECTION="entities" + +ENTITY_TYPE_DOCUMENT=$(cat < 0) { + print('Entity document updated successfully'); + } else { + throw new Error('Update failed'); + } +" + + + + +# Project database details +PROJECT_DB_NAME="elevate-project" +PROJECT_CATEGORY_COLLECTION="projectCategories" + +PROJECT_CATEGORY_DOCUMENT=$(cat < 0) { + print(result.insertedIds); + } else { + throw new Error('Insert failed'); + } +") + + +# Convert the string into an array +IFS=',' read -r -a PROJECT_CATEGORY_ID_ARRAY <<< "$PROJECT_CATEGORY_ID" +PROJECT_CATEGORY_ID=$(echo "$PROJECT_CATEGORY_ID" | grep -oP "ObjectId\('\K[0-9a-f]{24}" | head -n 1) + +echo "Project Category ID: $PROJECT_CATEGORY_ID" + +PROGRAMS_COLLECTION="programs" + +PROGRAMS_DOCUMENT=$(cat < 0) { + print(result.insertedIds); + } else { + throw new Error('Insert failed'); + } +") + +# Convert the string into an array +IFS=',' read -r -a PROJECT_TEMPLATE_ID_ARRAY <<< "$PROJECT_TEMPLATE_ID" + + +PROJECT_TEMPLATE_ID_1=$(echo "$PROJECT_TEMPLATE_ID" | grep -oP "ObjectId\('\K[0-9a-f]{24}" | head -n 1) +PROJECT_TEMPLATE_ID_2=$(echo "$PROJECT_TEMPLATE_ID" | grep -oP "ObjectId\('\K[0-9a-f]{24}" | sed -n '2p') +PROJECT_TEMPLATE_ID_3=$(echo "$PROJECT_TEMPLATE_ID" | grep -oP "ObjectId\('\K[0-9a-f]{24}" | sed -n '3p') +PROJECT_TEMPLATE_ID_4=$(echo "$PROJECT_TEMPLATE_ID" | grep -oP "ObjectId\('\K[0-9a-f]{24}" | sed -n '4p') + + +PROJECT_TEMPLATE_TASKS_COLLECTION="projectTemplateTasks" +PROJECT_TEMPLATE_TASKS_DOCUMENTS=$(cat < 0) { + print(result.insertedIds); + } else { + throw new Error('Insert failed'); + } +") + +# Convert the string into an array +IFS=',' read -r -a PROJECT_TEMPLATE_TASKS_ID_ARRAY <<< "$PROJECT_TEMPLATE_TASKS_ID" + + +echo $PROJECT_TEMPLATE_TASKS_ID + + +PROJECT_TEMPLATE_TASK_ID_1=$(echo "$PROJECT_TEMPLATE_TASKS_ID" | grep -oP "ObjectId\('\K[0-9a-f]{24}" | head -n 1) +PROJECT_TEMPLATE_TASK_ID_2=$(echo "$PROJECT_TEMPLATE_TASKS_ID" | grep -oP "ObjectId\('\K[0-9a-f]{24}" | sed -n '2p') +PROJECT_TEMPLATE_TASK_ID_3=$(echo "$PROJECT_TEMPLATE_TASKS_ID" | grep -oP "ObjectId\('\K[0-9a-f]{24}" | sed -n '3p') +PROJECT_TEMPLATE_TASK_ID_4=$(echo "$PROJECT_TEMPLATE_TASKS_ID" | grep -oP "ObjectId\('\K[0-9a-f]{24}" | sed -n '4p') + +SOLUTIONS_COLLECTION="solutions" + +SOLUTION_DOCUMENT=$(cat < 0) { + print(result.insertedIds); + } else { + throw new Error('Insert failed'); + } +") + +# Convert the string into an array +IFS=',' read -r -a SOLUTION_ID_ARRAY <<< "$SOLUTION_ID" + +echo $SOLUTION_ID + +SOLUTION_ID_1=$(echo "$SOLUTION_ID" | grep -oP "ObjectId\('\K[0-9a-f]{24}" | head -n 1) +SOLUTION_ID_2=$(echo "$SOLUTION_ID" | grep -oP "ObjectId\('\K[0-9a-f]{24}" | sed -n '2p') +SOLUTION_ID_3=$(echo "$SOLUTION_ID" | grep -oP "ObjectId\('\K[0-9a-f]{24}" | sed -n '3p') +SOLUTION_ID_4=$(echo "$SOLUTION_ID" | grep -oP "ObjectId\('\K[0-9a-f]{24}" | sed -n '4p') + + +mongosh --host "$MONGO_HOST" --port "$MONGO_PORT" --quiet --eval " + var updateResult = db.getSiblingDB('$PROJECT_DB_NAME').$PROJECT_TEMPLATES_COLLECTION.updateOne( + {_id: ObjectId('$PROJECT_TEMPLATE_ID_1')}, + { + \$set: { + 'solutionId': ObjectId('$SOLUTION_ID_1') + }, + \$push: { + 'tasks': ObjectId('$PROJECT_TEMPLATE_TASK_ID_1') + } + } + ); + if (updateResult.matchedCount > 0) { + print('Document updated successfully for ID: $PROJECT_TEMPLATE_ID_1'); // Output the specific ID + } else { + throw new Error('Update failed for ID: $PROJECT_TEMPLATE_ID_1'); + }" + + +mongosh --host "$MONGO_HOST" --port "$MONGO_PORT" --quiet --eval " + var updateResult = db.getSiblingDB('$PROJECT_DB_NAME').$PROJECT_TEMPLATES_COLLECTION.updateOne( + {_id: ObjectId('$PROJECT_TEMPLATE_ID_2')}, + { + \$set: { + 'solutionId': ObjectId('$SOLUTION_ID_2') + }, + \$push: { + 'tasks': ObjectId('$PROJECT_TEMPLATE_TASK_ID_2') + } + } + ); + if (updateResult.matchedCount > 0) { + print('Document updated successfully for ID: $PROJECT_TEMPLATE_ID_2'); // Output the specific ID + } else { + throw new Error('Update failed for ID: $PROJECT_TEMPLATE_ID_2'); + }" + + +mongosh --host "$MONGO_HOST" --port "$MONGO_PORT" --quiet --eval " + var updateResult = db.getSiblingDB('$PROJECT_DB_NAME').$PROJECT_TEMPLATES_COLLECTION.updateOne( + {_id: ObjectId('$PROJECT_TEMPLATE_ID_3')}, + { + \$set: { + 'solutionId': ObjectId('$SOLUTION_ID_3') + }, + \$push: { + 'tasks': ObjectId('$PROJECT_TEMPLATE_TASK_ID_3') + } + } + ); + if (updateResult.matchedCount > 0) { + print('Document updated successfully for ID: $PROJECT_TEMPLATE_ID_3'); // Output the specific ID + } else { + throw new Error('Update failed for ID: $PROJECT_TEMPLATE_ID_3'); + }" + +CONFIGURATIONS_COLLECTION="configurations" + +CONFIGURATIONS_DOCUMENT=$(cat < Date: Thu, 4 Dec 2025 12:28:49 +0530 Subject: [PATCH 29/63] Fix project database name in sample data script --- .../native/scripts/scp/ubuntu/entity-project-sample-data.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/3.4.0/native/scripts/scp/ubuntu/entity-project-sample-data.sh b/documentation/3.4.0/native/scripts/scp/ubuntu/entity-project-sample-data.sh index 43b77a80..9fb56eb7 100644 --- a/documentation/3.4.0/native/scripts/scp/ubuntu/entity-project-sample-data.sh +++ b/documentation/3.4.0/native/scripts/scp/ubuntu/entity-project-sample-data.sh @@ -156,7 +156,7 @@ mongosh --host "$MONGO_HOST" --port "$MONGO_PORT" --quiet --eval " # Project database details -PROJECT_DB_NAME="elevate-project" +PROJECT_DB_NAME="project" PROJECT_CATEGORY_COLLECTION="projectCategories" PROJECT_CATEGORY_DOCUMENT=$(cat < Date: Thu, 4 Dec 2025 14:42:31 +0530 Subject: [PATCH 30/63] Update import forms script URL in README for setup guide --- documentation/3.4.0/setup/native/scp/ubuntu/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/3.4.0/setup/native/scp/ubuntu/README.md b/documentation/3.4.0/setup/native/scp/ubuntu/README.md index b7c5e23d..40741843 100644 --- a/documentation/3.4.0/setup/native/scp/ubuntu/README.md +++ b/documentation/3.4.0/setup/native/scp/ubuntu/README.md @@ -246,7 +246,7 @@ curl -L -o observation-portal/src/assets/env/env.js https://raw.githubuserconten 10. **Insert Forms Data into Database** ``` - curl -s https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/3.4.0/native/scripts/linux/import_forms.js | node + curl -s https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/scripts/linux/import_forms.js | node ``` 11. **Start The Services** From 1acefad784c06a059571edec0b728252bfd6bd81 Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Thu, 4 Dec 2025 14:50:54 +0530 Subject: [PATCH 31/63] Update README to include axios installation step before running import forms script --- .../3.4.0/setup/native/scp/ubuntu/README.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/documentation/3.4.0/setup/native/scp/ubuntu/README.md b/documentation/3.4.0/setup/native/scp/ubuntu/README.md index 40741843..268439de 100644 --- a/documentation/3.4.0/setup/native/scp/ubuntu/README.md +++ b/documentation/3.4.0/setup/native/scp/ubuntu/README.md @@ -245,9 +245,17 @@ curl -L -o observation-portal/src/assets/env/env.js https://raw.githubuserconten 10. **Insert Forms Data into Database** - ``` - curl -s https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/scripts/linux/import_forms.js | node - ``` +If the `axios` package is not available in the current project directory, install it before running the import script: + +```bash +npm install axios +``` + +Then run the import script: + +```bash +curl -s https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/scripts/linux/import_forms.js | node +``` 11. **Start The Services** From 7a6811bb2f9bc6d8574e4a28d1b8386a586c2938 Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Thu, 4 Dec 2025 14:51:56 +0530 Subject: [PATCH 32/63] Fix formatting for axios installation instructions in README --- .../3.4.0/setup/native/scp/ubuntu/README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/documentation/3.4.0/setup/native/scp/ubuntu/README.md b/documentation/3.4.0/setup/native/scp/ubuntu/README.md index 268439de..4b277b9f 100644 --- a/documentation/3.4.0/setup/native/scp/ubuntu/README.md +++ b/documentation/3.4.0/setup/native/scp/ubuntu/README.md @@ -245,17 +245,17 @@ curl -L -o observation-portal/src/assets/env/env.js https://raw.githubuserconten 10. **Insert Forms Data into Database** -If the `axios` package is not available in the current project directory, install it before running the import script: + If the `axios` package is not available in the current project directory, install it before running the import script: -```bash -npm install axios -``` + ```bash + npm install axios + ``` -Then run the import script: + Then run the import script: -```bash -curl -s https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/scripts/linux/import_forms.js | node -``` + ```bash + curl -s https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/scripts/linux/import_forms.js | node + ``` 11. **Start The Services** From ca69fe2508aee9bf570af275a6013d84a271f029 Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Thu, 4 Dec 2025 15:59:10 +0530 Subject: [PATCH 33/63] Update README to correct URL for sample data insertion script and add missing environment variables in notification_env --- documentation/3.4.0/native/envs/scp/notification_env | 4 +++- .../3.4.0/native/scripts/scp/ubuntu/insert_sample_data.sh | 1 + documentation/3.4.0/setup/native/scp/ubuntu/README.md | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/documentation/3.4.0/native/envs/scp/notification_env b/documentation/3.4.0/native/envs/scp/notification_env index ce2f2d64..1360cf0a 100644 --- a/documentation/3.4.0/native/envs/scp/notification_env +++ b/documentation/3.4.0/native/envs/scp/notification_env @@ -11,4 +11,6 @@ KAFKA_GROUP_ID=notification KAFKA_HOST=localhost:9092 KAFKA_TOPIC=develop.notifications SENDGRID_API_KEY=SG.asd9f87a9s8d7f. -SENDGRID_FROM_MAIL=no-reply@some.org \ No newline at end of file +SENDGRID_FROM_MAIL=no-reply@some.org +EMAIL_SERVICE=sendgrid +FROM_EMAIL=no-reply@some.org \ No newline at end of file diff --git a/documentation/3.4.0/native/scripts/scp/ubuntu/insert_sample_data.sh b/documentation/3.4.0/native/scripts/scp/ubuntu/insert_sample_data.sh index a1054c76..713c8079 100644 --- a/documentation/3.4.0/native/scripts/scp/ubuntu/insert_sample_data.sh +++ b/documentation/3.4.0/native/scripts/scp/ubuntu/insert_sample_data.sh @@ -40,3 +40,4 @@ sudo -u postgres psql -p 5432 -d users -c "SELECT nextval('users_id_seq'::regcla sudo -u postgres psql -p 5432 -d users -c "SELECT nextval('users_credentials_id_seq'::regclass) FROM public.users_credentials;" sudo -u postgres psql -p 5432 -d users -c "UPDATE role_permission_mapping SET role_title = 'state_education_officer' WHERE role_title = 'mentor';" sudo -u postgres psql -p 5432 -d users -c "SELECT NULL;" + diff --git a/documentation/3.4.0/setup/native/scp/ubuntu/README.md b/documentation/3.4.0/setup/native/scp/ubuntu/README.md index 4b277b9f..62802793 100644 --- a/documentation/3.4.0/setup/native/scp/ubuntu/README.md +++ b/documentation/3.4.0/setup/native/scp/ubuntu/README.md @@ -310,7 +310,7 @@ In such cases, you can generate sample user accounts using the steps below. This > **Warning:** Use this generator only immediately after the initial system setup and before any normal user accounts are created through the portal. It should not be used under any circumstances thereafter. ``` -curl -o insert_sample_data.sh https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/scripts/stand-alone/ubuntu/insert_sample_data.sh && \ +curl -o insert_sample_data.sh https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/scripts/scp/ubuntu/insert_sample_data.sh && \ chmod +x insert_sample_data.sh && \ ./insert_sample_data.sh ``` From 7746af30e45b5f921843f10dbb5279573a32906f Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Thu, 4 Dec 2025 17:13:48 +0530 Subject: [PATCH 34/63] Enhance insert_sample_data.sh to ensure sequences are up-to-date and insert default entity types --- .../native/scripts/scp/ubuntu/insert_sample_data.sh | 10 +++++++--- documentation/3.4.0/setup/native/scp/ubuntu/README.md | 8 +++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/documentation/3.4.0/native/scripts/scp/ubuntu/insert_sample_data.sh b/documentation/3.4.0/native/scripts/scp/ubuntu/insert_sample_data.sh index 713c8079..ccb4f675 100644 --- a/documentation/3.4.0/native/scripts/scp/ubuntu/insert_sample_data.sh +++ b/documentation/3.4.0/native/scripts/scp/ubuntu/insert_sample_data.sh @@ -34,10 +34,14 @@ sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organization_ sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 4, 'default_code', 3, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" -sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.entity_types (id, value, label, status, created_by, updated_by, allow_filtering, data_type, organization_id, parent_id, has_entities, allow_custom_entities, model_names, created_at, updated_at, deleted_at, meta, external_entity_type, required, regex) VALUES (4, 'state', 'State', 'ACTIVE', 0, 0, true, 'STRING', 1, NULL, true, true, '{User}', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, NULL, true, false, NULL);" +# Ensure users and users_credentials sequences are up-to-date +sudo -u postgres psql -p 5432 -d users -c "SELECT setval('users_id_seq', COALESCE((SELECT MAX(id) FROM public.users), 0));" +sudo -u postgres psql -p 5432 -d users -c "SELECT setval('users_credentials_id_seq', COALESCE((SELECT MAX(id) FROM public.users_credentials), 0));" + +# Ensure entity_types sequence exists and is set, then insert WITHOUT an explicit id +sudo -u postgres psql -p 5432 -d users -c "SELECT setval(pg_get_serial_sequence('public.entity_types','id'), COALESCE((SELECT MAX(id) FROM public.entity_types), 0));" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.entity_types (value, label, status, created_by, updated_by, allow_filtering, data_type, organization_id, parent_id, has_entities, allow_custom_entities, model_names, created_at, updated_at, deleted_at, meta, external_entity_type, required, regex, tenant_code, organization_code) VALUES ('state', 'State', 'ACTIVE', 0, 0, true, 'STRING', 1, NULL, true, true, '{User}', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, NULL, true, false, NULL, 'default', 'default_code') RETURNING id;" sudo -u postgres psql -p 5432 -d users -c "UPDATE public.entity_types SET status = 'INACTIVE' WHERE id = 3;" -sudo -u postgres psql -p 5432 -d users -c "SELECT nextval('users_id_seq'::regclass) FROM public.users;" -sudo -u postgres psql -p 5432 -d users -c "SELECT nextval('users_credentials_id_seq'::regclass) FROM public.users_credentials;" sudo -u postgres psql -p 5432 -d users -c "UPDATE role_permission_mapping SET role_title = 'state_education_officer' WHERE role_title = 'mentor';" sudo -u postgres psql -p 5432 -d users -c "SELECT NULL;" diff --git a/documentation/3.4.0/setup/native/scp/ubuntu/README.md b/documentation/3.4.0/setup/native/scp/ubuntu/README.md index 62802793..00466649 100644 --- a/documentation/3.4.0/setup/native/scp/ubuntu/README.md +++ b/documentation/3.4.0/setup/native/scp/ubuntu/README.md @@ -164,7 +164,7 @@ curl -L -o observation-portal/src/assets/env/env.js https://raw.githubuserconten ./create-databases.sh ``` -7. **Run Migrations To Create Tables** +7. **Run Migrations to Create Tables and Seed Default Values** ``` cd user/src && npx sequelize-cli db:migrate && cd ../.. && \ @@ -172,6 +172,12 @@ curl -L -o observation-portal/src/assets/env/env.js https://raw.githubuserconten cd notification/src && npx sequelize-cli db:migrate && cd ../.. ``` + To seed the default values, run the following command: + + ``` + cd user/src && npx sequelize-cli db:seed:all && cd ../.. && \ + ``` + 8. **Enabling Citus And Setting Distribution Columns (Optional)** To boost performance and scalability, users can opt to enable the Citus extension. This transforms PostgreSQL into a distributed database, spreading data across multiple nodes to handle large datasets more efficiently as demand grows. From fad0ac57450415c1faaff2501c4e1fb00b215a0d Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Sat, 6 Dec 2025 23:02:01 +0530 Subject: [PATCH 35/63] Add user roles for content creation and program management workflows --- .../scripts/scp/ubuntu/insert_sample_data.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/documentation/3.4.0/native/scripts/scp/ubuntu/insert_sample_data.sh b/documentation/3.4.0/native/scripts/scp/ubuntu/insert_sample_data.sh index ccb4f675..14934658 100644 --- a/documentation/3.4.0/native/scripts/scp/ubuntu/insert_sample_data.sh +++ b/documentation/3.4.0/native/scripts/scp/ubuntu/insert_sample_data.sh @@ -24,10 +24,7 @@ SET meta = '{ }' WHERE code = 'default'; " - - -# FIXES: -# - Quoted the organization_code and tenant_code variables. +# --- 2. INSERT INTO public.user_organization_roles --- sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 2, 'default_code', 1, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 3, 'default_code', 2, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 2, 'default_code', 3, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" @@ -42,6 +39,16 @@ sudo -u postgres psql -p 5432 -d users -c "SELECT setval('users_credentials_id_s sudo -u postgres psql -p 5432 -d users -c "SELECT setval(pg_get_serial_sequence('public.entity_types','id'), COALESCE((SELECT MAX(id) FROM public.entity_types), 0));" sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.entity_types (value, label, status, created_by, updated_by, allow_filtering, data_type, organization_id, parent_id, has_entities, allow_custom_entities, model_names, created_at, updated_at, deleted_at, meta, external_entity_type, required, regex, tenant_code, organization_code) VALUES ('state', 'State', 'ACTIVE', 0, 0, true, 'STRING', 1, NULL, true, true, '{User}', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, NULL, true, false, NULL, 'default', 'default_code') RETURNING id;" sudo -u postgres psql -p 5432 -d users -c "UPDATE public.entity_types SET status = 'INACTIVE' WHERE id = 3;" + +# --- 3. INSERT INTO public.user_roles --- +# Add new roles for content creation and program management workflows +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_roles (title, user_type, status, created_at, updated_at, deleted_at, visibility, organization_id, label, translations, tenant_code) VALUES ('content_creator', 0, 'ACTIVE', NOW(), NOW(), NULL, 'PUBLIC', 1, 'Content Creator', NULL, 'default');" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_roles (title, user_type, status, created_at, updated_at, deleted_at, visibility, organization_id, label, translations, tenant_code) VALUES ('reviewer', 0, 'ACTIVE', NOW(), NOW(), NULL, 'PUBLIC', 1, 'Reviewer', NULL, 'default');" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_roles (title, user_type, status, created_at, updated_at, deleted_at, visibility, organization_id, label, translations, tenant_code) VALUES ('program_designer', 0, 'ACTIVE', NOW(), NOW(), NULL, 'PUBLIC', 1, 'Program Designer', NULL, 'default');" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_roles (title, user_type, status, created_at, updated_at, deleted_at, visibility, organization_id, label, translations, tenant_code) VALUES ('program_manager', 0, 'ACTIVE', NOW(), NOW(), NULL, 'PUBLIC', 1, 'Program Manager', NULL, 'default');" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_roles (title, user_type, status, created_at, updated_at, deleted_at, visibility, organization_id, label, translations, tenant_code) VALUES ('rollout_manager', 0, 'ACTIVE', NOW(), NOW(), NULL, 'PUBLIC', 1, 'Rollout Manager', NULL, 'default');" + +# Update role_permission_mapping to reflect new role titles sudo -u postgres psql -p 5432 -d users -c "UPDATE role_permission_mapping SET role_title = 'state_education_officer' WHERE role_title = 'mentor';" sudo -u postgres psql -p 5432 -d users -c "SELECT NULL;" From fbbc297006148b144dbd13c4ed41a6dddb77382e Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Sat, 6 Dec 2025 23:04:00 +0530 Subject: [PATCH 36/63] Update INTERNAL_ACCESS_TOKEN in notification_env for consistency --- documentation/3.4.0/native/envs/scp/notification_env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/3.4.0/native/envs/scp/notification_env b/documentation/3.4.0/native/envs/scp/notification_env index 1360cf0a..c6fde34c 100644 --- a/documentation/3.4.0/native/envs/scp/notification_env +++ b/documentation/3.4.0/native/envs/scp/notification_env @@ -6,7 +6,7 @@ DEV_DATABASE_URL=postgres://postgres:postgres@localhost:5432/notification DISABLE_LOG=false ENABLE_LOG=true ERROR_LOG_LEVEL=silly -INTERNAL_ACCESS_TOKEN=qwertyhdgffs +INTERNAL_ACCESS_TOKEN=xahusub12yexlashsbxAXADHBlaj KAFKA_GROUP_ID=notification KAFKA_HOST=localhost:9092 KAFKA_TOPIC=develop.notifications From 8562d0ba259133ba4ee90184ad580596547106b1 Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Sat, 6 Dec 2025 23:07:04 +0530 Subject: [PATCH 37/63] Format example command for creating ELEVATE-Project directory in README --- documentation/3.4.0/setup/native/scp/ubuntu/README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/documentation/3.4.0/setup/native/scp/ubuntu/README.md b/documentation/3.4.0/setup/native/scp/ubuntu/README.md index 00466649..731f0924 100644 --- a/documentation/3.4.0/setup/native/scp/ubuntu/README.md +++ b/documentation/3.4.0/setup/native/scp/ubuntu/README.md @@ -79,7 +79,10 @@ Before setting up the following ELEVATE-Project application, dependencies given 1. **Create ELEVATE-Project Directory:** Create a directory named **ELEVATE-Project**. - > Example Command: `mkdir ELEVATE-Project && cd ELEVATE-Project/` + Example Command: + ``` + mkdir ELEVATE-Project && cd ELEVATE-Project/ + ``` 2. **Git Clone Services And Portal Repositories** From c639256b1a580d75f0bf7408ee7c8ac43b3a4856 Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Sat, 6 Dec 2025 23:54:01 +0530 Subject: [PATCH 38/63] Add additional user entries and update sequences in insert_sample_data.sh --- .../scripts/scp/ubuntu/insert_sample_data.sh | 32 ++++++++++++++----- .../3.4.0/setup/native/scp/ubuntu/README.md | 2 +- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/documentation/3.4.0/native/scripts/scp/ubuntu/insert_sample_data.sh b/documentation/3.4.0/native/scripts/scp/ubuntu/insert_sample_data.sh index 14934658..577dc6f6 100644 --- a/documentation/3.4.0/native/scripts/scp/ubuntu/insert_sample_data.sh +++ b/documentation/3.4.0/native/scripts/scp/ubuntu/insert_sample_data.sh @@ -3,17 +3,24 @@ sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.users (id, name, e sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (2, 'Prajwal C S', 'c4113be1bc2cef51981a6ec687302e42fc4f87f4dfac4276584844d9e3e0f5ae', false, '{8,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default','53bc5d0ff0c53bee460c08b8afe087455050dc7529a2f1d4f7319c0da653a767','+91', NULL);" sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (3, 'Vishnu V P', '1092be87fd483fce1deba56c8cdefa79bed4f70a4b110fc4e7947c57aacff219', false, '{8,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default','53bc5d0ff0c53bee460c08b8afe087455050dc7529a2f1d4f7319c0da653a7e0','+91', NULL);" sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (4, 'Mallanagouda R B', 'e5fc674d4b1a54c6cf772485e3bca6f7ae14b60de32b9f0cd9f955ee469345bc', false, '{8,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default','53bc5d0ff0c53bee460c08b8afe087455050dc7529a2f1d4f7319c0da653a700','+91', NULL);" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (5, 'Priyanka', 'ceb796d9c0a6219d4323ff794b2af33a61bfd2bf6770ba566e5dbcb9755687fd', false, '{8,11,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default',NULL, NULL, NULL);" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (6, 'Adithya', 'ea959d865423d4f7105e33f6413e0a1d9b87c455c558f7629c60dd39c1c836b9', false, '{8,9,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default',NULL, NULL, NULL);" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (7, 'Praveen', '67bd4cacaef5be249b1587060f54b8631cffd7a75fa913323dda320858442e27', false, '{8,10,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default',NULL, NULL, NULL);" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (8, 'Nevin', '3d83442625031895c5b76602acd5083e', false, '{8,13,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default',NULL, NULL, NULL);" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (9, 'Saish', '28c23e53cfa34cc4eec7a44bd83d9625', false, '{8,12,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default',NULL, NULL, NULL);" # --- 2. INSERT INTO public.user_organizations --- -# FIXES: -# - Quoted the organization_code and tenant_code variables. sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organizations (user_id,organization_code, tenant_code, created_at, updated_at, deleted_at) VALUES (1, 'default_code', 'default', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organizations (user_id,organization_code, tenant_code, created_at, updated_at, deleted_at) VALUES (2, 'default_code', 'default', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organizations (user_id,organization_code, tenant_code, created_at, updated_at, deleted_at) VALUES (3, 'default_code', 'default', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organizations (user_id,organization_code, tenant_code, created_at, updated_at, deleted_at) VALUES (4, 'default_code', 'default', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organizations (user_id,organization_code, tenant_code, created_at, updated_at, deleted_at) VALUES (5, 'default_code', 'default', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organizations (user_id,organization_code, tenant_code, created_at, updated_at, deleted_at) VALUES (6, 'default_code', 'default', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organizations (user_id,organization_code, tenant_code, created_at, updated_at, deleted_at) VALUES (7, 'default_code', 'default', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organizations (user_id,organization_code, tenant_code, created_at, updated_at, deleted_at) VALUES (8, 'default_code', 'default', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organizations (user_id,organization_code, tenant_code, created_at, updated_at, deleted_at) VALUES (9, 'default_code', 'default', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" - -sudo -u postgres psql -p 5432 -d user -c " +sudo -u postgres psql -p 5432 -d users -c " UPDATE public.tenants SET meta = '{ \"factors\": [\"professional_role\", \"professional_subroles\"], @@ -29,14 +36,23 @@ sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organization_ sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 3, 'default_code', 2, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 2, 'default_code', 3, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 4, 'default_code', 3, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" - +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 5, 'default_code', 8, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 5, 'default_code', 11, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 6, 'default_code', 9, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 6, 'default_code', 8, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 7, 'default_code', 10, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 7, 'default_code', 8, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 8, 'default_code', 13, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 8, 'default_code', 8, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 9, 'default_code', 12, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 9, 'default_code', 8, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" # Ensure users and users_credentials sequences are up-to-date -sudo -u postgres psql -p 5432 -d users -c "SELECT setval('users_id_seq', COALESCE((SELECT MAX(id) FROM public.users), 0));" -sudo -u postgres psql -p 5432 -d users -c "SELECT setval('users_credentials_id_seq', COALESCE((SELECT MAX(id) FROM public.users_credentials), 0));" +sudo -u postgres psql -p 5432 -d users -c "SELECT setval('users_id_seq', COALESCE((SELECT MAX(id) FROM public.users), 1));" +sudo -u postgres psql -p 5432 -d users -c "SELECT setval('users_credentials_id_seq', COALESCE((SELECT MAX(id) FROM public.users_credentials), 1));" # Ensure entity_types sequence exists and is set, then insert WITHOUT an explicit id -sudo -u postgres psql -p 5432 -d users -c "SELECT setval(pg_get_serial_sequence('public.entity_types','id'), COALESCE((SELECT MAX(id) FROM public.entity_types), 0));" +sudo -u postgres psql -p 5432 -d users -c "SELECT setval(pg_get_serial_sequence('public.entity_types','id'), COALESCE((SELECT MAX(id) FROM public.entity_types), 1));" sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.entity_types (value, label, status, created_by, updated_by, allow_filtering, data_type, organization_id, parent_id, has_entities, allow_custom_entities, model_names, created_at, updated_at, deleted_at, meta, external_entity_type, required, regex, tenant_code, organization_code) VALUES ('state', 'State', 'ACTIVE', 0, 0, true, 'STRING', 1, NULL, true, true, '{User}', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, NULL, true, false, NULL, 'default', 'default_code') RETURNING id;" sudo -u postgres psql -p 5432 -d users -c "UPDATE public.entity_types SET status = 'INACTIVE' WHERE id = 3;" diff --git a/documentation/3.4.0/setup/native/scp/ubuntu/README.md b/documentation/3.4.0/setup/native/scp/ubuntu/README.md index 731f0924..2f6bfc83 100644 --- a/documentation/3.4.0/setup/native/scp/ubuntu/README.md +++ b/documentation/3.4.0/setup/native/scp/ubuntu/README.md @@ -178,7 +178,7 @@ curl -L -o observation-portal/src/assets/env/env.js https://raw.githubuserconten To seed the default values, run the following command: ``` - cd user/src && npx sequelize-cli db:seed:all && cd ../.. && \ + cd user/src && npx sequelize-cli db:seed:all && cd ../../ ``` 8. **Enabling Citus And Setting Distribution Columns (Optional)** From 9b663c69a91cc661740957dc53b6e0d080e152ab Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Sun, 7 Dec 2025 00:25:22 +0530 Subject: [PATCH 39/63] Refactor insert_sample_data.sh to add new user roles for content creation and program management workflows --- .../scripts/scp/ubuntu/insert_sample_data.sh | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/documentation/3.4.0/native/scripts/scp/ubuntu/insert_sample_data.sh b/documentation/3.4.0/native/scripts/scp/ubuntu/insert_sample_data.sh index 577dc6f6..e3ed5869 100644 --- a/documentation/3.4.0/native/scripts/scp/ubuntu/insert_sample_data.sh +++ b/documentation/3.4.0/native/scripts/scp/ubuntu/insert_sample_data.sh @@ -1,4 +1,13 @@ #!/bin/bash + +# --- 3. INSERT INTO public.user_roles --- +# Add new roles for content creation and program management workflows +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_roles (title, user_type, status, created_at, updated_at, deleted_at, visibility, organization_id, label, translations, tenant_code) VALUES ('content_creator', 0, 'ACTIVE', NOW(), NOW(), NULL, 'PUBLIC', 1, 'Content Creator', NULL, 'default');" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_roles (title, user_type, status, created_at, updated_at, deleted_at, visibility, organization_id, label, translations, tenant_code) VALUES ('reviewer', 0, 'ACTIVE', NOW(), NOW(), NULL, 'PUBLIC', 1, 'Reviewer', NULL, 'default');" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_roles (title, user_type, status, created_at, updated_at, deleted_at, visibility, organization_id, label, translations, tenant_code) VALUES ('program_designer', 0, 'ACTIVE', NOW(), NOW(), NULL, 'PUBLIC', 1, 'Program Designer', NULL, 'default');" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_roles (title, user_type, status, created_at, updated_at, deleted_at, visibility, organization_id, label, translations, tenant_code) VALUES ('program_manager', 0, 'ACTIVE', NOW(), NOW(), NULL, 'PUBLIC', 1, 'Program Manager', NULL, 'default');" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_roles (title, user_type, status, created_at, updated_at, deleted_at, visibility, organization_id, label, translations, tenant_code) VALUES ('rollout_manager', 0, 'ACTIVE', NOW(), NOW(), NULL, 'PUBLIC', 1, 'Rollout Manager', NULL, 'default');" + sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (1, 'Rahul R B', 'a0db5e0a39ee13db7fc5d1309e637f2c', false, '{8,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default','53bc5d0ff0c53bee460c08b8afe087455050dc7529a2f1d4f7319c0da653a7e4','+91', NULL);" sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (2, 'Prajwal C S', 'c4113be1bc2cef51981a6ec687302e42fc4f87f4dfac4276584844d9e3e0f5ae', false, '{8,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default','53bc5d0ff0c53bee460c08b8afe087455050dc7529a2f1d4f7319c0da653a767','+91', NULL);" sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (3, 'Vishnu V P', '1092be87fd483fce1deba56c8cdefa79bed4f70a4b110fc4e7947c57aacff219', false, '{8,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default','53bc5d0ff0c53bee460c08b8afe087455050dc7529a2f1d4f7319c0da653a7e0','+91', NULL);" @@ -56,15 +65,7 @@ sudo -u postgres psql -p 5432 -d users -c "SELECT setval(pg_get_serial_sequence( sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.entity_types (value, label, status, created_by, updated_by, allow_filtering, data_type, organization_id, parent_id, has_entities, allow_custom_entities, model_names, created_at, updated_at, deleted_at, meta, external_entity_type, required, regex, tenant_code, organization_code) VALUES ('state', 'State', 'ACTIVE', 0, 0, true, 'STRING', 1, NULL, true, true, '{User}', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, NULL, true, false, NULL, 'default', 'default_code') RETURNING id;" sudo -u postgres psql -p 5432 -d users -c "UPDATE public.entity_types SET status = 'INACTIVE' WHERE id = 3;" -# --- 3. INSERT INTO public.user_roles --- -# Add new roles for content creation and program management workflows -sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_roles (title, user_type, status, created_at, updated_at, deleted_at, visibility, organization_id, label, translations, tenant_code) VALUES ('content_creator', 0, 'ACTIVE', NOW(), NOW(), NULL, 'PUBLIC', 1, 'Content Creator', NULL, 'default');" -sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_roles (title, user_type, status, created_at, updated_at, deleted_at, visibility, organization_id, label, translations, tenant_code) VALUES ('reviewer', 0, 'ACTIVE', NOW(), NOW(), NULL, 'PUBLIC', 1, 'Reviewer', NULL, 'default');" -sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_roles (title, user_type, status, created_at, updated_at, deleted_at, visibility, organization_id, label, translations, tenant_code) VALUES ('program_designer', 0, 'ACTIVE', NOW(), NOW(), NULL, 'PUBLIC', 1, 'Program Designer', NULL, 'default');" -sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_roles (title, user_type, status, created_at, updated_at, deleted_at, visibility, organization_id, label, translations, tenant_code) VALUES ('program_manager', 0, 'ACTIVE', NOW(), NOW(), NULL, 'PUBLIC', 1, 'Program Manager', NULL, 'default');" -sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_roles (title, user_type, status, created_at, updated_at, deleted_at, visibility, organization_id, label, translations, tenant_code) VALUES ('rollout_manager', 0, 'ACTIVE', NOW(), NOW(), NULL, 'PUBLIC', 1, 'Rollout Manager', NULL, 'default');" # Update role_permission_mapping to reflect new role titles sudo -u postgres psql -p 5432 -d users -c "UPDATE role_permission_mapping SET role_title = 'state_education_officer' WHERE role_title = 'mentor';" sudo -u postgres psql -p 5432 -d users -c "SELECT NULL;" - From ecc88d7c4871e8c572d7e76ca4912d72ae462f3f Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Sun, 7 Dec 2025 01:24:05 +0530 Subject: [PATCH 40/63] Refactor setup_project.sh and update sample data scripts - Updated URLs in setup_project.sh to point to the correct environment files and scripts for the SCP setup. - Added new sampleData.sql file for SCP with user roles and organizations. - Modified existing sampleData.sql to remove duplicate entries and ensure consistency. - Changed the method of checking for port availability in the README.md from `lsof` to `ss` for better compatibility. --- .../{ => scp}/survey_project_creation_env | 0 .../scripts/scp/ubuntu/entity_sampleData.js | 224 --- .../scp/ubuntu/insert_sample_solutions.js | 56 - .../scripts/scp/ubuntu/project_sampleData.js | 1612 ----------------- .../scripts/scp/ubuntu/setup_project.sh | 19 +- .../sample-data/mac-linux/user/sampleData.sql | 7 +- .../scp/mac-linux/user/sampleData.sql | 28 + .../3.4.0/setup/docker/scp/ubuntu/README.md | 2 +- 8 files changed, 40 insertions(+), 1908 deletions(-) rename documentation/3.4.0/dockerized/envs/{ => scp}/survey_project_creation_env (100%) delete mode 100644 documentation/3.4.0/dockerized/scripts/scp/ubuntu/entity_sampleData.js delete mode 100644 documentation/3.4.0/dockerized/scripts/scp/ubuntu/insert_sample_solutions.js delete mode 100644 documentation/3.4.0/dockerized/scripts/scp/ubuntu/project_sampleData.js create mode 100644 documentation/3.4.0/sample-data/scp/mac-linux/user/sampleData.sql diff --git a/documentation/3.4.0/dockerized/envs/survey_project_creation_env b/documentation/3.4.0/dockerized/envs/scp/survey_project_creation_env similarity index 100% rename from documentation/3.4.0/dockerized/envs/survey_project_creation_env rename to documentation/3.4.0/dockerized/envs/scp/survey_project_creation_env diff --git a/documentation/3.4.0/dockerized/scripts/scp/ubuntu/entity_sampleData.js b/documentation/3.4.0/dockerized/scripts/scp/ubuntu/entity_sampleData.js deleted file mode 100644 index aebc1cfc..00000000 --- a/documentation/3.4.0/dockerized/scripts/scp/ubuntu/entity_sampleData.js +++ /dev/null @@ -1,224 +0,0 @@ -const { ObjectId } = require('mongodb') - -let entityType = [ - { - _id: new ObjectId('6825914b97b5680013e6a140'), - profileForm: [], - profileFields: [], - types: [], - callResponseTypes: [], - isObservable: true, - immediateChildrenEntityType: ['district'], - createdBy: '49', - updatedBy: '49', - deleted: false, - isDeleted: false, - name: 'state', - toBeMappedToParentEntities: true, - tenantId: 'shikshalokam', - updatedAt: new Date('2025-05-15T07:01:31.680Z'), - createdAt: new Date('2025-05-15T07:01:31.680Z'), - __v: 0, - orgId: 'sl', - }, - { - _id: new ObjectId('6825915197b5680013e6a142'), - profileForm: [], - profileFields: [], - types: [], - callResponseTypes: [], - isObservable: true, - immediateChildrenEntityType: ['district'], - createdBy: '49', - updatedBy: '49', - deleted: false, - isDeleted: false, - name: 'district', - toBeMappedToParentEntities: true, - tenantId: 'shikshalokam', - updatedAt: new Date('2025-05-15T07:01:37.892Z'), - createdAt: new Date('2025-05-15T07:01:37.892Z'), - __v: 0, - orgId: 'sl', - }, - { - _id: new ObjectId('682591cc97b5680013e6a15c'), - profileForm: [], - profileFields: [], - types: [], - callResponseTypes: [], - isObservable: true, - immediateChildrenEntityType: ['district'], - createdBy: '49', - updatedBy: '49', - deleted: false, - isDeleted: false, - name: 'professional_role', - toBeMappedToParentEntities: true, - tenantId: 'shikshalokam', - updatedAt: new Date('2025-05-15T07:03:40.376Z'), - createdAt: new Date('2025-05-15T07:03:40.376Z'), - __v: 0, - orgId: 'sl', - }, - { - _id: new ObjectId('682591d397b5680013e6a15e'), - profileForm: [], - profileFields: [], - types: [], - callResponseTypes: [], - isObservable: true, - immediateChildrenEntityType: ['district'], - createdBy: '49', - updatedBy: '49', - deleted: false, - isDeleted: false, - name: 'professional_subroles', - toBeMappedToParentEntities: true, - tenantId: 'shikshalokam', - updatedAt: new Date('2025-05-15T07:03:47.062Z'), - createdAt: new Date('2025-05-15T07:03:47.062Z'), - __v: 0, - orgId: 'sl', - }, - -] - -let entities = [ - { - _id: new ObjectId('6852c86c7248c20014b38a4d'), - metaInformation: { - targetedEntityTypes: [], - externalId: '16', - name: 'Tripura', - }, - childHierarchyPath: ['district', 'block', 'cluster', 'school'], - createdBy: '20', - updatedBy: '20', - deleted: false, - entityTypeId: new ObjectId('6825914b97b5680013e6a140'), - entityType: 'state', - registryDetails: { - code: '16', - locationId: '16', - }, - tenantId: 'shikshalokam', - orgId: 'sl', - updatedAt: new Date('2025-06-18T14:29:00.266Z'), - createdAt: new Date('2025-06-18T14:08:44.438Z'), - __v: 0, - groups: { - district: [new ObjectId('6852c8ae7248c20014b38a57')], - }, - }, - { - _id: new ObjectId('6852c8ae7248c20014b38a57'), - metaInformation: { - targetedEntityTypes: [], - externalId: 'westTripura', - name: 'West Tripura', - }, - childHierarchyPath: ['block', 'cluster', 'school'], - createdBy: '20', - updatedBy: '20', - deleted: false, - entityTypeId: new ObjectId('6825915197b5680013e6a142'), - entityType: 'district', - registryDetails: { - code: 'westTripura', - locationId: 'westTripura', - }, - tenantId: 'shikshalokam', - orgId: 'sl', - updatedAt: new Date('2025-06-18T14:27:43.218Z'), - createdAt: new Date('2025-06-18T14:09:50.337Z'), - __v: 0, - groups: { - block: [ - new ObjectId('6852c8de7248c20014b38a9d'), - new ObjectId('6852c8de7248c20014b38a9e'), - new ObjectId('6852c8de7248c20014b38a9f'), - new ObjectId('6852c8de7248c20014b38aa0'), - new ObjectId('6852c8de7248c20014b38aa1'), - new ObjectId('6852c8de7248c20014b38aa2'), - new ObjectId('6852c8de7248c20014b38aa3'), - new ObjectId('6852c8de7248c20014b38aa4'), - new ObjectId('6852c8de7248c20014b38aa5'), - new ObjectId('6852c8de7248c20014b38aa6'), - new ObjectId('6852c8de7248c20014b38aa7'), - new ObjectId('6852c8de7248c20014b38aa8'), - ], - }, - }, - { - _id: new ObjectId('68876746b19aea00144c2af9'), - metaInformation: { - targetedEntityTypes: [ - { - entityTypeId: '6825915197b5680013e6a142', - entityType: 'district', - }, - ], - externalId: 'Facilitator', - name: 'Facilitator', - }, - childHierarchyPath: ['professional_role', 'professional_subroles'], - createdBy: '1', - updatedBy: '1', - deleted: false, - entityTypeId: new ObjectId('682591cc97b5680013e6a15c'), - entityType: 'professional_role', - registryDetails: { - locationId: 'Facilitator', - code: 'Facilitator', - }, - userId: '1', - tenantId: 'shikshalokam', - orgId: 'tan90', - updatedAt: new Date('2025-07-28T12:08:56.065Z'), - createdAt: new Date('2025-07-28T12:04:22.011Z'), - __v: 0, - groups: { - professional_subroles: [new ObjectId('688767deb19aea00144c2b08')], - }, - }, - { - _id: new ObjectId('688767deb19aea00144c2b08'), - metaInformation: { - targetedEntityTypes: [ - { - entityType: 'Handbook1_Activity', - entityTypeId: '688762feb19aea00144c2a81', - }, - { - entityType: 'Handbook2_Activity', - entityTypeId: '68887766b19aea00144c3631', - }, - ], - externalId: 'facilitator', - name: 'Facilitator', - }, - childHierarchyPath: ['professional_subroles'], - createdBy: '1', - updatedBy: '1', - deleted: false, - entityTypeId: new ObjectId('682591d397b5680013e6a15e'), - entityType: 'professional_subroles', - registryDetails: { - locationId: 'facilitator', - code: 'facilitator', - }, - userId: '1', - tenantId: 'shikshalokam', - orgId: 'tan90', - updatedAt: new Date('2025-07-29T07:28:05.355Z'), - createdAt: new Date('2025-07-28T12:06:54.072Z'), - __v: 0, - }, - -] - -module.exports = { - entities, - entityType, -} diff --git a/documentation/3.4.0/dockerized/scripts/scp/ubuntu/insert_sample_solutions.js b/documentation/3.4.0/dockerized/scripts/scp/ubuntu/insert_sample_solutions.js deleted file mode 100644 index 82a616ce..00000000 --- a/documentation/3.4.0/dockerized/scripts/scp/ubuntu/insert_sample_solutions.js +++ /dev/null @@ -1,56 +0,0 @@ -const { MongoClient } = require('mongodb') - -const url = 'mongodb://localhost:27017/' // MongoDB URL -const dbName = 'elevate-project' -const dbName2 = 'elevate-entity' -const entityData = require('./entity_sampleData.js') -const projectData = require('./project_sampleData.js') - -async function insertData(collectionName, dataFile, curretDB = dbName) { - const client = new MongoClient(url) - - try { - // Connect to MongoDB - await client.connect() - console.log(`Connected to MongoDB for ${collectionName}`) - - const db = client.db(curretDB) - const collection = db.collection(collectionName) - - // Read the data from the file - const data = dataFile - - if (!data) { - await client.close() - return - } - - const result = await collection.insertMany(data) - //console.log(`Inserted ${result.insertedCount} documents into ${collectionName}`); - } finally { - await client.close() - } -} - -async function main({ dataToBeInserted }) { - await insertData('entities', dataToBeInserted.entities, dbName2) - await insertData('entityTypes', dataToBeInserted.entityType, dbName2) - await insertData('programs', dataToBeInserted.programData) - await insertData('solutions', dataToBeInserted.solutionData) - await insertData('projectTemplates', dataToBeInserted.projectTemplatesData) - await insertData('projectTemplateTasks', dataToBeInserted.projectTemplateTasksData) - await insertData('certificateTemplates', dataToBeInserted.certificateTemplatesData) - await insertData('certificateBaseTemplates', dataToBeInserted.certificateBaseTemplatesData) - await insertData('projectCategories', dataToBeInserted.projectCategoriesData) -} - -main({ dataToBeInserted: entityData }) - .then(() => { - console.log('Entity data populated successfully.') - }) - .catch(console.error) -main({ dataToBeInserted: projectData }) - .then(() => { - console.log('project data populated successfully.') - }) - .catch(console.error) diff --git a/documentation/3.4.0/dockerized/scripts/scp/ubuntu/project_sampleData.js b/documentation/3.4.0/dockerized/scripts/scp/ubuntu/project_sampleData.js deleted file mode 100644 index 84184d27..00000000 --- a/documentation/3.4.0/dockerized/scripts/scp/ubuntu/project_sampleData.js +++ /dev/null @@ -1,1612 +0,0 @@ -const { ObjectId } = require('mongodb') - -let solutionData = [ - { - _id: new ObjectId('68ee4bb3fb9bee08b93b6d68'), - resourceType: ['Improvement Project Solution'], - language: ['English'], - keywords: ['Improvement Project'], - concepts: [], - themes: [], - flattenedThemes: [], - entities: [], - registry: [], - isRubricDriven: false, - enableQuestionReadOut: false, - captureGpsLocationAtQuestionLevel: false, - isAPrivateProgram: false, - allowMultipleAssessemts: false, - isDeleted: false, - pageHeading: 'Domains', - minNoOfSubmissionsRequired: 1, - rootOrganisations: [], - createdFor: [], - submissionLevel: 'USER', - availableForPrivateConsumption: true, - parentEntityKey: null, - deleted: false, - programExternalId: 'Testing_for_prTGCEBGFFRYVBDFGJ7DGDGF12SDFGHJ345CVBNMDRGYY', - entityType: 'school', - externalId: 'PROJ19099023DGHG789SDASDFGHR4567-1760447411369-PROJECT-SOLUTION', - name: 'pro with obsasatask oct 8 facilitator only 2nd', - description: 'To construct a wired car using a DPDT switch.', - isReusable: false, - startDate: new Date('2025-09-09T00:00:00.000Z'), - endDate: new Date('2026-09-09T18:29:59.000Z'), - subType: 'improvementProject', - type: 'improvementProject', - programId: new ObjectId('68ee4b79fb9bee08b93b6d34'), - programName: 'custom observation as a task check on oct 14th facilitator', - programDescription: 'custom observation as a task check on oct 14th facilitator', - status: 'active', - tenantId: 'shikshalokam', - orgId: 'tan90', - updatedAt: new Date('2025-10-14T13:11:17.993Z'), - createdAt: new Date('2025-10-14T13:10:11.897Z'), - __v: 0, - scope: { - professional_role: ['68876746b19aea00144c2af9'], - professional_subroles: ['688767deb19aea00144c2b08'], - organizations: ['tan90'], - state: ['6852c86c7248c20014b38a4d'], - district: ['6852c8ae7248c20014b38a57'], - block: ['ALL'], - cluster: ['ALL'], - school: ['ALL'], - }, - projectTemplateId: new ObjectId('68ee4bb3fb9bee08b93b6d70'), - updatedBy: '1', - author: '1', - creator: 'Nevil', - certificateTemplateId: new ObjectId('68ee4bf5fb9bee08b93b6d97'), - link: 'f8a8e9ba397a29cf75ad5057db6cb7f9', - }, - { - _id: new ObjectId('68e8c635201642091e014914'), - resourceType: ['Improvement Project Solution'], - language: ['English'], - keywords: ['Improvement Project'], - concepts: [], - themes: [], - flattenedThemes: [], - entities: [], - registry: [], - isRubricDriven: false, - enableQuestionReadOut: false, - captureGpsLocationAtQuestionLevel: false, - isAPrivateProgram: false, - allowMultipleAssessemts: false, - isDeleted: false, - pageHeading: 'Domains', - minNoOfSubmissionsRequired: 1, - rootOrganisations: [], - createdFor: [], - submissionLevel: 'USER', - availableForPrivateConsumption: true, - parentEntityKey: null, - deleted: false, - programExternalId: 'Testing_for_prTGCEBGFFRYVBDFGJ7DGDGF123456', - entityType: 'school', - externalId: 'PROJ190909764HJHF123FGHHcvvbgd-1760085557008-PROJECT-SOLUTION', - name: 'Testing Project For LED IMP facilitator only', - description: 'To construct a wired car using a DPDT switch.', - isReusable: false, - startDate: new Date('2025-09-09T00:00:00.000Z'), - endDate: new Date('2026-09-09T18:29:59.000Z'), - subType: 'improvementProject', - type: 'improvementProject', - programId: new ObjectId('68e8c284201642091e0148c1'), - programName: 'custom observation as a task check on oct 10th facilitator', - programDescription: 'custom observation as a task check on oct 10th facilitator', - status: 'active', - tenantId: 'shikshalokam', - orgId: 'tan90', - updatedAt: new Date('2025-10-10T08:40:22.617Z'), - createdAt: new Date('2025-10-10T08:39:17.519Z'), - __v: 0, - scope: { - professional_role: ['68876746b19aea00144c2af9'], - professional_subroles: ['688767deb19aea00144c2b08'], - organizations: ['tan90'], - state: ['6852c86c7248c20014b38a4d'], - district: ['6852c8ae7248c20014b38a57'], - block: ['ALL'], - cluster: ['ALL'], - school: ['ALL'], - }, - projectTemplateId: new ObjectId('68e8c635201642091e01491c'), - updatedBy: '1', - author: '1', - creator: 'Nevil', - certificateTemplateId: new ObjectId('68e8c676201642091e014943'), - link: '178ac1fdff5b367ef3335ce0e1665a6c', - }, - { - _id: new ObjectId('68c98d9538aee0086ee61096'), - resourceType: ['Improvement Project Solution'], - language: ['English'], - keywords: ['Improvement Project'], - concepts: [], - themes: [], - flattenedThemes: [], - entities: [], - registry: [], - isRubricDriven: false, - enableQuestionReadOut: false, - captureGpsLocationAtQuestionLevel: false, - isAPrivateProgram: false, - allowMultipleAssessemts: false, - isDeleted: false, - pageHeading: 'Domains', - minNoOfSubmissionsRequired: 1, - rootOrganisations: [], - createdFor: [], - submissionLevel: 'USER', - availableForPrivateConsumption: true, - parentEntityKey: null, - deleted: false, - programExternalId: 'ProgramTestKey1', - entityType: 'school', - externalId: 'ProjectIdtestKey1-1758039445176-PROJECT-SOLUTION', - name: 'Project name sep 16 9 30', - description: - 'Gathers insights from teachers regarding available resources, training needs, and challenges faced in classrooms.', - isReusable: false, - startDate: new Date('2025-07-29T18:30:00.000Z'), - endDate: new Date('2026-01-30T18:29:59.000Z'), - subType: 'improvementProject', - type: 'improvementProject', - programId: new ObjectId('68c98d8f38aee0086ee61070'), - programName: 'Program name is sep 16 9 30', - programDescription: 'Description of the Program', - status: 'active', - tenantId: 'shikshalokam', - orgId: 'tan90', - updatedAt: new Date('2025-09-16T16:17:25.599Z'), - createdAt: new Date('2025-09-16T16:17:25.472Z'), - __v: 0, - scope: { - professional_role: ['ALL'], - professional_subroles: ['ALL'], - organizations: ['tan90'], - state: ['ALL'], - district: ['ALL'], - block: ['ALL'], - cluster: ['ALL'], - school: ['ALL'], - }, - projectTemplateId: new ObjectId('68c98d9538aee0086ee6109e'), - }, - { - _id: new ObjectId('68d3b9a72ba17cc3cb238821'), - resourceType: ['Improvement Project Solution'], - language: ['English'], - keywords: ['Improvement Project'], - concepts: [], - themes: [], - flattenedThemes: [], - entities: [], - registry: [], - isRubricDriven: false, - enableQuestionReadOut: false, - captureGpsLocationAtQuestionLevel: false, - isAPrivateProgram: false, - allowMultipleAssessemts: false, - isDeleted: false, - pageHeading: 'Domains', - minNoOfSubmissionsRequired: 1, - rootOrganisations: [], - createdFor: [], - submissionLevel: 'USER', - availableForPrivateConsumption: true, - parentEntityKey: null, - deleted: false, - programExternalId: 'SUP_as_a_task_test_sept_24_1500', - entityType: 'school', - externalId: 'DPDTSCH012025-1758706081315-PROJECT-SOLUTION', - name: 'project sup test with obs or sur tasks sep 23 1520', - description: 'To construct a wired car using a DPDT switch.', - isReusable: false, - startDate: new Date('2025-07-29T18:30:00.000Z'), - endDate: new Date('2025-12-30T18:29:59.000Z'), - subType: 'improvementProject', - type: 'improvementProject', - programId: new ObjectId('68d3b9681e09f9b5b1e0693d'), - programName: 'SUP_as_a_task_test_sept_24_1500', - programDescription: 'This is the description of the program.', - status: 'active', - tenantId: 'shikshalokam', - orgId: 'tan90', - updatedAt: new Date('2025-09-24T09:28:19.783Z'), - createdAt: new Date('2025-09-24T09:28:07.900Z'), - __v: 0, - scope: { - professional_role: ['ALL'], - professional_subroles: ['688767deb19aea00144c2b08'], - organizations: ['tan90'], - state: ['ALL'], - district: ['ALL', '6852c8ae7248c20014b38a57'], - block: ['ALL'], - cluster: ['ALL'], - school: ['ALL'], - }, - projectTemplateId: new ObjectId('68d3b9a92ba17cc3cb238829'), - updatedBy: '1', - author: '1', - creator: 'Nevil', - link: 'a0acc357edbcf3287e9767d20a7d9f12', - }, -] - -let programData = [ - { - _id: new ObjectId('68ee4b79fb9bee08b93b6d34'), - resourceType: ['program'], - language: ['English'], - keywords: ['CBSE', 'SQAA'], - concepts: [], - components: [ - { - _id: new ObjectId('68ee4bb3fb9bee08b93b6d68'), - order: 1, - }, - ], - isAPrivateProgram: false, - isDeleted: false, - requestForPIIConsent: true, - rootOrganisations: [], - createdFor: [], - deleted: false, - status: 'active', - owner: '1', - createdBy: '1', - updatedBy: '1', - externalId: 'Testing_for_prTGCEBGFFRYVBDFGJ7DGDGF12SDFGHJ345CVBNMDRGYY', - name: 'custom observation as a task check on oct 14th facilitator', - description: 'custom observation as a task check on oct 14th facilitator', - startDate: new Date('2025-09-08T18:30:00.000Z'), - endDate: new Date('2026-09-09T18:29:59.000Z'), - imageCompression: { - quality: 10, - }, - metaInformation: { - state: ['Tripura'], - recommendedFor: ['Facilitator'], - }, - tenantId: 'shikshalokam', - orgId: 'tan90', - updatedAt: new Date('2025-10-14T13:18:46.936Z'), - createdAt: new Date('2025-10-14T13:09:13.649Z'), - __v: 0, - scope: { - professional_role: ['68876746b19aea00144c2af9'], - professional_subroles: ['688767deb19aea00144c2b08'], - organizations: ['tan90'], - state: ['6852c86c7248c20014b38a4d'], - district: ['6852c8ae7248c20014b38a57'], - block: ['ALL'], - cluster: ['ALL'], - school: ['ALL'], - }, - }, - { - _id: new ObjectId('68e8c284201642091e0148c1'), - resourceType: ['program'], - language: ['English'], - keywords: ['CBSE', 'SQAA'], - concepts: [], - components: [ - { - _id: new ObjectId('68e8c635201642091e014914'), - order: 1, - }, - ], - isAPrivateProgram: false, - isDeleted: false, - requestForPIIConsent: true, - rootOrganisations: [], - createdFor: [], - deleted: false, - status: 'active', - owner: '1', - createdBy: '1', - updatedBy: '1', - externalId: 'Testing_for_prTGCEBGFFRYVBDFGJ7DGDGF123456', - name: 'custom observation as a task check on oct 10th facilitator', - description: 'custom observation as a task check on oct 10th facilitator', - startDate: new Date('2025-09-08T18:30:00.000Z'), - endDate: new Date('2026-09-09T18:29:59.000Z'), - imageCompression: { - quality: 10, - }, - metaInformation: { - state: ['Tripura'], - recommendedFor: ['Facilitator'], - }, - tenantId: 'shikshalokam', - orgId: 'tan90', - updatedAt: new Date('2025-10-10T08:44:35.535Z'), - createdAt: new Date('2025-10-10T08:23:32.295Z'), - __v: 0, - scope: { - professional_role: ['68876746b19aea00144c2af9'], - professional_subroles: ['688767deb19aea00144c2b08'], - organizations: ['tan90'], - state: ['6852c86c7248c20014b38a4d'], - district: ['6852c8ae7248c20014b38a57'], - block: ['ALL'], - cluster: ['ALL'], - school: ['ALL'], - }, - }, - { - _id: new ObjectId('68c98d8f38aee0086ee61070'), - resourceType: ['program'], - language: ['English'], - keywords: [], - concepts: [], - components: [ - { - _id: new ObjectId('68c98d9538aee0086ee61096'), - order: 1, - }, - ], - isAPrivateProgram: false, - isDeleted: false, - requestForPIIConsent: true, - rootOrganisations: [], - createdFor: [], - deleted: false, - status: 'active', - owner: '1', - createdBy: '1', - updatedBy: '1', - externalId: 'ProgramTestKey1', - name: 'Program name is sep 16 9 30', - description: 'Description of the Program', - metaInformation: { - state: ['Tripura'], - recommendedFor: ['functionaries-officials', 'teacher-educators-coordinators'], - }, - imageCompression: { - quality: 10, - }, - startDate: new Date('2025-07-29T18:30:00.000Z'), - endDate: new Date('2026-01-30T18:29:59.000Z'), - tenantId: 'shikshalokam', - orgId: 'tan90', - updatedAt: new Date('2025-09-16T17:06:14.752Z'), - createdAt: new Date('2025-09-16T16:17:19.239Z'), - __v: 0, - scope: { - professional_role: ['68876746b19aea00144c2af9'], - professional_subroles: ['688767deb19aea00144c2b08'], - organizations: ['tan90'], - state: ['6852c86c7248c20014b38a4d'], - district: ['6852c8ae7248c20014b38a57'], - block: ['ALL'], - cluster: ['ALL'], - school: ['ALL'], - }, - }, - { - _id: new ObjectId('68d3b9681e09f9b5b1e0693d'), - resourceType: ['program'], - language: ['English'], - keywords: [], - concepts: [], - components: [ - { - _id: new ObjectId('68d3b9a72ba17cc3cb238821'), - order: 1, - }, - ], - isAPrivateProgram: false, - isDeleted: false, - requestForPIIConsent: true, - rootOrganisations: [], - createdFor: [], - deleted: false, - status: 'active', - owner: '1', - createdBy: '1', - updatedBy: '1', - externalId: 'SUP_as_a_task_test_sept_24_1500', - name: 'SUP_as_a_task_test_sept_24_1500 oct 3', - description: 'This is the description of the program.', - metaInformation: { - state: ['Tripura'], - recommendedFor: ['functionaries-officials'], - }, - imageCompression: { - quality: 10, - }, - startDate: new Date('2025-07-29T18:30:00.000Z'), - endDate: new Date('2025-12-30T18:29:59.000Z'), - tenantId: 'shikshalokam', - orgId: 'tan90', - updatedAt: new Date('2025-10-03T09:20:39.907Z'), - createdAt: new Date('2025-09-24T09:27:04.322Z'), - __v: 0, - scope: { - professional_role: ['68876746b19aea00144c2af9'], - professional_subroles: ['688767deb19aea00144c2b08'], - organizations: ['tan90'], - state: ['6852c86c7248c20014b38a4d'], - district: ['6852c8ae7248c20014b38a57'], - block: ['ALL'], - cluster: ['ALL'], - school: ['ALL'], - }, - }, -] - -let projectTemplatesData = [ - { - _id: new ObjectId('68ee4bb3fb9bee08b93b6d70'), - description: 'To construct a wired car using a DPDT switch.', - concepts: [''], - keywords: ['Science, Activity Based Learning, STEM Education, STEM Lab, DPDT Switch Car'], - isDeleted: false, - recommendedFor: ['Learner'], - tasks: [ - new ObjectId('68ee4bb4fb9bee08b93b6d7a'), - new ObjectId('68ee4bb4fb9bee08b93b6d7e'), - new ObjectId('68ee4bb4fb9bee08b93b6d82'), - new ObjectId('68ee4bb4fb9bee08b93b6d86'), - ], - createdBy: '1', - updatedBy: '1', - learningResources: [], - isReusable: false, - taskSequence: [ - 'DPDTSC-HandBook-1-2025-Task1-1760447411369-1760447411984', - 'DPDTSC-HandBook-1-2025-Task2-1760447411369', - 'DPDTSC-HandBook-1-2025-Task3-1760447411369', - 'DPDTSC-HandBook-1-2025-Task4-1760447411369', - 'DPDTSC-HandBook-1-2025-Task5-1760447411369', - ], - averageRating: 0, - noOfRatings: 0, - ratings: { - 1: 0, - 2: 0, - 3: 0, - 4: 0, - 5: 0, - }, - importCount: 0, - evidences: [], - isPrivate: false, - hasSpotlight: false, - hasStory: false, - text: [], - visibility: 'CURRENT', - visibleToOrganizations: ['tan90'], - deleted: false, - title: 'pro with obsasatask oct 8 facilitator only 2nd', - externalId: 'PROJ19099023DGHG789SDASDFGHR4567-1760447411369_IMPORTED', - categories: [ - { - _id: new ObjectId('685ae6a0cb7c7200145dadae'), - externalId: 'teachers', - name: 'teachers', - }, - ], - entityType: '', - taskCreationForm: '', - durationInDays: 365, - metaInformation: { - testimonials: [], - goal: 'TEMP', - rationale: '', - primaryAudience: '', - duration: '1 year', - successIndicators: '', - risks: '', - approaches: '', - }, - status: 'published', - tenantId: 'shikshalokam', - orgId: 'tan90', - updatedAt: new Date('2025-10-14T13:11:17.899Z'), - createdAt: new Date('2025-10-14T13:10:11.630Z'), - __v: 0, - solutionId: new ObjectId('68ee4bb3fb9bee08b93b6d68'), - solutionExternalId: 'PROJ19099023DGHG789SDASDFGHR4567-1760447411369-PROJECT-SOLUTION', - programId: new ObjectId('68ee4b79fb9bee08b93b6d34'), - programExternalId: 'Testing_for_prTGCEBGFFRYVBDFGJ7DGDGF12SDFGHJ345CVBNMDRGYY', - parentTemplateId: new ObjectId('68ee4bb3fb9bee08b93b6d4c'), - certificateTemplateId: new ObjectId('68ee4bf5fb9bee08b93b6d97'), - }, - { - _id: new ObjectId('68e8c635201642091e01491c'), - description: 'To construct a wired car using a DPDT switch.', - concepts: [''], - keywords: ['Science, Activity Based Learning, STEM Education, STEM Lab, DPDT Switch Car'], - isDeleted: false, - recommendedFor: ['Learner'], - tasks: [ - new ObjectId('68e8c635201642091e014926'), - new ObjectId('68e8c635201642091e01492a'), - new ObjectId('68e8c635201642091e01492e'), - new ObjectId('68e8c635201642091e014932'), - ], - createdBy: '1', - updatedBy: '1', - learningResources: [], - isReusable: false, - taskSequence: [ - 'DPDTSC-HandBook-1-2025-Task1-1760085557008-1760085557606', - 'DPDTSC-HandBook-1-2025-Task2-1760085557008', - 'DPDTSC-HandBook-1-2025-Task3-1760085557008', - 'DPDTSC-HandBook-1-2025-Task4-1760085557008', - 'DPDTSC-HandBook-1-2025-Task5-1760085557008', - ], - averageRating: 0, - noOfRatings: 0, - ratings: { - 1: 0, - 2: 0, - 3: 0, - 4: 0, - 5: 0, - }, - importCount: 0, - evidences: [], - isPrivate: false, - hasSpotlight: false, - hasStory: false, - text: [], - visibility: 'CURRENT', - visibleToOrganizations: ['tan90'], - deleted: false, - title: 'Testing Project For LED IMP facilitator only', - externalId: 'PROJ190909764HJHF123FGHHcvvbgd-1760085557008_IMPORTED', - categories: [ - { - _id: new ObjectId('685ae6a0cb7c7200145dadae'), - externalId: 'teachers', - name: 'teachers', - }, - ], - entityType: '', - taskCreationForm: '', - durationInDays: 365, - metaInformation: { - testimonials: [], - goal: 'TEMP', - rationale: '', - primaryAudience: '', - duration: '1 year', - successIndicators: '', - risks: '', - approaches: '', - }, - status: 'published', - tenantId: 'shikshalokam', - orgId: 'tan90', - updatedAt: new Date('2025-10-10T08:40:22.544Z'), - createdAt: new Date('2025-10-10T08:39:17.260Z'), - __v: 0, - solutionId: new ObjectId('68e8c635201642091e014914'), - solutionExternalId: 'PROJ190909764HJHF123FGHHcvvbgd-1760085557008-PROJECT-SOLUTION', - programId: new ObjectId('68e8c284201642091e0148c1'), - programExternalId: 'Testing_for_prTGCEBGFFRYVBDFGJ7DGDGF123456', - parentTemplateId: new ObjectId('68e8c635201642091e0148f8'), - certificateTemplateId: new ObjectId('68e8c676201642091e014943'), - }, - { - _id: new ObjectId('68c98d9538aee0086ee6109e'), - description: - 'Gathers insights from teachers regarding available resources, training needs, and challenges faced in classrooms.', - concepts: [''], - keywords: ['Science, Activity Based Learning, STEM Education, STEM Lab, DPDT Switch Car'], - isDeleted: false, - recommendedFor: [''], - tasks: [ - new ObjectId('68c98d9538aee0086ee610a2'), - new ObjectId('68c98d9538aee0086ee610a6'), - new ObjectId('68c98d9538aee0086ee610aa'), - ], - createdBy: '1', - updatedBy: '1', - learningResources: [], - isReusable: false, - taskSequence: [ - 'Task1-1758039445176', - 'Task2-1758039445176', - 'Task3-1758039445176', - 'Task4-1758039445176', - 'Task5-1758039445176', - ], - averageRating: 0, - noOfRatings: 0, - ratings: { - 1: 0, - 2: 0, - 3: 0, - 4: 0, - 5: 0, - }, - importCount: 0, - evidences: [], - isPrivate: false, - hasSpotlight: false, - hasStory: false, - text: [], - deleted: false, - title: 'Project name sep 16 9 30', - externalId: 'ProjectIdtestKey1-1758039445176_IMPORTED', - categories: [ - { - _id: new ObjectId('685ae6a0cb7c7200145dadae'), - externalId: 'teachers', - name: 'teachers', - }, - ], - entityType: '', - taskCreationForm: '', - durationInDays: 365, - metaInformation: { - testimonials: [], - goal: 'TEMP', - rationale: '', - primaryAudience: '', - duration: '1 year', - successIndicators: '', - risks: '', - approaches: '', - }, - status: 'published', - tenantId: 'shikshalokam', - orgId: 'tan90', - updatedAt: new Date('2025-09-16T16:17:25.596Z'), - createdAt: new Date('2025-09-16T16:17:25.301Z'), - __v: 0, - solutionId: new ObjectId('68c98d9538aee0086ee61096'), - solutionExternalId: 'ProjectIdtestKey1-1758039445176-PROJECT-SOLUTION', - programId: new ObjectId('68c98d8f38aee0086ee61070'), - programExternalId: 'ProgramTestKey1', - parentTemplateId: new ObjectId('68c98d9538aee0086ee6107a'), - }, - { - _id: new ObjectId('68d3b9a92ba17cc3cb238829'), - description: 'To construct a wired car using a DPDT switch.', - concepts: [''], - keywords: ['Science, Activity Based Learning, STEM Education, STEM Lab, DPDT Switch Car'], - isDeleted: false, - recommendedFor: ['Learner'], - tasks: [ - new ObjectId('68d3b9ad2ba17cc3cb238837'), - new ObjectId('68d3b9ad2ba17cc3cb23883b'), - new ObjectId('68d3b9ae2ba17cc3cb23883f'), - ], - createdBy: '1', - updatedBy: '1', - learningResources: [], - isReusable: false, - taskSequence: [ - 'DPDTSC-HandBook-1/2025-Task1-1758706081315-1758706089304', - 'DPDTSC-HandBook-1/2025-Task2-1758706081315', - 'DPDTSC-HandBook-1/2025-Task3-1758706081315', - 'DPDTSC-HandBook-1/2025-Task4-1758706081315', - 'DPDTSC-HandBook-1/2025-Task5-1758706081315', - ], - averageRating: 0, - noOfRatings: 0, - ratings: { - 1: 0, - 2: 0, - 3: 0, - 4: 0, - 5: 0, - }, - importCount: 0, - evidences: [], - isPrivate: false, - hasSpotlight: false, - hasStory: false, - text: [], - deleted: false, - title: 'project sup test with obs or sur tasks sep 23 1520', - externalId: 'DPDTSCH012025-1758706081315_IMPORTED', - categories: [ - { - _id: new ObjectId('685ae6a0cb7c7200145dadae'), - externalId: 'teachers', - name: 'teachers', - }, - ], - entityType: '', - taskCreationForm: '', - durationInDays: 365, - metaInformation: { - testimonials: [], - goal: 'TEMP', - rationale: '', - primaryAudience: '', - duration: '1 year', - successIndicators: '', - risks: '', - approaches: '', - }, - status: 'published', - tenantId: 'shikshalokam', - orgId: 'tan90', - updatedAt: new Date('2025-09-24T09:28:14.561Z'), - createdAt: new Date('2025-09-24T09:28:03.404Z'), - __v: 0, - solutionId: new ObjectId('68d3b9a72ba17cc3cb238821'), - solutionExternalId: 'DPDTSCH012025-1758706081315-PROJECT-SOLUTION', - programId: new ObjectId('68d3b9681e09f9b5b1e0693d'), - programExternalId: 'SUP_as_a_task_test_sept_24_1500', - parentTemplateId: new ObjectId('68d3b9a32ba17cc3cb238805'), - }, -] - -let projectTemplateTasksData = [ - { - _id: new ObjectId('68ee4bb4fb9bee08b93b6d7a'), - createdBy: '1', - updatedBy: '1', - isDeleted: false, - isDeletable: false, - taskSequence: [], - children: [], - visibleIf: [], - hasSubTasks: false, - learningResources: [ - { - name: 'Activity Steps (Video)', - link: 'https://youtu.be/MNvM_H9zD3Y?si=BdfslSzCkmDCggih', - app: 'projectService', - id: 'MNvM_H9zD3Y?si=BdfslSzCkmDCggih', - }, - ], - deleted: false, - type: 'content', - projectTemplateId: new ObjectId('68ee4bb3fb9bee08b93b6d70'), - projectTemplateExternalId: 'PROJ19099023DGHG789SDASDFGHR4567-1760447411369_IMPORTED', - name: 'Watch the Activity Video', - externalId: 'DPDTSC-HandBook-1-2025-Task2-1760447411369-1760447412188', - description: '', - sequenceNumber: '2', - tenantId: 'shikshalokam', - orgId: 'tan90', - metaInformation: { - hasAParentTask: 'NO', - parentTaskOperator: '', - parentTaskValue: '', - parentTaskId: '', - startDate: '01/08/2025', - endDate: '31/12/2025', - isAnExternalTask: '', - minNoOfSubmissionsRequired: '', - redirectLink: '', - buttonLabel: '', - }, - updatedAt: new Date('2025-10-14T13:10:12.192Z'), - createdAt: new Date('2025-10-14T13:10:11.805Z'), - __v: 0, - }, - { - _id: new ObjectId('68ee4bb4fb9bee08b93b6d7e'), - createdBy: '1', - updatedBy: '1', - isDeleted: false, - isDeletable: false, - taskSequence: [], - children: [], - visibleIf: [], - hasSubTasks: false, - learningResources: [], - deleted: false, - type: 'simple', - projectTemplateId: new ObjectId('68ee4bb3fb9bee08b93b6d70'), - projectTemplateExternalId: 'PROJ19099023DGHG789SDASDFGHR4567-1760447411369_IMPORTED', - name: 'Conduct the Activity with students', - externalId: 'DPDTSC-HandBook-1-2025-Task3-1760447411369-1760447412197', - description: '', - sequenceNumber: '3', - tenantId: 'shikshalokam', - orgId: 'tan90', - metaInformation: { - hasAParentTask: 'NO', - parentTaskOperator: '', - parentTaskValue: '', - parentTaskId: '', - startDate: '01/08/2025', - endDate: '31/12/2025', - isAnExternalTask: '', - minNoOfSubmissionsRequired: '', - redirectLink: '', - buttonLabel: '', - }, - updatedAt: new Date('2025-10-14T13:10:12.202Z'), - createdAt: new Date('2025-10-14T13:10:11.813Z'), - __v: 0, - }, - { - _id: new ObjectId('68ee4bb4fb9bee08b93b6d82'), - createdBy: '1', - updatedBy: '1', - isDeleted: false, - isDeletable: false, - taskSequence: [], - children: [], - visibleIf: [], - hasSubTasks: false, - learningResources: [ - { - name: 'learn', - link: 'https://drive.google.com/file/d/1HOaFxlahxEzc5HOeFqVTw3V_yszmHFbZ/view?usp=drive_link', - app: 'projectService', - id: 'view?usp=drive_link', - }, - ], - deleted: false, - type: 'content', - projectTemplateId: new ObjectId('68ee4bb3fb9bee08b93b6d70'), - projectTemplateExternalId: 'PROJ19099023DGHG789SDASDFGHR4567-1760447411369_IMPORTED', - name: 'Conduct the Activity Assessment', - externalId: 'DPDTSC-HandBook-1-2025-Task4-1760447411369-1760447412206', - description: '', - sequenceNumber: '4', - tenantId: 'shikshalokam', - orgId: 'tan90', - metaInformation: { - hasAParentTask: 'NO', - parentTaskOperator: '', - parentTaskValue: '', - parentTaskId: '', - startDate: '01/08/2025', - endDate: '31/12/2025', - isAnExternalTask: '', - minNoOfSubmissionsRequired: '', - redirectLink: '', - buttonLabel: '', - }, - updatedAt: new Date('2025-10-14T13:10:12.210Z'), - createdAt: new Date('2025-10-14T13:10:11.825Z'), - __v: 0, - }, - { - _id: new ObjectId('68ee4bb4fb9bee08b93b6d86'), - createdBy: '1', - updatedBy: '1', - isDeleted: false, - isDeletable: false, - taskSequence: [], - children: [], - visibleIf: [], - hasSubTasks: false, - learningResources: [ - { - name: 'walking', - link: 'https://drive.google.com/file/d/1eGLKxFb9BaeroTeIOlXoO8XCxyah7fM9/view?usp=sharing', - app: 'projectService', - id: 'view?usp=sharing', - }, - ], - deleted: false, - type: 'content', - projectTemplateId: new ObjectId('68ee4bb3fb9bee08b93b6d70'), - projectTemplateExternalId: 'PROJ19099023DGHG789SDASDFGHR4567-1760447411369_IMPORTED', - name: "Log into the scanner app and scan the OMR sheets (check that the students' names are appearing on scanning the OMR)", - externalId: 'DPDTSC-HandBook-1-2025-Task5-1760447411369-1760447412214', - description: '', - sequenceNumber: '5', - tenantId: 'shikshalokam', - orgId: 'tan90', - metaInformation: { - hasAParentTask: 'NO', - parentTaskOperator: '', - parentTaskValue: '', - parentTaskId: '', - startDate: '01/08/2025', - endDate: '31/12/2025', - isAnExternalTask: '', - minNoOfSubmissionsRequired: '', - redirectLink: '', - buttonLabel: '', - }, - updatedAt: new Date('2025-10-14T13:10:12.218Z'), - createdAt: new Date('2025-10-14T13:10:11.833Z'), - __v: 0, - }, - { - _id: new ObjectId('68e8c635201642091e014926'), - createdBy: '1', - updatedBy: '1', - isDeleted: false, - isDeletable: false, - taskSequence: [], - children: [], - visibleIf: [], - hasSubTasks: false, - learningResources: [ - { - name: 'Activity Steps (Video)', - link: 'https://youtu.be/MNvM_H9zD3Y?si=BdfslSzCkmDCggih', - app: 'projectService', - id: 'MNvM_H9zD3Y?si=BdfslSzCkmDCggih', - }, - ], - deleted: false, - type: 'content', - projectTemplateId: new ObjectId('68e8c635201642091e01491c'), - projectTemplateExternalId: 'PROJ190909764HJHF123FGHHcvvbgd-1760085557008_IMPORTED', - name: 'Watch the Activity Video', - externalId: 'DPDTSC-HandBook-1-2025-Task2-1760085557008-1760085557809', - description: '', - sequenceNumber: '2', - tenantId: 'shikshalokam', - orgId: 'tan90', - metaInformation: { - hasAParentTask: 'NO', - parentTaskOperator: '', - parentTaskValue: '', - parentTaskId: '', - startDate: '01/08/2026', - endDate: '31/12/2026', - isAnExternalTask: '', - minNoOfSubmissionsRequired: '', - redirectLink: '', - buttonLabel: '', - }, - updatedAt: new Date('2025-10-10T08:39:17.813Z'), - createdAt: new Date('2025-10-10T08:39:17.430Z'), - __v: 0, - }, - { - _id: new ObjectId('68e8c635201642091e01492a'), - createdBy: '1', - updatedBy: '1', - isDeleted: false, - isDeletable: false, - taskSequence: [], - children: [], - visibleIf: [], - hasSubTasks: false, - learningResources: [], - deleted: false, - type: 'simple', - projectTemplateId: new ObjectId('68e8c635201642091e01491c'), - projectTemplateExternalId: 'PROJ190909764HJHF123FGHHcvvbgd-1760085557008_IMPORTED', - name: 'Conduct the Activity with students', - externalId: 'DPDTSC-HandBook-1-2025-Task3-1760085557008-1760085557818', - description: '', - sequenceNumber: '3', - tenantId: 'shikshalokam', - orgId: 'tan90', - metaInformation: { - hasAParentTask: 'NO', - parentTaskOperator: '', - parentTaskValue: '', - parentTaskId: '', - startDate: '01/08/2027', - endDate: '31/12/2027', - isAnExternalTask: '', - minNoOfSubmissionsRequired: '', - redirectLink: '', - buttonLabel: '', - }, - updatedAt: new Date('2025-10-10T08:39:17.822Z'), - createdAt: new Date('2025-10-10T08:39:17.439Z'), - __v: 0, - }, - { - _id: new ObjectId('68e8c635201642091e01492e'), - createdBy: '1', - updatedBy: '1', - isDeleted: false, - isDeletable: false, - taskSequence: [], - children: [], - visibleIf: [], - hasSubTasks: false, - learningResources: [ - { - name: 'learn', - link: 'https://drive.google.com/file/d/1HOaFxlahxEzc5HOeFqVTw3V_yszmHFbZ/view?usp=drive_link', - app: 'projectService', - id: 'view?usp=drive_link', - }, - ], - deleted: false, - type: 'content', - projectTemplateId: new ObjectId('68e8c635201642091e01491c'), - projectTemplateExternalId: 'PROJ190909764HJHF123FGHHcvvbgd-1760085557008_IMPORTED', - name: 'Conduct the Activity Assessment', - externalId: 'DPDTSC-HandBook-1-2025-Task4-1760085557008-1760085557827', - description: '', - sequenceNumber: '4', - tenantId: 'shikshalokam', - orgId: 'tan90', - metaInformation: { - hasAParentTask: 'NO', - parentTaskOperator: '', - parentTaskValue: '', - parentTaskId: '', - startDate: '01/08/2028', - endDate: '31/12/2028', - isAnExternalTask: '', - minNoOfSubmissionsRequired: '', - redirectLink: '', - buttonLabel: '', - }, - updatedAt: new Date('2025-10-10T08:39:17.831Z'), - createdAt: new Date('2025-10-10T08:39:17.449Z'), - __v: 0, - }, - { - _id: new ObjectId('68e8c635201642091e014932'), - createdBy: '1', - updatedBy: '1', - isDeleted: false, - isDeletable: false, - taskSequence: [], - children: [], - visibleIf: [], - hasSubTasks: false, - learningResources: [ - { - name: 'walking', - link: 'https://drive.google.com/file/d/1eGLKxFb9BaeroTeIOlXoO8XCxyah7fM9/view?usp=sharing', - app: 'projectService', - id: 'view?usp=sharing', - }, - ], - deleted: false, - type: 'content', - projectTemplateId: new ObjectId('68e8c635201642091e01491c'), - projectTemplateExternalId: 'PROJ190909764HJHF123FGHHcvvbgd-1760085557008_IMPORTED', - name: "Log into the scanner app and scan the OMR sheets (check that the students' names are appearing on scanning the OMR)", - externalId: 'DPDTSC-HandBook-1-2025-Task5-1760085557008-1760085557835', - description: '', - sequenceNumber: '5', - tenantId: 'shikshalokam', - orgId: 'tan90', - metaInformation: { - hasAParentTask: 'NO', - parentTaskOperator: '', - parentTaskValue: '', - parentTaskId: '', - startDate: '01/08/2029', - endDate: '31/12/2029', - isAnExternalTask: '', - minNoOfSubmissionsRequired: '', - redirectLink: '', - buttonLabel: '', - }, - updatedAt: new Date('2025-10-10T08:39:17.840Z'), - createdAt: new Date('2025-10-10T08:39:17.458Z'), - __v: 0, - }, - { - _id: new ObjectId('68c98d9538aee0086ee610a2'), - createdBy: '1', - updatedBy: '1', - isDeleted: false, - isDeletable: false, - taskSequence: [], - children: [], - visibleIf: [], - hasSubTasks: false, - learningResources: [ - { - name: 'Activity Manual (PDF)', - link: 'https://docs.google.com/document/d/1NCUdj9nPAz82sPV5q2BJ8At31sFJdSDwocrDCh_g7W0/edit?tab=t.0', - app: 'projectService', - id: 'edit?tab=t.0', - }, - ], - deleted: false, - type: 'content', - projectTemplateId: new ObjectId('68c98d9538aee0086ee6109e'), - projectTemplateExternalId: 'ProjectIdtestKey1-1758039445176_IMPORTED', - name: 'Review the Activity Manual', - externalId: 'Task1-1758039445176-1758039445561', - description: '', - sequenceNumber: '1', - tenantId: 'shikshalokam', - orgId: 'tan90', - metaInformation: { - hasAParentTask: 'NO', - parentTaskOperator: '', - parentTaskValue: '', - parentTaskId: '', - startDate: '28/07/2025', - endDate: '30/01/2026', - isAnExternalTask: '', - minNoOfSubmissionsRequired: '', - redirectLink: '', - buttonLabel: '', - }, - updatedAt: new Date('2025-09-16T16:17:25.564Z'), - createdAt: new Date('2025-09-16T16:17:25.375Z'), - __v: 0, - }, - { - _id: new ObjectId('68c98d9538aee0086ee610a6'), - createdBy: '1', - updatedBy: '1', - isDeleted: false, - isDeletable: false, - taskSequence: [], - children: [], - visibleIf: [], - hasSubTasks: false, - learningResources: [ - { - name: 'Activity Steps (Video)', - link: 'https://youtu.be/MNvM_H9zD3Y?si=BdfslSzCkmDCggih', - app: 'projectService', - id: 'MNvM_H9zD3Y?si=BdfslSzCkmDCggih', - }, - ], - deleted: false, - type: 'content', - projectTemplateId: new ObjectId('68c98d9538aee0086ee6109e'), - projectTemplateExternalId: 'ProjectIdtestKey1-1758039445176_IMPORTED', - name: 'Watch the Activity Video', - externalId: 'Task2-1758039445176-1758039445567', - description: '', - sequenceNumber: '2', - tenantId: 'shikshalokam', - orgId: 'tan90', - metaInformation: { - hasAParentTask: 'NO', - parentTaskOperator: '', - parentTaskValue: '', - parentTaskId: '', - startDate: '29/07/2025', - endDate: '30/01/2027', - isAnExternalTask: '', - minNoOfSubmissionsRequired: '', - redirectLink: '', - buttonLabel: '', - }, - updatedAt: new Date('2025-09-16T16:17:25.571Z'), - createdAt: new Date('2025-09-16T16:17:25.386Z'), - __v: 0, - }, - { - _id: new ObjectId('68c98d9538aee0086ee610aa'), - createdBy: '1', - updatedBy: '1', - isDeleted: false, - isDeletable: false, - taskSequence: [], - children: [], - visibleIf: [], - hasSubTasks: false, - learningResources: [], - deleted: false, - type: 'simple', - projectTemplateId: new ObjectId('68c98d9538aee0086ee6109e'), - projectTemplateExternalId: 'ProjectIdtestKey1-1758039445176_IMPORTED', - name: 'Conduct the Activity with students', - externalId: 'Task3-1758039445176-1758039445575', - description: '', - sequenceNumber: '3', - tenantId: 'shikshalokam', - orgId: 'tan90', - metaInformation: { - hasAParentTask: 'NO', - parentTaskOperator: '', - parentTaskValue: '', - parentTaskId: '', - startDate: '30/07/2025', - endDate: '30/01/2028', - isAnExternalTask: '', - minNoOfSubmissionsRequired: '', - redirectLink: '', - buttonLabel: '', - }, - updatedAt: new Date('2025-09-16T16:17:25.579Z'), - createdAt: new Date('2025-09-16T16:17:25.396Z'), - __v: 0, - }, - { - _id: new ObjectId('68d3b9ad2ba17cc3cb238837'), - createdBy: '1', - updatedBy: '1', - isDeleted: false, - isDeletable: false, - taskSequence: [], - children: [], - visibleIf: [], - hasSubTasks: false, - learningResources: [], - deleted: false, - type: 'simple', - projectTemplateId: new ObjectId('68d3b9a92ba17cc3cb238829'), - projectTemplateExternalId: 'DPDTSCH012025-1758706081315_IMPORTED', - name: 'Conduct the Activity with students', - externalId: 'DPDTSC-HandBook-1/2025-Task3-1758706081315-1758706093343', - description: '', - sequenceNumber: '3', - tenantId: 'shikshalokam', - orgId: 'tan90', - metaInformation: { - hasAParentTask: 'NO', - parentTaskOperator: '', - parentTaskValue: '', - parentTaskId: '', - startDate: '30/07/2025', - endDate: '30/12/2025', - isAnExternalTask: '', - minNoOfSubmissionsRequired: '', - redirectLink: '', - buttonLabel: '', - }, - updatedAt: new Date('2025-09-24T09:28:13.534Z'), - createdAt: new Date('2025-09-24T09:28:06.227Z'), - __v: 0, - }, - { - _id: new ObjectId('68d3b9ad2ba17cc3cb23883b'), - createdBy: '1', - updatedBy: '1', - isDeleted: false, - isDeletable: false, - taskSequence: [], - children: [], - visibleIf: [], - hasSubTasks: false, - learningResources: [ - { - name: 'Activity Assessment (PDF)', - link: 'https://sunbirdsaaspublic.blob.core.windows.net/content/content/assets/do_2143687931908833281255/dpdt-switch-car.pdf', - app: 'projectService', - id: 'dpdt-switch-car.pdf', - }, - { - name: 'Activity OMR Sheet (PDF)', - link: 'https://drive.google.com/file/d/1-f7Tg8bmZd-xlcxlhfOcf2ZO6vpc6qkH/view', - app: 'projectService', - id: 'view', - }, - ], - deleted: false, - type: 'content', - projectTemplateId: new ObjectId('68d3b9a92ba17cc3cb238829'), - projectTemplateExternalId: 'DPDTSCH012025-1758706081315_IMPORTED', - name: 'Conduct the Activity Assessment', - externalId: 'DPDTSC-HandBook-1/2025-Task4-1758706081315-1758706093849', - description: '', - sequenceNumber: '4', - tenantId: 'shikshalokam', - orgId: 'tan90', - metaInformation: { - hasAParentTask: 'NO', - parentTaskOperator: '', - parentTaskValue: '', - parentTaskId: '', - startDate: '30/07/2025', - endDate: '30/12/2025', - isAnExternalTask: '', - minNoOfSubmissionsRequired: '', - redirectLink: '', - buttonLabel: '', - }, - updatedAt: new Date('2025-09-24T09:28:13.967Z'), - createdAt: new Date('2025-09-24T09:28:06.583Z'), - __v: 0, - }, - { - _id: new ObjectId('68d3b9ae2ba17cc3cb23883f'), - createdBy: '1', - updatedBy: '1', - isDeleted: false, - isDeletable: false, - taskSequence: [], - children: [], - visibleIf: [], - hasSubTasks: false, - learningResources: [], - deleted: false, - type: 'simple', - projectTemplateId: new ObjectId('68d3b9a92ba17cc3cb238829'), - projectTemplateExternalId: 'DPDTSCH012025-1758706081315_IMPORTED', - name: "Log into the scanner app and scan the OMR sheets (check that the students' names are appearing on scanning the OMR)", - externalId: 'DPDTSC-HandBook-1/2025-Task5-1758706081315-1758706094241', - description: '', - sequenceNumber: '5', - tenantId: 'shikshalokam', - orgId: 'tan90', - metaInformation: { - hasAParentTask: 'NO', - parentTaskOperator: '', - parentTaskValue: '', - parentTaskId: '', - startDate: '30/07/2025', - endDate: '30/12/2025', - isAnExternalTask: '', - minNoOfSubmissionsRequired: '', - redirectLink: '', - buttonLabel: '', - }, - updatedAt: new Date('2025-09-24T09:28:14.374Z'), - createdAt: new Date('2025-09-24T09:28:07.083Z'), - __v: 0, - }, -] - -let certificateTemplatesData = [ - { - _id: new ObjectId('68ee4bf5fb9bee08b93b6d97'), - status: 'active', - deleted: false, - criteria: { - validationText: 'Complete validation message', - expression: 'C1&&(C3||C4||C5||C6)', - conditions: { - C1: { - validationText: 'Submit your project.', - expression: 'C1', - conditions: { - C1: { - scope: 'project', - key: 'status', - operator: '==', - value: 'submitted', - }, - }, - }, - C3: { - expression: 'C1', - conditions: { - C1: { - scope: 'task', - key: 'attachments', - function: 'count', - filter: { - key: 'type', - value: 'all', - }, - operator: '>=', - value: 2, - taskDetails: ['68ee4bb3fb9bee08b93b6d53'], - }, - }, - validationText: 'Add 2 evidence for any task', - }, - C4: { - expression: 'C1', - conditions: { - C1: { - scope: 'task', - key: 'attachments', - function: 'count', - filter: { - key: 'type', - value: 'all', - }, - operator: '>=', - value: 2, - taskDetails: ['68ee4bb3fb9bee08b93b6d57'], - }, - }, - }, - C5: { - expression: 'C1', - conditions: { - C1: { - scope: 'task', - key: 'attachments', - function: 'count', - filter: { - key: 'type', - value: 'all', - }, - operator: '>=', - value: 2, - taskDetails: ['68ee4bb3fb9bee08b93b6d5b'], - }, - }, - }, - C6: { - expression: 'C1', - conditions: { - C1: { - scope: 'task', - key: 'attachments', - function: 'count', - filter: { - key: 'type', - value: 'all', - }, - operator: '>=', - value: 2, - taskDetails: ['68ee4bb3fb9bee08b93b6d63'], - }, - }, - }, - }, - }, - issuer: { - name: 'Tan90', - }, - solutionId: new ObjectId('68ee4bb3fb9bee08b93b6d68'), - programId: new ObjectId('68ee4b79fb9bee08b93b6d34'), - baseTemplateId: new ObjectId('68c008dfd113c30c11f1aca2'), - tenantId: 'shikshalokam', - orgId: 'tan90', - updatedAt: new Date('2025-10-14T13:11:17.793Z'), - createdAt: new Date('2025-10-14T13:11:17.628Z'), - __v: 0, - templateUrl: - 'certificate/aa8529e3-6754-4432-a669-72b73d358e2f/1/7042c718-a1bf-43e3-b296-586de247a440/68ee4bf5fb9bee08b93b6d97/14-9-2025-1760447477692_Dowloaded.svg', - }, - { - _id: new ObjectId('68e8c676201642091e014943'), - status: 'active', - deleted: false, - criteria: { - validationText: 'Complete validation message', - expression: 'C1&&(C3||C4||C5||C6||C7)', - conditions: { - C1: { - validationText: 'Submit your project.', - expression: 'C1', - conditions: { - C1: { - scope: 'project', - key: 'status', - operator: '==', - value: 'submitted', - }, - }, - }, - C3: { - expression: 'C1', - conditions: { - C1: { - scope: 'task', - key: 'attachments', - function: 'count', - filter: { - key: 'type', - value: 'all', - }, - operator: '>=', - value: 2, - taskDetails: ['68e8c635201642091e0148ff'], - }, - }, - validationText: 'Add 2 evidence for any task', - }, - C4: { - expression: 'C1', - conditions: { - C1: { - scope: 'task', - key: 'attachments', - function: 'count', - filter: { - key: 'type', - value: 'all', - }, - operator: '>=', - value: 2, - taskDetails: ['68e8c635201642091e014903'], - }, - }, - }, - C5: { - expression: 'C1', - conditions: { - C1: { - scope: 'task', - key: 'attachments', - function: 'count', - filter: { - key: 'type', - value: 'all', - }, - operator: '>=', - value: 2, - taskDetails: ['68e8c635201642091e014907'], - }, - }, - }, - C6: { - expression: 'C1', - conditions: { - C1: { - scope: 'task', - key: 'attachments', - function: 'count', - filter: { - key: 'type', - value: 'all', - }, - operator: '>=', - value: 2, - taskDetails: ['68e8c635201642091e01490b'], - }, - }, - }, - C7: { - expression: 'C1', - conditions: { - C1: { - scope: 'task', - key: 'attachments', - function: 'count', - filter: { - key: 'type', - value: 'all', - }, - operator: '>=', - value: 2, - taskDetails: ['68e8c635201642091e01490f'], - }, - }, - }, - }, - }, - issuer: { - name: 'Tan90', - }, - solutionId: new ObjectId('68e8c635201642091e014914'), - programId: new ObjectId('68e8c284201642091e0148c1'), - baseTemplateId: new ObjectId('68c008dfd113c30c11f1aca2'), - tenantId: 'shikshalokam', - orgId: 'tan90', - updatedAt: new Date('2025-10-10T08:40:22.454Z'), - createdAt: new Date('2025-10-10T08:40:22.298Z'), - __v: 0, - templateUrl: - 'certificate/0bcc856d-0145-448c-8188-300ca3f3250e/1/58cfdf3c-f1a2-4a94-bbb5-21dcd7286913/68e8c676201642091e014943/10-9-2025-1760085622353_Dowloaded.svg', - }, -] - -let certificateBaseTemplatesData = [ - { - _id: new ObjectId('68c008dfd113c30c11f1aca2'), - deleted: false, - code: 'onelogo_onesign', - name: 'onelogo_onesign', - url: 'certificate/ef2058a1-92e0-4a63-af5f-b712f992bf90/1/81fc35ad-9519-4ec4-87bb-6cef64b940f0/9-8-2025-1757415647754_sl_s1l1.svg', - tenantId: 'shikshalokam', - orgId: 'slorg', - updatedAt: new Date('2025-09-09T11:00:47.878Z'), - createdAt: new Date('2025-09-09T11:00:47.878Z'), - __v: 0, - }, -] - -let projectCategoriesData = [ - { - _id: new ObjectId('685ae6a0cb7c7200145dadae'), - createdBy: 'SYSTEM', - updatedBy: 'SYSTEM', - isDeleted: false, - isVisible: true, - status: 'active', - icon: '', - noOfProjects: 361, - evidences: [], - deleted: false, - name: 'teachers', - externalId: 'teachers', - tenantId: 'shikshalokam', - orgId: 'slorg', - updatedAt: new Date('2025-06-24T17:55:44.720Z'), - createdAt: new Date('2025-06-24T17:55:44.720Z'), - __v: 0, - }, -] -module.exports = { - solutionData, - programData, - projectTemplatesData, - projectTemplateTasksData, - certificateTemplatesData, - certificateBaseTemplatesData, - projectCategoriesData, -} diff --git a/documentation/3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh b/documentation/3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh index 250e1ae3..bbcbaa06 100644 --- a/documentation/3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh +++ b/documentation/3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh @@ -14,12 +14,12 @@ log "Docker Compose file downloaded." log "Downloading environment files..." curl -L \ -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/envs/interface_env \ - -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/envs/entity_management_env \ - -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/envs/project_env \ - -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/envs/notification_env \ - -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/envs/scheduler_env \ - -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/envs/user_env \ - -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/envs/survey_project_creation_env \ + -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuidedocumentation/3.4.0/dockerized/envs/entity_management_env \ + -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuidedocumentation/3.4.0/dockerized/envs/project_env \ + -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuidedocumentation/3.4.0/dockerized/envs/notification_env \ + -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuidedocumentation/3.4.0/dockerized/envs/scheduler_env \ + -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuidedocumentation/3.4.0/dockerized/envs/user_env \ + -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/envs/scp/survey_project_creation_env \ -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/envs/env.js log "Environment files downloaded." @@ -62,13 +62,13 @@ log "survey-project-creation directory created and distributionColumns.sql downl # Step 10: Download and make citus_setup.sh executable log "Downloading citus_setup.sh..." -curl -OJL https://github.com/ELEVATE-Project/project-service/raw/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/scripts/mac-linux/citus_setup.sh +curl -OJL https://github.com/ELEVATE-Project/project-service/raw/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/scripts/scp/ubuntu/citus_setup.sh chmod +x citus_setup.sh # Step 11: Create sample-data directory and download SQL file log "Creating sample-data directory and downloading sampleData.sql..." mkdir -p sample-data/user && \ -curl -L https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/sample-data/mac-linux/user/sampleData.sql -o sample-data/user/sampleData.sql +curl -L https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/sample-data/scp/mac-linux/user/sampleData.sql -o sample-data/user/sampleData.sql log "Sample-data directory created and sampleData.sql downloaded." @@ -83,7 +83,7 @@ log "Downloading sample data scripts..." curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/entity_sampleData.js curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/project_sampleData.js curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/insert_sample_solutions.js -curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/insert_sample_data.sh +curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/scripts/scp/ubuntu/insert_sample_data.sh log "sample data scripts downloaded." @@ -91,6 +91,7 @@ log "Downloading config.json file..." curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/config.json log "config.json file is downloaded." +# remove once the docker image is generated log "Cloning survey-project-creation-service repository..." git clone -b release-1.0.0 https://github.com/ELEVATE-Project/survey-project-creation-service.git log "survey-project-creation-service repository cloned." diff --git a/documentation/3.4.0/sample-data/mac-linux/user/sampleData.sql b/documentation/3.4.0/sample-data/mac-linux/user/sampleData.sql index 48620b41..a6f1a27b 100644 --- a/documentation/3.4.0/sample-data/mac-linux/user/sampleData.sql +++ b/documentation/3.4.0/sample-data/mac-linux/user/sampleData.sql @@ -1,9 +1,4 @@ -INSERT INTO public.user_roles (id, title, user_type, status, created_at, updated_at, deleted_at, visibility, organization_id, label) VALUES (8, 'state_education_officer', 0, 'ACTIVE', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, 'PUBLIC', 1, 'State Education Officer'); -INSERT INTO public.user_roles (id, title, user_type, status, created_at, updated_at, deleted_at, visibility, organization_id, label) VALUES (9, 'content_creator', 0, 'ACTIVE', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, 'PUBLIC', 1, 'Content Creator'); -INSERT INTO public.user_roles (id, title, user_type, status, created_at, updated_at, deleted_at, visibility, organization_id, label) VALUES (10, 'reviewer', 0, 'ACTIVE', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, 'PUBLIC', 1, 'Reviewer'); -INSERT INTO public.user_roles (id, title, user_type, status, created_at, updated_at, deleted_at, visibility, organization_id, label) VALUES (11, 'program_designer', 0, 'ACTIVE', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, 'PUBLIC', 1, 'Program Designer'); -INSERT INTO public.user_roles (id, title, user_type, status, created_at, updated_at, deleted_at, visibility, organization_id, label) VALUES (12, 'program_manager', 0, 'ACTIVE', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, 'PUBLIC', 1, 'Program Manager'); -INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (1, 'Rahul R B', 'a0db5e0a39ee13db7fc5d1309e637f2c', false, '{8,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default','53bc5d0ff0c53bee460c08b8afe087455050dc7529a2f1d4f7319c0da653a7e4','+91', NULL); +INSERT INTO public.user_roles (id, title, user_type, status, created_at, updated_at, deleted_at, visibility, organization_id, label) VALUES (8, 'state_education_officer', 0, 'ACTIVE', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, 'PUBLIC', 1, 'State Education Officer');INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (1, 'Rahul R B', 'a0db5e0a39ee13db7fc5d1309e637f2c', false, '{8,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default','53bc5d0ff0c53bee460c08b8afe087455050dc7529a2f1d4f7319c0da653a7e4','+91', NULL); INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (2, 'Prajwal C S', 'c4113be1bc2cef51981a6ec687302e42fc4f87f4dfac4276584844d9e3e0f5ae', false, '{8,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default','53bc5d0ff0c53bee460c08b8afe087455050dc7529a2f1d4f7319c0da653a767','+91', NULL); INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (3, 'Vishnu V P', '1092be87fd483fce1deba56c8cdefa79bed4f70a4b110fc4e7947c57aacff219', false, '{8,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default','53bc5d0ff0c53bee460c08b8afe087455050dc7529a2f1d4f7319c0da653a7e0','+91', NULL); INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (4, 'Mallanagouda R B', 'e5fc674d4b1a54c6cf772485e3bca6f7ae14b60de32b9f0cd9f955ee469345bc', false, '{8,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default','53bc5d0ff0c53bee460c08b8afe087455050dc7529a2f1d4f7319c0da653a700','+91', NULL); diff --git a/documentation/3.4.0/sample-data/scp/mac-linux/user/sampleData.sql b/documentation/3.4.0/sample-data/scp/mac-linux/user/sampleData.sql new file mode 100644 index 00000000..48620b41 --- /dev/null +++ b/documentation/3.4.0/sample-data/scp/mac-linux/user/sampleData.sql @@ -0,0 +1,28 @@ +INSERT INTO public.user_roles (id, title, user_type, status, created_at, updated_at, deleted_at, visibility, organization_id, label) VALUES (8, 'state_education_officer', 0, 'ACTIVE', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, 'PUBLIC', 1, 'State Education Officer'); +INSERT INTO public.user_roles (id, title, user_type, status, created_at, updated_at, deleted_at, visibility, organization_id, label) VALUES (9, 'content_creator', 0, 'ACTIVE', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, 'PUBLIC', 1, 'Content Creator'); +INSERT INTO public.user_roles (id, title, user_type, status, created_at, updated_at, deleted_at, visibility, organization_id, label) VALUES (10, 'reviewer', 0, 'ACTIVE', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, 'PUBLIC', 1, 'Reviewer'); +INSERT INTO public.user_roles (id, title, user_type, status, created_at, updated_at, deleted_at, visibility, organization_id, label) VALUES (11, 'program_designer', 0, 'ACTIVE', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, 'PUBLIC', 1, 'Program Designer'); +INSERT INTO public.user_roles (id, title, user_type, status, created_at, updated_at, deleted_at, visibility, organization_id, label) VALUES (12, 'program_manager', 0, 'ACTIVE', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, 'PUBLIC', 1, 'Program Manager'); +INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (1, 'Rahul R B', 'a0db5e0a39ee13db7fc5d1309e637f2c', false, '{8,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default','53bc5d0ff0c53bee460c08b8afe087455050dc7529a2f1d4f7319c0da653a7e4','+91', NULL); +INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (2, 'Prajwal C S', 'c4113be1bc2cef51981a6ec687302e42fc4f87f4dfac4276584844d9e3e0f5ae', false, '{8,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default','53bc5d0ff0c53bee460c08b8afe087455050dc7529a2f1d4f7319c0da653a767','+91', NULL); +INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (3, 'Vishnu V P', '1092be87fd483fce1deba56c8cdefa79bed4f70a4b110fc4e7947c57aacff219', false, '{8,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default','53bc5d0ff0c53bee460c08b8afe087455050dc7529a2f1d4f7319c0da653a7e0','+91', NULL); +INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (4, 'Mallanagouda R B', 'e5fc674d4b1a54c6cf772485e3bca6f7ae14b60de32b9f0cd9f955ee469345bc', false, '{8,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default','53bc5d0ff0c53bee460c08b8afe087455050dc7529a2f1d4f7319c0da653a700','+91', NULL); + +INSERT INTO public.user_organizations (user_id,organization_code, tenant_code, created_at, updated_at, deleted_at) VALUES (1, 'default_code', 'default', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL); +INSERT INTO public.user_organizations (user_id,organization_code, tenant_code, created_at, updated_at, deleted_at) VALUES (2, 'default_code', 'default', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL); +INSERT INTO public.user_organizations (user_id,organization_code, tenant_code, created_at, updated_at, deleted_at) VALUES (3, 'default_code', 'default', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL); +INSERT INTO public.user_organizations (user_id,organization_code, tenant_code, created_at, updated_at, deleted_at) VALUES (4, 'default_code', 'default', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL); + + +INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 2, 'default_code', 1, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL); +INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 3, 'default_code', 2, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL); +INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 2, 'default_code', 3, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL); +INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 4, 'default_code', 3, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL); + + +INSERT INTO public.entity_types (id, value, label, status, created_by, updated_by, allow_filtering, data_type, organization_id, parent_id, has_entities, allow_custom_entities, model_names, created_at, updated_at, deleted_at, meta, external_entity_type, required, regex, tenant_code,organization_code) VALUES (5, 'state', 'State', 'ACTIVE', 0, 0, true, 'STRING', 1, NULL, true, true, '{User}', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, '{\"service\": \"entity-management-service\",\"endPoint\": \"v1/entities/find\"}', true, false, NULL,'default', 'default_code'); +INSERT INTO public.entity_types (id, value, label, status, created_by, updated_by, allow_filtering, data_type, organization_id, parent_id, has_entities, allow_custom_entities, model_names, created_at, updated_at, deleted_at, meta, external_entity_type, required, regex) VALUES (5, 'district', 'District', 'ACTIVE', 0, 0, true, 'STRING', 1, NULL, true, true, '{User}', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, NULL, true, false, NULL); +UPDATE public.entity_types SET status = 'INACTIVE' WHERE id = 3; +SELECT nextval('users_id_seq'::regclass) FROM public.users; +SELECT nextval('users_credentials_id_seq'::regclass) FROM public.users_credentials; +SELECT NULL; \ No newline at end of file diff --git a/documentation/3.4.0/setup/docker/scp/ubuntu/README.md b/documentation/3.4.0/setup/docker/scp/ubuntu/README.md index cc4ca719..ef1d4fbf 100644 --- a/documentation/3.4.0/setup/docker/scp/ubuntu/README.md +++ b/documentation/3.4.0/setup/docker/scp/ubuntu/README.md @@ -48,7 +48,7 @@ To set up the Project application, ensure you have Docker and Docker Compose ins ``` for port in 3000 3001 3002 6000 5001 4000 9092 5432 7007 2181 2707 3569 6001 27017; do - if lsof -iTCP:$port -sTCP:LISTEN &>/dev/null; then + if ss -tuln | grep ":$port " > /dev/null; then echo "Port $port is in use" else echo "Port $port is available" From 614b602596932e0a05edcb803eb32978c9fb7f97 Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Sun, 7 Dec 2025 01:34:17 +0530 Subject: [PATCH 41/63] Format example command for creating project directory in README --- documentation/3.4.0/setup/docker/scp/ubuntu/README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/documentation/3.4.0/setup/docker/scp/ubuntu/README.md b/documentation/3.4.0/setup/docker/scp/ubuntu/README.md index ef1d4fbf..e8051860 100644 --- a/documentation/3.4.0/setup/docker/scp/ubuntu/README.md +++ b/documentation/3.4.0/setup/docker/scp/ubuntu/README.md @@ -38,7 +38,10 @@ To set up the Project application, ensure you have Docker and Docker Compose ins **Create project Directory:** Establish a directory titled **project**. -> Example Command: `mkdir project && cd project/` +Example Command: +``` +mkdir project && cd project/ +``` > Note: All commands are run from the project directory. From 19d95a8b41c52e737976c2ea5e711083923c16a5 Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Sun, 7 Dec 2025 02:22:05 +0530 Subject: [PATCH 42/63] Refactor environment files and update download links in setup_project.sh --- .../dockerized/envs/entity_management_env | 24 +++-- .../3.4.0/dockerized/envs/notification_env | 2 +- .../3.4.0/dockerized/envs/project_env | 86 ++++++++++------- .../3.4.0/dockerized/envs/scheduler_env | 2 +- .../3.4.0/dockerized/envs/scp/interface_env | 26 +++++ .../envs/scp/survey_project_creation_env | 16 ++-- documentation/3.4.0/dockerized/envs/user_env | 95 +++++++++++-------- .../scripts/scp/ubuntu/setup_project.sh | 12 +-- 8 files changed, 158 insertions(+), 105 deletions(-) create mode 100644 documentation/3.4.0/dockerized/envs/scp/interface_env diff --git a/documentation/3.4.0/dockerized/envs/entity_management_env b/documentation/3.4.0/dockerized/envs/entity_management_env index 8f530d17..9cf304c0 100644 --- a/documentation/3.4.0/dockerized/envs/entity_management_env +++ b/documentation/3.4.0/dockerized/envs/entity_management_env @@ -1,23 +1,21 @@ -APPLICATION_PORT = 5001 -APPLICATION_ENV ="development" +APPLICATION_PORT=5001 +APPLICATION_ENV="development" APPLICATION_BASE_URL='/entity-management/' -INTERNAL_ACCESS_TOKEN =xahusub12yexlashsbxAXADHBlaj +INTERNAL_ACCESS_TOKEN=xahusub12yexlashsbxAXADHBlaj ACCESS_TOKEN_SECRET=bsj82AHBxahusub12yexlashsbxAXADHBlaj MONGODB_URL=mongodb://mongo:27017/elevate-entity -AUTH_METHOD = native -USER_SERVICE_URL = http://interface:3569 +AUTH_METHOD=native +USER_SERVICE_URL=http://interface:3569 USER_SERVICE_BASE_URL=/user -KAFKA_HEALTH_CHECK_TOPIC=test -SERVICE_NAME = elevate-entity-service -API_DOC_URL="https://entity-management/entity-management/api-doc" +SERVICE_NAME=elevate-entity-service +API_DOC_URL="/entity-management/api-doc" APPLICATION_HOST=entity_management IS_AUTH_TOKEN_BEARER="false" ADMIN_ACCESS_TOKEN=rwwee3$123 ADMIN_TOKEN_HEADER_NAME="admin-auth-token" INTERFACE_SERVICE_URL=http://interface:3569 -KAFKA_HEALTH_CHECK_TOPIC = entity-health-check-topic-check -KAFKA_COMMUNICATIONS_ON_OFF = ON +KAFKA_HEALTH_CHECK_TOPIC=entity-health-check-topic-check +KAFKA_COMMUNICATIONS_ON_OFF=ON KAFKA_URL=kafka:9092 -KAFKA_COMMUNICATIONS_ON_OFF = ON -KAFKA_GROUP_ID = entity -HEALTH_CHECK_DEBUG_MODE = true \ No newline at end of file +KAFKA_GROUP_ID=dev.entity +HEALTH_CHECK_DEBUG_MODE=true \ No newline at end of file diff --git a/documentation/3.4.0/dockerized/envs/notification_env b/documentation/3.4.0/dockerized/envs/notification_env index 4d7616b8..b10abbae 100644 --- a/documentation/3.4.0/dockerized/envs/notification_env +++ b/documentation/3.4.0/dockerized/envs/notification_env @@ -9,7 +9,7 @@ ERROR_LOG_LEVEL=silly INTERNAL_ACCESS_TOKEN=xahusub12yexlashsbxAXADHBlaj KAFKA_GROUP_ID=notification KAFKA_HOST=kafka:9092 -KAFKA_TOPIC=notifications +KAFKA_TOPIC=dev.notifications SENDGRID_API_KEY=SG.asd9f87a9s8d7f. SENDGRID_FROM_MAIL=no-reply@some.org ERROR_LOG_LEVEL=ERROR_LOG_LEVEL diff --git a/documentation/3.4.0/dockerized/envs/project_env b/documentation/3.4.0/dockerized/envs/project_env index 2494e2b2..acabfb47 100644 --- a/documentation/3.4.0/dockerized/envs/project_env +++ b/documentation/3.4.0/dockerized/envs/project_env @@ -1,49 +1,63 @@ -APPLICATION_PORT = 6000 -APPLICATION_ENV = development +APPLICATION_PORT=6000 +APPLICATION_ENV=development ACCESS_TOKEN_SECRET=bsj82AHBxahusub12yexlashsbxAXADHBlaj -INTERNAL_ACCESS_TOKEN =xahusub12yexlashsbxAXADHBlaj -MONGODB_URL = mongodb://mongodb:27017/elevate-project -KEYCLOAK_PUBLIC_KEY_PATH = keycloak-public-keys -KAFKA_COMMUNICATIONS_ON_OFF = ON -KAFKA_URL =kafka:9092 -KAFKA_GROUP_ID = projects -KAFKA_HEALTH_CHECK_TOPIC = project-health-check-topic-check +INTERNAL_ACCESS_TOKEN=xahusub12yexlashsbxAXADHBlaj +MONGODB_URL=mongodb://mongodb:27017/elevate-project +KEYCLOAK_PUBLIC_KEY_PATH=keycloak-public-keys +KAFKA_COMMUNICATIONS_ON_OFF=ON +KAFKA_URL=kafka:9092 +KAFKA_GROUP_ID=dev.projects +KAFKA_HEALTH_CHECK_TOPIC=project-health-check-topic-check PROJECT_SUBMISSION_TOPIC=sl-improvement-project-submission-dev -SUBMISSION_TOPIC = Projectsubmissions -PROJECT_CERTIFICATE_TOPIC = generateProjectCertificate +SUBMISSION_TOPIC=elevate_project_task_submissions_dev +PROJECT_CERTIFICATE_TOPIC=generateProjectCertificate ELEVATE_PROJECT_SERVICE_URL=http://project:6000 -SERVICE_NAME = project -USER_DELETE_TOPIC = deleteuser +SERVICE_NAME=project +USER_DELETE_TOPIC=dev.userCreate TELEMETRY_TOPIC=telemetry.raw -ID = projectservice +ID=projectservice TELEMETRY_ON_OFF=ON -USER_DELETE_ON_OFF=OFF +USER_DELETE_ON_OFF=ON CLOUD_STORAGE=ON -TIMEZONE_DIFFRENECE_BETWEEN_LOCAL_TIME_AND_UTC = +05:30 -VALIDATE_ENTITIES = ON -APP_PORTAL_BASE_URL =http://portal:7007 -NO_OF_MINUTES = 30 -NO_OF_EXPIRY_TIME = 60 -PRESIGNED_URL_EXPIRY_IN_SECONDS = 300 -DOWNLOADABLE_URL_EXPIRY_IN_SECONDS = 300 -DEFAULT_ORGANISATION_CODE = 1 +TIMEZONE_DIFFRENECE_BETWEEN_LOCAL_TIME_AND_UTC=+05:30 +VALIDATE_ENTITIES=ON +APP_PORTAL_BASE_URL=http://portal:7007 +NO_OF_MINUTES=30 +NO_OF_EXPIRY_TIME=60 +PRESIGNED_URL_EXPIRY_IN_SECONDS=300 +DOWNLOADABLE_URL_EXPIRY_IN_SECONDS=300 +DEFAULT_ORGANISATION_CODE=default_code GOTENBERG_URL=http://gotenberg:3000 API_DOC_URL="http://project/project/api-doc" -INTERFACE_SERVICE_URL = http://interface:3569 -USER_SERVICE_BASE_URL = "/user" -ENTITY_MANAGEMENT_SERVICE_BASE_URL = "/entity-management" +INTERFACE_SERVICE_URL=http://interface:3569 +USER_SERVICE_BASE_URL="/user" +ENTITY_MANAGEMENT_SERVICE_BASE_URL="/entity-management" CLOUD_STORAGE_PROVIDER=gcloud -CLOUD_STORAGE_ACCOUNTNAME=CLOUD_STORAGE_ACCOUNTNAME -CLOUD_STORAGE_SECRET="CLOUD_STORAGE_SECRET" -CLOUD_STORAGE_BUCKETNAME=CLOUD_STORAGE_BUCKETNAME +CLOUD_STORAGE_ACCOUNTNAME=project-storage +CLOUD_STORAGE_SECRET=AKIAIOSFODNN7EXAMPLE +CLOUD_STORAGE_BUCKETNAME=project-storage-bucket CLOUD_STORAGE_BUCKET_TYPE=private -ADMIN_ACCESS_TOKEN = N0DM5NAwwCN5KNXKJwlwu6c0nQQt6Rcl -ADMIN_AUTH_TOKEN = N0DM5NAwwCN5KNXKJwlwu6c0nQQt6Rcl -ADMIN_TOKEN_HEADER_NAME = 'admin-auth-token' -IS_AUTH_TOKEN_BEARER = false -AUTH_METHOD = native +ADMIN_ACCESS_TOKEN=N0DM5NAwwCN5KNXKJwlwu6c0nQQt6Rcl +ADMIN_AUTH_TOKEN=N0DM5NAwwCN5KNXKJwlwu6c0nQQt6Rcl +ADMIN_TOKEN_HEADER_NAME='admin-auth-token' +IS_AUTH_TOKEN_BEARER=false +AUTH_METHOD=native REDIS_HOST=redis://redis:6379 PUBLIC_ASSET_BUCKETNAME=mentoring-storage-public -USER_SERVICE_URL = http://user:3569 +USER_SERVICE_URL=http://user:3569 RESOURCE_DELETION_TOPIC=RESOURCE_DELETION_TOPIC -CLOUD_STORAGE_PROJECT =sl-project \ No newline at end of file +CLOUD_STORAGE_PROJECT=sl-project +APPLICATION_BASE_URL=/project/ +APPLICATION_HOST=project +AUTH_CONFIG_FILE_PATH=config.json +ENABLE_REFLECTION=true +ENTITY_BASE_URL=http://interface:3569 +ENTITY_MONGODB_URL=mongodb://mongodb:27017/elevate_entity +ORGANIZATION_EXTENSION_TOPIC=dev.organizationEvent +ORG_ID_HEADER_NAME=Org-id +ORG_UPDATES_TOPIC=dev.organizationEvent +PROGRAM_USER_MAPPING_TOPIC=qa.program +SESSION_VERIFICATION_METHOD=user_service_authenticated +SUBMISSION_LEVEL=USER +USER_ACCOUNT_EVENT_TOPIC=dev.userCreate +USER_ACTIVITY_TOPIC=dev-user-activities \ No newline at end of file diff --git a/documentation/3.4.0/dockerized/envs/scheduler_env b/documentation/3.4.0/dockerized/envs/scheduler_env index 9de73d13..8c1b7eb5 100644 --- a/documentation/3.4.0/dockerized/envs/scheduler_env +++ b/documentation/3.4.0/dockerized/envs/scheduler_env @@ -7,6 +7,6 @@ DISABLE_LOG=false ENABLE_LOG=true ERROR_LOG_LEVEL=silly KAFKA_URL=kafka:9092 -NOTIFICATION_KAFKA_TOPIC=notifications +NOTIFICATION_KAFKA_TOPIC=dev.notifications REDIS_HOST=redis REDIS_PORT=6379 \ No newline at end of file diff --git a/documentation/3.4.0/dockerized/envs/scp/interface_env b/documentation/3.4.0/dockerized/envs/scp/interface_env new file mode 100644 index 00000000..2c690f4b --- /dev/null +++ b/documentation/3.4.0/dockerized/envs/scp/interface_env @@ -0,0 +1,26 @@ +API_DOC_URL=/interface/api-doc +APPLICATION_ENV=development +APPLICATION_PORT=3569 +ELEVATE_NOTIFICATION_KAFKA_BROKERS=kafka:9092 +ELEVATE_NOTIFICATION_KAFKA_GROUP_ID=mentoring +ELEVATE_NOTIFICATION_KAFKA_TOPIC=notification +ENTITY_SERVICE_BASE_URL=http://entity_management:5001 +INSTALLED_PACKAGES=elevate-mentoring elevate-survey-observation@1.0.1 elevate-self-creation-portal +MENTORING_SERVICE_BASE_URL=http://mentoring:7101 +NOTIFICATION_SERVICE_BASE_URL=http://notification:7201 +PROJECT_SERVICE_BASE_URL=http://project:6000 +RATE_LIMITER_ENABLED=true +RATE_LIMITER_GENERAL_LIMIT=500 +RATE_LIMITER_NUMBER_OF_PROXIES=3 +RATE_LIMITER_PUBLIC_LOW_LIMIT=5 +REQUIRED_BASE_PACKAGES=elevate-mentoring elevate-project elevate-survey-observation self-creation-portal +REQUIRED_PACKAGES=elevate-mentoring@1.2.90 elevate-survey-observation@1.0.22 elevate-project@1.1.53 shiksha-notification@1.1.3 elevate-self-creation-portal@1.0.70 +ROUTE_CONFIG_JSON_URLS_PATHS=https://raw.githubusercontent.com/ELEVATE-Project/utils/refs/heads/develop/interface-routes/elevate-routes.json +SAAS_NOTIFICATION_BASE_URL=interface/v1/notification/send-raw +SAAS_NOTIFICATION_SEND_EMAIL_ROUTE=interface/v1/notification/send-raw +SAMIKSHA_SERVICE_BASE_URL=http://survey:5007 +SCHEDULER_SERVICE_BASE_URL=http://scheduler:7401 +SELF-CREATION-PORTAL_SERVICE_BASE_URL=http://scp:6001 +SUPPORTED_HTTP_TYPES=GET POST PUT PATCH DELETE +SURVEY_SERVICE_BASE_URL=http://survey:5007 +USER_SERVICE_BASE_URL=http://user:3001 \ No newline at end of file diff --git a/documentation/3.4.0/dockerized/envs/scp/survey_project_creation_env b/documentation/3.4.0/dockerized/envs/scp/survey_project_creation_env index 24d2d9eb..ac364369 100644 --- a/documentation/3.4.0/dockerized/envs/scp/survey_project_creation_env +++ b/documentation/3.4.0/dockerized/envs/scp/survey_project_creation_env @@ -3,7 +3,7 @@ ACCESS_TOKEN_SECRET=bsj82AHBxahusub12yexlashsbxAXADHBlaj API_DOC_URL=/scp/api-doc APPLICATION_BASE_URL=/scp/ APPLICATION_ENV=development -APPLICATION_HOST=localhost +APPLICATION_HOST=scp APPLICATION_PORT=6001 AUTH_CONFIG_FILE_PATH=config.json AUTH_METHOD=native @@ -11,14 +11,14 @@ AUTH_TOKEN_HEADER_NAME=x-auth-token BROWSE_EXISTING_END_POINT=v1/internal/getAllPublishedResources CLEAR_INTERNAL_CACHE=scpinternal #Cloud storage details -CLOUD_ENDPOINT=cloud_storage_endpoint +CLOUD_ENDPOINT=s3.ap-south-1.amazonaws.com CLOUD_STORAGE=aws CLOUD_STORAGE_ACCOUNTNAME=project-scp-storage -CLOUD_STORAGE_BUCKETNAME=scp-uploads-prod +CLOUD_STORAGE_BUCKETNAME=scp-prod-storage-private CLOUD_STORAGE_PROVIDER=aws -CLOUD_STORAGE_REGION=us-west-2 +CLOUD_STORAGE_REGION=ap-south-1 CLOUD_STORAGE_SECRET=AKIAIOSFODNN7EXAMPLE -CLOUD_STORAGE_BUCKET_TYPE=public +CLOUD_STORAGE_BUCKET_TYPE=private PUBLIC_ASSET_BUCKETNAME=scp-public-assets CONSUMPTION_SERVICE=elevate CONSUMPTION_SERVICE_BASE_URL=/project/ @@ -45,7 +45,7 @@ ENTITY_MANAGEMENT_SERVICE_NAME=/entity-management/ ERROR_LOG_LEVEL=silly HIGHEST_IN_ENTITY_HIERARCHY=state INTERFACE_SERVICE_HOST=http://interface:3569 -INTERNAL_ACCESS_TOKEN=Fqn0m0HQ0gXydRtBCg5l +INTERNAL_ACCESS_TOKEN=xahusub12yexlashsbxAXADHBlaj INTERNAL_CACHE_EXP_TIME=86400 IS_AUTH_TOKEN_BEARER=false KAFKA_COMMUNICATIONS_ON_OFF=ON @@ -63,11 +63,11 @@ ORGANIZATION_LIST_ENDPOINT=v1/organization/list ORGANIZATION_READ_ENDPOINT=v1/organization/read ORG_ID_HEADER_NAME=organization-id PROGRAM_META_INFO_KEYS=state,recommendedFor -PROGRAM_PUBLISH_KAFKA_TOPIC=qa.programpublish +PROGRAM_PUBLISH_KAFKA_TOPIC=dev.programpublish PROJECT_DEEP_LINK_URL=https://portal/view/project/ PROJECT_MONGO_DB_URL=mongodb://mongodb:27017/elevate-project PROJECT_PUBLISH_END_POINT=v1/scp/publishTemplateAndTasks -PROJECT_PUBLISH_KAFKA_TOPIC=qa.projectpublish +PROJECT_PUBLISH_KAFKA_TOPIC=dev.projectpublish PROJECT_REFLECTION_TASK_REDIRECT_URL=https://elevate-mitra.shikshalokam.org/mohini/sso?flow=guest-mi-story PROJECT_SERVICE_BASE_URL=/project/ REDIS_HOST=redis://redis:6379 diff --git a/documentation/3.4.0/dockerized/envs/user_env b/documentation/3.4.0/dockerized/envs/user_env index f6287fa2..853b7ddd 100644 --- a/documentation/3.4.0/dockerized/envs/user_env +++ b/documentation/3.4.0/dockerized/envs/user_env @@ -1,16 +1,17 @@ ACCESS_TOKEN_EXPIRY='30m' +ALLOWED_HOST='*' ACCESS_TOKEN_SECRET='bsj82AHBxahusub12yexlashsbxAXADHBlaj' API_DOC_URL=/user/api-doc APP_NAME=MentorED APPLICATION_ENV=development APPLICATION_PORT=3001 -CLOUD_STORAGE_PROVIDER = aws -CLOUD_STORAGE_BUCKETNAME =mentoring-prod-storage-private -CLOUD_STORAGE_SECRET= CLOUD_STORAGE_SECRET/H1UM8XLL -CLOUD_STORAGE_REGION =ap-south-1 -CLOUD_ENDPOINT = s3.ap-south-1.amazonaws.com -CLOUD_STORAGE_ACCOUNTNAME =CLOUD_STORAGE_ACCOUNTNAME -CLOUD_STORAGE_BUCKET_TYPE = private +CLOUD_STORAGE_PROVIDER=aws +CLOUD_STORAGE_BUCKETNAME=mentoring-prod-storage-private +CLOUD_STORAGE_SECRET=AKIAIOSFODNN7EXAMPLE +CLOUD_STORAGE_REGION=ap-south-1 +CLOUD_ENDPOINT=s3.ap-south-1.amazonaws.com +CLOUD_STORAGE_ACCOUNTNAME=mentoring-prod-storage-private +CLOUD_STORAGE_BUCKET_TYPE=private PUBLIC_ASSET_BUCKETNAME=mentoring-prod-storage-private AZURE_ACCOUNT_KEY='AZURE_ACCOUNT_KEY' AZURE_ACCOUNT_NAME=elevatementoringaccount @@ -25,13 +26,13 @@ GCP_PROJECT_ID=sl-dev-project INTERNAL_ACCESS_TOKEN=xahusub12yexlashsbxAXADHBlaj INTERNAL_CACHE_EXP_TIME=86400 IV=LHYOA5YnTonqcgrm15k3/Q== -KAFKA_GROUP_ID=projects -KAFKA_TOPIC= -KAFKA_URL= kafka:9092 +KAFKA_GROUP_ID=users +KAFKA_TOPIC=dev.topic.user +KAFKA_URL=kafka:9092 KEY=E/m3RD/aM3Ed3lLfYVcKizakG9R+bFybAPZSLjIP2hY= MENTOR_SECRET_CODE=4567 MONGODB_URL=mongodb://mongo:27017/elevate-users -NOTIFICATION_KAFKA_TOPIC=notifications +NOTIFICATION_KAFKA_TOPIC=dev.notifications OTP_EMAIL_TEMPLATE_CODE=emailotp OTP_EXP_TIME=86400 RATING_KAFKA_TOPIC=dev.mentor_rating @@ -42,41 +43,55 @@ REGISTRATION_EMAIL_TEMPLATE_CODE=registration REGISTRATION_OTP_EMAIL_TEMPLATE_CODE=registrationotp SALT_ROUNDS=10 DEFAULT_OCI_BUCKET_NAME=mentoring-oci-private -OCI_ACCESS_KEY_ID= 81a4c2553026982360af6b24497c489b0fea9436 +OCI_ACCESS_KEY_ID=81a4c2553026982360af6b24497c489b0fea9436 OCI_BUCKET_ENDPOINT=https://axgqmpkrpmt5.compat.objectstorage.ap-hyderabad-1.oraclecloud.com -OCI_BUCKET_REGION= ap-hyderabad-1 +OCI_BUCKET_REGION=ap-hyderabad-1 OCI_SECRET_ACCESS_KEY='+U4O+CjiC6M/mOcGjYh7K/9XjfSdJ79OoLuQrABPOJ8=' -ERROR_LOG_LEVEL= silly -DISABLE_LOG= false +ERROR_LOG_LEVEL=silly +DISABLE_LOG=false DEFAULT_ORGANISATION_CODE=default_code DEV_DATABASE_URL=postgres://postgres:postgres@citus_master:5432/user ADMIN_SECRET_CODE=W5bF7gesuS0xsNWmpsKy -MENTORING_SERVICE_URL="http://localhost:3000" -INVITEE_EMAIL_TEMPLATE_CODE="emailcode" -ADMIN_INVITEE_UPLOAD_EMAIL_TEMPLATE_CODE="coeadmin" +MENTORING_SERVICE_URL="http://mentoring:3000" +INVITEE_EMAIL_TEMPLATE_CODE="invite_user" +ADMIN_INVITEE_UPLOAD_EMAIL_TEMPLATE_CODE="invitee_upload_status" DEFAULT_QUEUE="defaultque" -MENTOR_INVITATION_EMAIL_TEMPLATE_CODE="mentorinvitationTemplateCode" -MENTEE_INVITATION_EMAIL_TEMPLATE_CODE="mentee invitationTemplateCode" +MENTOR_INVITATION_EMAIL_TEMPLATE_CODE="invite_mentor" +MENTEE_INVITATION_EMAIL_TEMPLATE_CODE="invite_mentee" DEFAULT_ROLE="mentee" -SAMPLE_CSV_FILE_PATH="sample path" -ORG_ADMIN_INVITATION_EMAIL_TEMPLATE_CODE = "code5" -DEFAULT_ORG_ID = 1 -PORTAL_URL = "portaladdress" -SCHEDULER_SERVICE_HOST = scheduler -SCHEDULER_SERVICE_BASE_URL = "/scheduler/" -REFRESH_VIEW_INTERVAL = 100000 -EMAIL_ID_ENCRYPTION_IV = 'a390328e496f025249a88384f318a536' -EMAIL_ID_ENCRYPTION_KEY = '9bbf4698e081176b4e38c3f04f9c0cff6ae80b1960e5ac868cc234ac8537aa66' -EMAIL_ID_ENCRYPTION_ALGORITHM = 'aes-256-cbc' -GENERIC_INVITATION_EMAIL_TEMPLATE_CODE = 'check_code' -EVENT_ORG_LISTENER_URLS = "sample url" -EVENT_ENABLE_ORG_EVENTS = false -DOWNLOAD_URL_EXPIRATION_DURATION = 300 -APPLICATION_HOST= "localhost" -CHANGE_PASSWORD_TEMPLATE_CODE = "change_password" -CAPTCHA_ENABLE = false -RECAPTCHA_SECRET_KEY= "6LfWEKYpAAAAAJS0eukS2Su_5vwlXRs5vPbC34W0" +SAMPLE_CSV_FILE_PATH="sample/bulk_user_creation.csv" +ORG_ADMIN_INVITATION_EMAIL_TEMPLATE_CODE="invite_org_admin" +DEFAULT_ORG_ID=1 +PORTAL_URL="portaladdress" +SCHEDULER_SERVICE_HOST="http://scheduler:4000" +SCHEDULER_SERVICE_BASE_URL="/scheduler/" +REFRESH_VIEW_INTERVAL=100000 +EMAIL_ID_ENCRYPTION_IV='a390328e496f025249a88384f318a536' +EMAIL_ID_ENCRYPTION_KEY='9bbf4698e081176b4e38c3f04f9c0cff6ae80b1960e5ac868cc234ac8537aa66' +EMAIL_ID_ENCRYPTION_ALGORITHM='aes-256-cbc' +GENERIC_INVITATION_EMAIL_TEMPLATE_CODE='check_code' +EVENT_ORG_LISTENER_URLS="http://interface:3569/mentoring/v1/organization/eventListener" +EVENT_ENABLE_ORG_EVENTS=false +DOWNLOAD_URL_EXPIRATION_DURATION=300 +APPLICATION_HOST="user" +CHANGE_PASSWORD_TEMPLATE_CODE="change_password" +CAPTCHA_ENABLE=false +RECAPTCHA_SECRET_KEY="6LfWEKYpAAAAAJS0eukS2Su_5vwlXRs5vPbC34W0" ALLOWED_IDLE_TIME=1200000 APPLICATION_BASE_URL="/user" -ENTITY_MANAGEMENT_SERVICE_BASE_URL="/" -IS_AUTH_TOKEN_BEARER=false \ No newline at end of file +ENTITY_MANAGEMENT_SERVICE_BASE_URL="/entity-management" +IS_AUTH_TOKEN_BEARER=false +DEFAULT_TENANT_ORG_CODE=default_code +DEFAULT_TENANT_ORG_NAME="Default Organization" +EVENT_ENABLE_ORG_KAFKA_EVENTS=true +EVENT_ENABLE_TENANT_KAFKA_EVENTS=true +EVENT_ENABLE_USER_KAFKA_EVENTS=true +EVENT_ORGANIZATION_KAFKA_TOPIC="dev.organizationEvent" +EVENT_TENANT_KAFKA_TOPIC="dev.tenantEvent" +EVENT_USER_KAFKA_TOPIC="dev.userCreate" +INTERFACE_SERVICE_HOST="http://interface:3569" +JWT_SECRET='bsj82AHBxahusub12yexlashsbxAXADHBlaj' +SCHEDULER_SERVICE_ERROR_REPORTING_EMAIL_ID="test@yopmail.com" +SCHEDULER_SERVICE_URL="http://interface:3569/jobs/scheduleJob" +SERVICE_NAME="UserService" +SIGNED_URL_EXPIRY_IN_SECONDS="900" \ No newline at end of file diff --git a/documentation/3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh b/documentation/3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh index bbcbaa06..194f6880 100644 --- a/documentation/3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh +++ b/documentation/3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh @@ -13,12 +13,12 @@ log "Docker Compose file downloaded." # Step 2: Download environment files log "Downloading environment files..." curl -L \ - -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/envs/interface_env \ - -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuidedocumentation/3.4.0/dockerized/envs/entity_management_env \ - -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuidedocumentation/3.4.0/dockerized/envs/project_env \ - -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuidedocumentation/3.4.0/dockerized/envs/notification_env \ - -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuidedocumentation/3.4.0/dockerized/envs/scheduler_env \ - -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuidedocumentation/3.4.0/dockerized/envs/user_env \ + -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/envs/scp/interface_env \ + -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/3.4.0/dockerized/envs/entity_management_env \ + -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/3.4.0/dockerized/envs/project_env \ + -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/3.4.0/dockerized/envs/notification_env \ + -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/3.4.0/dockerized/envs/scheduler_env \ + -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/3.4.0/dockerized/envs/user_env \ -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/envs/scp/survey_project_creation_env \ -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/envs/env.js log "Environment files downloaded." From 6b2934cf70ca8e44c800eaa8ed95135701e68fdb Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Sun, 7 Dec 2025 02:38:17 +0530 Subject: [PATCH 43/63] Enhance docker-compose configuration with health checks for Zookeeper and Kafka services; update notification environment variables. --- .../scp/docker-compose-project.yml | 29 +++++++------------ .../3.4.0/dockerized/envs/notification_env | 3 +- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml b/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml index cd127de6..88ceb27e 100644 --- a/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml +++ b/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml @@ -8,6 +8,11 @@ services: - ALLOW_ANONYMOUS_LOGIN=yes - ZOOKEEPER_CLIENT_PORT=2181 - ZOOKEEPER_TICK_TIME=2000 + healthcheck: + test: echo srvr | nc localhost 2181 || exit 1 + interval: 10s + timeout: 5s + retries: 5 networks: - project_net kafka: @@ -23,7 +28,8 @@ services: KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 depends_on: - - zookeeper + zookeeper: + condition: service_healthy healthcheck: test: kafka-topics --bootstrap-server localhost:9092 --list || exit 1 interval: 10s @@ -125,16 +131,14 @@ services: - DEV_DATABASE_URL=postgres://postgres:postgres@citus_master:5432/notification networks: - project_net - # env_file: - # - ./notification_env + env_file: + - ./notification_env scheduler: image: shikshalokamqa/elevate-scheduler:2.6.1 ports: - '4000:4000' command: ['nodemon', 'app.js'] - # environment: - # - KAFKA_URL=kafka:9092 depends_on: kafka: condition: service_healthy @@ -145,8 +149,6 @@ services: env_file: - ./scheduler_env interface: - # Update with latest image - # build: ./interface-service image: shikshalokamqa/elevate-interface:3.3.2 ports: - '3569:3569' @@ -218,7 +220,7 @@ services: ports: - '7007:7007' volumes: - - /home/user4/Workspace/Docker Image/env.js:/usr/src/app/www/assets/env/env.js + - ../../envs/env.js:/usr/src/app/www/assets/env/env.js command: > /bin/bash -c "ionic build --prod && ionic serve --host 0.0.0.0" networks: @@ -237,19 +239,8 @@ services: done; echo 'Kafka is ready.' && nodemon app.js" - environment: - - KAFKA_URL=kafka:9092 - - DEV_DATABASE_URL=postgres://postgres:postgres@citus_master:5432/scp - - REDIS_HOST=redis://redis:6379 env_file: - ./survey_project_creation_env - depends_on: - kafka: - condition: service_healthy - citus: - condition: service_started - redis: - condition: service_healthy volumes: - ./survey-project-creation-service/src/:/var/src networks: diff --git a/documentation/3.4.0/dockerized/envs/notification_env b/documentation/3.4.0/dockerized/envs/notification_env index b10abbae..29342aa8 100644 --- a/documentation/3.4.0/dockerized/envs/notification_env +++ b/documentation/3.4.0/dockerized/envs/notification_env @@ -12,5 +12,4 @@ KAFKA_HOST=kafka:9092 KAFKA_TOPIC=dev.notifications SENDGRID_API_KEY=SG.asd9f87a9s8d7f. SENDGRID_FROM_MAIL=no-reply@some.org -ERROR_LOG_LEVEL=ERROR_LOG_LEVEL -DISABLE_LOG=true \ No newline at end of file +DISABLE_LOG=true From e88babd033b0adf5035454e5f66ab78cbd03a3c1 Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Sun, 7 Dec 2025 02:42:50 +0530 Subject: [PATCH 44/63] Update baseURL in env.js and correct download links in setup_project.sh for environment files --- documentation/3.4.0/dockerized/envs/env.js | 2 +- .../dockerized/scripts/scp/ubuntu/setup_project.sh | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/documentation/3.4.0/dockerized/envs/env.js b/documentation/3.4.0/dockerized/envs/env.js index 9606a60a..923660d5 100644 --- a/documentation/3.4.0/dockerized/envs/env.js +++ b/documentation/3.4.0/dockerized/envs/env.js @@ -1,6 +1,6 @@ window['env'] = { production: true, - baseURL: 'https://qa.elevate-apis.shikshalokam.org', + baseURL: 'http://interface:3569', capabilities: 'all', restrictedPages: ['DOWNLOADS', 'AUTH_PAGES', 'PROFILE', 'EDIT_PROFILE'], unauthorizedRedirectUrl: '/', diff --git a/documentation/3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh b/documentation/3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh index 194f6880..94b8bbeb 100644 --- a/documentation/3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh +++ b/documentation/3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh @@ -14,11 +14,11 @@ log "Docker Compose file downloaded." log "Downloading environment files..." curl -L \ -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/envs/scp/interface_env \ - -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/3.4.0/dockerized/envs/entity_management_env \ - -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/3.4.0/dockerized/envs/project_env \ - -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/3.4.0/dockerized/envs/notification_env \ - -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/3.4.0/dockerized/envs/scheduler_env \ - -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/3.4.0/dockerized/envs/user_env \ + -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/envs/entity_management_env \ + -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/envs/project_env \ + -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/envs/notification_env \ + -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/envs/scheduler_env \ + -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/envs/user_env \ -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/envs/scp/survey_project_creation_env \ -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/envs/env.js log "Environment files downloaded." From 29284eb7de8d08816624c4314b85180ae15345ca Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Sun, 7 Dec 2025 02:51:38 +0530 Subject: [PATCH 45/63] Update volume path for env.js in docker-compose configuration --- .../3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml b/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml index 88ceb27e..ed02c26e 100644 --- a/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml +++ b/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml @@ -220,7 +220,7 @@ services: ports: - '7007:7007' volumes: - - ../../envs/env.js:/usr/src/app/www/assets/env/env.js + - ./env.js:/usr/src/app/www/assets/env/env.js command: > /bin/bash -c "ionic build --prod && ionic serve --host 0.0.0.0" networks: From e15d5d8e48b1503a0421ffe4de766c32e64bb8a2 Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Sun, 7 Dec 2025 03:28:53 +0530 Subject: [PATCH 46/63] Update docker-compose configuration for scp service and add ORG_CODE_HEADER_NAME to user_env --- .../scp/docker-compose-project.yml | 24 ++++++++++++------- documentation/3.4.0/dockerized/envs/user_env | 3 ++- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml b/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml index ed02c26e..7556de3e 100644 --- a/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml +++ b/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml @@ -93,7 +93,7 @@ services: (while ! curl -sSf http://user:3001 > /dev/null; do sleep 1; done && echo 'Service is up' && - /bin/bash -c 'cd scripts && echo Running user service scripts && node insertDefaultOrg.js && node -r module-alias/register uploadSampleCSV.js'); + /bin/bash -c 'cd scripts && echo Running user service scripts && node -r module-alias/register uploadSampleCSV.js'); tail -f /dev/null" depends_on: - kafka @@ -225,20 +225,26 @@ services: /bin/bash -c "ionic build --prod && ionic serve --host 0.0.0.0" networks: - project_net - survey-project-creation-service: + scp: build: ./survey-project-creation-service container_name: survey-project-creation-service ports: - '6001:6001' command: > - bash -c "cp /var/src/config.sample.json /var/src/config.json 2>/dev/null || true && - echo 'Waiting for Kafka to be ready...' && - while ! timeout 1 bash -c 'cat < /dev/null > /dev/tcp/kafka/9092' 2> /dev/null; do - echo 'Waiting for Kafka...'; - sleep 2; + bash -c "echo 'Waiting for PostgreSQL on citus_master:5432 to accept connections...' && + while ! timeout 1 bash -c 'cat < /dev/null > /dev/tcp/citus_master/5432' 2> /dev/null; do + echo 'Waiting for citus_master to be ready...'; + sleep 1; done; - echo 'Kafka is ready.' && - nodemon app.js" + echo 'Database is ready.'; + npm run db:init && + (echo 'Running nodeee' && nodemon app.js &) && + (while ! curl -sSf http://scp:6001 > /dev/null; do + sleep 1; + done && echo 'Service is up' && + cp /var/src/config.sample.json /var/src/config.json 2>/dev/null || true && + /bin/bash -c 'cd scripts && echo Running scp service scripts && node addDefaultEntitiesForEducationSector.js'); + tail -f /dev/null" env_file: - ./survey_project_creation_env volumes: diff --git a/documentation/3.4.0/dockerized/envs/user_env b/documentation/3.4.0/dockerized/envs/user_env index 853b7ddd..9b20f305 100644 --- a/documentation/3.4.0/dockerized/envs/user_env +++ b/documentation/3.4.0/dockerized/envs/user_env @@ -94,4 +94,5 @@ JWT_SECRET='bsj82AHBxahusub12yexlashsbxAXADHBlaj' SCHEDULER_SERVICE_ERROR_REPORTING_EMAIL_ID="test@yopmail.com" SCHEDULER_SERVICE_URL="http://interface:3569/jobs/scheduleJob" SERVICE_NAME="UserService" -SIGNED_URL_EXPIRY_IN_SECONDS="900" \ No newline at end of file +SIGNED_URL_EXPIRY_IN_SECONDS="900" +ORG_CODE_HEADER_NAME=organization-id \ No newline at end of file From 9e04e8b96817c2b962b522c24dcd54d95e7d1341 Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Sun, 7 Dec 2025 22:16:10 +0530 Subject: [PATCH 47/63] Update Kafka group IDs and notification topics in environment files; adjust MongoDB URLs for consistency --- .../3.4.0/dockerized/envs/entity_management_env | 2 +- documentation/3.4.0/dockerized/envs/interface_env | 12 ++++++------ documentation/3.4.0/dockerized/envs/project_env | 6 +++--- .../3.4.0/dockerized/envs/scp/interface_env | 2 +- .../dockerized/envs/scp/survey_project_creation_env | 6 +++--- documentation/3.4.0/dockerized/envs/user_env | 3 ++- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/documentation/3.4.0/dockerized/envs/entity_management_env b/documentation/3.4.0/dockerized/envs/entity_management_env index 9cf304c0..c63885e9 100644 --- a/documentation/3.4.0/dockerized/envs/entity_management_env +++ b/documentation/3.4.0/dockerized/envs/entity_management_env @@ -17,5 +17,5 @@ INTERFACE_SERVICE_URL=http://interface:3569 KAFKA_HEALTH_CHECK_TOPIC=entity-health-check-topic-check KAFKA_COMMUNICATIONS_ON_OFF=ON KAFKA_URL=kafka:9092 -KAFKA_GROUP_ID=dev.entity +KAFKA_GROUP_ID=entity HEALTH_CHECK_DEBUG_MODE=true \ No newline at end of file diff --git a/documentation/3.4.0/dockerized/envs/interface_env b/documentation/3.4.0/dockerized/envs/interface_env index f79f110b..8e437c10 100644 --- a/documentation/3.4.0/dockerized/envs/interface_env +++ b/documentation/3.4.0/dockerized/envs/interface_env @@ -6,8 +6,8 @@ ELEVATE_NOTIFICATION_KAFKA_GROUP_ID=mentoring ELEVATE_NOTIFICATION_KAFKA_TOPIC=notification ENTITY_SERVICE_BASE_URL=http://entity_management:5001 INSTALLED_PACKAGES=elevate-mentoring elevate-survey-observation@1.0.1 elevate-self-creation-portal -MENTORING_SERVICE_BASE_URL=http://localhost:7101 -NOTIFICATION_SERVICE_BASE_URL=http://localhost:7201 +MENTORING_SERVICE_BASE_URL=http://mentoring:7101 +NOTIFICATION_SERVICE_BASE_URL=http://notification:7201 PROJECT_SERVICE_BASE_URL=http://project:6000 RATE_LIMITER_ENABLED=true RATE_LIMITER_GENERAL_LIMIT=500 @@ -18,9 +18,9 @@ REQUIRED_PACKAGES=elevate-mentoring@1.2.90 elevate-survey-observation@1.0.22 ele ROUTE_CONFIG_JSON_URLS_PATHS=https://raw.githubusercontent.com/ELEVATE-Project/utils/refs/heads/develop/interface-routes/elevate-routes.json SAAS_NOTIFICATION_BASE_URL=interface/v1/notification/send-raw SAAS_NOTIFICATION_SEND_EMAIL_ROUTE=interface/v1/notification/send-raw -SAMIKSHA_SERVICE_BASE_URL=http://localhost:5007 -SCHEDULER_SERVICE_BASE_URL=http://localhost:7401 -SELF-CREATION-PORTAL_SERVICE_BASE_URL=http://localhost:6001 +SAMIKSHA_SERVICE_BASE_URL=http://samiksha:5007 +SCHEDULER_SERVICE_BASE_URL=http://scheduler:7401 +SELF-CREATION-PORTAL_SERVICE_BASE_URL=http://scp:6001 SUPPORTED_HTTP_TYPES=GET POST PUT PATCH DELETE -SURVEY_SERVICE_BASE_URL=http://localhost:5007 +SURVEY_SERVICE_BASE_URL=http://samiksha:5007 USER_SERVICE_BASE_URL=http://user:3001 \ No newline at end of file diff --git a/documentation/3.4.0/dockerized/envs/project_env b/documentation/3.4.0/dockerized/envs/project_env index acabfb47..5dd868fd 100644 --- a/documentation/3.4.0/dockerized/envs/project_env +++ b/documentation/3.4.0/dockerized/envs/project_env @@ -6,7 +6,7 @@ MONGODB_URL=mongodb://mongodb:27017/elevate-project KEYCLOAK_PUBLIC_KEY_PATH=keycloak-public-keys KAFKA_COMMUNICATIONS_ON_OFF=ON KAFKA_URL=kafka:9092 -KAFKA_GROUP_ID=dev.projects +KAFKA_GROUP_ID=projects KAFKA_HEALTH_CHECK_TOPIC=project-health-check-topic-check PROJECT_SUBMISSION_TOPIC=sl-improvement-project-submission-dev SUBMISSION_TOPIC=elevate_project_task_submissions_dev @@ -52,11 +52,11 @@ APPLICATION_HOST=project AUTH_CONFIG_FILE_PATH=config.json ENABLE_REFLECTION=true ENTITY_BASE_URL=http://interface:3569 -ENTITY_MONGODB_URL=mongodb://mongodb:27017/elevate_entity +ENTITY_MONGODB_URL=mongodb://mongo:27017/elevate_entity ORGANIZATION_EXTENSION_TOPIC=dev.organizationEvent ORG_ID_HEADER_NAME=Org-id ORG_UPDATES_TOPIC=dev.organizationEvent -PROGRAM_USER_MAPPING_TOPIC=qa.program +PROGRAM_USER_MAPPING_TOPIC=dev.program SESSION_VERIFICATION_METHOD=user_service_authenticated SUBMISSION_LEVEL=USER USER_ACCOUNT_EVENT_TOPIC=dev.userCreate diff --git a/documentation/3.4.0/dockerized/envs/scp/interface_env b/documentation/3.4.0/dockerized/envs/scp/interface_env index 2c690f4b..fc58ff0e 100644 --- a/documentation/3.4.0/dockerized/envs/scp/interface_env +++ b/documentation/3.4.0/dockerized/envs/scp/interface_env @@ -3,7 +3,7 @@ APPLICATION_ENV=development APPLICATION_PORT=3569 ELEVATE_NOTIFICATION_KAFKA_BROKERS=kafka:9092 ELEVATE_NOTIFICATION_KAFKA_GROUP_ID=mentoring -ELEVATE_NOTIFICATION_KAFKA_TOPIC=notification +ELEVATE_NOTIFICATION_KAFKA_TOPIC=dev.notification ENTITY_SERVICE_BASE_URL=http://entity_management:5001 INSTALLED_PACKAGES=elevate-mentoring elevate-survey-observation@1.0.1 elevate-self-creation-portal MENTORING_SERVICE_BASE_URL=http://mentoring:7101 diff --git a/documentation/3.4.0/dockerized/envs/scp/survey_project_creation_env b/documentation/3.4.0/dockerized/envs/scp/survey_project_creation_env index ac364369..3ab13486 100644 --- a/documentation/3.4.0/dockerized/envs/scp/survey_project_creation_env +++ b/documentation/3.4.0/dockerized/envs/scp/survey_project_creation_env @@ -55,9 +55,9 @@ MAX_BODY_LENGTH_FOR_UPLOAD=5242880 MAX_PROJECT_TASK_COUNT=10 MAX_RESOURCE_NOTE_LENGTH=200 MIN_APPROVAL=1 -MONGODB_URL=mongodb://mongodb:27017/elevate-project +MONGODB_URL=mongodb://mongo:27017/elevate-project MONGO_DB_MODE=individual -NOTIFICATION_KAFKA_TOPIC=qa.notification +NOTIFICATION_KAFKA_TOPIC=dev.notification OBSERVATION_DEEP_LINK_REGEX=^https://portal/view/observation/[a-f0-9]{32}$ ORGANIZATION_LIST_ENDPOINT=v1/organization/list ORGANIZATION_READ_ENDPOINT=v1/organization/read @@ -80,7 +80,7 @@ REVIEW_TYPE=SEQUENTIAL ROLLOUT_PUBLISH_KAFKA_TOPIC=dev.rolloutpublish SESSION_VERIFICATION_METHOD=user_service_authenticated SHOW_REVIEWER_LIST=true -SURVEY_MONGO_DB_URL=mongodb://mongodb:27017/elevate-samiksha +SURVEY_MONGO_DB_URL=mongodb://mongo:27017/elevate-samiksha SURVEY_SERVICE_BASE_URL=/survey/ TENANT_ID_HEADER_NAME=tenant-id USER_LIST_ENDPOINT=v1/account/search diff --git a/documentation/3.4.0/dockerized/envs/user_env b/documentation/3.4.0/dockerized/envs/user_env index 9b20f305..678adae8 100644 --- a/documentation/3.4.0/dockerized/envs/user_env +++ b/documentation/3.4.0/dockerized/envs/user_env @@ -95,4 +95,5 @@ SCHEDULER_SERVICE_ERROR_REPORTING_EMAIL_ID="test@yopmail.com" SCHEDULER_SERVICE_URL="http://interface:3569/jobs/scheduleJob" SERVICE_NAME="UserService" SIGNED_URL_EXPIRY_IN_SECONDS="900" -ORG_CODE_HEADER_NAME=organization-id \ No newline at end of file +ORG_CODE_HEADER_NAME=organization-id +ORG_ID_HEADER_NAME=organization-id \ No newline at end of file From b5f747b04828406a5181c008257361309481a6f6 Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Sun, 7 Dec 2025 22:30:57 +0530 Subject: [PATCH 48/63] Add node_modules volume to survey project creation service in docker-compose --- .../3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml b/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml index 7556de3e..fec22f0c 100644 --- a/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml +++ b/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml @@ -249,6 +249,7 @@ services: - ./survey_project_creation_env volumes: - ./survey-project-creation-service/src/:/var/src + - /var/src/node_modules networks: - project_net networks: From e0ada18ca4891321fe18121ecfdf77eb2ffca370 Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Sun, 7 Dec 2025 22:45:01 +0530 Subject: [PATCH 49/63] Add config.json creation logic and update user_env with new header names --- .../dockerFiles/scp/docker-compose-project.yml | 11 +++++++++-- documentation/3.4.0/dockerized/envs/user_env | 3 ++- documentation/3.4.0/native/envs/scp/user_env | 5 ++++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml b/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml index fec22f0c..04171b03 100644 --- a/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml +++ b/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml @@ -237,12 +237,19 @@ services: sleep 1; done; echo 'Database is ready.'; + echo 'Creating config.json from config.sample.json...'; + if [ -f /var/src/config.sample.json ]; then + cp /var/src/config.sample.json /var/src/config.json; + echo 'config.json created successfully'; + else + echo 'ERROR: config.sample.json not found'; + exit 1; + fi; npm run db:init && (echo 'Running nodeee' && nodemon app.js &) && - (while ! curl -sSf http://scp:6001 > /dev/null; do + (while ! curl -sSf http://scp:6001 > /dev/null; do sleep 1; done && echo 'Service is up' && - cp /var/src/config.sample.json /var/src/config.json 2>/dev/null || true && /bin/bash -c 'cd scripts && echo Running scp service scripts && node addDefaultEntitiesForEducationSector.js'); tail -f /dev/null" env_file: diff --git a/documentation/3.4.0/dockerized/envs/user_env b/documentation/3.4.0/dockerized/envs/user_env index 678adae8..1b910015 100644 --- a/documentation/3.4.0/dockerized/envs/user_env +++ b/documentation/3.4.0/dockerized/envs/user_env @@ -96,4 +96,5 @@ SCHEDULER_SERVICE_URL="http://interface:3569/jobs/scheduleJob" SERVICE_NAME="UserService" SIGNED_URL_EXPIRY_IN_SECONDS="900" ORG_CODE_HEADER_NAME=organization-id -ORG_ID_HEADER_NAME=organization-id \ No newline at end of file +ORG_ID_HEADER_NAME=organization-id +TENANT_CODE_HEADER_NAME=tenant-id \ No newline at end of file diff --git a/documentation/3.4.0/native/envs/scp/user_env b/documentation/3.4.0/native/envs/scp/user_env index 23ecf03a..2078f5cc 100644 --- a/documentation/3.4.0/native/envs/scp/user_env +++ b/documentation/3.4.0/native/envs/scp/user_env @@ -79,4 +79,7 @@ CAPTCHA_ENABLE = false RECAPTCHA_SECRET_KEY= "6LfWEKYpAAAAAJS0eukS2Su_5vwlXRs5vPbC34W0" ALLOWED_IDLE_TIME=1200000 APPLICATION_BASE_URL="/user" -ENTITY_MANAGEMENT_SERVICE_BASE_URL="/" \ No newline at end of file +ENTITY_MANAGEMENT_SERVICE_BASE_URL="/" +ORG_CODE_HEADER_NAME=organization-id +ORG_ID_HEADER_NAME=organization-id +TENANT_CODE_HEADER_NAME=tenant-id \ No newline at end of file From ff4039587a060585a02f4c7cd693d5bb7d3c9873 Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Sun, 7 Dec 2025 22:50:28 +0530 Subject: [PATCH 50/63] Refactor docker-compose for Zookeeper and Kafka services: update environment variable syntax, improve healthcheck commands, and simplify Kafka listener configuration. --- .../scp/docker-compose-project.yml | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml b/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml index 04171b03..ef98c011 100644 --- a/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml +++ b/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml @@ -2,14 +2,15 @@ version: '3' services: zookeeper: image: 'confluentinc/cp-zookeeper:7.3.0' + container_name: zookeeper ports: - '2181:2181' environment: - - ALLOW_ANONYMOUS_LOGIN=yes - - ZOOKEEPER_CLIENT_PORT=2181 - - ZOOKEEPER_TICK_TIME=2000 + ZOOKEEPER_CLIENT_PORT: 2181 + ZOOKEEPER_TICK_TIME: 2000 + ALLOW_ANONYMOUS_LOGIN: "yes" healthcheck: - test: echo srvr | nc localhost 2181 || exit 1 + test: ["CMD", "nc", "-z", "localhost", "2181"] interval: 10s timeout: 5s retries: 5 @@ -17,24 +18,29 @@ services: - project_net kafka: image: 'confluentinc/cp-kafka:7.3.0' + container_name: kafka ports: - '9092:9092' environment: KAFKA_BROKER_ID: 1 KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 - KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:29092,PLAINTEXT_HOST://0.0.0.0:9092 - KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092 - KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT + # Key change: Only use one listener on port 9092 + KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9092 + KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092 + KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 + KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true" + KAFKA_LOG_RETENTION_HOURS: 168 depends_on: zookeeper: condition: service_healthy healthcheck: - test: kafka-topics --bootstrap-server localhost:9092 --list || exit 1 - interval: 10s - timeout: 5s - retries: 9 + test: ["CMD", "kafka-topics", "--bootstrap-server", "localhost:9092", "--list"] + interval: 15s + timeout: 10s + retries: 10 + start_period: 30s networks: - project_net redis: From 38c58b447c8d855ad03a418f62f224271d514c99 Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Sun, 7 Dec 2025 22:54:19 +0530 Subject: [PATCH 51/63] Fix config file naming in project service: update script to reference config-sample.json instead of config.sample.json --- .../dockerized/dockerFiles/scp/docker-compose-project.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml b/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml index ef98c011..fce33b75 100644 --- a/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml +++ b/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml @@ -243,12 +243,12 @@ services: sleep 1; done; echo 'Database is ready.'; - echo 'Creating config.json from config.sample.json...'; - if [ -f /var/src/config.sample.json ]; then - cp /var/src/config.sample.json /var/src/config.json; + echo 'Creating config.json from config-sample.json...'; + if [ -f /var/src/config-sample.json ]; then + cp /var/src/config-sample.json /var/src/config.json; echo 'config.json created successfully'; else - echo 'ERROR: config.sample.json not found'; + echo 'ERROR: config-sample.json not found'; exit 1; fi; npm run db:init && From 0a9d5047ca878072fbec7c04d21fc397797e89df Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Sun, 7 Dec 2025 23:06:50 +0530 Subject: [PATCH 52/63] Update Kafka URL in environment variables to use the correct port 9092 --- .../3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml | 2 +- .../dockerFiles/stand-alone/docker-compose-project.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml b/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml index fce33b75..30cec52c 100644 --- a/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml +++ b/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml @@ -108,7 +108,7 @@ services: - scheduler environment: - DEV_DATABASE_URL=postgres://postgres:postgres@citus_master:5432/user - - KAFKA_URL=kafka:29092 + - KAFKA_URL=kafka:9092 - REDIS_HOST=redis://redis:6379 volumes: - ./user:/usr/src/app diff --git a/documentation/3.4.0/dockerized/dockerFiles/stand-alone/docker-compose-project.yml b/documentation/3.4.0/dockerized/dockerFiles/stand-alone/docker-compose-project.yml index 00a61013..1396937f 100644 --- a/documentation/3.4.0/dockerized/dockerFiles/stand-alone/docker-compose-project.yml +++ b/documentation/3.4.0/dockerized/dockerFiles/stand-alone/docker-compose-project.yml @@ -96,7 +96,7 @@ services: - scheduler environment: - DEV_DATABASE_URL=postgres://postgres:postgres@citus_master:5432/user - - KAFKA_URL=kafka:29092 + - KAFKA_URL=kafka:9092 - REDIS_HOST=redis://redis:6379 volumes: - ./user:/usr/src/app From ab7a557f2ee46c9442c7168b12e3d8064efa8097 Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Sun, 7 Dec 2025 23:24:23 +0530 Subject: [PATCH 53/63] Add new user roles and sample users, update tenant metadata, and ensure sequences are set --- .../scripts/scp/ubuntu/insert_sample_data.sh | 74 +++++++++++++++---- 1 file changed, 58 insertions(+), 16 deletions(-) diff --git a/documentation/3.4.0/dockerized/scripts/scp/ubuntu/insert_sample_data.sh b/documentation/3.4.0/dockerized/scripts/scp/ubuntu/insert_sample_data.sh index 64da00ee..56c1f453 100755 --- a/documentation/3.4.0/dockerized/scripts/scp/ubuntu/insert_sample_data.sh +++ b/documentation/3.4.0/dockerized/scripts/scp/ubuntu/insert_sample_data.sh @@ -1,35 +1,77 @@ #!/bin/bash +# --- 1. INSERT INTO public.user_roles --- +# Add new roles for content creation and program management workflows +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_roles (title, user_type, status, created_at, updated_at, deleted_at, visibility, organization_id, label, translations, tenant_code) VALUES ('content_creator', 0, 'ACTIVE', NOW(), NOW(), NULL, 'PUBLIC', 1, 'Content Creator', NULL, 'default');" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_roles (title, user_type, status, created_at, updated_at, deleted_at, visibility, organization_id, label, translations, tenant_code) VALUES ('reviewer', 0, 'ACTIVE', NOW(), NOW(), NULL, 'PUBLIC', 1, 'Reviewer', NULL, 'default');" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_roles (title, user_type, status, created_at, updated_at, deleted_at, visibility, organization_id, label, translations, tenant_code) VALUES ('program_designer', 0, 'ACTIVE', NOW(), NOW(), NULL, 'PUBLIC', 1, 'Program Designer', NULL, 'default');" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_roles (title, user_type, status, created_at, updated_at, deleted_at, visibility, organization_id, label, translations, tenant_code) VALUES ('program_manager', 0, 'ACTIVE', NOW(), NOW(), NULL, 'PUBLIC', 1, 'Program Manager', NULL, 'default');" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_roles (title, user_type, status, created_at, updated_at, deleted_at, visibility, organization_id, label, translations, tenant_code) VALUES ('rollout_manager', 0, 'ACTIVE', NOW(), NOW(), NULL, 'PUBLIC', 1, 'Rollout Manager', NULL, 'default');" + +# --- 2. INSERT INTO public.users --- psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (1, 'Rahul R B', 'a0db5e0a39ee13db7fc5d1309e637f2c', false, '{8,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default','53bc5d0ff0c53bee460c08b8afe087455050dc7529a2f1d4f7319c0da653a7e4','+91', NULL);" psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (2, 'Prajwal C S', 'c4113be1bc2cef51981a6ec687302e42fc4f87f4dfac4276584844d9e3e0f5ae', false, '{8,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default','53bc5d0ff0c53bee460c08b8afe087455050dc7529a2f1d4f7319c0da653a767','+91', NULL);" psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (3, 'Vishnu V P', '1092be87fd483fce1deba56c8cdefa79bed4f70a4b110fc4e7947c57aacff219', false, '{8,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default','53bc5d0ff0c53bee460c08b8afe087455050dc7529a2f1d4f7319c0da653a7e0','+91', NULL);" psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (4, 'Mallanagouda R B', 'e5fc674d4b1a54c6cf772485e3bca6f7ae14b60de32b9f0cd9f955ee469345bc', false, '{8,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default','53bc5d0ff0c53bee460c08b8afe087455050dc7529a2f1d4f7319c0da653a700','+91', NULL);" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (5, 'Priyanka', 'ceb796d9c0a6219d4323ff794b2af33a61bfd2bf6770ba566e5dbcb9755687fd', false, '{8,11,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default',NULL, NULL, NULL);" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (6, 'Adithya', 'ea959d865423d4f7105e33f6413e0a1d9b87c455c558f7629c60dd39c1c836b9', false, '{8,9,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default',NULL, NULL, NULL);" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (7, 'Praveen', '67bd4cacaef5be249b1587060f54b8631cffd7a75fa913323dda320858442e27', false, '{8,10,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default',NULL, NULL, NULL);" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (8, 'Nevin', '3d83442625031895c5b76602acd5083e', false, '{8,13,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default',NULL, NULL, NULL);" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (9, 'Saish', '28c23e53cfa34cc4eec7a44bd83d9625', false, '{8,12,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default',NULL, NULL, NULL);" -# --- 2. INSERT INTO public.user_organizations --- -# FIXES: -# - Quoted the organization_code and tenant_code variables. +# --- 3. INSERT INTO public.user_organizations --- psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_organizations (user_id,organization_code, tenant_code, created_at, updated_at, deleted_at) VALUES (1, 'default_code', 'default', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_organizations (user_id,organization_code, tenant_code, created_at, updated_at, deleted_at) VALUES (2, 'default_code', 'default', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_organizations (user_id,organization_code, tenant_code, created_at, updated_at, deleted_at) VALUES (3, 'default_code', 'default', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_organizations (user_id,organization_code, tenant_code, created_at, updated_at, deleted_at) VALUES (4, 'default_code', 'default', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_organizations (user_id,organization_code, tenant_code, created_at, updated_at, deleted_at) VALUES (5, 'default_code', 'default', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_organizations (user_id,organization_code, tenant_code, created_at, updated_at, deleted_at) VALUES (6, 'default_code', 'default', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_organizations (user_id,organization_code, tenant_code, created_at, updated_at, deleted_at) VALUES (7, 'default_code', 'default', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_organizations (user_id,organization_code, tenant_code, created_at, updated_at, deleted_at) VALUES (8, 'default_code', 'default', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_organizations (user_id,organization_code, tenant_code, created_at, updated_at, deleted_at) VALUES (9, 'default_code', 'default', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" + +# --- 4. UPDATE public.tenants --- +psql -h localhost -p 5432 -U postgres -d user -c " +UPDATE public.tenants +SET meta = '{ + \"factors\": [\"professional_role\", \"professional_subroles\"], + \"observableEntityKeys\": [\"professional_subroles\"], + \"optional_factors\": [\"state\", \"district\", \"block\", \"cluster\", \"school\"], + \"validationExcludedScopeKeys\": [\"language\", \"gender\"], + \"portalSignInUrl\": \"https://shikshagrah-qa.tekdinext.com/register\" +}' +WHERE code = 'default'; +" -# --- 3. INSERT INTO public.user_organization_roles --- -# FIXES: -# - Quoted the organization_code and tenant_code variables. +# --- 5. INSERT INTO public.user_organization_roles --- psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 2, 'default_code', 1, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" -psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 3, 'default_code', 8, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" -psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 2, 'default_code', 8, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" -psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 4, 'default_code', 8, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 3, 'default_code', 2, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 2, 'default_code', 3, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 4, 'default_code', 3, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 5, 'default_code', 8, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 5, 'default_code', 11, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 6, 'default_code', 9, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 6, 'default_code', 8, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 7, 'default_code', 10, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 7, 'default_code', 8, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 8, 'default_code', 13, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 8, 'default_code', 8, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 9, 'default_code', 12, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 9, 'default_code', 8, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" -# --- 4. INSERT INTO public.entity_types --- -# FIXES: -# - Quoted the JSON value for the 'meta' column. -psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.entity_types (id, value, label, status, created_by, updated_by, allow_filtering, data_type, organization_id, parent_id, has_entities, allow_custom_entities, model_names, created_at, updated_at, deleted_at, meta, external_entity_type, required, regex, tenant_code,organization_code) VALUES (5, 'state', 'State', 'ACTIVE', 0, 0, true, 'STRING', 1, NULL, true, true, '{User}', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, '{\"service\": \"entity-management-service\",\"endPoint\": \"v1/entities/find\"}', true, false, NULL,'default', 'default_code');" +# --- 6. Ensure users and users_credentials sequences are up-to-date --- +psql -h localhost -p 5432 -U postgres -d user -c "SELECT setval('users_id_seq', COALESCE((SELECT MAX(id) FROM public.users), 1));" +psql -h localhost -p 5432 -U postgres -d user -c "SELECT setval('users_credentials_id_seq', COALESCE((SELECT MAX(id) FROM public.users_credentials), 1));" -# --- 5. UPDATES and SEQUENCES --- +# --- 7. Ensure entity_types sequence exists and is set, then insert WITHOUT an explicit id --- +psql -h localhost -p 5432 -U postgres -d user -c "SELECT setval(pg_get_serial_sequence('public.entity_types','id'), COALESCE((SELECT MAX(id) FROM public.entity_types), 1));" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.entity_types (value, label, status, created_by, updated_by, allow_filtering, data_type, organization_id, parent_id, has_entities, allow_custom_entities, model_names, created_at, updated_at, deleted_at, meta, external_entity_type, required, regex, tenant_code, organization_code) VALUES ('state', 'State', 'ACTIVE', 0, 0, true, 'STRING', 1, NULL, true, true, '{User}', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, NULL, true, false, NULL, 'default', 'default_code') RETURNING id;" + +# --- 8. UPDATES --- psql -h localhost -p 5432 -U postgres -d user -c "UPDATE public.entity_types SET status = 'INACTIVE' WHERE id = 3;" -psql -h localhost -p 5432 -U postgres -d user -c "SELECT nextval('users_id_seq'::regclass) FROM public.users;" -psql -h localhost -p 5432 -U postgres -d user -c "SELECT nextval('users_credentials_id_seq'::regclass) FROM public.users_credentials;" + +# Update role_permission_mapping to reflect new role titles +psql -h localhost -p 5432 -U postgres -d user -c "UPDATE role_permission_mapping SET role_title = 'state_education_officer' WHERE role_title = 'mentor';" psql -h localhost -p 5432 -U postgres -d user -c "SELECT NULL;" From 6e02c96d57ea397d3b0532cc2bc2273ac7d6609d Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Sun, 7 Dec 2025 23:27:20 +0530 Subject: [PATCH 54/63] Update README.md: Un-comment section for Sample Data Creation for Projects --- documentation/3.4.0/setup/docker/scp/ubuntu/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/documentation/3.4.0/setup/docker/scp/ubuntu/README.md b/documentation/3.4.0/setup/docker/scp/ubuntu/README.md index e8051860..195c5250 100644 --- a/documentation/3.4.0/setup/docker/scp/ubuntu/README.md +++ b/documentation/3.4.0/setup/docker/scp/ubuntu/README.md @@ -184,7 +184,7 @@ After successfully running the script mentioned above, the following user accoun | adithya@gmail.com | Password1@ | Content Creator | | praveen@gmail.com | Password1@ | Reviewer | - + ``` ## Default Forms Creation for Portal Configuration From 5d9029706947171e136305ea32755d7de5c71a86 Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Mon, 8 Dec 2025 15:20:21 +0530 Subject: [PATCH 55/63] Update macOS setup guide link and add platform specification for Citus service in Docker Compose --- README.md | 3 +- .../scp/docker-compose-project.yml | 9 +- .../3.4.0/setup/docker/scp/mac/README.md | 253 ++++++++++++++++++ 3 files changed, 259 insertions(+), 6 deletions(-) create mode 100644 documentation/3.4.0/setup/docker/scp/mac/README.md diff --git a/README.md b/README.md index 2c7e95c3..8ad5de7b 100644 --- a/README.md +++ b/README.md @@ -140,7 +140,6 @@ Go to the detailed Windows Native setup guide: ** 2. macOS Setup
-Go to the detailed macOS Docker setup guide: **
SETUP_SCP_DOCKER_MACOS.md** +Go to the detailed macOS Docker setup guide: **SETUP_SCP_DOCKER_MACOS.md**
diff --git a/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml b/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml index 30cec52c..0fdf5357 100644 --- a/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml +++ b/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml @@ -8,9 +8,9 @@ services: environment: ZOOKEEPER_CLIENT_PORT: 2181 ZOOKEEPER_TICK_TIME: 2000 - ALLOW_ANONYMOUS_LOGIN: "yes" + ALLOW_ANONYMOUS_LOGIN: 'yes' healthcheck: - test: ["CMD", "nc", "-z", "localhost", "2181"] + test: ['CMD', 'nc', '-z', 'localhost', '2181'] interval: 10s timeout: 5s retries: 5 @@ -30,13 +30,13 @@ services: KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 - KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true" + KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'true' KAFKA_LOG_RETENTION_HOURS: 168 depends_on: zookeeper: condition: service_healthy healthcheck: - test: ["CMD", "kafka-topics", "--bootstrap-server", "localhost:9092", "--list"] + test: ['CMD', 'kafka-topics', '--bootstrap-server', 'localhost:9092', '--list'] interval: 15s timeout: 10s retries: 10 @@ -166,6 +166,7 @@ services: citus: image: citusdata/citus:11.2.0 container_name: 'citus_master' + platform: linux/amd64 ports: - 5432:5432 expose: diff --git a/documentation/3.4.0/setup/docker/scp/mac/README.md b/documentation/3.4.0/setup/docker/scp/mac/README.md new file mode 100644 index 00000000..07336a73 --- /dev/null +++ b/documentation/3.4.0/setup/docker/scp/mac/README.md @@ -0,0 +1,253 @@ +
+ +# Projects Service + + + + + +![GitHub package.json version (subfolder of monorepo)](https://img.shields.io/github/package-json/v/ELEVATE-Project/mentoring?filename=src%2Fpackage.json) +[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT) + +
+ + +
+The Project building block facilitates the creation and engagement with micro-improvement projects. + + +
+ +## Supported Operating Systems + +- **Mac (Recommended: Intel and M1 and above)** + +## Dockerized Services & Dependencies + +Expectation: By diligently following the outlined steps, you will successfully establish a fully operational Project application setup, including both the portal and backend services. + +## Prerequisites + +To set up the Project application, ensure you have Docker and Docker Compose installed on your system. For Ubuntu users, detailed installation instructions for both can be found in the documentation here: [How To Install and Use Docker Compose on Mac](https://docs.docker.com/desktop/setup/install/mac-install/). To install and use Nodejs in Ubuntu machine, you can follow instructions here: [How To Install Nodejs in Mac](https://nodejs.org/en/download/package-manager). + +## Installation + +**Create project Directory:** Establish a directory titled **project**. + +Example Command: + +``` +mkdir project && cd project/ +``` + +> Note: All commands are run from the project directory. + +## Operating Systems: Mac + +> **Caution:** Before proceeding, please ensure that the ports given here are available and open. It is essential to verify their availability prior to moving forward. You can run below command in your terminal to check this + +``` +for port in 3000 3001 3002 6000 5001 4000 9092 5432 7007 2181 2707 3569 6001 27017; do + if lsof -iTCP:"$port" -sTCP:LISTEN -n -P >/dev/null 2>&1 || lsof -iUDP:"$port" -n -P >/dev/null 2>&1; then + echo "Port $port is in use" + else + echo "Port $port is available" + fi +done +``` + +1. **Download and execute main setup script:** Execute the following command in your terminal from the project directory. + ``` + curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh && chmod +x setup_project.sh && sudo ./setup_project.sh + ``` + +> Note : The script will download all the essential files and launch the services in Docker. Once all services are successfully up and running, you can proceed to the next steps. + +> **General Instructions :** + +1. All containers which are part of the docker-compose can be gracefully stopped by pressing Ctrl + c in the same terminal where the services are running. + +2. All docker containers can be stopped and removed by using below command. + +``` +sudo ./docker-compose-down.sh +``` + +3. All services and dependencies can be started using below command. + +``` +sudo ./docker-compose-up.sh +``` + +**Keep the current terminal session active, and kindly open a new terminal window within the project directory.** + +**After successfully completing this, please move to the next section: [Enable Citus Extension](#enable-citus-extension-optional)** + +## Enable Citus Extension (Optional) + +User management service comes with this bundle relies on PostgreSQL as its core database system. To boost performance and scalability, users can opt to enable the Citus extension. This transforms PostgreSQL into a distributed database, spreading data across multiple nodes to handle large datasets more efficiently as demand grows. + +For more information, refer **[Citus Data](https://www.citusdata.com/)**. + +To enable the Citus extension for user services, follow these steps. + +1. Create a sub-directory named `user` and download `distributionColumns.sql` into it. (Skip this for linux) + ``` + mkdir user && curl -o ./user/distributionColumns.sql -JL https://github.com/ELEVATE-Project/project-service/raw/main/documentation/3.4.0/distribution-columns/user/distributionColumns.sql + ``` +2. Create a sub-directory named `survey-project-creation` and download `distributionColumns.sql` into it. (Skip this for linux) + ``` + mkdir survey-project-creation && curl -o ./survey-project-creation/distributionColumns.sql -JL https://github.com/ELEVATE-Project/project-service/raw/main/documentation/3.4.0/distribution-columns/survey-project-creation/distributionColumns.sql + ``` +3. Set up the citus_setup file by following the steps given below. + + 1. Enable Citus and set distribution columns for `user` database by running the `citus_setup.sh`with the following arguments. + + ``` + sudo ./citus_setup.sh user postgres://postgres:postgres@citus_master:5432/user + ``` + +4. Set up the citus_setup file by following the steps given below. + + 1. Enable Citus and set distribution columns for `survey-project-creation` database by running the `citus_setup.sh`with the following arguments. + + ``` + sudo ./citus_setup.sh survey-project-creation postgres://postgres:postgres@citus_master:5432/scp + ``` + +## Persistence Of Database Data In Docker Container (Optional) + +To ensure the persistence of database data when running `docker compose down`, it is necessary to modify the `docker-compose-project.yml` file according to the steps given below: + +1. **Modification Of The `docker-compose-project.yml` File:** + + Begin by opening the `docker-compose-project.yml` file. Locate the section pertaining to the Citus and mongo container and proceed to uncomment the volume specification. This action is demonstrated in the snippet provided below: + + ```yaml + mongo: + image: 'mongo:4.4.14' + restart: 'always' + ports: + - '27017:27017' + networks: + - project_net + volumes: + - mongo-data:/data/db + logging: + driver: none + + citus: + image: citusdata/citus:11.2.0 + container_name: 'citus_master' + ports: + - 5432:5432 + volumes: + - citus-data:/var/lib/postgresql/data + ``` + +2. **Uncommenting Volume Names Under The Volumes Section:** + + Next, navigate to the volumes section of the file and proceed to uncomment the volume names as illustrated in the subsequent snippet: + + ```yaml + networks: + elevate_net: + external: false + + volumes: + citus-data: + mongo-data: + ``` + +By implementing these adjustments, the configuration ensures that when the `docker-compose down` command is executed, the database data is securely stored within the specified volumes. Consequently, this data will be retained and remain accessible, even after the containers are terminated and subsequently reinstated using the `docker-compose up` command. + +## Sample User Accounts Generation + +During the initial setup of Project services with the default configuration, you may encounter issues creating new accounts through the regular SignUp flow on the project portal. This typically occurs because the default SignUp process includes OTP verification to prevent abuse. Until the notification service is configured correctly to send actual emails, you will not be able to create new accounts. + +In such cases, you can generate sample user accounts using the steps below. This allows you to explore the Project services and portal immediately after setup. + +> **Warning:** Use this generator only immediately after the initial system setup and before any normal user accounts are created through the portal. It should not be used under any circumstances thereafter. + +``` +sudo ./insert_sample_data.sh user postgres://postgres:postgres@citus_master:5432/user +``` + +After successfully running the script mentioned above, the following user accounts will be created and available for login: + +| Email ID | Password | Role | +| ---------------------- | ---------- | ----------------------- | +| mallanagouda@gmail.com | Password1@ | State Education Officer | +| prajwal@gmail.com | Password1@ | State Education Officer | +| vishnu@gmail.com | Password1@ | State Education Officer | +| priyanka@gmail.com | Password1@ | Program Designer | +| adithya@gmail.com | Password1@ | Content Creator | +| praveen@gmail.com | Password1@ | Reviewer | + +## Sample Data Creation For Projects + +This step will guide us in implementing a sample project solution following the initial setup of the project service. + +1. **Insert Sample Data To Database:** + + ``` + node insert_sample_solutions.js + ``` + +## Default Forms Creation for Portal Configuration + +This step inserts configuration forms into MongoDB, enabling or disabling features and fields on portal pages. + +#### Insert Forms Data into Database + +``` +curl -OJL https://github.com/ELEVATE-Project/project-service/raw/main/documentation/1.0.0/dockerized/scripts/mac-linux/import_forms_mongo.sh && chmod +x import_forms_mongo.sh && sudo ./import_forms_mongo.sh mongodb://mongo:27017/elevate-project +``` + +## Explore the Consumption Portal + +Once the services are up and the front-end app bundle is built successfully, navigate to **[localhost:7007](http://localhost:7007/)** to access the Project app. + +> **Warning:** In this setup, features such as **Sign-Up, Project Certificate, Project Sharing, and Project PDF Report** will not be available because cloud storage credentials have been masked in the environment files for security reasons. + +## Default Forms Creation for Self Creation Portal Configuration + +This step inserts configuration forms into postgres, enabling or disabling features and fields on portal pages. + +#### Insert Forms Data into Database + +``` +curl -OJL https://github.com/ELEVATE-Project/project-service/raw/main/documentation/3.4.0/dockerized/scripts/scp/ubuntu/import_forms_postgres.sh && chmod +x import_forms_postgres.sh && sudo ./import_forms_postgres.sh postgres://postgres:postgres@citus_master:5432/scp +``` + +## Explore the Self Creation Portal + +Once the services are up and the front-end app bundle is built successfully, navigate to **[localhost:1819](http://localhost:1819/)** to access the Creation app. + +> **Warning:** In this setup, features such as **Sign-Up, Resource Creation** will not be available because cloud storage credentials have been masked in the environment files for security reasons. Before runs the docker compose file please update this with actual cloud credentials + +## Postman Collections + +- [Projects Service](https://github.com/ELEVATE-Project/project-service/tree/main/api-doc) + +- [Surevy Project Creation Service](https://github.com/ELEVATE-Project/survey-project-creation-service/tree/release-1.0.0/src/api-doc) + +# Team + + + + + +# Open Source Dependencies + +Several open source dependencies that have aided Projects's development: + +![NodeJS](https://img.shields.io/badge/node.js-6DA55F?style=for-the-badge&logo=node.js&logoColor=white) +![Apache Kafka](https://img.shields.io/badge/Apache%20Kafka-000?style=for-the-badge&logo=apachekafka) +![Redis](https://img.shields.io/badge/redis-%23DD0031.svg?style=for-the-badge&logo=redis&logoColor=white) +![Jest](https://img.shields.io/badge/-jest-%23C21325?style=for-the-badge&logo=jest&logoColor=white) +![Git](https://img.shields.io/badge/git-%23F05033.svg?style=for-the-badge&logo=git&logoColor=white) From bb66b9d5bb9adcd25493d342a2e3dfe07bdc44eb Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Mon, 8 Dec 2025 15:22:17 +0530 Subject: [PATCH 56/63] Fix installation instructions in README.md for Mac users --- documentation/3.4.0/setup/docker/scp/mac/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/3.4.0/setup/docker/scp/mac/README.md b/documentation/3.4.0/setup/docker/scp/mac/README.md index 07336a73..dd74711e 100644 --- a/documentation/3.4.0/setup/docker/scp/mac/README.md +++ b/documentation/3.4.0/setup/docker/scp/mac/README.md @@ -32,7 +32,7 @@ Expectation: By diligently following the outlined steps, you will successfully e ## Prerequisites -To set up the Project application, ensure you have Docker and Docker Compose installed on your system. For Ubuntu users, detailed installation instructions for both can be found in the documentation here: [How To Install and Use Docker Compose on Mac](https://docs.docker.com/desktop/setup/install/mac-install/). To install and use Nodejs in Ubuntu machine, you can follow instructions here: [How To Install Nodejs in Mac](https://nodejs.org/en/download/package-manager). +To set up the Project application, ensure you have Docker and Docker Compose installed on your system. For Mac users, detailed installation instructions for both can be found in the documentation here: [How To Install and Use Docker Compose on Mac](https://docs.docker.com/desktop/setup/install/mac-install/). To install and use Nodejs in Mac machine, you can follow instructions here: [How To Install Nodejs in Mac](https://nodejs.org/en/download/package-manager). ## Installation From 64e8a3aa81f6b4ffc0e43453d233ed0db91bf165 Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Mon, 8 Dec 2025 15:37:17 +0530 Subject: [PATCH 57/63] Update Docker Compose and setup script: switch to pre-release image and comment out cloning steps --- .../dockerFiles/scp/docker-compose-project.yml | 9 +++++---- .../3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml b/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml index 0fdf5357..6a99efac 100644 --- a/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml +++ b/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml @@ -233,7 +233,8 @@ services: networks: - project_net scp: - build: ./survey-project-creation-service + # build: ./survey-project-creation-service + image: shikshalokamqa/elevate-scp-service:pre-release-1.0 container_name: survey-project-creation-service ports: - '6001:6001' @@ -261,9 +262,9 @@ services: tail -f /dev/null" env_file: - ./survey_project_creation_env - volumes: - - ./survey-project-creation-service/src/:/var/src - - /var/src/node_modules + # volumes: + # - ./survey-project-creation-service/src/:/var/src + # - /var/src/node_modules networks: - project_net networks: diff --git a/documentation/3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh b/documentation/3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh index 94b8bbeb..92574541 100644 --- a/documentation/3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh +++ b/documentation/3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh @@ -92,9 +92,9 @@ curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs log "config.json file is downloaded." # remove once the docker image is generated -log "Cloning survey-project-creation-service repository..." -git clone -b release-1.0.0 https://github.com/ELEVATE-Project/survey-project-creation-service.git -log "survey-project-creation-service repository cloned." +# log "Cloning survey-project-creation-service repository..." +# git clone -b release-1.0.0 https://github.com/ELEVATE-Project/survey-project-creation-service.git +# log "survey-project-creation-service repository cloned." # Step 14: Run docker-compose-up.sh script log "Running docker-compose-up.sh script..." From dd9139223f427e355d9f9d9932d6c13a2711280a Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Mon, 8 Dec 2025 15:50:58 +0530 Subject: [PATCH 58/63] Make insert_sample_data.sh executable after downloading --- .../3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/documentation/3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh b/documentation/3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh index 92574541..93660be3 100644 --- a/documentation/3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh +++ b/documentation/3.4.0/dockerized/scripts/scp/ubuntu/setup_project.sh @@ -84,6 +84,7 @@ curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/project_sampleData.js curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/insert_sample_solutions.js curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/dockerized/scripts/scp/ubuntu/insert_sample_data.sh +chmod +x insert_sample_data.sh log "sample data scripts downloaded." From c01261dfbb95653adeab6479b69ab33dae8eba2c Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Mon, 8 Dec 2025 15:59:04 +0530 Subject: [PATCH 59/63] Add container names for Redis, Entity Management, User, Notification, Scheduler, Interface, and Mongo services; fix typo in README.md for Survey Project Creation Service --- .../dockerized/dockerFiles/scp/docker-compose-project.yml | 8 +++++++- documentation/3.4.0/setup/docker/scp/mac/README.md | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml b/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml index 6a99efac..5c6a86bb 100644 --- a/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml +++ b/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml @@ -45,6 +45,7 @@ services: - project_net redis: image: 'redis:7.0.0' + container_name: redis restart: 'always' expose: - 6379 @@ -73,6 +74,7 @@ services: - project_net entity_management: image: shikshalokamqa/elevate-entity-management:3.3.13.1 + container_name: entity_management ports: - '5001:5001' env_file: @@ -85,6 +87,7 @@ services: - project_net user: image: shikshalokamqa/elevate-user:3.3.24 + container_name: user ports: - '3001:3001' command: > @@ -119,6 +122,7 @@ services: notification: image: shikshalokamqa/elevate-notification:2.6.1 + container_name: notification ports: - '3002:3002' command: > @@ -142,6 +146,7 @@ services: scheduler: image: shikshalokamqa/elevate-scheduler:2.6.1 + container_name: scheduler ports: - '4000:4000' command: ['nodemon', 'app.js'] @@ -156,6 +161,7 @@ services: - ./scheduler_env interface: image: shikshalokamqa/elevate-interface:3.3.2 + container_name: interface ports: - '3569:3569' command: ['node', 'app.js'] @@ -200,7 +206,7 @@ services: # Mongo config mongo: image: 'mongo:4.4.14' - container_name: project_mongo_1 + container_name: mongo restart: 'always' ports: - '27017:27017' diff --git a/documentation/3.4.0/setup/docker/scp/mac/README.md b/documentation/3.4.0/setup/docker/scp/mac/README.md index dd74711e..844fa0b7 100644 --- a/documentation/3.4.0/setup/docker/scp/mac/README.md +++ b/documentation/3.4.0/setup/docker/scp/mac/README.md @@ -234,7 +234,7 @@ Once the services are up and the front-end app bundle is built successfully, nav - [Projects Service](https://github.com/ELEVATE-Project/project-service/tree/main/api-doc) -- [Surevy Project Creation Service](https://github.com/ELEVATE-Project/survey-project-creation-service/tree/release-1.0.0/src/api-doc) +- [Survey Project Creation Service](https://github.com/ELEVATE-Project/survey-project-creation-service/tree/release-1.0.0/src/api-doc) # Team From 566909f4d9782e592738d438220f1d3344d89e14 Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Mon, 8 Dec 2025 16:15:33 +0530 Subject: [PATCH 60/63] Update Docker Compose for SCP service: switch to pre-release image and remove commented build and volume configurations --- .../dockerized/dockerFiles/scp/docker-compose-project.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml b/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml index 5c6a86bb..fe750d9b 100644 --- a/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml +++ b/documentation/3.4.0/dockerized/dockerFiles/scp/docker-compose-project.yml @@ -239,7 +239,6 @@ services: networks: - project_net scp: - # build: ./survey-project-creation-service image: shikshalokamqa/elevate-scp-service:pre-release-1.0 container_name: survey-project-creation-service ports: @@ -268,9 +267,6 @@ services: tail -f /dev/null" env_file: - ./survey_project_creation_env - # volumes: - # - ./survey-project-creation-service/src/:/var/src - # - /var/src/node_modules networks: - project_net networks: From 303d6fa58fb33528bd9119e86567a2587c9a80e5 Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Mon, 6 Apr 2026 12:30:21 +0530 Subject: [PATCH 61/63] Add sample data SQL scripts for Mac/Linux and Windows environments; enhance README for Docker and native setups --- README.md | 1528 +-------------- documentation/1.0.0/ReadMe.md | 1512 +++++++++++++++ .../user/distributionColumns.sql | 14 + .../stand-alone/docker-compose-project.yml | 235 +++ .../dockerized/envs/entity_management_env | 23 + documentation/3.4.0/dockerized/envs/env.js | 17 + .../3.4.0/dockerized/envs/interface_env | 24 + .../3.4.0/dockerized/envs/notification_env | 12 + .../3.4.0/dockerized/envs/project_env | 49 + .../3.4.0/dockerized/envs/scheduler_env | 12 + documentation/3.4.0/dockerized/envs/user_env | 99 + .../scripts/stand-alone/ubuntu/citus_setup.sh | 129 ++ .../stand-alone/ubuntu/configFile.json | 11 + .../stand-alone/ubuntu/docker-compose-down.sh | 15 + .../stand-alone/ubuntu/docker-compose-up.sh | 15 + .../stand-alone/ubuntu/entity_sampleData.js | 290 +++ .../stand-alone/ubuntu/insert_sample_data.sh | 54 + .../ubuntu/insert_sample_solutions.js | 184 ++ .../stand-alone/ubuntu/project_sampleData.js | 1631 +++++++++++++++++ .../stand-alone/ubuntu/replace_volume_path.sh | 21 + .../stand-alone/ubuntu/setup_project.sh | 84 + .../native/envs/non-citus/notification_env | 14 + .../3.4.0/native/envs/non-citus/user_env | 74 + .../envs/stand-alone/elevate_portal_env | 48 + .../envs/stand-alone/entity_management_env | 23 + .../native/envs/stand-alone/interface_env | 24 + .../native/envs/stand-alone/notification_env | 17 + .../envs/stand-alone/observation_portal_env | 4 + .../observation_survey_projects_pwa_env | 18 + .../3.4.0/native/envs/stand-alone/project_env | 47 + .../native/envs/stand-alone/scheduler_env | 13 + .../3.4.0/native/envs/stand-alone/user_env | 82 + .../stand-alone/ubuntu/check-dependencies.sh | 139 ++ .../scripts/stand-alone/ubuntu/citus_setup.sh | 133 ++ .../scripts/stand-alone/ubuntu/common.js | 39 + .../stand-alone/ubuntu/configFile.json | 11 + .../stand-alone/ubuntu/create-databases.sh | 16 + .../stand-alone/ubuntu/entity_sampleData.js | 290 +++ .../stand-alone/ubuntu/import_forms.js | 51 + .../stand-alone/ubuntu/insert_sample_data.sh | 58 + .../ubuntu/insert_sample_solutions.js | 170 ++ .../ubuntu/install-dependencies.sh | 206 +++ .../ubuntu/project_entity_sample_data.sh | 57 + .../stand-alone/ubuntu/project_sampleData.js | 1631 +++++++++++++++++ .../ubuntu/uninstall-dependencies.sh | 131 ++ .../sample-data/mac-linux/user/sampleData.sql | 23 + .../sample-data/windows/user/sampleData.sql | 21 + .../setup/docker/stand-alone/ubuntu/README.md | 231 +++ .../setup/native/stand-alone/ubuntu/README.md | 285 +++ 49 files changed, 8383 insertions(+), 1432 deletions(-) create mode 100644 documentation/1.0.0/ReadMe.md create mode 100644 documentation/3.4.0/distribution-columns/user/distributionColumns.sql create mode 100644 documentation/3.4.0/dockerized/dockerFiles/stand-alone/docker-compose-project.yml create mode 100644 documentation/3.4.0/dockerized/envs/entity_management_env create mode 100644 documentation/3.4.0/dockerized/envs/env.js create mode 100644 documentation/3.4.0/dockerized/envs/interface_env create mode 100644 documentation/3.4.0/dockerized/envs/notification_env create mode 100644 documentation/3.4.0/dockerized/envs/project_env create mode 100644 documentation/3.4.0/dockerized/envs/scheduler_env create mode 100644 documentation/3.4.0/dockerized/envs/user_env create mode 100644 documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/citus_setup.sh create mode 100644 documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/configFile.json create mode 100644 documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/docker-compose-down.sh create mode 100644 documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/docker-compose-up.sh create mode 100644 documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/entity_sampleData.js create mode 100755 documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/insert_sample_data.sh create mode 100644 documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/insert_sample_solutions.js create mode 100644 documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/project_sampleData.js create mode 100644 documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/replace_volume_path.sh create mode 100644 documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/setup_project.sh create mode 100644 documentation/3.4.0/native/envs/non-citus/notification_env create mode 100644 documentation/3.4.0/native/envs/non-citus/user_env create mode 100644 documentation/3.4.0/native/envs/stand-alone/elevate_portal_env create mode 100644 documentation/3.4.0/native/envs/stand-alone/entity_management_env create mode 100644 documentation/3.4.0/native/envs/stand-alone/interface_env create mode 100644 documentation/3.4.0/native/envs/stand-alone/notification_env create mode 100644 documentation/3.4.0/native/envs/stand-alone/observation_portal_env create mode 100644 documentation/3.4.0/native/envs/stand-alone/observation_survey_projects_pwa_env create mode 100644 documentation/3.4.0/native/envs/stand-alone/project_env create mode 100644 documentation/3.4.0/native/envs/stand-alone/scheduler_env create mode 100644 documentation/3.4.0/native/envs/stand-alone/user_env create mode 100644 documentation/3.4.0/native/scripts/stand-alone/ubuntu/check-dependencies.sh create mode 100644 documentation/3.4.0/native/scripts/stand-alone/ubuntu/citus_setup.sh create mode 100644 documentation/3.4.0/native/scripts/stand-alone/ubuntu/common.js create mode 100644 documentation/3.4.0/native/scripts/stand-alone/ubuntu/configFile.json create mode 100644 documentation/3.4.0/native/scripts/stand-alone/ubuntu/create-databases.sh create mode 100644 documentation/3.4.0/native/scripts/stand-alone/ubuntu/entity_sampleData.js create mode 100644 documentation/3.4.0/native/scripts/stand-alone/ubuntu/import_forms.js create mode 100644 documentation/3.4.0/native/scripts/stand-alone/ubuntu/insert_sample_data.sh create mode 100644 documentation/3.4.0/native/scripts/stand-alone/ubuntu/insert_sample_solutions.js create mode 100644 documentation/3.4.0/native/scripts/stand-alone/ubuntu/install-dependencies.sh create mode 100644 documentation/3.4.0/native/scripts/stand-alone/ubuntu/project_entity_sample_data.sh create mode 100644 documentation/3.4.0/native/scripts/stand-alone/ubuntu/project_sampleData.js create mode 100644 documentation/3.4.0/native/scripts/stand-alone/ubuntu/uninstall-dependencies.sh create mode 100644 documentation/3.4.0/sample-data/mac-linux/user/sampleData.sql create mode 100644 documentation/3.4.0/sample-data/windows/user/sampleData.sql create mode 100644 documentation/3.4.0/setup/docker/stand-alone/ubuntu/README.md create mode 100644 documentation/3.4.0/setup/native/stand-alone/ubuntu/README.md diff --git a/README.md b/README.md index fddde5a5..a757287e 100644 --- a/README.md +++ b/README.md @@ -13,1492 +13,159 @@ ![GitHub package.json version (subfolder of monorepo)](https://img.shields.io/github/package-json/v/ELEVATE-Project/mentoring?filename=src%2Fpackage.json) [![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT) - - +
The Project building block facilitates the creation and engagement with micro-improvement projects. - -
- -# Supported Operating Systems - -- **Ubuntu (Recommended: Version 20 and above)** -- **Windows (Recommended: Version 11 and above)** -- **macOs (Recommended: Version 12 and above)** - -# Setup Options - -**Project services can be setup using two methods:** - -> Note : This guide outlines two setup methods, detailed below. For a quick, beginner-friendly setup and walkthrough of services, it is recommended to use the Dockerized Services & Dependencies setup with the Docker-Compose file. - -
Dockerized Services & Dependencies Using Docker-Compose File - -## Dockerized Services & Dependencies - -Expectation: By diligently following the outlined steps, you will successfully establish a fully operational Project application setup, including both the portal and backend services. - -## Prerequisites - -To set up the Project application, ensure you have Docker and Docker Compose installed on your system. For Ubuntu users, detailed installation instructions for both can be found in the documentation here: [How To Install and Use Docker Compose on Ubuntu](https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-compose-on-ubuntu-20-04). To install and use Nodejs in Ubuntu machine, you can follow instructions here: [How To Install Nodejs in Ubuntu](https://nodejs.org/en/download/package-manager). For Windows and MacOS users, you can refer to the Docker documentation for installation instructions: [Docker Compose Installation Guide](https://docs.docker.com/compose/install/). Once these prerequisites are in place, you're all set to get started with setting up the Project application. - -## Installation - -**Create project Directory:** Establish a directory titled **project**. - -> Example Command: `mkdir project && cd project/` - -> Note: All commands are run from the project directory. - -## Operating Systems: Linux / macOS - -> **Caution:** Before proceeding, please ensure that the ports given here are available and open. It is essential to verify their availability prior to moving forward. You can run below command in your terminal to check this - -``` -for port in 3000 3001 3002 6000 5001 4000 9092 5432 7007 2181 2707 3569; do - if lsof -iTCP:$port -sTCP:LISTEN &>/dev/null; then - echo "Port $port is in use" - else - echo "Port $port is available" - fi -done -``` - -1. **Download and execute main setup script:** Execute the following command in your terminal from the project directory. - ` curl -OJL https://github.com/ELEVATE-Project/project-service/raw/main/documentation/1.0.0/dockerized/scripts/mac-linux/setup_project.sh && chmod +x setup_project.sh && sudo ./setup_project.sh` - - > Note : The script will download all the essential files and launch the services in Docker. Once all services are successfully up and running, you can proceed to the next steps. - - **General Instructions :** - - 1. All containers which are part of the docker-compose can be gracefully stopped by pressing Ctrl + c in the same terminal where the services are running. - - 2. All docker containers can be stopped and removed by using below command. - ``` - sudo ./docker-compose-down.sh - ``` - 3. All services and dependencies can be started using below command. - ``` - sudo ./docker-compose-up.sh - ``` - - **Keep the current terminal session active, and kindly open a new terminal window within the project directory.** - -**After successfully completing this, please move to the next section: [Enable Citus Extension](#enable-citus-extension-optional)** - -## Operating Systems: Windows - -1. **Download Docker Compose File:** Retrieve the **[docker-compose-project.yml](https://github.com/ELEVATE-Project/project-service/raw/main/documentation/1.0.0/dockerized/docker-compose-project.yml)** file from the Project service repository and save it to the project directory. - - ``` - curl -OJL https://github.com/ELEVATE-Project/project-service/raw/main/documentation/1.0.0/dockerized/docker-compose-project.yml - ``` - - > Note: All commands are run from the project directory. - -2. **Download Environment Files**: Using the OS specific commands given below, download environment files for all the services. - - - **Windows** - - ``` - curl -L ^ - -O https://github.com/ELEVATE-Project/project-service/raw/main/documentation/1.0.0/dockerized/envs/interface_env ^ - -O https://github.com/ELEVATE-Project/project-service/raw/main/documentation/1.0.0/dockerized/envs/entity_management_env ^ - -O https://github.com/ELEVATE-Project/project-service/raw/main/documentation/1.0.0/dockerized/envs/project_env ^ - -O https://github.com/ELEVATE-Project/project-service/raw/main/documentation/1.0.0/dockerized/envs/notification_env ^ - -O https://github.com/ELEVATE-Project/project-service/raw/main/documentation/1.0.0/dockerized/envs/scheduler_env ^ - -O https://github.com/ELEVATE-Project/project-service/raw/main/documentation/1.0.0/dockerized/envs/user_env ^ - -O https://github.com/ELEVATE-Project/project-service/raw/main/documentation/1.0.0/dockerized/envs/env.js - ``` - - > **Note:** Modify the environment files as necessary for your deployment using any text editor, ensuring that the values are appropriate for your environment. The default values provided in the current files are functional and serve as a good starting point. Refer to the sample env files provided at the [Project](https://github.com/ELEVATE-Project/project-service/blob/main/.env.sample), [User](https://github.com/ELEVATE-Project/user/blob/master/src/.env.sample), [Notification](https://github.com/ELEVATE-Project/notification/blob/master/src/.env.sample), [Scheduler](https://github.com/ELEVATE-Project/scheduler/blob/master/src/.env.sample), [Interface](https://github.com/ELEVATE-Project/interface-service/blob/main/src/.env.sample) and [Entity-management](https://github.com/ELEVATE-Project/entity-management/blob/main/src/.env.sample) repositories for reference. - - > **Caution:** While the default values in the downloaded environment files enable the Project Application to operate, certain features may not function correctly or could be impaired unless the adopter-specific environment variables are properly configured. - -3. **Download `replace_volume_path` Script File** - - - **Windows** - - ``` - curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/main/documentation/1.0.0/dockerized/scripts/windows/replace_volume_path.bat - ``` - -4. **Run `replace_volume_path` Script File** - - - **Windows** - - Run the script file either by double clicking it or by executing the following command from the terminal. - - ``` - replace_volume_path.bat - ``` - - > **Note**: The provided script file replaces the host path for the **portal** service container volume in the `docker-compose-project.yml` file with your current directory path. - > - > volumes: - > - > \- /home/shikshalokam/elevate/single-click/linux/env.js:/usr/src/app/www/assets/env/env.js - -5. **Download `docker-compose-up` & `docker-compose-down` Script Files** - - - **Windows** - - ``` - curl -OJL https://github.com/ELEVATE-Project/project-service/raw/main/documentation/1.0.0/dockerized/scripts/windows/docker-compose-up.bat - ``` - - ``` - curl -OJL https://github.com/ELEVATE-Project/project-service/raw/main/documentation/1.0.0/dockerized/scripts/windows/docker-compose-down.bat - ``` - -6. **Run All Services & Dependencies**:All services and dependencies can be started using the `docker-compose-up` script file. - - - **Windows** - - ``` - docker-compose-up.bat - ``` - - > Double-click the file or run the above command from the terminal. - - > **Note**: During the first Docker Compose run, the database, migration seeder files, and the script to set the default organization will be executed automatically. - -7. **Remove All Service & Dependency Containers**: - All docker containers can be stopped and removed by using the `docker-compose-down` file. - - - **Windows** - - ``` - docker-compose-down.bat - ``` - - > **Caution**: As per the default configuration in the `docker-compose-project.yml` file, using the `down` command will lead to data loss since the database container does not persist data. To persist data across `down` commands and subsequent container removals, refer to the "Persistence of Database Data in Docker Containers" section of this documentation. +--- -## Enable Citus Extension (Optional) +## 💻 Supported Operating Systems -User management service comes with this bundle relies on PostgreSQL as its core database system. To boost performance and scalability, users can opt to enable the Citus extension. This transforms PostgreSQL into a distributed database, spreading data across multiple nodes to handle large datasets more efficiently as demand grows. +- **Ubuntu** (Recommended: Version 20 and above) +- **Windows** (Recommended: Version 11 and above) +- **macOS** (Recommended: Version 12 and above) -For more information, refer **[Citus Data](https://www.citusdata.com/)**. +--- -To enable the Citus extension for user services, follow these steps. +## ✨ Setup & Deployment Guide -1. Create a sub-directory named `user` and download `distributionColumns.sql` into it. (Skip this for linux/macOs) - ``` - mkdir user && curl -o ./user/distributionColumns.sql -JL https://github.com/ELEVATE-Project/project-service/raw/main/documentation/1.0.0/distribution-columns/user/distributionColumns.sql - ``` -2. Set up the citus_setup file by following the steps given below. +This section outlines the different ways to set up the **Projects Service**. Please select the deployment environment and setup method that best suits your needs. - - **Ubuntu/Linux/Mac** +### 🥇 **STAND-ALONE SETUP (Projects Service Only)** - 1. Enable Citus and set distribution columns for `user` database by running the `citus_setup.sh`with the following arguments. - ``` - sudo ./citus_setup.sh user postgres://postgres:postgres@citus_master:5432/user - ``` - - - **Windows** - 1. Download the `citus_setup.bat` file. - ``` - curl -OJL https://github.com/ELEVATE-Project/project-service/raw/main/documentation/1.0.0/dockerized/scripts/windows/citus_setup.bat - ``` - 2. Enable Citus and set distribution columns for `user` database by running the `citus_setup.bat`with the following arguments. - ``` - citus_setup.bat user postgres://postgres:postgres@citus_master:5432/user - ``` - > **Note:** Since the `citus_setup.bat` file requires arguments, it must be run from a terminal. - -## Persistence Of Database Data In Docker Container (Optional) - -To ensure the persistence of database data when running `docker compose down`, it is necessary to modify the `docker-compose-project.yml` file according to the steps given below: - -1. **Modification Of The `docker-compose-project.yml` File:** - - Begin by opening the `docker-compose-project.yml` file. Locate the section pertaining to the Citus and mongo container and proceed to uncomment the volume specification. This action is demonstrated in the snippet provided below: - - ```yaml - mongo: - image: 'mongo:4.4.14' - restart: 'always' - ports: - - '27017:27017' - networks: - - project_net - volumes: - - mongo-data:/data/db - logging: - driver: none - - citus: - image: citusdata/citus:11.2.0 - container_name: 'citus_master' - ports: - - 5432:5432 - volumes: - - citus-data:/var/lib/postgresql/data - ``` - -2. **Uncommenting Volume Names Under The Volumes Section:** - - Next, navigate to the volumes section of the file and proceed to uncomment the volume names as illustrated in the subsequent snippet: - - ```yaml - networks: - elevate_net: - external: false - - volumes: - citus-data: - mongo-data: - ``` - -By implementing these adjustments, the configuration ensures that when the `docker-compose down` command is executed, the database data is securely stored within the specified volumes. Consequently, this data will be retained and remain accessible, even after the containers are terminated and subsequently reinstated using the `docker-compose up` command. - -## Sample User Accounts Generation - -During the initial setup of Project services with the default configuration, you may encounter issues creating new accounts through the regular SignUp flow on the project portal. This typically occurs because the default SignUp process includes OTP verification to prevent abuse. Until the notification service is configured correctly to send actual emails, you will not be able to create new accounts. - -In such cases, you can generate sample user accounts using the steps below. This allows you to explore the Project services and portal immediately after setup. - -> **Warning:** Use this generator only immediately after the initial system setup and before any normal user accounts are created through the portal. It should not be used under any circumstances thereafter. - -- **Ubuntu/Linux/Mac** - - ``` - sudo ./insert_sample_data.sh user postgres://postgres:postgres@citus_master:5432/user - ``` - -- **Windows** - - 1. **Download The `sampleData.sql` Files:** - - ``` - mkdir sample-data\user 2>nul & ^ - curl -L "https://raw.githubusercontent.com/ELEVATE-Project/project-service/main/documentation/1.0.0/sample-data/windows/user/sampleData.sql" -o sample-data\user\sampleData.sql - ``` - - 2. **Download The `insert_sample_data` Script File:** - - ``` - curl -L -o insert_sample_data.bat https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/dockerized/scripts/windows/insert_sample_data.bat - ``` - - 3. **Run The `insert_sample_data` Script File:** - - ``` - insert_sample_data.bat user postgres://postgres:postgres@citus_master:5432/user - ``` - - After successfully running the script mentioned above, the following user accounts will be created and available for login: - - | Email ID | Password | Role | - | ------------------------ | ---------- | ----------------------- | - | aaravpatel@example.com | Password1@ | State Education Officer | - | arunimareddy@example.com | Password1@ | State Education Officer | - | devikasingh@example.com | Password1@ | State Education Officer | - -## Sample Data Creation For Projects - -This step will guide us in implementing a sample project solution following the initial setup of the project service. - -1. **Insert Sample Data To Database:** - - - **Ubuntu/Linux/Mac** - - 1. Insert sample data by running the following command. - - ``` - sudo ./add_sample_project_entity_data.sh - ``` - - - **Windows** - - 1. Download `entity-project-sample-data.bat` Script File: - - ``` - curl -L ^ - -O https://github.com/ELEVATE-Project/project-service/raw/main/documentation/1.0.0/dockerized/scripts/windows/entity-project-sample-data.bat ^ - ``` - - 2. Make the setup file executable by running the following command. - - ``` - entity-project-sample-data.bat - ``` - -## Default Forms Creation for Portal Configuration - -This step inserts configuration forms into MongoDB, enabling or disabling features and fields on portal pages. - -#### Insert Forms Data into Database - -- **Ubuntu/Linux/Mac**: - - ``` - curl -OJL https://github.com/ELEVATE-Project/project-service/raw/main/documentation/1.0.0/dockerized/scripts/mac-linux/import_forms_mongo.sh && chmod +x import_forms_mongo.sh && sudo ./import_forms_mongo.sh mongodb://mongo:27017/elevate-project - ``` - -- **Windows**: - 1. Download the `import_forms_mongo.bat` file: - ```cmd - curl -L -O https://github.com/ELEVATE-Project/project-service/raw/main/documentation/1.0.0/dockerized/scripts/windows/import_forms_mongo.bat - ``` - 2. Run the script: - ```cmd - import_forms_mongo.bat mongodb://localhost:27017/elevate-project - ``` - -## Explore the Portal +
+ **Click to Expand Stand-Alone Setup Options** +
-Once the services are up and the front-end app bundle is built successfully, navigate to **[localhost:7007](http://localhost:7007/)** to access the Project app. +This setup is ideal for **local development, testing**, and deployments where only the core Projects Service components are required. -> **Warning:** In this setup, features such as **Sign-Up, Project Certificate, Project Sharing, and Project PDF Report** will not be available because cloud storage credentials have been masked in the environment files for security reasons. +#### I. Docker Setup (Recommended) +
+ 1. Ubuntu Setup +
+Go to the detailed Ubuntu Docker setup guide: **SETUP_STANDALONE_DOCKER_UBUNTU.md**
-Natively Installed Services & Dependencies - -## PM2 Managed Services & Natively Installed Dependencies - -### System Requirements - -- **Node.js®:** v20 -- **PostgreSQL:** 16 -- **Apache Kafka®:** 3.5.0 -- **MongoDB:** 4.4.14 -- **Gotenberg:** 8.5.0 - -Expectation: Upon following the prescribed steps, you will achieve a fully operational ELEVATE-Project application setup. Both the portal and backend services are managed using PM2, with all dependencies installed natively on the host system. - -## Prerequisites - -Before setting up the following ELEVATE-Project application, dependencies given below should be installed and verified to be running. Refer to the steps given below to install them and verify. - -- **Ubuntu/Linux** - - 1. Download dependency management scripts: - - ``` - curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/main/documentation/1.0.0/native/scripts/linux/check-dependencies.sh && \ - curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/main/documentation/1.0.0/native/scripts/linux/install-dependencies.sh && \ - curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/main/documentation/1.0.0/native/scripts/linux/uninstall-dependencies.sh && \ - chmod +x check-dependencies.sh && \ - chmod +x install-dependencies.sh && \ - chmod +x uninstall-dependencies.sh - ``` - - 2. Verify installed dependencies by running `check-dependencies.sh`: - - ``` - ./check-dependencies.sh - ``` - - > Note: Keep note of any missing dependencies. - - 3. Install dependencies by running `install-dependencies.sh`: - ``` - ./install-dependencies.sh - ``` - > Note: Install all missing dependencies and use check-dependencies script to ensure everything is installed and running. - 4. Uninstall dependencies by running `uninstall-dependencies.sh`: - - ``` - ./uninstall-dependencies.sh - ``` - - > Warning: Due to the destructive nature of the script (without further warnings), it should only be used during the initial setup of the dependencies. For example, Uninstalling PostgreSQL/Citus using script will lead to data loss. USE EXTREME CAUTION. - - > Warning: This script should only be used to uninstall dependencies that were installed via installation script in step 3. If same dependencies were installed using other methods, refrain from using this script. This script is provided in-order to reverse installation in-case issues arise from a bad install. - -- **MacOS** - - 1. Install Node.js 20: - - ``` - brew install node@20 - ``` - - ``` - brew link --overwrite node@20 - ``` - - 2. Install Kafka: - - ``` - brew install kafka - ``` - - > Note: To install Kafka on older macOS versions like Monterey (Intel architecture), you need to follow the manual installation process instead of using Homebrew. The process includes downloading Kafka, setting up ZooKeeper, and running Kafka services. You can find the official Kafka installation guide here: [Kafka Quickstart Guide](https://kafka.apache.org/quickstart).This ensures compatibility with older macOS systems. Follow the steps outlined in the documentation for a smooth setup. - - 3. Install PostgreSQL 16: - - ``` - brew install postgresql@16 - ``` - - 4. Install PM2: - - ``` - sudo npm install pm2@latest -g - ``` - - 5. Install Redis: - - ``` - brew install redis - ``` - - 6. Install mongDB: - - ``` - brew tap mongodb/brew - ``` - - ``` - brew install mongodb-community@4.4 - ``` - - ``` - brew link mongodb-community@4.4 --force - ``` - - ``` - brew services start mongodb-community@4.4 - ``` - - 7. Download `check-dependencies.sh` file: - - ``` - curl -OJL https://github.com/ELEVATE-Project/project-service/raw/main/documentation/1.0.0/native/scripts/macos/check-dependencies.sh && \ - chmod +x check-dependencies.sh - ``` - - 8. Verify installed dependencies by running `check-dependencies.sh`: - - ``` - ./check-dependencies.sh - ``` - - > Note : If you've manually installed Kafka without Homebrew, the script might incorrectly indicate that Kafka and Homebrew are not installed, as it checks only for Homebrew installations. In such cases, you can safely ignore this warning. Ensure that both Kafka and ZooKeeper are running on their default ports (ZooKeeper on `2181`, Kafka on `9092`). This will confirm proper installation and functionality despite the script's output. - -- **Windows** - - 1. Install Node.js 20: - - Download and install Node.js v20 for Windows platform (x64) from official [Node.js download page](https://nodejs.org/en/download). - - 2. Install Kafka 3.5.0: - - 1. Adapt the instructions given in the following ["Apache Kafka on Windows"](https://www.conduktor.io/kafka/how-to-install-apache-kafka-on-windows/) documentation to install Kafka version 3.5.0. - - > Note: As per the instructions, Kafka server and Zookeeper has to be kept active on different WSL terminals for the entire lifetime of ELEVATE-Project services. - - > Note: Multiple WSL terminals can be opened by launching `Ubuntu` from start menu. - - 2. Open a new WSL terminal and execute the following command to get the IP of the WSL instance. - - ``` - ip addr show eth0 - ``` - - Sample Output: - - ``` - 2: eth0: mtu 1492 qdisc mq state UP group default qlen 1000 - link/ether 11:56:54:f0:as:vf brd ff:ff:ff:ff:ff:ff - inet 172.12.46.150/20 brd 172.24.79.255 scope global eth0 - valid_lft forever preferred_lft forever - inet6 fe80::215:5dff:fee7:dc52/64 scope link - valid_lft forever preferred_lft forever - ``` - - Keep note of the IP address shown alongside `inet`. In the above case, `172.12.46.150` is IP address of the WSL instance. - - 3. In the same WSL terminal, navigate to `config` directory of Kafka from step 1 and make the following changes to `server.properties` file. - - - Uncomment `listeners=PLAINTEXT://:9092` line and change it to `listeners=PLAINTEXT://0.0.0.0:9092` to allow connections from any IP. - - - Uncomment `advertised.listeners` line and set it to `advertised.listeners=PLAINTEXT://172.12.46.150:9092`. Replace `172.12.46.150` with the actual IP address of your WSL instance. - - 4. Restart the Zookeeper and Kafka Server from their own WSL terminals from step 1. - - 3. Install Redis: - - 1. Follow the instructions given in the official [Redis Documentation](https://redis.io/docs/latest/operate/oss_and_stack/install/install-redis/install-redis-on-windows/) to install Redis using WSL. - - 2. Using the WSL terminal, open the Redis configuration file in a text editor, such as nano: - - ``` - sudo nano /etc/redis/redis.conf - ``` - - 3. Find the line containing `bind 127.0.0.1 ::1` and change it to `bind 0.0.0.0 ::.`. This change allows Redis to accept connections from any IP address. Then save and exit the file. - - 4. Restart Redis to apply the changes: - - ``` - sudo service redis-server restart - ``` - - 4. Install PM2: - - ``` - npm install pm2@latest -g - ``` - - 5. Install PostgreSQL 16: - - 1. Download and install PostgreSQL 16 from [EnterpriseDB PostgreSQL](https://www.enterprisedb.com/downloads/postgres-postgresql-downloads) download page. - - > Note: Set username and password for the default database to be 'postgres' during installation. - - 2. Once installed, Add `C:\Program Files\PostgreSQL\16\bin` to windows environment variables. Refer [here](https://www.computerhope.com/issues/ch000549.htm) or [here](https://stackoverflow.com/a/68851621) for more information regarding how to set it. - - 6. Install MongoDB: - - Follow the official [MongoDB Website](https://www.mongodb.com/try/download/community) to install MongoDB. - - 7. Install Gotenberg via Docker: - - 1. Download Docker Desktop for Windows from [Docker Website](https://docs.docker.com/desktop/setup/install/windows-install/) - - 2. Run the installer and follow the setup instructions. - - 3. Ensure Docker Desktop is running and configured to use Linux containers(default settings). - - 4. Open a terminal (e.g., Command Prompt). - - 5. Pull the Gotenberg image: - - ``` - docker pull gotenberg/gotenberg:latest - ``` - - 6. Run the Gotenberg container with the following command: - - ``` - docker run -d --name gotenberg -p 3000:3000 gotenberg/gotenberg:latest - ``` - - 7. Verify the container is running. You should see the Gotenberg container listed after running the below command. - ``` - docker ps - ``` - -## Installation - -1. **Create ELEVATE-Project Directory:** Create a directory named **ELEVATE-Project**. - - > Example Command: `mkdir ELEVATE-Project && cd ELEVATE-Project/` - -2. **Git Clone Services And Portal Repositories** - - - **Ubuntu/Linux/MacOS** - - ``` - git clone -b main https://github.com/ELEVATE-Project/project-service.git && \ - git clone -b main https://github.com/ELEVATE-Project/entity-management.git && \ - git clone -b master https://github.com/ELEVATE-Project/user.git && \ - git clone -b master https://github.com/ELEVATE-Project/notification.git && \ - git clone -b main https://github.com/ELEVATE-Project/interface-service.git && \ - git clone -b master https://github.com/ELEVATE-Project/scheduler.git && \ - git clone -b main https://github.com/ELEVATE-Project/observation-survey-projects-pwa - ``` - - - **Windows** - - ``` - git clone -b staging https://github.com/ELEVATE-Project/project-service.git & - git clone -b staging https://github.com/ELEVATE-Project/entity-management.git & - git clone -b master https://github.com/ELEVATE-Project/user.git & - git clone -b master https://github.com/ELEVATE-Project/notification.git & - git clone -b main https://github.com/ELEVATE-Project/interface-service.git & - git clone -b master https://github.com/ELEVATE-Project/scheduler.git & - git clone -b main https://github.com/ELEVATE-Project/observation-survey-projects-pwa - ``` - -3. **Install NPM Packages** - - - **Ubuntu/Linux/MacOS** - - ``` - cd project-service && npm install && cd ../ && \ - cd entity-management/src && npm install && cd ../.. && \ - cd user/src && npm install && cd ../.. && \ - cd notification/src && npm install && cd ../.. && \ - cd interface-service/src && npm install && cd ../.. && \ - cd scheduler/src && npm install && cd ../.. && \ - cd observation-survey-projects-pwa && npm install --force && cd .. - ``` - - - **Windows** - - ``` - cd project-service && npm install && cd .. - cd user\src && npm install && cd ..\.. - cd notification\src && npm install && cd ..\.. - cd interface-service\src && npm install && cd ..\.. - cd scheduler\src && npm install && cd ..\.. - cd observation-survey-projects-pwa && npm install --force && cd .. - ``` - - > Note: Entity-management service runs only on node-16 for Windows native setup. - - ``` - nvm use 16 - ``` - - ``` - cd entity-management\src && npm install && cd ..\.. - ``` - - > Note: Change the node version as it was before. - -4. **Download Environment Files** - - - **Ubuntu/Linux** - - ``` - curl -L -o project-service/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/envs/project_env && \ - curl -L -o entity-management/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/envs/entity_management_env && \ - curl -L -o user/src/.env https://github.com/ELEVATE-Project/project-service/raw/refs/heads/main/documentation/1.0.0/native/envs/user_env && \ - curl -L -o notification/src/.env https://github.com/ELEVATE-Project/project-service/raw/refs/heads/main/documentation/1.0.0/native/envs/notification_env && \ - curl -L -o interface-service/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/envs/interface_env && \ - curl -L -o scheduler/src/.env https://github.com/ELEVATE-Project/project-service/raw/refs/heads/main/documentation/1.0.0/native/envs/scheduler_env && \ - curl -L -o observation-survey-projects-pwa/src/environments/environment.ts https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/envs/enviroment.ts - ``` - - - **MacOs** - - ``` - curl -L -o project-service/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/envs/project_env && \ - curl -L -o entity-management/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/envs/entity_management_env && \ - curl -L -o user/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/envs/non-citus/user_env && \ - curl -L -o notification/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/envs/non-citus/notification_env && \ - curl -L -o interface-service/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/envs/interface_env && \ - curl -L -o scheduler/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/envs/scheduler_env && \ - curl -L -o observation-survey-projects-pwa/src/environments/environment.ts https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/envs/enviroment.ts - ``` - - - **Windows** - - ``` - curl -L -o project-service\.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/envs/project_env & - curl -L -o entity-management\src\.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/envs/entity_management_env & - curl -L -o user\src\.env https://github.com/ELEVATE-Project/project-service/raw/refs/heads/main/documentation/1.0.0/native/envs/user_env & - curl -L -o notification\src\.env https://github.com/ELEVATE-Project/project-service/raw/refs/heads/main/documentation/1.0.0/native/envs/notification_env & - curl -L -o interface-service\src\.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/envs/interface_env & - curl -L -o scheduler\src\.env https://github.com/ELEVATE-Project/project-service/raw/refs/heads/main/documentation/1.0.0/native/envs/scheduler_env & - curl -L -o observation-survey-projects-pwa\src\environments\environment.ts https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/envs/enviroment.ts - ``` - - > **Note:** Modify the environment files as necessary for your deployment using any text editor, ensuring that the values are appropriate for your environment. The default values provided in the current files are functional and serve as a good starting point. Refer to the sample env files provided at the [Project](https://github.com/ELEVATE-Project/project-service/blob/main/.env.sample), [User](https://github.com/ELEVATE-Project/user/blob/master/src/.env.sample), [Notification](https://github.com/ELEVATE-Project/notification/blob/master/src/.env.sample), [Scheduler](https://github.com/ELEVATE-Project/scheduler/blob/master/src/.env.sample), [Interface](https://github.com/ELEVATE-Project/interface-service/blob/main/src/.env.sample) and [Entity-Management](https://github.com/ELEVATE-Project/entity-management/blob/main/src/.env.sample) repositories for reference. - - > **Caution:** While the default values in the downloaded environment files enable the ELEVATE-Project Application to operate, certain features may not function correctly or could be impaired unless the adopter-specific environment variables are properly configured. - - > **Important:** As mentioned in the above linked document, the **User SignUp** functionality may be compromised if key environment variables are not set correctly during deployment. If you opt to skip this setup, consider using the sample user account generator detailed in the `Sample User Accounts Generation` section of this document. - -5. **Create Databases** - - - **Ubuntu/Linux** - - 1. Download `create-databases.sh` Script File: - - ``` - curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/main/documentation/1.0.0/native/scripts/linux/create-databases.sh - ``` - - 2. Make the executable by running the following command: - ``` - chmod +x create-databases.sh - ``` - 3. Run the script file: - ``` - ./create-databases.sh - ``` - - - **MacOs** - - 1. Download `create-databases.sh` Script File: - - ``` - curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/main/documentation/1.0.0/native/scripts/macos/create-databases.sh - - ``` - - 2. Make the executable by running the following command: - ``` - chmod +x create-databases.sh - ``` - 3. Run the script file: - ``` - ./create-databases.sh - ``` - - - **Windows** - - 1. Download `create-databases.bat` Script File: - ``` - curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/main/documentation/1.0.0/native/scripts/windows/create-databases.bat - ``` - 2. Run the script file: - ``` - create-databases.bat - ``` - -6. **Run Migrations To Create Tables** - - - **Ubuntu/Linux/MacOS** - - 1. Run Migrations: - ``` - cd user/src && npx sequelize-cli db:migrate && cd ../.. && \ - cd notification/src && npx sequelize-cli db:migrate && cd ../.. - ``` - - - **Windows** - - 1. Run Migrations: - ``` - cd user\src && npx sequelize-cli db:migrate && cd ..\.. && cd notification\src && npx sequelize-cli db:migrate && cd ..\.. - ``` - -7. **Enabling Citus And Setting Distribution Columns (Optional)** - - To boost performance and scalability, users can opt to enable the Citus extension. This transforms PostgreSQL into a distributed database, spreading data across multiple nodes to handle large datasets more efficiently as demand grows. - - > NOTE: Currently only available for Linux based operation systems. - - 1. Download user `distributionColumns.sql` file. - - ``` - curl -o ./user/distributionColumns.sql -JL https://github.com/ELEVATE-Project/project-service/raw/refs/heads/main/documentation/1.0.0/distribution-columns/user/distributionColumns.sql - ``` - - 2. Set up the `citus_setup` file by following the steps given below. - - - **Ubuntu/Linux** - - 1. Download the `citus_setup.sh` file: - - ``` - curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/scripts/linux/citus_setup.sh - - ``` - - 2. Make the setup file executable by running the following command: - - ``` - chmod +x citus_setup.sh - ``` - - 3. Enable Citus and set distribution columns for `user` database by running the `citus_setup.sh`with the following arguments. - ``` - ./citus_setup.sh user postgres://postgres:postgres@localhost:9700/users - ``` - -8. **Insert Initial Data** - - - **Ubuntu/Linux/MacOS** - - 1. Download `entity-project-sample-data.sh` Script File: - - 1.1. For ubuntu/linux - - ``` - curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/scripts/linux/entity-project-sample-data.sh - ``` - - 1.1. For mac - - ``` - curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/scripts/macos/entity-project-sample-data.sh - ``` - - 2. Make the executable by running the following command: - ``` - chmod +x entity-project-sample-data.sh - ``` - 3. Run the script file: - ``` - ./entity-project-sample-data.sh - ``` - 4. Run seeders of user service - ``` - cd user/src && npm run db:seed:all && cd ../.. - ``` - - - **Windows** - - 1. Download `entity-project-sample-data.bat` Script File: - - ``` - curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/scripts/windows/entity-project-sample-data.bat - ``` - - 2. Run the script file: - - ``` - entity-project-sample-data.bat - ``` - - 3. Run seeders of user service - - ``` - cd user\src && npm run db:seed:all && cd ..\.. - ``` - -9. **Insert Forms Data into Database** - - - **Ubuntu/Linux/MacOS** - - 1. Download `import_forms.js` Script File And Make the setup file executable by running the following command: - - ``` - curl -s https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/scripts/linux/import_forms.js | node - ``` - - - **Windows** - - 1. Download `import_forms_mongo.bat` Script File and execute the file by running the following commands: - - ``` - curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/scripts/windows/import_forms_mongo.bat - ``` - - ``` - import_forms_mongo.bat - ``` - -10. **Start The Services** - - Following the steps given below, 2 instances of each ELEVATE-Project backend service will be deployed and be managed by PM2 process manager. - - - **Ubuntu/Linux** - - ``` - (cd project-service && pm2 start app.js --name project-service && cd -) && \ - (cd entity-management/src && pm2 start app.js --name entity-management && cd -) && \ - (cd user/src && pm2 start app.js --name user && cd -) && \ - (cd notification/src && pm2 start app.js --name notification && cd -) && \ - (cd interface-service/src && pm2 start app.js --name interface && cd -) && \ - (cd scheduler/src && pm2 start app.js --name scheduler && cd -) - ``` - - - **MacOs** - - ``` - cd project-service && npx pm2 start app.js -i 2 --name project-service && cd .. && \ - cd entity-management/src && npx pm2 start app.js -i 2 --name entity-management && cd ../.. && \ - cd user/src && npx pm2 start app.js -i 2 --name user && cd ../.. && \ - cd notification/src && npx pm2 start app.js -i 2 --name notification && cd ../.. && \ - cd interface-service/src && npx pm2 start app.js -i 2 --name interface && cd ../.. && \ - cd scheduler/src && npx pm2 start app.js -i 2 --name scheduler && cd ../.. - ``` - - - **Windows** - - ``` - cd project-service && pm2 start app.js --name project-service && cd .. - cd entity-management\src && pm2 start app.js --name entity-management && cd ..\.. - cd user\src && pm2 start app.js --name user && cd ..\.. - cd notification\src && pm2 start app.js --name notification && cd ..\.. - cd interface-service\src && pm2 start app.js --name interface && cd ..\.. - cd scheduler\src && pm2 start app.js --name scheduler && cd ..\.. - ``` - -11. **Run Service Scripts** - - - **Ubuntu/Linux/MacOS** - - ``` - cd user/src/scripts && node insertDefaultOrg.js && node viewsScript.js && cd ../../.. - ``` - - - **Windows** - - ``` - cd user\src\scripts && node insertDefaultOrg.js && node viewsScript.js && cd ..\..\.. - ``` - -12. **Start The Portal** - - ELEVATE-Project portal utilizes Ionic for building the browser bundle, follow the steps given below to install them and start the portal. - - - **Ubuntu/Linux/Windows** - - 1. Install the Ionic framework: - - ``` - npm install -g ionic - ``` - - 2. Install the Ionic client: - - ``` - npm install -g @ionic/cli - ``` - - 3. Navigate to `observation-survey-projects-pwa` directory: - - ``` - cd observation-survey-projects-pwa - ``` - - 4. Run the project on your local system using the following command: - - ``` - ionic serve - ``` - - Navigate to http://localhost:8100 to access the ELEVATE-Project Portal. - -## Sample User Accounts Generation - -During the initial setup of ELEVATE-Project services with the default configuration, you may encounter issues creating new accounts through the regular SignUp flow on the ELEVATE-Project portal. This typically occurs because the default SignUp process includes OTP verification to prevent abuse. Until the notification service is configured correctly to send actual emails, you will not be able to create new accounts. - -In such cases, you can generate sample user accounts using the steps below. This allows you to explore the ELEVATE-Project services and portal immediately after setup. - -> **Warning:** Use this generator only immediately after the initial system setup and before any normal user accounts are created through the portal. It should not be used under any circumstances thereafter. - -- **Ubuntu/Linux** - - ``` - curl -o insert_sample_data.sh https://raw.githubusercontent.com/ELEVATE-Project/project-service/main/documentation/1.0.0/native/scripts/linux/insert_sample_data.sh && \ - chmod +x insert_sample_data.sh && \ - ./insert_sample_data.sh - ``` - -- **MacOS** - - ``` - curl -o insert_sample_data.sh https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/scripts/macos/insert_sample_data.sh && \ - chmod +x insert_sample_data.sh && \ - ./insert_sample_data.sh - ``` - -- **Windows** - - ``` - curl -o insert_sample_data.bat https://raw.githubusercontent.com/ELEVATE-Project/project-service/main/documentation/1.0.0/native/scripts/windows/insert_sample_data.bat && ^ - insert_sample_data.bat - ``` - -After successfully running the script mentioned above, the following user accounts will be created and available for login: - -| Email ID | Password | Role | -| ------------------------ | ---------- | ------------------------- | -| aaravpatel@example.com | Password1@ | State Educational Officer | -| arunimareddy@example.com | Password1@ | State Educational Officer | -| devikasingh@example.com | Password1@ | State Educational Officer | - + 2. macOS Setup +
+Go to the detailed macOS Docker setup guide: **SETUP_STANDALONE_DOCKER_MACOS.md**
-## Postman Collections - -- [Projects Service](https://github.com/ELEVATE-Project/project-service/tree/main/api-doc) - -## Adding New Projects to the System - -With implementation scripts, you can seamlessly add new projects to the system. Once a project is successfully added, it becomes visible on the portal, ready for use and interaction. For a comprehensive guide on setting up and using the implementation script, please refer to the [documentation here](https://github.com/ELEVATE-Project/project-service/tree/main/Project-Service-implementation-Script). - - - - +--- -# Team +## 🤝 Team -# Open Source Dependencies +### Open Source Dependencies Several open source dependencies that have aided Projects's development: @@ -1507,6 +174,3 @@ Several open source dependencies that have aided Projects's development: ![Redis](https://img.shields.io/badge/redis-%23DD0031.svg?style=for-the-badge&logo=redis&logoColor=white) ![Jest](https://img.shields.io/badge/-jest-%23C21325?style=for-the-badge&logo=jest&logoColor=white) ![Git](https://img.shields.io/badge/git-%23F05033.svg?style=for-the-badge&logo=git&logoColor=white) - - diff --git a/documentation/1.0.0/ReadMe.md b/documentation/1.0.0/ReadMe.md new file mode 100644 index 00000000..fddde5a5 --- /dev/null +++ b/documentation/1.0.0/ReadMe.md @@ -0,0 +1,1512 @@ +
+ +# Projects Service + + + + + +![GitHub package.json version (subfolder of monorepo)](https://img.shields.io/github/package-json/v/ELEVATE-Project/mentoring?filename=src%2Fpackage.json) +[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT) + +
+
+ +
+The Project building block facilitates the creation and engagement with micro-improvement projects. + + +
+ +# Supported Operating Systems + +- **Ubuntu (Recommended: Version 20 and above)** +- **Windows (Recommended: Version 11 and above)** +- **macOs (Recommended: Version 12 and above)** + +# Setup Options + +**Project services can be setup using two methods:** + +> Note : This guide outlines two setup methods, detailed below. For a quick, beginner-friendly setup and walkthrough of services, it is recommended to use the Dockerized Services & Dependencies setup with the Docker-Compose file. + +
Dockerized Services & Dependencies Using Docker-Compose File + +## Dockerized Services & Dependencies + +Expectation: By diligently following the outlined steps, you will successfully establish a fully operational Project application setup, including both the portal and backend services. + +## Prerequisites + +To set up the Project application, ensure you have Docker and Docker Compose installed on your system. For Ubuntu users, detailed installation instructions for both can be found in the documentation here: [How To Install and Use Docker Compose on Ubuntu](https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-compose-on-ubuntu-20-04). To install and use Nodejs in Ubuntu machine, you can follow instructions here: [How To Install Nodejs in Ubuntu](https://nodejs.org/en/download/package-manager). For Windows and MacOS users, you can refer to the Docker documentation for installation instructions: [Docker Compose Installation Guide](https://docs.docker.com/compose/install/). Once these prerequisites are in place, you're all set to get started with setting up the Project application. + +## Installation + +**Create project Directory:** Establish a directory titled **project**. + +> Example Command: `mkdir project && cd project/` + +> Note: All commands are run from the project directory. + +## Operating Systems: Linux / macOS + +> **Caution:** Before proceeding, please ensure that the ports given here are available and open. It is essential to verify their availability prior to moving forward. You can run below command in your terminal to check this + +``` +for port in 3000 3001 3002 6000 5001 4000 9092 5432 7007 2181 2707 3569; do + if lsof -iTCP:$port -sTCP:LISTEN &>/dev/null; then + echo "Port $port is in use" + else + echo "Port $port is available" + fi +done +``` + +1. **Download and execute main setup script:** Execute the following command in your terminal from the project directory. + ` curl -OJL https://github.com/ELEVATE-Project/project-service/raw/main/documentation/1.0.0/dockerized/scripts/mac-linux/setup_project.sh && chmod +x setup_project.sh && sudo ./setup_project.sh` + + > Note : The script will download all the essential files and launch the services in Docker. Once all services are successfully up and running, you can proceed to the next steps. + + **General Instructions :** + + 1. All containers which are part of the docker-compose can be gracefully stopped by pressing Ctrl + c in the same terminal where the services are running. + + 2. All docker containers can be stopped and removed by using below command. + ``` + sudo ./docker-compose-down.sh + ``` + 3. All services and dependencies can be started using below command. + ``` + sudo ./docker-compose-up.sh + ``` + + **Keep the current terminal session active, and kindly open a new terminal window within the project directory.** + +**After successfully completing this, please move to the next section: [Enable Citus Extension](#enable-citus-extension-optional)** + +## Operating Systems: Windows + +1. **Download Docker Compose File:** Retrieve the **[docker-compose-project.yml](https://github.com/ELEVATE-Project/project-service/raw/main/documentation/1.0.0/dockerized/docker-compose-project.yml)** file from the Project service repository and save it to the project directory. + + ``` + curl -OJL https://github.com/ELEVATE-Project/project-service/raw/main/documentation/1.0.0/dockerized/docker-compose-project.yml + ``` + + > Note: All commands are run from the project directory. + +2. **Download Environment Files**: Using the OS specific commands given below, download environment files for all the services. + + - **Windows** + + ``` + curl -L ^ + -O https://github.com/ELEVATE-Project/project-service/raw/main/documentation/1.0.0/dockerized/envs/interface_env ^ + -O https://github.com/ELEVATE-Project/project-service/raw/main/documentation/1.0.0/dockerized/envs/entity_management_env ^ + -O https://github.com/ELEVATE-Project/project-service/raw/main/documentation/1.0.0/dockerized/envs/project_env ^ + -O https://github.com/ELEVATE-Project/project-service/raw/main/documentation/1.0.0/dockerized/envs/notification_env ^ + -O https://github.com/ELEVATE-Project/project-service/raw/main/documentation/1.0.0/dockerized/envs/scheduler_env ^ + -O https://github.com/ELEVATE-Project/project-service/raw/main/documentation/1.0.0/dockerized/envs/user_env ^ + -O https://github.com/ELEVATE-Project/project-service/raw/main/documentation/1.0.0/dockerized/envs/env.js + ``` + + > **Note:** Modify the environment files as necessary for your deployment using any text editor, ensuring that the values are appropriate for your environment. The default values provided in the current files are functional and serve as a good starting point. Refer to the sample env files provided at the [Project](https://github.com/ELEVATE-Project/project-service/blob/main/.env.sample), [User](https://github.com/ELEVATE-Project/user/blob/master/src/.env.sample), [Notification](https://github.com/ELEVATE-Project/notification/blob/master/src/.env.sample), [Scheduler](https://github.com/ELEVATE-Project/scheduler/blob/master/src/.env.sample), [Interface](https://github.com/ELEVATE-Project/interface-service/blob/main/src/.env.sample) and [Entity-management](https://github.com/ELEVATE-Project/entity-management/blob/main/src/.env.sample) repositories for reference. + + > **Caution:** While the default values in the downloaded environment files enable the Project Application to operate, certain features may not function correctly or could be impaired unless the adopter-specific environment variables are properly configured. + +3. **Download `replace_volume_path` Script File** + + - **Windows** + + ``` + curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/main/documentation/1.0.0/dockerized/scripts/windows/replace_volume_path.bat + ``` + +4. **Run `replace_volume_path` Script File** + + - **Windows** + + Run the script file either by double clicking it or by executing the following command from the terminal. + + ``` + replace_volume_path.bat + ``` + + > **Note**: The provided script file replaces the host path for the **portal** service container volume in the `docker-compose-project.yml` file with your current directory path. + > + > volumes: + > + > \- /home/shikshalokam/elevate/single-click/linux/env.js:/usr/src/app/www/assets/env/env.js + +5. **Download `docker-compose-up` & `docker-compose-down` Script Files** + + - **Windows** + + ``` + curl -OJL https://github.com/ELEVATE-Project/project-service/raw/main/documentation/1.0.0/dockerized/scripts/windows/docker-compose-up.bat + ``` + + ``` + curl -OJL https://github.com/ELEVATE-Project/project-service/raw/main/documentation/1.0.0/dockerized/scripts/windows/docker-compose-down.bat + ``` + +6. **Run All Services & Dependencies**:All services and dependencies can be started using the `docker-compose-up` script file. + + - **Windows** + + ``` + docker-compose-up.bat + ``` + + > Double-click the file or run the above command from the terminal. + + > **Note**: During the first Docker Compose run, the database, migration seeder files, and the script to set the default organization will be executed automatically. + +7. **Remove All Service & Dependency Containers**: + All docker containers can be stopped and removed by using the `docker-compose-down` file. + + - **Windows** + + ``` + docker-compose-down.bat + ``` + + > **Caution**: As per the default configuration in the `docker-compose-project.yml` file, using the `down` command will lead to data loss since the database container does not persist data. To persist data across `down` commands and subsequent container removals, refer to the "Persistence of Database Data in Docker Containers" section of this documentation. + +## Enable Citus Extension (Optional) + +User management service comes with this bundle relies on PostgreSQL as its core database system. To boost performance and scalability, users can opt to enable the Citus extension. This transforms PostgreSQL into a distributed database, spreading data across multiple nodes to handle large datasets more efficiently as demand grows. + +For more information, refer **[Citus Data](https://www.citusdata.com/)**. + +To enable the Citus extension for user services, follow these steps. + +1. Create a sub-directory named `user` and download `distributionColumns.sql` into it. (Skip this for linux/macOs) + ``` + mkdir user && curl -o ./user/distributionColumns.sql -JL https://github.com/ELEVATE-Project/project-service/raw/main/documentation/1.0.0/distribution-columns/user/distributionColumns.sql + ``` +2. Set up the citus_setup file by following the steps given below. + + - **Ubuntu/Linux/Mac** + + 1. Enable Citus and set distribution columns for `user` database by running the `citus_setup.sh`with the following arguments. + ``` + sudo ./citus_setup.sh user postgres://postgres:postgres@citus_master:5432/user + ``` + + - **Windows** + 1. Download the `citus_setup.bat` file. + ``` + curl -OJL https://github.com/ELEVATE-Project/project-service/raw/main/documentation/1.0.0/dockerized/scripts/windows/citus_setup.bat + ``` + 2. Enable Citus and set distribution columns for `user` database by running the `citus_setup.bat`with the following arguments. + ``` + citus_setup.bat user postgres://postgres:postgres@citus_master:5432/user + ``` + > **Note:** Since the `citus_setup.bat` file requires arguments, it must be run from a terminal. + +## Persistence Of Database Data In Docker Container (Optional) + +To ensure the persistence of database data when running `docker compose down`, it is necessary to modify the `docker-compose-project.yml` file according to the steps given below: + +1. **Modification Of The `docker-compose-project.yml` File:** + + Begin by opening the `docker-compose-project.yml` file. Locate the section pertaining to the Citus and mongo container and proceed to uncomment the volume specification. This action is demonstrated in the snippet provided below: + + ```yaml + mongo: + image: 'mongo:4.4.14' + restart: 'always' + ports: + - '27017:27017' + networks: + - project_net + volumes: + - mongo-data:/data/db + logging: + driver: none + + citus: + image: citusdata/citus:11.2.0 + container_name: 'citus_master' + ports: + - 5432:5432 + volumes: + - citus-data:/var/lib/postgresql/data + ``` + +2. **Uncommenting Volume Names Under The Volumes Section:** + + Next, navigate to the volumes section of the file and proceed to uncomment the volume names as illustrated in the subsequent snippet: + + ```yaml + networks: + elevate_net: + external: false + + volumes: + citus-data: + mongo-data: + ``` + +By implementing these adjustments, the configuration ensures that when the `docker-compose down` command is executed, the database data is securely stored within the specified volumes. Consequently, this data will be retained and remain accessible, even after the containers are terminated and subsequently reinstated using the `docker-compose up` command. + +## Sample User Accounts Generation + +During the initial setup of Project services with the default configuration, you may encounter issues creating new accounts through the regular SignUp flow on the project portal. This typically occurs because the default SignUp process includes OTP verification to prevent abuse. Until the notification service is configured correctly to send actual emails, you will not be able to create new accounts. + +In such cases, you can generate sample user accounts using the steps below. This allows you to explore the Project services and portal immediately after setup. + +> **Warning:** Use this generator only immediately after the initial system setup and before any normal user accounts are created through the portal. It should not be used under any circumstances thereafter. + +- **Ubuntu/Linux/Mac** + + ``` + sudo ./insert_sample_data.sh user postgres://postgres:postgres@citus_master:5432/user + ``` + +- **Windows** + + 1. **Download The `sampleData.sql` Files:** + + ``` + mkdir sample-data\user 2>nul & ^ + curl -L "https://raw.githubusercontent.com/ELEVATE-Project/project-service/main/documentation/1.0.0/sample-data/windows/user/sampleData.sql" -o sample-data\user\sampleData.sql + ``` + + 2. **Download The `insert_sample_data` Script File:** + + ``` + curl -L -o insert_sample_data.bat https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/dockerized/scripts/windows/insert_sample_data.bat + ``` + + 3. **Run The `insert_sample_data` Script File:** + + ``` + insert_sample_data.bat user postgres://postgres:postgres@citus_master:5432/user + ``` + + After successfully running the script mentioned above, the following user accounts will be created and available for login: + + | Email ID | Password | Role | + | ------------------------ | ---------- | ----------------------- | + | aaravpatel@example.com | Password1@ | State Education Officer | + | arunimareddy@example.com | Password1@ | State Education Officer | + | devikasingh@example.com | Password1@ | State Education Officer | + +## Sample Data Creation For Projects + +This step will guide us in implementing a sample project solution following the initial setup of the project service. + +1. **Insert Sample Data To Database:** + + - **Ubuntu/Linux/Mac** + + 1. Insert sample data by running the following command. + + ``` + sudo ./add_sample_project_entity_data.sh + ``` + + - **Windows** + + 1. Download `entity-project-sample-data.bat` Script File: + + ``` + curl -L ^ + -O https://github.com/ELEVATE-Project/project-service/raw/main/documentation/1.0.0/dockerized/scripts/windows/entity-project-sample-data.bat ^ + ``` + + 2. Make the setup file executable by running the following command. + + ``` + entity-project-sample-data.bat + ``` + +## Default Forms Creation for Portal Configuration + +This step inserts configuration forms into MongoDB, enabling or disabling features and fields on portal pages. + +#### Insert Forms Data into Database + +- **Ubuntu/Linux/Mac**: + + ``` + curl -OJL https://github.com/ELEVATE-Project/project-service/raw/main/documentation/1.0.0/dockerized/scripts/mac-linux/import_forms_mongo.sh && chmod +x import_forms_mongo.sh && sudo ./import_forms_mongo.sh mongodb://mongo:27017/elevate-project + ``` + +- **Windows**: + 1. Download the `import_forms_mongo.bat` file: + ```cmd + curl -L -O https://github.com/ELEVATE-Project/project-service/raw/main/documentation/1.0.0/dockerized/scripts/windows/import_forms_mongo.bat + ``` + 2. Run the script: + ```cmd + import_forms_mongo.bat mongodb://localhost:27017/elevate-project + ``` + +## Explore the Portal + +Once the services are up and the front-end app bundle is built successfully, navigate to **[localhost:7007](http://localhost:7007/)** to access the Project app. + +> **Warning:** In this setup, features such as **Sign-Up, Project Certificate, Project Sharing, and Project PDF Report** will not be available because cloud storage credentials have been masked in the environment files for security reasons. + +
+ +
+Natively Installed Services & Dependencies + +## PM2 Managed Services & Natively Installed Dependencies + +### System Requirements + +- **Node.js®:** v20 +- **PostgreSQL:** 16 +- **Apache Kafka®:** 3.5.0 +- **MongoDB:** 4.4.14 +- **Gotenberg:** 8.5.0 + +Expectation: Upon following the prescribed steps, you will achieve a fully operational ELEVATE-Project application setup. Both the portal and backend services are managed using PM2, with all dependencies installed natively on the host system. + +## Prerequisites + +Before setting up the following ELEVATE-Project application, dependencies given below should be installed and verified to be running. Refer to the steps given below to install them and verify. + +- **Ubuntu/Linux** + + 1. Download dependency management scripts: + + ``` + curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/main/documentation/1.0.0/native/scripts/linux/check-dependencies.sh && \ + curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/main/documentation/1.0.0/native/scripts/linux/install-dependencies.sh && \ + curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/main/documentation/1.0.0/native/scripts/linux/uninstall-dependencies.sh && \ + chmod +x check-dependencies.sh && \ + chmod +x install-dependencies.sh && \ + chmod +x uninstall-dependencies.sh + ``` + + 2. Verify installed dependencies by running `check-dependencies.sh`: + + ``` + ./check-dependencies.sh + ``` + + > Note: Keep note of any missing dependencies. + + 3. Install dependencies by running `install-dependencies.sh`: + ``` + ./install-dependencies.sh + ``` + > Note: Install all missing dependencies and use check-dependencies script to ensure everything is installed and running. + 4. Uninstall dependencies by running `uninstall-dependencies.sh`: + + ``` + ./uninstall-dependencies.sh + ``` + + > Warning: Due to the destructive nature of the script (without further warnings), it should only be used during the initial setup of the dependencies. For example, Uninstalling PostgreSQL/Citus using script will lead to data loss. USE EXTREME CAUTION. + + > Warning: This script should only be used to uninstall dependencies that were installed via installation script in step 3. If same dependencies were installed using other methods, refrain from using this script. This script is provided in-order to reverse installation in-case issues arise from a bad install. + +- **MacOS** + + 1. Install Node.js 20: + + ``` + brew install node@20 + ``` + + ``` + brew link --overwrite node@20 + ``` + + 2. Install Kafka: + + ``` + brew install kafka + ``` + + > Note: To install Kafka on older macOS versions like Monterey (Intel architecture), you need to follow the manual installation process instead of using Homebrew. The process includes downloading Kafka, setting up ZooKeeper, and running Kafka services. You can find the official Kafka installation guide here: [Kafka Quickstart Guide](https://kafka.apache.org/quickstart).This ensures compatibility with older macOS systems. Follow the steps outlined in the documentation for a smooth setup. + + 3. Install PostgreSQL 16: + + ``` + brew install postgresql@16 + ``` + + 4. Install PM2: + + ``` + sudo npm install pm2@latest -g + ``` + + 5. Install Redis: + + ``` + brew install redis + ``` + + 6. Install mongDB: + + ``` + brew tap mongodb/brew + ``` + + ``` + brew install mongodb-community@4.4 + ``` + + ``` + brew link mongodb-community@4.4 --force + ``` + + ``` + brew services start mongodb-community@4.4 + ``` + + 7. Download `check-dependencies.sh` file: + + ``` + curl -OJL https://github.com/ELEVATE-Project/project-service/raw/main/documentation/1.0.0/native/scripts/macos/check-dependencies.sh && \ + chmod +x check-dependencies.sh + ``` + + 8. Verify installed dependencies by running `check-dependencies.sh`: + + ``` + ./check-dependencies.sh + ``` + + > Note : If you've manually installed Kafka without Homebrew, the script might incorrectly indicate that Kafka and Homebrew are not installed, as it checks only for Homebrew installations. In such cases, you can safely ignore this warning. Ensure that both Kafka and ZooKeeper are running on their default ports (ZooKeeper on `2181`, Kafka on `9092`). This will confirm proper installation and functionality despite the script's output. + +- **Windows** + + 1. Install Node.js 20: + + Download and install Node.js v20 for Windows platform (x64) from official [Node.js download page](https://nodejs.org/en/download). + + 2. Install Kafka 3.5.0: + + 1. Adapt the instructions given in the following ["Apache Kafka on Windows"](https://www.conduktor.io/kafka/how-to-install-apache-kafka-on-windows/) documentation to install Kafka version 3.5.0. + + > Note: As per the instructions, Kafka server and Zookeeper has to be kept active on different WSL terminals for the entire lifetime of ELEVATE-Project services. + + > Note: Multiple WSL terminals can be opened by launching `Ubuntu` from start menu. + + 2. Open a new WSL terminal and execute the following command to get the IP of the WSL instance. + + ``` + ip addr show eth0 + ``` + + Sample Output: + + ``` + 2: eth0: mtu 1492 qdisc mq state UP group default qlen 1000 + link/ether 11:56:54:f0:as:vf brd ff:ff:ff:ff:ff:ff + inet 172.12.46.150/20 brd 172.24.79.255 scope global eth0 + valid_lft forever preferred_lft forever + inet6 fe80::215:5dff:fee7:dc52/64 scope link + valid_lft forever preferred_lft forever + ``` + + Keep note of the IP address shown alongside `inet`. In the above case, `172.12.46.150` is IP address of the WSL instance. + + 3. In the same WSL terminal, navigate to `config` directory of Kafka from step 1 and make the following changes to `server.properties` file. + + - Uncomment `listeners=PLAINTEXT://:9092` line and change it to `listeners=PLAINTEXT://0.0.0.0:9092` to allow connections from any IP. + + - Uncomment `advertised.listeners` line and set it to `advertised.listeners=PLAINTEXT://172.12.46.150:9092`. Replace `172.12.46.150` with the actual IP address of your WSL instance. + + 4. Restart the Zookeeper and Kafka Server from their own WSL terminals from step 1. + + 3. Install Redis: + + 1. Follow the instructions given in the official [Redis Documentation](https://redis.io/docs/latest/operate/oss_and_stack/install/install-redis/install-redis-on-windows/) to install Redis using WSL. + + 2. Using the WSL terminal, open the Redis configuration file in a text editor, such as nano: + + ``` + sudo nano /etc/redis/redis.conf + ``` + + 3. Find the line containing `bind 127.0.0.1 ::1` and change it to `bind 0.0.0.0 ::.`. This change allows Redis to accept connections from any IP address. Then save and exit the file. + + 4. Restart Redis to apply the changes: + + ``` + sudo service redis-server restart + ``` + + 4. Install PM2: + + ``` + npm install pm2@latest -g + ``` + + 5. Install PostgreSQL 16: + + 1. Download and install PostgreSQL 16 from [EnterpriseDB PostgreSQL](https://www.enterprisedb.com/downloads/postgres-postgresql-downloads) download page. + + > Note: Set username and password for the default database to be 'postgres' during installation. + + 2. Once installed, Add `C:\Program Files\PostgreSQL\16\bin` to windows environment variables. Refer [here](https://www.computerhope.com/issues/ch000549.htm) or [here](https://stackoverflow.com/a/68851621) for more information regarding how to set it. + + 6. Install MongoDB: + + Follow the official [MongoDB Website](https://www.mongodb.com/try/download/community) to install MongoDB. + + 7. Install Gotenberg via Docker: + + 1. Download Docker Desktop for Windows from [Docker Website](https://docs.docker.com/desktop/setup/install/windows-install/) + + 2. Run the installer and follow the setup instructions. + + 3. Ensure Docker Desktop is running and configured to use Linux containers(default settings). + + 4. Open a terminal (e.g., Command Prompt). + + 5. Pull the Gotenberg image: + + ``` + docker pull gotenberg/gotenberg:latest + ``` + + 6. Run the Gotenberg container with the following command: + + ``` + docker run -d --name gotenberg -p 3000:3000 gotenberg/gotenberg:latest + ``` + + 7. Verify the container is running. You should see the Gotenberg container listed after running the below command. + ``` + docker ps + ``` + +## Installation + +1. **Create ELEVATE-Project Directory:** Create a directory named **ELEVATE-Project**. + + > Example Command: `mkdir ELEVATE-Project && cd ELEVATE-Project/` + +2. **Git Clone Services And Portal Repositories** + + - **Ubuntu/Linux/MacOS** + + ``` + git clone -b main https://github.com/ELEVATE-Project/project-service.git && \ + git clone -b main https://github.com/ELEVATE-Project/entity-management.git && \ + git clone -b master https://github.com/ELEVATE-Project/user.git && \ + git clone -b master https://github.com/ELEVATE-Project/notification.git && \ + git clone -b main https://github.com/ELEVATE-Project/interface-service.git && \ + git clone -b master https://github.com/ELEVATE-Project/scheduler.git && \ + git clone -b main https://github.com/ELEVATE-Project/observation-survey-projects-pwa + ``` + + - **Windows** + + ``` + git clone -b staging https://github.com/ELEVATE-Project/project-service.git & + git clone -b staging https://github.com/ELEVATE-Project/entity-management.git & + git clone -b master https://github.com/ELEVATE-Project/user.git & + git clone -b master https://github.com/ELEVATE-Project/notification.git & + git clone -b main https://github.com/ELEVATE-Project/interface-service.git & + git clone -b master https://github.com/ELEVATE-Project/scheduler.git & + git clone -b main https://github.com/ELEVATE-Project/observation-survey-projects-pwa + ``` + +3. **Install NPM Packages** + + - **Ubuntu/Linux/MacOS** + + ``` + cd project-service && npm install && cd ../ && \ + cd entity-management/src && npm install && cd ../.. && \ + cd user/src && npm install && cd ../.. && \ + cd notification/src && npm install && cd ../.. && \ + cd interface-service/src && npm install && cd ../.. && \ + cd scheduler/src && npm install && cd ../.. && \ + cd observation-survey-projects-pwa && npm install --force && cd .. + ``` + + - **Windows** + + ``` + cd project-service && npm install && cd .. + cd user\src && npm install && cd ..\.. + cd notification\src && npm install && cd ..\.. + cd interface-service\src && npm install && cd ..\.. + cd scheduler\src && npm install && cd ..\.. + cd observation-survey-projects-pwa && npm install --force && cd .. + ``` + + > Note: Entity-management service runs only on node-16 for Windows native setup. + + ``` + nvm use 16 + ``` + + ``` + cd entity-management\src && npm install && cd ..\.. + ``` + + > Note: Change the node version as it was before. + +4. **Download Environment Files** + + - **Ubuntu/Linux** + + ``` + curl -L -o project-service/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/envs/project_env && \ + curl -L -o entity-management/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/envs/entity_management_env && \ + curl -L -o user/src/.env https://github.com/ELEVATE-Project/project-service/raw/refs/heads/main/documentation/1.0.0/native/envs/user_env && \ + curl -L -o notification/src/.env https://github.com/ELEVATE-Project/project-service/raw/refs/heads/main/documentation/1.0.0/native/envs/notification_env && \ + curl -L -o interface-service/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/envs/interface_env && \ + curl -L -o scheduler/src/.env https://github.com/ELEVATE-Project/project-service/raw/refs/heads/main/documentation/1.0.0/native/envs/scheduler_env && \ + curl -L -o observation-survey-projects-pwa/src/environments/environment.ts https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/envs/enviroment.ts + ``` + + - **MacOs** + + ``` + curl -L -o project-service/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/envs/project_env && \ + curl -L -o entity-management/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/envs/entity_management_env && \ + curl -L -o user/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/envs/non-citus/user_env && \ + curl -L -o notification/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/envs/non-citus/notification_env && \ + curl -L -o interface-service/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/envs/interface_env && \ + curl -L -o scheduler/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/envs/scheduler_env && \ + curl -L -o observation-survey-projects-pwa/src/environments/environment.ts https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/envs/enviroment.ts + ``` + + - **Windows** + + ``` + curl -L -o project-service\.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/envs/project_env & + curl -L -o entity-management\src\.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/envs/entity_management_env & + curl -L -o user\src\.env https://github.com/ELEVATE-Project/project-service/raw/refs/heads/main/documentation/1.0.0/native/envs/user_env & + curl -L -o notification\src\.env https://github.com/ELEVATE-Project/project-service/raw/refs/heads/main/documentation/1.0.0/native/envs/notification_env & + curl -L -o interface-service\src\.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/envs/interface_env & + curl -L -o scheduler\src\.env https://github.com/ELEVATE-Project/project-service/raw/refs/heads/main/documentation/1.0.0/native/envs/scheduler_env & + curl -L -o observation-survey-projects-pwa\src\environments\environment.ts https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/envs/enviroment.ts + ``` + + > **Note:** Modify the environment files as necessary for your deployment using any text editor, ensuring that the values are appropriate for your environment. The default values provided in the current files are functional and serve as a good starting point. Refer to the sample env files provided at the [Project](https://github.com/ELEVATE-Project/project-service/blob/main/.env.sample), [User](https://github.com/ELEVATE-Project/user/blob/master/src/.env.sample), [Notification](https://github.com/ELEVATE-Project/notification/blob/master/src/.env.sample), [Scheduler](https://github.com/ELEVATE-Project/scheduler/blob/master/src/.env.sample), [Interface](https://github.com/ELEVATE-Project/interface-service/blob/main/src/.env.sample) and [Entity-Management](https://github.com/ELEVATE-Project/entity-management/blob/main/src/.env.sample) repositories for reference. + + > **Caution:** While the default values in the downloaded environment files enable the ELEVATE-Project Application to operate, certain features may not function correctly or could be impaired unless the adopter-specific environment variables are properly configured. + + > **Important:** As mentioned in the above linked document, the **User SignUp** functionality may be compromised if key environment variables are not set correctly during deployment. If you opt to skip this setup, consider using the sample user account generator detailed in the `Sample User Accounts Generation` section of this document. + +5. **Create Databases** + + - **Ubuntu/Linux** + + 1. Download `create-databases.sh` Script File: + + ``` + curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/main/documentation/1.0.0/native/scripts/linux/create-databases.sh + ``` + + 2. Make the executable by running the following command: + ``` + chmod +x create-databases.sh + ``` + 3. Run the script file: + ``` + ./create-databases.sh + ``` + + - **MacOs** + + 1. Download `create-databases.sh` Script File: + + ``` + curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/main/documentation/1.0.0/native/scripts/macos/create-databases.sh + + ``` + + 2. Make the executable by running the following command: + ``` + chmod +x create-databases.sh + ``` + 3. Run the script file: + ``` + ./create-databases.sh + ``` + + - **Windows** + + 1. Download `create-databases.bat` Script File: + ``` + curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/main/documentation/1.0.0/native/scripts/windows/create-databases.bat + ``` + 2. Run the script file: + ``` + create-databases.bat + ``` + +6. **Run Migrations To Create Tables** + + - **Ubuntu/Linux/MacOS** + + 1. Run Migrations: + ``` + cd user/src && npx sequelize-cli db:migrate && cd ../.. && \ + cd notification/src && npx sequelize-cli db:migrate && cd ../.. + ``` + + - **Windows** + + 1. Run Migrations: + ``` + cd user\src && npx sequelize-cli db:migrate && cd ..\.. && cd notification\src && npx sequelize-cli db:migrate && cd ..\.. + ``` + +7. **Enabling Citus And Setting Distribution Columns (Optional)** + + To boost performance and scalability, users can opt to enable the Citus extension. This transforms PostgreSQL into a distributed database, spreading data across multiple nodes to handle large datasets more efficiently as demand grows. + + > NOTE: Currently only available for Linux based operation systems. + + 1. Download user `distributionColumns.sql` file. + + ``` + curl -o ./user/distributionColumns.sql -JL https://github.com/ELEVATE-Project/project-service/raw/refs/heads/main/documentation/1.0.0/distribution-columns/user/distributionColumns.sql + ``` + + 2. Set up the `citus_setup` file by following the steps given below. + + - **Ubuntu/Linux** + + 1. Download the `citus_setup.sh` file: + + ``` + curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/scripts/linux/citus_setup.sh + + ``` + + 2. Make the setup file executable by running the following command: + + ``` + chmod +x citus_setup.sh + ``` + + 3. Enable Citus and set distribution columns for `user` database by running the `citus_setup.sh`with the following arguments. + ``` + ./citus_setup.sh user postgres://postgres:postgres@localhost:9700/users + ``` + +8. **Insert Initial Data** + + - **Ubuntu/Linux/MacOS** + + 1. Download `entity-project-sample-data.sh` Script File: + + 1.1. For ubuntu/linux + + ``` + curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/scripts/linux/entity-project-sample-data.sh + ``` + + 1.1. For mac + + ``` + curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/scripts/macos/entity-project-sample-data.sh + ``` + + 2. Make the executable by running the following command: + ``` + chmod +x entity-project-sample-data.sh + ``` + 3. Run the script file: + ``` + ./entity-project-sample-data.sh + ``` + 4. Run seeders of user service + ``` + cd user/src && npm run db:seed:all && cd ../.. + ``` + + - **Windows** + + 1. Download `entity-project-sample-data.bat` Script File: + + ``` + curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/scripts/windows/entity-project-sample-data.bat + ``` + + 2. Run the script file: + + ``` + entity-project-sample-data.bat + ``` + + 3. Run seeders of user service + + ``` + cd user\src && npm run db:seed:all && cd ..\.. + ``` + +9. **Insert Forms Data into Database** + + - **Ubuntu/Linux/MacOS** + + 1. Download `import_forms.js` Script File And Make the setup file executable by running the following command: + + ``` + curl -s https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/scripts/linux/import_forms.js | node + ``` + + - **Windows** + + 1. Download `import_forms_mongo.bat` Script File and execute the file by running the following commands: + + ``` + curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/scripts/windows/import_forms_mongo.bat + ``` + + ``` + import_forms_mongo.bat + ``` + +10. **Start The Services** + + Following the steps given below, 2 instances of each ELEVATE-Project backend service will be deployed and be managed by PM2 process manager. + + - **Ubuntu/Linux** + + ``` + (cd project-service && pm2 start app.js --name project-service && cd -) && \ + (cd entity-management/src && pm2 start app.js --name entity-management && cd -) && \ + (cd user/src && pm2 start app.js --name user && cd -) && \ + (cd notification/src && pm2 start app.js --name notification && cd -) && \ + (cd interface-service/src && pm2 start app.js --name interface && cd -) && \ + (cd scheduler/src && pm2 start app.js --name scheduler && cd -) + ``` + + - **MacOs** + + ``` + cd project-service && npx pm2 start app.js -i 2 --name project-service && cd .. && \ + cd entity-management/src && npx pm2 start app.js -i 2 --name entity-management && cd ../.. && \ + cd user/src && npx pm2 start app.js -i 2 --name user && cd ../.. && \ + cd notification/src && npx pm2 start app.js -i 2 --name notification && cd ../.. && \ + cd interface-service/src && npx pm2 start app.js -i 2 --name interface && cd ../.. && \ + cd scheduler/src && npx pm2 start app.js -i 2 --name scheduler && cd ../.. + ``` + + - **Windows** + + ``` + cd project-service && pm2 start app.js --name project-service && cd .. + cd entity-management\src && pm2 start app.js --name entity-management && cd ..\.. + cd user\src && pm2 start app.js --name user && cd ..\.. + cd notification\src && pm2 start app.js --name notification && cd ..\.. + cd interface-service\src && pm2 start app.js --name interface && cd ..\.. + cd scheduler\src && pm2 start app.js --name scheduler && cd ..\.. + ``` + +11. **Run Service Scripts** + + - **Ubuntu/Linux/MacOS** + + ``` + cd user/src/scripts && node insertDefaultOrg.js && node viewsScript.js && cd ../../.. + ``` + + - **Windows** + + ``` + cd user\src\scripts && node insertDefaultOrg.js && node viewsScript.js && cd ..\..\.. + ``` + +12. **Start The Portal** + + ELEVATE-Project portal utilizes Ionic for building the browser bundle, follow the steps given below to install them and start the portal. + + - **Ubuntu/Linux/Windows** + + 1. Install the Ionic framework: + + ``` + npm install -g ionic + ``` + + 2. Install the Ionic client: + + ``` + npm install -g @ionic/cli + ``` + + 3. Navigate to `observation-survey-projects-pwa` directory: + + ``` + cd observation-survey-projects-pwa + ``` + + 4. Run the project on your local system using the following command: + + ``` + ionic serve + ``` + + Navigate to http://localhost:8100 to access the ELEVATE-Project Portal. + +## Sample User Accounts Generation + +During the initial setup of ELEVATE-Project services with the default configuration, you may encounter issues creating new accounts through the regular SignUp flow on the ELEVATE-Project portal. This typically occurs because the default SignUp process includes OTP verification to prevent abuse. Until the notification service is configured correctly to send actual emails, you will not be able to create new accounts. + +In such cases, you can generate sample user accounts using the steps below. This allows you to explore the ELEVATE-Project services and portal immediately after setup. + +> **Warning:** Use this generator only immediately after the initial system setup and before any normal user accounts are created through the portal. It should not be used under any circumstances thereafter. + +- **Ubuntu/Linux** + + ``` + curl -o insert_sample_data.sh https://raw.githubusercontent.com/ELEVATE-Project/project-service/main/documentation/1.0.0/native/scripts/linux/insert_sample_data.sh && \ + chmod +x insert_sample_data.sh && \ + ./insert_sample_data.sh + ``` + +- **MacOS** + + ``` + curl -o insert_sample_data.sh https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/scripts/macos/insert_sample_data.sh && \ + chmod +x insert_sample_data.sh && \ + ./insert_sample_data.sh + ``` + +- **Windows** + + ``` + curl -o insert_sample_data.bat https://raw.githubusercontent.com/ELEVATE-Project/project-service/main/documentation/1.0.0/native/scripts/windows/insert_sample_data.bat && ^ + insert_sample_data.bat + ``` + +After successfully running the script mentioned above, the following user accounts will be created and available for login: + +| Email ID | Password | Role | +| ------------------------ | ---------- | ------------------------- | +| aaravpatel@example.com | Password1@ | State Educational Officer | +| arunimareddy@example.com | Password1@ | State Educational Officer | +| devikasingh@example.com | Password1@ | State Educational Officer | + +
+ +## Postman Collections + +- [Projects Service](https://github.com/ELEVATE-Project/project-service/tree/main/api-doc) + +## Adding New Projects to the System + +With implementation scripts, you can seamlessly add new projects to the system. Once a project is successfully added, it becomes visible on the portal, ready for use and interaction. For a comprehensive guide on setting up and using the implementation script, please refer to the [documentation here](https://github.com/ELEVATE-Project/project-service/tree/main/Project-Service-implementation-Script). + + + + + +# Team + + + + + +# Open Source Dependencies + +Several open source dependencies that have aided Projects's development: + +![NodeJS](https://img.shields.io/badge/node.js-6DA55F?style=for-the-badge&logo=node.js&logoColor=white) +![Apache Kafka](https://img.shields.io/badge/Apache%20Kafka-000?style=for-the-badge&logo=apachekafka) +![Redis](https://img.shields.io/badge/redis-%23DD0031.svg?style=for-the-badge&logo=redis&logoColor=white) +![Jest](https://img.shields.io/badge/-jest-%23C21325?style=for-the-badge&logo=jest&logoColor=white) +![Git](https://img.shields.io/badge/git-%23F05033.svg?style=for-the-badge&logo=git&logoColor=white) + + diff --git a/documentation/3.4.0/distribution-columns/user/distributionColumns.sql b/documentation/3.4.0/distribution-columns/user/distributionColumns.sql new file mode 100644 index 00000000..3f7b690d --- /dev/null +++ b/documentation/3.4.0/distribution-columns/user/distributionColumns.sql @@ -0,0 +1,14 @@ +SELECT create_distributed_table('entities', 'entity_type_id'); +SELECT create_distributed_table('entity_types', 'organization_id'); +SELECT create_distributed_table('file_uploads', 'organization_id'); +SELECT create_distributed_table('forms', 'organization_id'); +SELECT create_distributed_table('notification_templates', 'organization_id'); +SELECT create_distributed_table('organizations', 'id'); +SELECT create_distributed_table('organization_codes', 'code'); +SELECT create_distributed_table('organization_domains', 'domain'); +SELECT create_distributed_table('organization_role_requests','organization_id'); +SELECT create_distributed_table('organization_user_invites','organization_id'); +SELECT create_distributed_table('users_credentials','email'); +SELECT create_distributed_table('users', 'organization_id'); +SELECT create_distributed_table('users', 'user_organizations'); +SELECT create_distributed_table('users', 'user_organization_roles'); \ No newline at end of file diff --git a/documentation/3.4.0/dockerized/dockerFiles/stand-alone/docker-compose-project.yml b/documentation/3.4.0/dockerized/dockerFiles/stand-alone/docker-compose-project.yml new file mode 100644 index 00000000..58efcfe3 --- /dev/null +++ b/documentation/3.4.0/dockerized/dockerFiles/stand-alone/docker-compose-project.yml @@ -0,0 +1,235 @@ +version: '3' +services: + zookeeper: + image: 'confluentinc/cp-zookeeper:7.3.0' + ports: + - '2181:2181' + environment: + - ALLOW_ANONYMOUS_LOGIN='yes' + - ZOOKEEPER_CLIENT_PORT=2181 + - ZOOKEEPER_TICK_TIME=2000 + networks: + - project_net + kafka: + image: 'confluentinc/cp-kafka:7.3.0' + ports: + - '9092:9092' + environment: + KAFKA_BROKER_ID: 1 + KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 + KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9092 + KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092 + KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT + KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT + KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 + depends_on: + - zookeeper + healthcheck: + test: kafka-topics --bootstrap-server localhost:9092 --list || exit 1 + interval: 10s + timeout: 5s + retries: 9 + networks: + - project_net + rabbitmq: + image: rabbitmq:3-management + container_name: rabbitmq + ports: + - '5672:5672' # Standard AMQP port + - '15672:15672' # Management plugin UI port + environment: + RABBITMQ_DEFAULT_USER: guest + RABBITMQ_DEFAULT_PASS: guest + healthcheck: + test: ['CMD', 'rabbitmqctl', 'status'] + interval: 5s + timeout: 10s + retries: 5 + networks: + - project_net + redis: + image: 'redis:7.0.0' + restart: 'always' + expose: + - 6379 + healthcheck: + test: ['CMD', 'redis-cli', 'ping'] + interval: 10s + timeout: 5s + retries: 5 + networks: + - project_net + project: + image: shikshalokamqa/elevate-project-service:3.3.6.1 + container_name: project + ports: + - '6000:6000' + environment: + - MONGODB_URL=mongodb://mongo:27017/elevate-project + env_file: + - ./project_env + depends_on: + - mongo + - kafka + volumes: + - ./config.json:/opt/projects/config.json + networks: + - project_net + entity_management: + image: shikshalokamqa/elevate-entity-management:3.3.13.1 + ports: + - '5001:5001' + env_file: + - ./entity_management_env + depends_on: + - mongo + volumes: + - ./config.json:/var/src/config.json + networks: + - project_net + user: + image: shikshalokamqa/elevate-user:3.3.24 + ports: + - '3001:3001' + command: > + bash -c "echo 'Waiting for PostgreSQL on citus_master:5432 to accept connections...' && + while ! timeout 1 bash -c 'cat < /dev/null > /dev/tcp/citus_master/5432' 2> /dev/null; do + echo 'Waiting for citus_master to be ready...'; + sleep 1; + done; + echo 'Database is ready.'; + npm run db:init && npm run db:seed:all && + (echo 'Running nodeee' && nodemon app.js &) && + (while ! curl -sSf http://user:3001 > /dev/null; do + sleep 1; + done && echo 'Service is up' && + /bin/bash -c 'cd scripts && echo Running user service scripts && node -r module-alias/register uploadSampleCSV.js'); + tail -f /dev/null" + depends_on: + - kafka + - citus + - redis + - scheduler + environment: + - DEV_DATABASE_URL=postgres://postgres:postgres@citus_master:5432/user + - KAFKA_URL=kafka:9092 + - REDIS_HOST=redis://redis:6379 + volumes: + - ./user:/usr/src/app + networks: + - project_net + env_file: + - ./user_env + + notification: + image: ttpldevops/notification + ports: + - '3002:3002' + depends_on: + citus: + condition: service_started + rabbitmq: + condition: service_started + networks: + - project_net + env_file: + - ./notification_env + + scheduler: + image: shikshalokamqa/elevate-scheduler:2.6.1 + ports: + - '4000:4000' + command: ['nodemon', 'app.js'] + depends_on: + kafka: + condition: service_healthy + redis: + condition: service_started + networks: + - project_net + env_file: + - ./scheduler_env + interface: + image: shikshalokamqa/elevate-interface:3.3.2 + ports: + - '3569:3569' + command: ['node', 'app.js'] + depends_on: + kafka: + condition: service_healthy + networks: + - project_net + env_file: + - ./interface_env + citus: + image: citusdata/citus:11.2.0 + container_name: 'citus_master' + ports: + - 5432:5432 + expose: + - 5432 + environment: &AUTH + POSTGRES_USER: '${POSTGRES_USER:-postgres}' + POSTGRES_PASSWORD: '${POSTGRES_PASSWORD:-postgres}' + PGUSER: '${POSTGRES_USER:-postgres}' + PGPASSWORD: '${POSTGRES_PASSWORD:-postgres}' + POSTGRES_DB: 'postgres' + POSTGRES_HOST_AUTH_METHOD: '${POSTGRES_HOST_AUTH_METHOD:-trust}' + POSTGRES_LOG_STATEMENT: 'all' # Enable query logging (set to 'all' for all queries) + healthcheck: + test: ['CMD-SHELL', 'pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB'] + interval: 5s + timeout: 3s + retries: 5 + networks: + - project_net + #volumes: + # - citus-data:/var/lib/postgresql/data + pgadmin: + image: dpage/pgadmin4 + container_name: elevate-pgadmin + restart: always + ports: + - '5500:80' + environment: + - PGADMIN_DEFAULT_EMAIL=user@shikshalokam.org + - PGADMIN_DEFAULT_PASSWORD=password + networks: + - project_net + mongo: + image: 'mongo:4.4.14' + container_name: project_mongo_1 + restart: 'always' + ports: + - '27017:27017' + networks: + - project_net + # volumes: + # - mongo-data:/data/db + # logging: + # driver: none + gotenberg: + image: gotenberg/gotenberg:latest + container_name: gotenberg + ports: + - '3003:3000' + networks: + - project_net + restart: 'always' + + portal: + image: shikshalokamqa/elevate-project-obervation-pwa:3.4.0.1 + container_name: portal + ports: + - '7007:7007' + volumes: + - ./env.js:/usr/src/app/www/ml/assets/env/env.js + networks: + - project_net + +networks: + project_net: + external: false +#volumes: +# mongo-data: +# citus-data: diff --git a/documentation/3.4.0/dockerized/envs/entity_management_env b/documentation/3.4.0/dockerized/envs/entity_management_env new file mode 100644 index 00000000..8f530d17 --- /dev/null +++ b/documentation/3.4.0/dockerized/envs/entity_management_env @@ -0,0 +1,23 @@ +APPLICATION_PORT = 5001 +APPLICATION_ENV ="development" +APPLICATION_BASE_URL='/entity-management/' +INTERNAL_ACCESS_TOKEN =xahusub12yexlashsbxAXADHBlaj +ACCESS_TOKEN_SECRET=bsj82AHBxahusub12yexlashsbxAXADHBlaj +MONGODB_URL=mongodb://mongo:27017/elevate-entity +AUTH_METHOD = native +USER_SERVICE_URL = http://interface:3569 +USER_SERVICE_BASE_URL=/user +KAFKA_HEALTH_CHECK_TOPIC=test +SERVICE_NAME = elevate-entity-service +API_DOC_URL="https://entity-management/entity-management/api-doc" +APPLICATION_HOST=entity_management +IS_AUTH_TOKEN_BEARER="false" +ADMIN_ACCESS_TOKEN=rwwee3$123 +ADMIN_TOKEN_HEADER_NAME="admin-auth-token" +INTERFACE_SERVICE_URL=http://interface:3569 +KAFKA_HEALTH_CHECK_TOPIC = entity-health-check-topic-check +KAFKA_COMMUNICATIONS_ON_OFF = ON +KAFKA_URL=kafka:9092 +KAFKA_COMMUNICATIONS_ON_OFF = ON +KAFKA_GROUP_ID = entity +HEALTH_CHECK_DEBUG_MODE = true \ No newline at end of file diff --git a/documentation/3.4.0/dockerized/envs/env.js b/documentation/3.4.0/dockerized/envs/env.js new file mode 100644 index 00000000..9606a60a --- /dev/null +++ b/documentation/3.4.0/dockerized/envs/env.js @@ -0,0 +1,17 @@ +window['env'] = { + production: true, + baseURL: 'https://qa.elevate-apis.shikshalokam.org', + capabilities: 'all', + restrictedPages: ['DOWNLOADS', 'AUTH_PAGES', 'PROFILE', 'EDIT_PROFILE'], + unauthorizedRedirectUrl: '/', + isAuthBypassed: true, + profileRedirectPath: '', + showHeader: true, + config: { + logoPath: 'assets/images/logo.png', + faviconPath: 'assets/icons/elevate-logo.png', + title: 'Elevate', + redirectUrl: '/home', + }, + hostPath: '/ml/', +} diff --git a/documentation/3.4.0/dockerized/envs/interface_env b/documentation/3.4.0/dockerized/envs/interface_env new file mode 100644 index 00000000..e0119e8d --- /dev/null +++ b/documentation/3.4.0/dockerized/envs/interface_env @@ -0,0 +1,24 @@ +API_DOC_URL=/interface/api-doc +APPLICATION_ENV=development +APPLICATION_PORT=3569 +ELEVATE_NOTIFICATION_KAFKA_BROKERS=kafka:9092 +ELEVATE_NOTIFICATION_KAFKA_GROUP_ID=mentoring +ELEVATE_NOTIFICATION_KAFKA_TOPIC=notification +ENTITY_SERVICE_BASE_URL=http://entity_management:5001 +INSTALLED_PACKAGES=elevate-mentoring elevate-survey-observation@1.0.1 elevate-self-creation-portal +NOTIFICATION_SERVICE_BASE_URL=http://localhost:7201 +PROJECT_SERVICE_BASE_URL=http://project:6000 +RATE_LIMITER_ENABLED=true +RATE_LIMITER_GENERAL_LIMIT=500 +RATE_LIMITER_NUMBER_OF_PROXIES=3 +RATE_LIMITER_PUBLIC_LOW_LIMIT=5 +REQUIRED_BASE_PACKAGES=elevate-mentoring elevate-project elevate-survey-observation self-creation-portal +REQUIRED_PACKAGES=elevate-mentoring@1.2.90 elevate-survey-observation@1.0.22 elevate-project@1.1.53 shiksha-notification@1.1.3 elevate-self-creation-portal@1.0.70 +ROUTE_CONFIG_JSON_URLS_PATHS=https://raw.githubusercontent.com/ELEVATE-Project/utils/refs/heads/develop/interface-routes/elevate-routes.json +SAAS_NOTIFICATION_BASE_URL=interface/v1/notification/send-raw +SAAS_NOTIFICATION_SEND_EMAIL_ROUTE=interface/v1/notification/send-raw +SAMIKSHA_SERVICE_BASE_URL=http://localhost:4301 +SCHEDULER_SERVICE_BASE_URL=http://localhost:7401 +SUPPORTED_HTTP_TYPES=GET POST PUT PATCH DELETE +SURVEY_SERVICE_BASE_URL=http://samiksha:4301 +USER_SERVICE_BASE_URL=http://user:3001 \ No newline at end of file diff --git a/documentation/3.4.0/dockerized/envs/notification_env b/documentation/3.4.0/dockerized/envs/notification_env new file mode 100644 index 00000000..c821b118 --- /dev/null +++ b/documentation/3.4.0/dockerized/envs/notification_env @@ -0,0 +1,12 @@ +# Database +POSTGRES_HOST=citus_master +POSTGRES_PORT=5432 +POSTGRES_DATABASE=notification +POSTGRES_USERNAME=postgres + +RABBITMQ_URL=amqp://rabbitmq:5672 + + +# Application +PORT=3002 +NODE_ENV=development \ No newline at end of file diff --git a/documentation/3.4.0/dockerized/envs/project_env b/documentation/3.4.0/dockerized/envs/project_env new file mode 100644 index 00000000..2494e2b2 --- /dev/null +++ b/documentation/3.4.0/dockerized/envs/project_env @@ -0,0 +1,49 @@ +APPLICATION_PORT = 6000 +APPLICATION_ENV = development +ACCESS_TOKEN_SECRET=bsj82AHBxahusub12yexlashsbxAXADHBlaj +INTERNAL_ACCESS_TOKEN =xahusub12yexlashsbxAXADHBlaj +MONGODB_URL = mongodb://mongodb:27017/elevate-project +KEYCLOAK_PUBLIC_KEY_PATH = keycloak-public-keys +KAFKA_COMMUNICATIONS_ON_OFF = ON +KAFKA_URL =kafka:9092 +KAFKA_GROUP_ID = projects +KAFKA_HEALTH_CHECK_TOPIC = project-health-check-topic-check +PROJECT_SUBMISSION_TOPIC=sl-improvement-project-submission-dev +SUBMISSION_TOPIC = Projectsubmissions +PROJECT_CERTIFICATE_TOPIC = generateProjectCertificate +ELEVATE_PROJECT_SERVICE_URL=http://project:6000 +SERVICE_NAME = project +USER_DELETE_TOPIC = deleteuser +TELEMETRY_TOPIC=telemetry.raw +ID = projectservice +TELEMETRY_ON_OFF=ON +USER_DELETE_ON_OFF=OFF +CLOUD_STORAGE=ON +TIMEZONE_DIFFRENECE_BETWEEN_LOCAL_TIME_AND_UTC = +05:30 +VALIDATE_ENTITIES = ON +APP_PORTAL_BASE_URL =http://portal:7007 +NO_OF_MINUTES = 30 +NO_OF_EXPIRY_TIME = 60 +PRESIGNED_URL_EXPIRY_IN_SECONDS = 300 +DOWNLOADABLE_URL_EXPIRY_IN_SECONDS = 300 +DEFAULT_ORGANISATION_CODE = 1 +GOTENBERG_URL=http://gotenberg:3000 +API_DOC_URL="http://project/project/api-doc" +INTERFACE_SERVICE_URL = http://interface:3569 +USER_SERVICE_BASE_URL = "/user" +ENTITY_MANAGEMENT_SERVICE_BASE_URL = "/entity-management" +CLOUD_STORAGE_PROVIDER=gcloud +CLOUD_STORAGE_ACCOUNTNAME=CLOUD_STORAGE_ACCOUNTNAME +CLOUD_STORAGE_SECRET="CLOUD_STORAGE_SECRET" +CLOUD_STORAGE_BUCKETNAME=CLOUD_STORAGE_BUCKETNAME +CLOUD_STORAGE_BUCKET_TYPE=private +ADMIN_ACCESS_TOKEN = N0DM5NAwwCN5KNXKJwlwu6c0nQQt6Rcl +ADMIN_AUTH_TOKEN = N0DM5NAwwCN5KNXKJwlwu6c0nQQt6Rcl +ADMIN_TOKEN_HEADER_NAME = 'admin-auth-token' +IS_AUTH_TOKEN_BEARER = false +AUTH_METHOD = native +REDIS_HOST=redis://redis:6379 +PUBLIC_ASSET_BUCKETNAME=mentoring-storage-public +USER_SERVICE_URL = http://user:3569 +RESOURCE_DELETION_TOPIC=RESOURCE_DELETION_TOPIC +CLOUD_STORAGE_PROJECT =sl-project \ No newline at end of file diff --git a/documentation/3.4.0/dockerized/envs/scheduler_env b/documentation/3.4.0/dockerized/envs/scheduler_env new file mode 100644 index 00000000..9de73d13 --- /dev/null +++ b/documentation/3.4.0/dockerized/envs/scheduler_env @@ -0,0 +1,12 @@ +API_DOC_URL=/api-doc +APPLICATION_BASE_URL=/scheduler/ +APPLICATION_ENV=development +APPLICATION_PORT=4000 +DEFAULT_QUEUE=email +DISABLE_LOG=false +ENABLE_LOG=true +ERROR_LOG_LEVEL=silly +KAFKA_URL=kafka:9092 +NOTIFICATION_KAFKA_TOPIC=notifications +REDIS_HOST=redis +REDIS_PORT=6379 \ No newline at end of file diff --git a/documentation/3.4.0/dockerized/envs/user_env b/documentation/3.4.0/dockerized/envs/user_env new file mode 100644 index 00000000..c72a1d2c --- /dev/null +++ b/documentation/3.4.0/dockerized/envs/user_env @@ -0,0 +1,99 @@ +ACCESS_TOKEN_EXPIRY='30m' +ALLOWED_HOST='*' +ACCESS_TOKEN_SECRET='bsj82AHBxahusub12yexlashsbxAXADHBlaj' +API_DOC_URL=/user/api-doc +APP_NAME=MentorED +APPLICATION_ENV=development +APPLICATION_PORT=3001 +CLOUD_STORAGE_PROVIDER=aws +CLOUD_STORAGE_BUCKETNAME=mentoring-prod-storage-private +CLOUD_STORAGE_SECRET=AKIAIOSFODNN7EXAMPLE +CLOUD_STORAGE_REGION=ap-south-1 +CLOUD_ENDPOINT=s3.ap-south-1.amazonaws.com +CLOUD_STORAGE_ACCOUNTNAME=mentoring-prod-storage-private +CLOUD_STORAGE_BUCKET_TYPE=private +PUBLIC_ASSET_BUCKETNAME=mentoring-prod-storage-private +AZURE_ACCOUNT_KEY='AZURE_ACCOUNT_KEY' +AZURE_ACCOUNT_NAME=elevatementoringaccount +CLEAR_INTERNAL_CACHE=userinternal +CLOUD_STORAGE=GCP +DEFAULT_AZURE_CONTAINER_NAME=mentoring-azure-private +DEFAULT_GCP_BUCKET_NAME=mentoring-dev-storage-private +ENABLE_EMAIL_OTP_VERIFICATION=false +ENABLE_LOG=true +GCP_PATH=gcp.json +GCP_PROJECT_ID=sl-dev-project +INTERNAL_ACCESS_TOKEN=xahusub12yexlashsbxAXADHBlaj +INTERNAL_CACHE_EXP_TIME=86400 +IV=LHYOA5YnTonqcgrm15k3/Q== +KAFKA_GROUP_ID=users +KAFKA_TOPIC=dev.topic.user +KAFKA_URL=kafka:9092 +KEY=E/m3RD/aM3Ed3lLfYVcKizakG9R+bFybAPZSLjIP2hY= +MENTOR_SECRET_CODE=4567 +MONGODB_URL=mongodb://mongo:27017/elevate-users +NOTIFICATION_KAFKA_TOPIC=dev.notifications +OTP_EMAIL_TEMPLATE_CODE=emailotp +OTP_EXP_TIME=86400 +RATING_KAFKA_TOPIC=dev.mentor_rating +REDIS_HOST=redis://redis:6379 +REFRESH_TOKEN_EXPIRY=183 +REFRESH_TOKEN_SECRET=371hkjkjady2y3ihdkajshdkiq23iuekw71yekhaskdvkvegavy23t78veqwexqvxveit6ttxyeeytt62tx236vv +REGISTRATION_EMAIL_TEMPLATE_CODE=registration +REGISTRATION_OTP_EMAIL_TEMPLATE_CODE=registrationotp +SALT_ROUNDS=10 +DEFAULT_OCI_BUCKET_NAME=mentoring-oci-private +OCI_ACCESS_KEY_ID=81a4c2553026982360af6b24497c489b0fea9436 +OCI_BUCKET_ENDPOINT=https://axgqmpkrpmt5.compat.objectstorage.ap-hyderabad-1.oraclecloud.com +OCI_BUCKET_REGION=ap-hyderabad-1 +OCI_SECRET_ACCESS_KEY='+U4O+CjiC6M/mOcGjYh7K/9XjfSdJ79OoLuQrABPOJ8=' +ERROR_LOG_LEVEL=silly +DISABLE_LOG=false +DEFAULT_ORGANISATION_CODE=default_code +DEV_DATABASE_URL=postgres://postgres:postgres@citus_master:5432/user +ADMIN_SECRET_CODE=W5bF7gesuS0xsNWmpsKy +MENTORING_SERVICE_URL="http://mentoring:3000" +INVITEE_EMAIL_TEMPLATE_CODE="invite_user" +ADMIN_INVITEE_UPLOAD_EMAIL_TEMPLATE_CODE="invitee_upload_status" +DEFAULT_QUEUE="defaultque" +MENTOR_INVITATION_EMAIL_TEMPLATE_CODE="invite_mentor" +MENTEE_INVITATION_EMAIL_TEMPLATE_CODE="invite_mentee" +DEFAULT_ROLE="mentee" +SAMPLE_CSV_FILE_PATH="sample/bulk_user_creation.csv" +ORG_ADMIN_INVITATION_EMAIL_TEMPLATE_CODE="invite_org_admin" +DEFAULT_ORG_ID=1 +PORTAL_URL="portaladdress" +SCHEDULER_SERVICE_HOST="http://scheduler:4000" +SCHEDULER_SERVICE_BASE_URL="/scheduler/" +REFRESH_VIEW_INTERVAL=100000 +EMAIL_ID_ENCRYPTION_IV='a390328e496f025249a88384f318a536' +EMAIL_ID_ENCRYPTION_KEY='9bbf4698e081176b4e38c3f04f9c0cff6ae80b1960e5ac868cc234ac8537aa66' +EMAIL_ID_ENCRYPTION_ALGORITHM='aes-256-cbc' +GENERIC_INVITATION_EMAIL_TEMPLATE_CODE='check_code' +EVENT_ORG_LISTENER_URLS="http://interface:3569/mentoring/v1/organization/eventListener" +EVENT_ENABLE_ORG_EVENTS=false +DOWNLOAD_URL_EXPIRATION_DURATION=300 +APPLICATION_HOST="user" +CHANGE_PASSWORD_TEMPLATE_CODE="change_password" +CAPTCHA_ENABLE=false +RECAPTCHA_SECRET_KEY="6LfWEKYpAAAAAJS0eukS2Su_5vwlXRs5vPbC34W0" +ALLOWED_IDLE_TIME=1200000 +APPLICATION_BASE_URL="/user" +ENTITY_MANAGEMENT_SERVICE_BASE_URL="http://interface:3569/entity-management/" +IS_AUTH_TOKEN_BEARER=false +DEFAULT_TENANT_ORG_CODE=default_code +DEFAULT_TENANT_ORG_NAME="Default Organization" +EVENT_ENABLE_ORG_KAFKA_EVENTS=true +EVENT_ENABLE_TENANT_KAFKA_EVENTS=true +EVENT_ENABLE_USER_KAFKA_EVENTS=true +EVENT_ORGANIZATION_KAFKA_TOPIC="dev.organizationEvent" +EVENT_TENANT_KAFKA_TOPIC="dev.tenantEvent" +EVENT_USER_KAFKA_TOPIC="dev.userCreate" +INTERFACE_SERVICE_HOST="http://interface:3569" +JWT_SECRET='bsj82AHBxahusub12yexlashsbxAXADHBlaj' +SCHEDULER_SERVICE_ERROR_REPORTING_EMAIL_ID="test@yopmail.com" +SCHEDULER_SERVICE_URL="http://interface:3569/jobs/scheduleJob" +SERVICE_NAME="UserService" +SIGNED_URL_EXPIRY_IN_SECONDS="900" +ORG_CODE_HEADER_NAME=organization-id +ORG_ID_HEADER_NAME=organization-id diff --git a/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/citus_setup.sh b/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/citus_setup.sh new file mode 100644 index 00000000..34066c39 --- /dev/null +++ b/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/citus_setup.sh @@ -0,0 +1,129 @@ +#!/bin/bash + +# Exit immediately if a command exits with a non-zero status. +set -e + +# --- 1. ARGUMENT VALIDATION --- +if [ $# -lt 2 ]; then + echo "Error: Folder name and database URL not provided." >&2 + echo "Usage: $0 " >&2 + exit 1 +fi + +# Use the provided folder name +FOLDER_NAME="$1" +DEV_DATABASE_URL="$2" + +# Check if folder exists +if [ ! -d "$FOLDER_NAME" ]; then + echo "Error: Folder '$FOLDER_NAME' not found." >&2 + exit 1 +fi + +# --- 2. HIGHLY RELIABLE DATABASE URL PARSING --- +echo "Parsing database URL..." + +# Remove the protocol part (e.g., 'postgres://') +DB_CLEAN_URL=$(echo "$DEV_DATABASE_URL" | sed 's/.*:\/\///') + +# 1. Extract DB_NAME (last part after the final slash) +DB_NAME=$(echo "$DB_CLEAN_URL" | awk -F '/' '{print $NF}') +# 2. Extract HOST and PORT (remove DB_NAME and the preceding slash) +HOST_PORT_PATH=$(echo "$DB_CLEAN_URL" | sed "s/\/$DB_NAME//") + +# 3. Use standard ':' and '@' delimiters on the remaining string +DB_USER=$(echo "$HOST_PORT_PATH" | awk -F '[:@]' '{print $1}') +DB_PASSWORD=$(echo "$HOST_PORT_PATH" | awk -F '[:@]' '{print $2}') +DB_HOST=$(echo "$HOST_PORT_PATH" | awk -F '[:@]' '{print $3}') +DB_PORT=$(echo "$HOST_PORT_PATH" | awk -F '[:@]' '{print $4}') + +# Define the container name (assumes container name is the DB_HOST, which is 'citus_master') +CONTAINER_NAME="$DB_HOST" + +# Log database variables (excluding password) +echo "Extracted Database Variables:" +echo "DB_USER: $DB_USER" +echo "DB_HOST: $DB_HOST" +echo "DB_PORT: $DB_PORT" +echo "DB_NAME: $DB_NAME" +echo "" + +# Check the extracted port +if [[ -z "$DB_PORT" ]]; then + echo "Error: Could not extract database port. Check URL format." >&2 + exit 1 +fi + +# --- 3. WAIT FOR CONTAINER AND DATABASE --- + +# Wait for Docker container to be up +echo "Waiting for Docker container '$CONTAINER_NAME' to be up..." +until docker inspect "$CONTAINER_NAME" &>/dev/null; do + echo -n "." + sleep 1 +done +echo -e "\nContainer is now up." + +# Wait for PostgreSQL to be ready to accept connections +# Use DB_USER for the check, as it must be a valid user +echo "Waiting for PostgreSQL on '$DB_HOST:$DB_PORT' to accept connections..." +until docker exec "$CONTAINER_NAME" bash -c "pg_isready -h localhost -p $DB_PORT -U $DB_USER > /dev/null 2>&1"; do + echo -n "." + sleep 1 +done +echo -e "\nDatabase server is ready." + +# Check and wait for the target database to exist +echo "Checking existence of database '$DB_NAME'..." +until docker exec "$CONTAINER_NAME" bash -c "PGPASSWORD='$DB_PASSWORD' psql -h localhost -U $DB_USER -d postgres -p $DB_PORT -lqt | grep -qw '$DB_NAME'"; do + echo -n "." + sleep 5 +done +echo -e "\nDatabase '$DB_NAME' exists, proceeding with script." + +# --- 4. CITUS EXTENSION SETUP --- + +DISTRIBUTION_COLUMNS_FILE="$FOLDER_NAME/distributionColumns.sql" +if [ ! -f "$DISTRIBUTION_COLUMNS_FILE" ]; then + echo "Error: distributionColumns.sql not found in folder '$FOLDER_NAME'." >&2 + exit 1 +fi + +echo "Copying distributionColumns.sql to container '$CONTAINER_NAME'..." +CONTAINER_SQL_PATH="/tmp/distributionColumns.sql" +docker cp "$DISTRIBUTION_COLUMNS_FILE" "$CONTAINER_NAME:$CONTAINER_SQL_PATH" + +echo "Creating Citus extension in the database..." +docker exec "$CONTAINER_NAME" bash -c "PGPASSWORD='$DB_PASSWORD' psql -h localhost -U $DB_USER -d $DB_NAME -p $DB_PORT --set ON_ERROR_STOP=1 -c 'CREATE EXTENSION IF NOT EXISTS citus;'" + +# --- 5. EXECUTE SQL FILE WITH ROBUST TABLE CHECK --- + +check_table() { + local table_name=$1 + # Check if we can select from the table. If we can't, it returns non-zero. + docker exec "$CONTAINER_NAME" bash -c "PGPASSWORD='$DB_PASSWORD' psql -h localhost -U $DB_USER -d $DB_NAME -p $DB_PORT -q -t --set ON_ERROR_STOP=1 -c \"SELECT 1 FROM $table_name LIMIT 1;\"" > /dev/null 2>&1 +} + +echo "Starting creation of distributed tables..." +docker exec "$CONTAINER_NAME" bash -c "cat $CONTAINER_SQL_PATH" | while IFS= read -r line; do + trimmed_line=$(echo "$line" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//') + + if [[ "$trimmed_line" =~ ^create_distributed_table\(\'([^\']+)\', ]]; then + table="${BASH_REMATCH[1]}" + echo "Processing table: '$table'" + + # Robust wait loop for the table to be created by the preceding process (e.g., migration) + until check_table "$table"; do + echo "Table '$table' does not exist yet (waiting for migration to finish)..." + sleep 1 + done + + echo "Table '$table' exists. Executing Citus distribution command..." + docker exec "$CONTAINER_NAME" bash -c "PGPASSWORD='$DB_PASSWORD' psql -h localhost -U $DB_USER -d $DB_NAME -p $DB_PORT --set ON_ERROR_STOP=1 -c \"$trimmed_line\"" + fi +done + +# Clean up temporary file in the container +docker exec "$CONTAINER_NAME" rm "$CONTAINER_SQL_PATH" + +echo "✅ Citus extension setup and distribution columns complete successfully!" \ No newline at end of file diff --git a/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/configFile.json b/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/configFile.json new file mode 100644 index 00000000..b3d32b2f --- /dev/null +++ b/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/configFile.json @@ -0,0 +1,11 @@ +{ + "authTokenUserInformation": { + "userId": "data.id", + "userName": "data.name", + "firstName": "data.name", + "organization_id": "data.organization_codes[0]", + "roles": "data.organizations[?code={{organization_id}}].roles", + "organizations": "data.organizations", + "tenant_id": "data.tenant_code" + } +} diff --git a/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/docker-compose-down.sh b/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/docker-compose-down.sh new file mode 100644 index 00000000..e26ce422 --- /dev/null +++ b/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/docker-compose-down.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# Get the directory of the shell script +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Set environment variables +export notification_env="$SCRIPT_DIR/notification_env" +export scheduler_env="$SCRIPT_DIR/scheduler_env" +export project_env="$SCRIPT_DIR/project_env" +export users_env="$SCRIPT_DIR/user_env" +export interface_env="$SCRIPT_DIR/interface_env" +export entity_management_env="$SCRIPT_DIR/entity_management_env" + +# Run docker-compose +docker compose -f "$SCRIPT_DIR/docker-compose-project.yml" down \ No newline at end of file diff --git a/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/docker-compose-up.sh b/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/docker-compose-up.sh new file mode 100644 index 00000000..bbab6136 --- /dev/null +++ b/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/docker-compose-up.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# Get the directory of the shell script +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Set environment variables +export notification_env="$SCRIPT_DIR/notification_env" +export scheduler_env="$SCRIPT_DIR/scheduler_env" +export project_env="$SCRIPT_DIR/project_env" +export users_env="$SCRIPT_DIR/user_env" +export interface_env="$SCRIPT_DIR/interface_env" +export entity_management_env="$SCRIPT_DIR/entity_management_env" + +# Run docker-compose +docker compose -f "$SCRIPT_DIR/docker-compose-project.yml" up diff --git a/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/entity_sampleData.js b/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/entity_sampleData.js new file mode 100644 index 00000000..8bcbfcb6 --- /dev/null +++ b/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/entity_sampleData.js @@ -0,0 +1,290 @@ +const { ObjectId } = require('mongodb') + +let entityType = [ + { + _id: new ObjectId('6825914b97b5680013e6a140'), + profileForm: [], + profileFields: [], + types: [], + callResponseTypes: [], + isObservable: true, + immediateChildrenEntityType: ['district'], + createdBy: '49', + updatedBy: '49', + deleted: false, + isDeleted: false, + name: 'state', + toBeMappedToParentEntities: true, + tenantId: 'default', + updatedAt: new Date('2025-05-15T07:01:31.680Z'), + createdAt: new Date('2025-05-15T07:01:31.680Z'), + __v: 0, + orgId: 'default_code', + }, + { + _id: new ObjectId('6825915197b5680013e6a142'), + profileForm: [], + profileFields: [], + types: [], + callResponseTypes: [], + isObservable: true, + immediateChildrenEntityType: ['district'], + createdBy: '49', + updatedBy: '49', + deleted: false, + isDeleted: false, + name: 'district', + toBeMappedToParentEntities: true, + tenantId: 'default', + updatedAt: new Date('2025-05-15T07:01:37.892Z'), + createdAt: new Date('2025-05-15T07:01:37.892Z'), + __v: 0, + orgId: 'default_code', + }, + { + _id: new ObjectId('682591cc97b5680013e6a15c'), + profileForm: [], + profileFields: [], + types: [], + callResponseTypes: [], + isObservable: true, + immediateChildrenEntityType: ['district'], + createdBy: '49', + updatedBy: '49', + deleted: false, + isDeleted: false, + name: 'professional_role', + toBeMappedToParentEntities: true, + tenantId: 'default', + updatedAt: new Date('2025-05-15T07:03:40.376Z'), + createdAt: new Date('2025-05-15T07:03:40.376Z'), + __v: 0, + orgId: 'default_code', + }, + { + _id: new ObjectId('682591d397b5680013e6a15e'), + profileForm: [], + profileFields: [], + types: [], + callResponseTypes: [], + isObservable: true, + immediateChildrenEntityType: ['district'], + createdBy: '49', + updatedBy: '49', + deleted: false, + isDeleted: false, + name: 'professional_subroles', + toBeMappedToParentEntities: true, + tenantId: 'default', + updatedAt: new Date('2025-05-15T07:03:47.062Z'), + createdAt: new Date('2025-05-15T07:03:47.062Z'), + __v: 0, + orgId: 'default_code', + }, +] + +let entities = [ + { + _id: new ObjectId('6852c86c7248c20014b38a4d'), + metaInformation: { + targetedEntityTypes: [], + externalId: '16', + name: 'Tripura', + }, + childHierarchyPath: ['district', 'block', 'cluster', 'school'], + createdBy: '20', + updatedBy: '20', + deleted: false, + entityTypeId: new ObjectId('6825914b97b5680013e6a140'), + entityType: 'state', + registryDetails: { + code: '16', + locationId: '16', + }, + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-06-18T14:29:00.266Z'), + createdAt: new Date('2025-06-18T14:08:44.438Z'), + __v: 0, + groups: { + district: [new ObjectId('6852c8ae7248c20014b38a57')], + block: [new ObjectId('6852c8de7248c20014b38a9d')], + cluster: [new ObjectId('6852c9027248c20014b38c34')], + school: [new ObjectId('6852c9237248c20014b39fa0')], + }, + }, + { + _id: new ObjectId('6852c8ae7248c20014b38a57'), + metaInformation: { + targetedEntityTypes: [], + externalId: 'westTripura', + name: 'West Tripura', + }, + childHierarchyPath: ['block', 'cluster', 'school'], + createdBy: '20', + updatedBy: '20', + deleted: false, + entityTypeId: new ObjectId('6825915197b5680013e6a142'), + entityType: 'district', + registryDetails: { + code: 'westTripura', + locationId: 'westTripura', + }, + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-06-18T14:27:43.218Z'), + createdAt: new Date('2025-06-18T14:09:50.337Z'), + __v: 0, + groups: { + block: [new ObjectId('6852c8de7248c20014b38a9d')], + cluster: [new ObjectId('6852c9027248c20014b38c34')], + school: [new ObjectId('6852c9237248c20014b39fa0')], + }, + }, + { + _id: new ObjectId('6852c8de7248c20014b38a9d'), + metaInformation: { + targetedEntityTypes: [], + externalId: '160101', + name: 'AGARTALA MUNICIPAL COORPORATION', + }, + childHierarchyPath: ['cluster', 'school'], + createdBy: '20', + updatedBy: '20', + deleted: false, + entityTypeId: new ObjectId('6825915597b5680013e6a144'), + entityType: 'block', + registryDetails: { + code: '160101', + locationId: '160101', + }, + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-06-18T14:24:30.469Z'), + createdAt: new Date('2025-06-18T14:10:38.736Z'), + __v: 0, + groups: { + cluster: [new ObjectId('6852c9027248c20014b38c34')], + school: [new ObjectId('6852c9237248c20014b39fa0')], + }, + }, + { + _id: new ObjectId('6852c9027248c20014b38c34'), + metaInformation: { + targetedEntityTypes: [], + externalId: '1601010004', + name: 'ACHARYA PRAFULLA CHANDRA H/S SCHOOL', + }, + childHierarchyPath: ['school'], + createdBy: '20', + updatedBy: '20', + deleted: false, + entityTypeId: new ObjectId('6825915897b5680013e6a146'), + entityType: 'cluster', + registryDetails: { + code: '1601010004', + locationId: '1601010004', + }, + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-06-18T14:22:16.044Z'), + createdAt: new Date('2025-06-18T14:11:14.746Z'), + __v: 0, + groups: { + school: [new ObjectId('6852c9237248c20014b39fa0')], + }, + }, + { + _id: new ObjectId('6852c9237248c20014b39fa0'), + metaInformation: { + targetedEntityTypes: [], + externalId: '16010100422', + name: 'ABINASH GOPE SMRITI (SAROJANI) JB SCHOOL', + }, + childHierarchyPath: [], + createdBy: '20', + updatedBy: '20', + deleted: false, + entityTypeId: new ObjectId('6825915c97b5680013e6a148'), + entityType: 'school', + registryDetails: { + code: '16010100422', + locationId: '16010100422', + }, + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-06-18T14:11:49.194Z'), + createdAt: new Date('2025-06-18T14:11:49.194Z'), + __v: 0, + }, + { + _id: new ObjectId('68876746b19aea00144c2af9'), + metaInformation: { + targetedEntityTypes: [ + { + entityTypeId: '6825915197b5680013e6a142', + entityType: 'district', + }, + ], + externalId: 'Facilitator', + name: 'Facilitator', + }, + childHierarchyPath: ['professional_role', 'professional_subroles'], + createdBy: '1', + updatedBy: '1', + deleted: false, + entityTypeId: new ObjectId('682591cc97b5680013e6a15c'), + entityType: 'professional_role', + registryDetails: { + locationId: 'Facilitator', + code: 'Facilitator', + }, + userId: '1', + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-07-28T12:08:56.065Z'), + createdAt: new Date('2025-07-28T12:04:22.011Z'), + __v: 0, + groups: { + professional_subroles: [new ObjectId('688767deb19aea00144c2b08')], + }, + }, + { + _id: new ObjectId('688767deb19aea00144c2b08'), + metaInformation: { + targetedEntityTypes: [ + { + entityType: 'Handbook1_Activity', + entityTypeId: '688762feb19aea00144c2a81', + }, + { + entityType: 'Handbook2_Activity', + entityTypeId: '68887766b19aea00144c3631', + }, + ], + externalId: 'facilitator', + name: 'Facilitator', + }, + childHierarchyPath: ['professional_subroles'], + createdBy: '1', + updatedBy: '1', + deleted: false, + entityTypeId: new ObjectId('682591d397b5680013e6a15e'), + entityType: 'professional_subroles', + registryDetails: { + locationId: 'facilitator', + code: 'facilitator', + }, + userId: '1', + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-07-29T07:28:05.355Z'), + createdAt: new Date('2025-07-28T12:06:54.072Z'), + __v: 0, + }, +] + +module.exports = { + entities, + entityType, +} diff --git a/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/insert_sample_data.sh b/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/insert_sample_data.sh new file mode 100755 index 00000000..59284c92 --- /dev/null +++ b/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/insert_sample_data.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (1, 'Rahul R B', 'a0db5e0a39ee13db7fc5d1309e637f2c', false, '{8,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default',NULL,NULL, NULL);" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (2, 'Prajwal C S', 'c4113be1bc2cef51981a6ec687302e42fc4f87f4dfac4276584844d9e3e0f5ae', false, '{8,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default',NULL,NULL, NULL);" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (3, 'Vishnu V P', '1092be87fd483fce1deba56c8cdefa79bed4f70a4b110fc4e7947c57aacff219', false, '{8,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default',NULL,NULL, NULL);" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (4, 'Mallanagouda R B', 'e5fc674d4b1a54c6cf772485e3bca6f7ae14b60de32b9f0cd9f955ee469345bc', false, '{8,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default',NULL,NULL, NULL);" + +# --- 2. INSERT INTO public.user_organizations --- +# FIXES: +# - Quoted the organization_code and tenant_code variables. +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_organizations (user_id,organization_code, tenant_code, created_at, updated_at, deleted_at) VALUES (1, 'default_code', 'default', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_organizations (user_id,organization_code, tenant_code, created_at, updated_at, deleted_at) VALUES (2, 'default_code', 'default', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_organizations (user_id,organization_code, tenant_code, created_at, updated_at, deleted_at) VALUES (3, 'default_code', 'default', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_organizations (user_id,organization_code, tenant_code, created_at, updated_at, deleted_at) VALUES (4, 'default_code', 'default', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" + +# --- 3. INSERT INTO public.user_organization_roles --- +# FIXES: +# - Quoted the organization_code and tenant_code variables. +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 2, 'default_code', 1, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 3, 'default_code', 8, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 2, 'default_code', 8, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 4, 'default_code', 8, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" + + +psql -h localhost -p 5432 -U postgres -d user -c " +UPDATE public.tenants +SET meta = '{ + \"factors\": [\"professional_role\", \"professional_subroles\"], + \"observableEntityKeys\": [\"professional_subroles\"], + \"optional_factors\": [\"state\", \"district\", \"block\", \"cluster\", \"school\"], + \"validationExcludedScopeKeys\": [\"language\", \"gender\"], + \"portalSignInUrl\": \"https://shikshagrah-qa.tekdinext.com/register\" +}' +WHERE code = 'default'; +" + +# --- 4. INSERT INTO public.entity_types --- +# FIXES: +# - Quoted the JSON value for the 'meta' column. +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.entity_types (id, value, label, status, created_by, updated_by, allow_filtering, data_type, organization_id, parent_id, has_entities, allow_custom_entities, model_names, created_at, updated_at, deleted_at, meta, external_entity_type, required, regex, tenant_code,organization_code) VALUES (5, 'state', 'State', 'ACTIVE', 0, 0, true, 'STRING', 1, NULL, true, true, '{User}', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, '{\"service\": \"entity-management-service\",\"endPoint\": \"v1/entities/find\"}', true, false, NULL,'default', 'default_code');" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.entity_types (id, value, label, status, created_by, updated_by, allow_filtering, data_type, organization_id, parent_id, has_entities, allow_custom_entities, model_names, created_at, updated_at, deleted_at, meta, external_entity_type, required, regex, tenant_code,organization_code) VALUES (6, 'block', 'Block', 'ACTIVE', 0, 0, true, 'STRING', 1, NULL, true, true, '{User}', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, '{\"service\": \"entity-management-service\",\"endPoint\": \"v1/entities/find\"}', true, false, NULL,'default', 'default_code');" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.entity_types (id, value, label, status, created_by, updated_by, allow_filtering, data_type, organization_id, parent_id, has_entities, allow_custom_entities, model_names, created_at, updated_at, deleted_at, meta, external_entity_type, required, regex, tenant_code,organization_code) VALUES (7, 'school', 'School', 'ACTIVE', 0, 0, true, 'STRING', 1, NULL, true, true, '{User}', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, '{\"service\": \"entity-management-service\",\"endPoint\": \"v1/entities/find\"}', true, false, NULL,'default', 'default_code');" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.entity_types (id, value, label, status, created_by, updated_by, allow_filtering, data_type, organization_id, parent_id, has_entities, allow_custom_entities, model_names, created_at, updated_at, deleted_at, meta, external_entity_type, required, regex, tenant_code,organization_code) VALUES (8, 'district', 'District', 'ACTIVE', 0, 0, true, 'STRING', 1, NULL, true, true, '{User}', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, '{\"service\": \"entity-management-service\",\"endPoint\": \"v1/entities/find\"}', true, false, NULL,'default', 'default_code');" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.entity_types (id, value, label, status, created_by, updated_by, allow_filtering, data_type, organization_id, parent_id, has_entities, allow_custom_entities, model_names, created_at, updated_at, deleted_at, meta, external_entity_type, required, regex, tenant_code,organization_code) VALUES (9, 'cluster', 'Cluster', 'ACTIVE', 0, 0, true, 'STRING', 1, NULL, true, true, '{User}', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, '{\"service\": \"entity-management-service\",\"endPoint\": \"v1/entities/find\"}', true, false, NULL,'default', 'default_code');" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.entity_types (id, value, label, status, created_by, updated_by, allow_filtering, data_type, organization_id, parent_id, has_entities, allow_custom_entities, model_names, created_at, updated_at, deleted_at, meta, external_entity_type, required, regex, tenant_code,organization_code) VALUES (10, 'professional_role','Professional Role','ACTIVE', 0, 0, true, 'STRING', 1, NULL, true, true, '{User}', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, '{\"service\": \"entity-management-service\",\"endPoint\": \"v1/entities/find\"}', true, false, NULL,'default', 'default_code');" +psql -h localhost -p 5432 -U postgres -d user -c "INSERT INTO public.entity_types (id, value, label, status, created_by, updated_by, allow_filtering, data_type, organization_id, parent_id, has_entities, allow_custom_entities, model_names, created_at, updated_at, deleted_at, meta, external_entity_type, required, regex, tenant_code,organization_code) VALUES (11, 'professional_subroles','Professional Subroles', 'ACTIVE', 0, 0, true, 'STRING', 1, NULL, true, true, '{User}', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, '{\"service\": \"entity-management-service\",\"endPoint\": \"v1/entities/find\"}', true, false, NULL,'default', 'default_code');" + +# --- 5. UPDATES and SEQUENCES --- +psql -h localhost -p 5432 -U postgres -d user -c "SELECT nextval('users_id_seq'::regclass) FROM public.users;" +psql -h localhost -p 5432 -U postgres -d user -c "SELECT nextval('users_credentials_id_seq'::regclass) FROM public.users_credentials;" +psql -h localhost -p 5432 -U postgres -d user -c "SELECT NULL;" + + + diff --git a/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/insert_sample_solutions.js b/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/insert_sample_solutions.js new file mode 100644 index 00000000..f789eab8 --- /dev/null +++ b/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/insert_sample_solutions.js @@ -0,0 +1,184 @@ +const { MongoClient } = require('mongodb') + +const url = 'mongodb://localhost:27017/' // MongoDB URL +const dbName = 'elevate-project' +const dbName2 = 'elevate-entity' +const entityData = require('./entity_sampleData.js') +const projectData = require('./project_sampleData.js') + +// MongoDB Error Code for Duplicate Key +const DUPLICATE_KEY_ERROR_CODE = 11000 + +// --- UTILITY FUNCTIONS --- + +/** + * Drops the specified collection, effectively deleting all data. + * @param {string} collectionName The name of the collection to drop. + * @param {string} currentDB The name of the database. + */ +async function cleanData(collectionName, currentDB) { + const client = new MongoClient(url) + try { + await client.connect() + const db = client.db(currentDB) + const collection = db.collection(collectionName) + + const exists = await collection.findOne({}) + if (exists) { + await collection.drop() + console.log(`🗑️ Successfully dropped collection: ${currentDB}.${collectionName}`) + } else { + // Use .listCollections for a more definitive check if needed, but drop() is usually safe. + console.log(`ℹ️ Collection ${collectionName} in ${currentDB} does not exist or is empty. Skipping drop.`) + } + } catch (error) { + // This catches general connection or other drop errors + console.error(`❌ Error dropping collection ${collectionName} in ${currentDB}: ${error.message}`) + } finally { + await client.close() + } +} + +/** + * Inserts data into the specified collection and provides detailed status messages. + * (This function is kept the same as your previous version for insertion logic) + * @param {string} collectionName The name of the collection. + * @param {Array} dataFile The array of documents to insert. + * @param {string} currentDB The name of the database. + */ +async function insertData(collectionName, dataFile, currentDB = dbName) { + const client = new MongoClient(url) + + try { + // Connect to MongoDB + await client.connect() + const db = client.db(currentDB) + const collection = db.collection(collectionName) + + const data = dataFile + + if (!data || data.length === 0) { + return + } + + console.log(`\n--- Attempting insertion into: ${currentDB}.${collectionName} ---`) + + const results = [] + + // Use Promise.all with map for concurrent insertion (faster) + await Promise.all( + data.map(async (doc, index) => { + const tempId = doc._id || `(Document Index: ${index})` + + try { + const result = await collection.insertOne(doc) + + // The _id is either the one from the source doc or the generated one + const finalId = result.insertedId || doc._id + + results.push({ + id: finalId, + status: 'SUCCESS', + message: `Document successfully created with _id: ${finalId}`, + }) + } catch (error) { + if (error.code === DUPLICATE_KEY_ERROR_CODE) { + // This typically happens if the document has an _id or a unique index violation + results.push({ + id: tempId, + status: 'DUPLICATE', + message: `The data with identifier ${tempId} is already present in the DB. Please ensure unique identifiers are provided or clean the existing data.`, + }) + } else { + // Catch other errors (e.g., validation failure, connection issues) + results.push({ + id: tempId, + status: 'FAILURE', + message: `Error inserting document ${tempId}: ${error.message}`, + }) + } + } + }) + ) + + // Print the detailed results + results.forEach((res) => { + let message = '' + if (res.status === 'SUCCESS') { + message = `✅ SUCCESS: ${res.message}` + } else if (res.status === 'DUPLICATE') { + message = `⚠️ DUPLICATE: ${res.message}` + } else { + message = `❌ FAILURE: ${res.message}` + } + console.log(message) + }) + } catch (globalError) { + console.error(`\nFatal error connecting to or operating on the database: ${globalError.message}`) + } finally { + await client.close() + } +} + +// --- MAIN EXECUTION LOGIC --- + +async function main({ dataToBeInserted }) { + const collectionsToInsert = [ + { name: 'entities', data: dataToBeInserted.entities, db: dbName2 }, + { name: 'entityTypes', data: dataToBeInserted.entityType, db: dbName2 }, + { name: 'programs', data: dataToBeInserted.programData, db: dbName }, + { name: 'solutions', data: dataToBeInserted.solutionData, db: dbName }, + { name: 'projectTemplates', data: dataToBeInserted.projectTemplatesData, db: dbName }, + { name: 'projectTemplateTasks', data: dataToBeInserted.projectTemplateTasksData, db: dbName }, + { name: 'certificateTemplates', data: dataToBeInserted.certificateTemplatesData, db: dbName }, + { name: 'certificateBaseTemplates', data: dataToBeInserted.certificateBaseTemplatesData, db: dbName }, + { name: 'projectCategories', data: dataToBeInserted.projectCategoriesData, db: dbName }, + { name: 'configurations', data: dataToBeInserted.configurationData, db: dbName }, + ] + + console.log(`\n=================================================`) + console.log( + `🗑️ Starting CLEANUP for ${dataToBeInserted === entityData ? 'Entity Data' : 'Project Data'} Collections...` + ) + console.log(`=================================================`) + + // 1. CLEANUP PHASE: Drop all relevant collections first + for (const item of collectionsToInsert) { + // Only call cleanData if there is corresponding data to be inserted, to avoid dropping unrelated collections + if (item.data) { + await cleanData(item.name, item.db) + } + } + + console.log(`\n=================================================`) + console.log( + `➕ Starting INSERTION for ${dataToBeInserted === entityData ? 'Entity Data' : 'Project Data'} Collections...` + ) + console.log(`=================================================`) + + // 2. INSERTION PHASE: Insert new data + for (const item of collectionsToInsert) { + if (item.data) { + // The insertData function already handles the database selection via the last argument + await insertData(item.name, item.data, item.db) + } + } +} + +// --- EXECUTION CALLS --- + +main({ dataToBeInserted: entityData }) + .then(() => { + console.log('\n=======================================') + console.log('✅ Entity data population process finished.') + console.log('=======================================') + }) + .catch(console.error) + +main({ dataToBeInserted: projectData }) + .then(() => { + console.log('\n=======================================') + console.log('✅ Project data population process finished.') + console.log('=======================================') + }) + .catch(console.error) diff --git a/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/project_sampleData.js b/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/project_sampleData.js new file mode 100644 index 00000000..513763ae --- /dev/null +++ b/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/project_sampleData.js @@ -0,0 +1,1631 @@ +const { ObjectId } = require('mongodb') + +let solutionData = [ + { + _id: new ObjectId('68ee4bb3fb9bee08b93b6d68'), + resourceType: ['Improvement Project Solution'], + language: ['English'], + keywords: ['Improvement Project'], + concepts: [], + themes: [], + flattenedThemes: [], + entities: [], + registry: [], + isRubricDriven: false, + enableQuestionReadOut: false, + captureGpsLocationAtQuestionLevel: false, + isAPrivateProgram: false, + allowMultipleAssessemts: false, + isDeleted: false, + pageHeading: 'Domains', + minNoOfSubmissionsRequired: 1, + rootOrganisations: [], + createdFor: [], + submissionLevel: 'USER', + availableForPrivateConsumption: true, + parentEntityKey: null, + deleted: false, + programExternalId: 'Testing_for_prTGCEBGFFRYVBDFGJ7DGDGF12SDFGHJ345CVBNMDRGYY', + entityType: 'school', + externalId: 'PROJ19099023DGHG789SDASDFGHR4567-1760447411369-PROJECT-SOLUTION', + name: 'pro with obsasatask oct 8 facilitator only 2nd', + description: 'To construct a wired car using a DPDT switch.', + isReusable: false, + startDate: new Date('2025-09-09T00:00:00.000Z'), + endDate: new Date('2026-09-09T18:29:59.000Z'), + subType: 'improvementProject', + type: 'improvementProject', + programId: new ObjectId('68ee4b79fb9bee08b93b6d34'), + programName: 'custom observation as a task check on oct 14th facilitator', + programDescription: 'custom observation as a task check on oct 14th facilitator', + status: 'active', + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-10-14T13:11:17.993Z'), + createdAt: new Date('2025-10-14T13:10:11.897Z'), + __v: 0, + scope: { + professional_role: ['68876746b19aea00144c2af9'], + professional_subroles: ['688767deb19aea00144c2b08'], + organizations: ['default_code'], + state: ['6852c86c7248c20014b38a4d'], + district: ['6852c8ae7248c20014b38a57'], + block: ['ALL'], + cluster: ['ALL'], + school: ['ALL'], + }, + projectTemplateId: new ObjectId('68ee4bb3fb9bee08b93b6d70'), + updatedBy: '1', + author: '1', + creator: 'Mallanagouda', + certificateTemplateId: new ObjectId('68ee4bf5fb9bee08b93b6d97'), + link: 'f8a8e9ba397a29cf75ad5057db6cb7f9', + }, + { + _id: new ObjectId('68e8c635201642091e014914'), + resourceType: ['Improvement Project Solution'], + language: ['English'], + keywords: ['Improvement Project'], + concepts: [], + themes: [], + flattenedThemes: [], + entities: [], + registry: [], + isRubricDriven: false, + enableQuestionReadOut: false, + captureGpsLocationAtQuestionLevel: false, + isAPrivateProgram: false, + allowMultipleAssessemts: false, + isDeleted: false, + pageHeading: 'Domains', + minNoOfSubmissionsRequired: 1, + rootOrganisations: [], + createdFor: [], + submissionLevel: 'USER', + availableForPrivateConsumption: true, + parentEntityKey: null, + deleted: false, + programExternalId: 'Testing_for_prTGCEBGFFRYVBDFGJ7DGDGF123456', + entityType: 'school', + externalId: 'PROJ190909764HJHF123FGHHcvvbgd-1760085557008-PROJECT-SOLUTION', + name: 'Testing Project For LED IMP facilitator only', + description: 'To construct a wired car using a DPDT switch.', + isReusable: false, + startDate: new Date('2025-09-09T00:00:00.000Z'), + endDate: new Date('2026-09-09T18:29:59.000Z'), + subType: 'improvementProject', + type: 'improvementProject', + programId: new ObjectId('68e8c284201642091e0148c1'), + programName: 'custom observation as a task check on oct 10th facilitator', + programDescription: 'custom observation as a task check on oct 10th facilitator', + status: 'active', + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-10-10T08:40:22.617Z'), + createdAt: new Date('2025-10-10T08:39:17.519Z'), + __v: 0, + scope: { + professional_role: ['68876746b19aea00144c2af9'], + professional_subroles: ['688767deb19aea00144c2b08'], + organizations: ['default_code'], + state: ['6852c86c7248c20014b38a4d'], + district: ['6852c8ae7248c20014b38a57'], + block: ['ALL'], + cluster: ['ALL'], + school: ['ALL'], + }, + projectTemplateId: new ObjectId('68e8c635201642091e01491c'), + updatedBy: '1', + author: '1', + creator: 'Mallanagouda', + certificateTemplateId: new ObjectId('68e8c676201642091e014943'), + link: '178ac1fdff5b367ef3335ce0e1665a6c', + }, + { + _id: new ObjectId('68c98d9538aee0086ee61096'), + resourceType: ['Improvement Project Solution'], + language: ['English'], + keywords: ['Improvement Project'], + concepts: [], + themes: [], + flattenedThemes: [], + entities: [], + registry: [], + isRubricDriven: false, + enableQuestionReadOut: false, + captureGpsLocationAtQuestionLevel: false, + isAPrivateProgram: false, + allowMultipleAssessemts: false, + isDeleted: false, + pageHeading: 'Domains', + minNoOfSubmissionsRequired: 1, + rootOrganisations: [], + createdFor: [], + submissionLevel: 'USER', + availableForPrivateConsumption: true, + parentEntityKey: null, + deleted: false, + programExternalId: 'ProgramTestKey1', + entityType: 'school', + externalId: 'ProjectIdtestKey1-1758039445176-PROJECT-SOLUTION', + name: 'Project name sep 16 9 30', + description: + 'Gathers insights from teachers regarding available resources, training needs, and challenges faced in classrooms.', + isReusable: false, + startDate: new Date('2025-07-29T18:30:00.000Z'), + endDate: new Date('2026-01-30T18:29:59.000Z'), + subType: 'improvementProject', + type: 'improvementProject', + programId: new ObjectId('68c98d8f38aee0086ee61070'), + programName: 'Program name is sep 16 9 30', + programDescription: 'Description of the Program', + status: 'active', + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-09-16T16:17:25.599Z'), + createdAt: new Date('2025-09-16T16:17:25.472Z'), + __v: 0, + scope: { + professional_role: ['ALL'], + professional_subroles: ['ALL'], + organizations: ['default_code'], + state: ['ALL'], + district: ['ALL'], + block: ['ALL'], + cluster: ['ALL'], + school: ['ALL'], + }, + projectTemplateId: new ObjectId('68c98d9538aee0086ee6109e'), + }, + { + _id: new ObjectId('68d3b9a72ba17cc3cb238821'), + resourceType: ['Improvement Project Solution'], + language: ['English'], + keywords: ['Improvement Project'], + concepts: [], + themes: [], + flattenedThemes: [], + entities: [], + registry: [], + isRubricDriven: false, + enableQuestionReadOut: false, + captureGpsLocationAtQuestionLevel: false, + isAPrivateProgram: false, + allowMultipleAssessemts: false, + isDeleted: false, + pageHeading: 'Domains', + minNoOfSubmissionsRequired: 1, + rootOrganisations: [], + createdFor: [], + submissionLevel: 'USER', + availableForPrivateConsumption: true, + parentEntityKey: null, + deleted: false, + programExternalId: 'SUP_as_a_task_test_sept_24_1500', + entityType: 'school', + externalId: 'DPDTSCH012025-1758706081315-PROJECT-SOLUTION', + name: 'project sup test with obs or sur tasks sep 23 1520', + description: 'To construct a wired car using a DPDT switch.', + isReusable: false, + startDate: new Date('2025-07-29T18:30:00.000Z'), + endDate: new Date('2025-12-30T18:29:59.000Z'), + subType: 'improvementProject', + type: 'improvementProject', + programId: new ObjectId('68d3b9681e09f9b5b1e0693d'), + programName: 'SUP_as_a_task_test_sept_24_1500', + programDescription: 'This is the description of the program.', + status: 'active', + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-09-24T09:28:19.783Z'), + createdAt: new Date('2025-09-24T09:28:07.900Z'), + __v: 0, + scope: { + professional_role: ['ALL'], + professional_subroles: ['688767deb19aea00144c2b08'], + organizations: ['default_code'], + state: ['ALL'], + district: ['ALL', '6852c8ae7248c20014b38a57'], + block: ['ALL'], + cluster: ['ALL'], + school: ['ALL'], + }, + projectTemplateId: new ObjectId('68d3b9a92ba17cc3cb238829'), + updatedBy: '1', + author: '1', + creator: 'Mallanagouda', + link: 'a0acc357edbcf3287e9767d20a7d9f12', + }, +] + +let programData = [ + { + _id: new ObjectId('68ee4b79fb9bee08b93b6d34'), + resourceType: ['program'], + language: ['English'], + keywords: ['CBSE', 'SQAA'], + concepts: [], + components: [ + { + _id: new ObjectId('68ee4bb3fb9bee08b93b6d68'), + order: 1, + }, + ], + isAPrivateProgram: false, + isDeleted: false, + requestForPIIConsent: true, + rootOrganisations: [], + createdFor: [], + deleted: false, + status: 'active', + owner: '1', + createdBy: '1', + updatedBy: '1', + externalId: 'Testing_for_prTGCEBGFFRYVBDFGJ7DGDGF12SDFGHJ345CVBNMDRGYY', + name: 'custom observation as a task check on oct 14th facilitator', + description: 'custom observation as a task check on oct 14th facilitator', + startDate: new Date('2025-09-08T18:30:00.000Z'), + endDate: new Date('2026-09-09T18:29:59.000Z'), + imageCompression: { + quality: 10, + }, + metaInformation: { + state: ['Tripura'], + recommendedFor: ['Facilitator'], + }, + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-10-14T13:18:46.936Z'), + createdAt: new Date('2025-10-14T13:09:13.649Z'), + __v: 0, + scope: { + professional_role: ['68876746b19aea00144c2af9'], + professional_subroles: ['688767deb19aea00144c2b08'], + organizations: ['default_code'], + state: ['6852c86c7248c20014b38a4d'], + district: ['6852c8ae7248c20014b38a57'], + block: ['ALL'], + cluster: ['ALL'], + school: ['ALL'], + }, + }, + { + _id: new ObjectId('68e8c284201642091e0148c1'), + resourceType: ['program'], + language: ['English'], + keywords: ['CBSE', 'SQAA'], + concepts: [], + components: [ + { + _id: new ObjectId('68e8c635201642091e014914'), + order: 1, + }, + ], + isAPrivateProgram: false, + isDeleted: false, + requestForPIIConsent: true, + rootOrganisations: [], + createdFor: [], + deleted: false, + status: 'active', + owner: '1', + createdBy: '1', + updatedBy: '1', + externalId: 'Testing_for_prTGCEBGFFRYVBDFGJ7DGDGF123456', + name: 'custom observation as a task check on oct 10th facilitator', + description: 'custom observation as a task check on oct 10th facilitator', + startDate: new Date('2025-09-08T18:30:00.000Z'), + endDate: new Date('2026-09-09T18:29:59.000Z'), + imageCompression: { + quality: 10, + }, + metaInformation: { + state: ['Tripura'], + recommendedFor: ['Facilitator'], + }, + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-10-10T08:44:35.535Z'), + createdAt: new Date('2025-10-10T08:23:32.295Z'), + __v: 0, + scope: { + professional_role: ['68876746b19aea00144c2af9'], + professional_subroles: ['688767deb19aea00144c2b08'], + organizations: ['default_code'], + state: ['6852c86c7248c20014b38a4d'], + district: ['6852c8ae7248c20014b38a57'], + block: ['ALL'], + cluster: ['ALL'], + school: ['ALL'], + }, + }, + { + _id: new ObjectId('68c98d8f38aee0086ee61070'), + resourceType: ['program'], + language: ['English'], + keywords: [], + concepts: [], + components: [ + { + _id: new ObjectId('68c98d9538aee0086ee61096'), + order: 1, + }, + ], + isAPrivateProgram: false, + isDeleted: false, + requestForPIIConsent: true, + rootOrganisations: [], + createdFor: [], + deleted: false, + status: 'active', + owner: '1', + createdBy: '1', + updatedBy: '1', + externalId: 'ProgramTestKey1', + name: 'Program name is sep 16 9 30', + description: 'Description of the Program', + metaInformation: { + state: ['Tripura'], + recommendedFor: ['functionaries-officials', 'teacher-educators-coordinators'], + }, + imageCompression: { + quality: 10, + }, + startDate: new Date('2025-07-29T18:30:00.000Z'), + endDate: new Date('2026-01-30T18:29:59.000Z'), + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-09-16T17:06:14.752Z'), + createdAt: new Date('2025-09-16T16:17:19.239Z'), + __v: 0, + scope: { + professional_role: ['68876746b19aea00144c2af9'], + professional_subroles: ['688767deb19aea00144c2b08'], + organizations: ['default_code'], + state: ['6852c86c7248c20014b38a4d'], + district: ['6852c8ae7248c20014b38a57'], + block: ['ALL'], + cluster: ['ALL'], + school: ['ALL'], + }, + }, + { + _id: new ObjectId('68d3b9681e09f9b5b1e0693d'), + resourceType: ['program'], + language: ['English'], + keywords: [], + concepts: [], + components: [ + { + _id: new ObjectId('68d3b9a72ba17cc3cb238821'), + order: 1, + }, + ], + isAPrivateProgram: false, + isDeleted: false, + requestForPIIConsent: true, + rootOrganisations: [], + createdFor: [], + deleted: false, + status: 'active', + owner: '1', + createdBy: '1', + updatedBy: '1', + externalId: 'SUP_as_a_task_test_sept_24_1500', + name: 'SUP_as_a_task_test_sept_24_1500 oct 3', + description: 'This is the description of the program.', + metaInformation: { + state: ['Tripura'], + recommendedFor: ['functionaries-officials'], + }, + imageCompression: { + quality: 10, + }, + startDate: new Date('2025-07-29T18:30:00.000Z'), + endDate: new Date('2025-12-30T18:29:59.000Z'), + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-10-03T09:20:39.907Z'), + createdAt: new Date('2025-09-24T09:27:04.322Z'), + __v: 0, + scope: { + professional_role: ['68876746b19aea00144c2af9'], + professional_subroles: ['688767deb19aea00144c2b08'], + organizations: ['default_code'], + state: ['6852c86c7248c20014b38a4d'], + district: ['6852c8ae7248c20014b38a57'], + block: ['ALL'], + cluster: ['ALL'], + school: ['ALL'], + }, + }, +] + +let projectTemplatesData = [ + { + _id: new ObjectId('68ee4bb3fb9bee08b93b6d70'), + description: 'To construct a wired car using a DPDT switch.', + concepts: [''], + keywords: ['Science, Activity Based Learning, STEM Education, STEM Lab, DPDT Switch Car'], + isDeleted: false, + recommendedFor: ['Learner'], + tasks: [ + new ObjectId('68ee4bb4fb9bee08b93b6d7a'), + new ObjectId('68ee4bb4fb9bee08b93b6d7e'), + new ObjectId('68ee4bb4fb9bee08b93b6d82'), + new ObjectId('68ee4bb4fb9bee08b93b6d86'), + ], + createdBy: '1', + updatedBy: '1', + learningResources: [], + isReusable: false, + taskSequence: [ + 'DPDTSC-HandBook-1-2025-Task2-1760447411369-1760447412188', + 'DPDTSC-HandBook-1-2025-Task3-1760447411369-1760447412197', + 'DPDTSC-HandBook-1-2025-Task4-1760447411369-1760447412206', + 'DPDTSC-HandBook-1-2025-Task5-1760447411369-1760447412214', + ], + averageRating: 0, + noOfRatings: 0, + ratings: { + 1: 0, + 2: 0, + 3: 0, + 4: 0, + 5: 0, + }, + importCount: 0, + evidences: [], + isPrivate: false, + hasSpotlight: false, + hasStory: false, + text: [], + visibility: 'CURRENT', + visibleToOrganizations: ['default_code'], + deleted: false, + title: 'pro with obsasatask oct 8 facilitator only 2nd', + externalId: 'PROJ19099023DGHG789SDASDFGHR4567-1760447411369_IMPORTED', + categories: [ + { + _id: new ObjectId('685ae6a0cb7c7200145dadae'), + externalId: 'teachers', + name: 'teachers', + }, + ], + entityType: '', + taskCreationForm: '', + durationInDays: 365, + metaInformation: { + testimonials: [], + goal: 'TEMP', + rationale: '', + primaryAudience: '', + duration: '1 year', + successIndicators: '', + risks: '', + approaches: '', + }, + status: 'published', + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-10-14T13:11:17.899Z'), + createdAt: new Date('2025-10-14T13:10:11.630Z'), + __v: 0, + solutionId: new ObjectId('68ee4bb3fb9bee08b93b6d68'), + solutionExternalId: 'PROJ19099023DGHG789SDASDFGHR4567-1760447411369-PROJECT-SOLUTION', + programId: new ObjectId('68ee4b79fb9bee08b93b6d34'), + programExternalId: 'Testing_for_prTGCEBGFFRYVBDFGJ7DGDGF12SDFGHJ345CVBNMDRGYY', + parentTemplateId: new ObjectId('68ee4bb3fb9bee08b93b6d4c'), + certificateTemplateId: new ObjectId('68ee4bf5fb9bee08b93b6d97'), + }, + { + _id: new ObjectId('68e8c635201642091e01491c'), + description: 'To construct a wired car using a DPDT switch.', + concepts: [''], + keywords: ['Science, Activity Based Learning, STEM Education, STEM Lab, DPDT Switch Car'], + isDeleted: false, + recommendedFor: ['Learner'], + tasks: [ + new ObjectId('68e8c635201642091e014926'), + new ObjectId('68e8c635201642091e01492a'), + new ObjectId('68e8c635201642091e01492e'), + new ObjectId('68e8c635201642091e014932'), + ], + createdBy: '1', + updatedBy: '1', + learningResources: [], + isReusable: false, + taskSequence: [ + 'DPDTSC-HandBook-1-2025-Task2-1760085557008-1760085557809', + 'DPDTSC-HandBook-1-2025-Task3-1760085557008-1760085557818', + 'DPDTSC-HandBook-1-2025-Task4-1760085557008-1760085557827', + 'DPDTSC-HandBook-1-2025-Task5-1760085557008-1760085557835', + ], + averageRating: 0, + noOfRatings: 0, + ratings: { + 1: 0, + 2: 0, + 3: 0, + 4: 0, + 5: 0, + }, + importCount: 0, + evidences: [], + isPrivate: false, + hasSpotlight: false, + hasStory: false, + text: [], + visibility: 'CURRENT', + visibleToOrganizations: ['default_code'], + deleted: false, + title: 'Testing Project For LED IMP facilitator only', + externalId: 'PROJ190909764HJHF123FGHHcvvbgd-1760085557008_IMPORTED', + categories: [ + { + _id: new ObjectId('685ae6a0cb7c7200145dadae'), + externalId: 'teachers', + name: 'teachers', + }, + ], + entityType: '', + taskCreationForm: '', + durationInDays: 365, + metaInformation: { + testimonials: [], + goal: 'TEMP', + rationale: '', + primaryAudience: '', + duration: '1 year', + successIndicators: '', + risks: '', + approaches: '', + }, + status: 'published', + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-10-10T08:40:22.544Z'), + createdAt: new Date('2025-10-10T08:39:17.260Z'), + __v: 0, + solutionId: new ObjectId('68e8c635201642091e014914'), + solutionExternalId: 'PROJ190909764HJHF123FGHHcvvbgd-1760085557008-PROJECT-SOLUTION', + programId: new ObjectId('68e8c284201642091e0148c1'), + programExternalId: 'Testing_for_prTGCEBGFFRYVBDFGJ7DGDGF123456', + parentTemplateId: new ObjectId('68e8c635201642091e0148f8'), + certificateTemplateId: new ObjectId('68e8c676201642091e014943'), + }, + { + _id: new ObjectId('68c98d9538aee0086ee6109e'), + description: + 'Gathers insights from teachers regarding available resources, training needs, and challenges faced in classrooms.', + concepts: [''], + keywords: ['Science, Activity Based Learning, STEM Education, STEM Lab, DPDT Switch Car'], + isDeleted: false, + recommendedFor: [''], + tasks: [ + new ObjectId('68c98d9538aee0086ee610a2'), + new ObjectId('68c98d9538aee0086ee610a6'), + new ObjectId('68c98d9538aee0086ee610aa'), + ], + createdBy: '1', + updatedBy: '1', + learningResources: [], + isReusable: false, + taskSequence: [ + 'Task1-1758039445176-1758039445561', + 'Task2-1758039445176-1758039445567', + 'Task3-1758039445176-1758039445575', + ], + averageRating: 0, + noOfRatings: 0, + ratings: { + 1: 0, + 2: 0, + 3: 0, + 4: 0, + 5: 0, + }, + importCount: 0, + evidences: [], + isPrivate: false, + hasSpotlight: false, + hasStory: false, + text: [], + deleted: false, + title: 'Project name sep 16 9 30', + externalId: 'ProjectIdtestKey1-1758039445176_IMPORTED', + categories: [ + { + _id: new ObjectId('685ae6a0cb7c7200145dadae'), + externalId: 'teachers', + name: 'teachers', + }, + ], + entityType: '', + taskCreationForm: '', + durationInDays: 365, + metaInformation: { + testimonials: [], + goal: 'TEMP', + rationale: '', + primaryAudience: '', + duration: '1 year', + successIndicators: '', + risks: '', + approaches: '', + }, + status: 'published', + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-09-16T16:17:25.596Z'), + createdAt: new Date('2025-09-16T16:17:25.301Z'), + __v: 0, + solutionId: new ObjectId('68c98d9538aee0086ee61096'), + solutionExternalId: 'ProjectIdtestKey1-1758039445176-PROJECT-SOLUTION', + programId: new ObjectId('68c98d8f38aee0086ee61070'), + programExternalId: 'ProgramTestKey1', + parentTemplateId: new ObjectId('68c98d9538aee0086ee6107a'), + }, + { + _id: new ObjectId('68d3b9a92ba17cc3cb238829'), + description: 'To construct a wired car using a DPDT switch.', + concepts: [''], + keywords: ['Science, Activity Based Learning, STEM Education, STEM Lab, DPDT Switch Car'], + isDeleted: false, + recommendedFor: ['Learner'], + tasks: [ + new ObjectId('68d3b9ad2ba17cc3cb238837'), + new ObjectId('68d3b9ad2ba17cc3cb23883b'), + new ObjectId('68d3b9ae2ba17cc3cb23883f'), + ], + createdBy: '1', + updatedBy: '1', + learningResources: [], + isReusable: false, + taskSequence: [ + 'DPDTSC-HandBook-1/2025-Task3-1758706081315-1758706093343', + 'DPDTSC-HandBook-1/2025-Task4-1758706081315-1758706093849', + 'DPDTSC-HandBook-1/2025-Task5-1758706081315-1758706094241', + ], + averageRating: 0, + noOfRatings: 0, + ratings: { + 1: 0, + 2: 0, + 3: 0, + 4: 0, + 5: 0, + }, + importCount: 0, + evidences: [], + isPrivate: false, + hasSpotlight: false, + hasStory: false, + text: [], + deleted: false, + title: 'project sup test with obs or sur tasks sep 23 1520', + externalId: 'DPDTSCH012025-1758706081315_IMPORTED', + categories: [ + { + _id: new ObjectId('685ae6a0cb7c7200145dadae'), + externalId: 'teachers', + name: 'teachers', + }, + ], + entityType: '', + taskCreationForm: '', + durationInDays: 365, + metaInformation: { + testimonials: [], + goal: 'TEMP', + rationale: '', + primaryAudience: '', + duration: '1 year', + successIndicators: '', + risks: '', + approaches: '', + }, + status: 'published', + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-09-24T09:28:14.561Z'), + createdAt: new Date('2025-09-24T09:28:03.404Z'), + __v: 0, + solutionId: new ObjectId('68d3b9a72ba17cc3cb238821'), + solutionExternalId: 'DPDTSCH012025-1758706081315-PROJECT-SOLUTION', + programId: new ObjectId('68d3b9681e09f9b5b1e0693d'), + programExternalId: 'SUP_as_a_task_test_sept_24_1500', + parentTemplateId: new ObjectId('68d3b9a32ba17cc3cb238805'), + }, +] + +let projectTemplateTasksData = [ + { + _id: new ObjectId('68ee4bb4fb9bee08b93b6d7a'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [ + { + name: 'Activity Steps (Video)', + link: 'https://youtu.be/MNvM_H9zD3Y?si=BdfslSzCkmDCggih', + app: 'projectService', + id: 'MNvM_H9zD3Y?si=BdfslSzCkmDCggih', + }, + ], + deleted: false, + type: 'content', + projectTemplateId: new ObjectId('68ee4bb3fb9bee08b93b6d70'), + projectTemplateExternalId: 'PROJ19099023DGHG789SDASDFGHR4567-1760447411369_IMPORTED', + name: 'Watch the Activity Video', + externalId: 'DPDTSC-HandBook-1-2025-Task2-1760447411369-1760447412188', + description: '', + sequenceNumber: '2', + tenantId: 'default', + orgId: 'default_code', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '01/08/2025', + endDate: '31/12/2025', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-10-14T13:10:12.192Z'), + createdAt: new Date('2025-10-14T13:10:11.805Z'), + __v: 0, + }, + { + _id: new ObjectId('68ee4bb4fb9bee08b93b6d7e'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [], + deleted: false, + type: 'simple', + projectTemplateId: new ObjectId('68ee4bb3fb9bee08b93b6d70'), + projectTemplateExternalId: 'PROJ19099023DGHG789SDASDFGHR4567-1760447411369_IMPORTED', + name: 'Conduct the Activity with students', + externalId: 'DPDTSC-HandBook-1-2025-Task3-1760447411369-1760447412197', + description: '', + sequenceNumber: '3', + tenantId: 'default', + orgId: 'default_code', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '01/08/2025', + endDate: '31/12/2025', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-10-14T13:10:12.202Z'), + createdAt: new Date('2025-10-14T13:10:11.813Z'), + __v: 0, + }, + { + _id: new ObjectId('68ee4bb4fb9bee08b93b6d82'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [ + { + name: 'learn', + link: 'https://drive.google.com/file/d/1HOaFxlahxEzc5HOeFqVTw3V_yszmHFbZ/view?usp=drive_link', + app: 'projectService', + id: 'view?usp=drive_link', + }, + ], + deleted: false, + type: 'content', + projectTemplateId: new ObjectId('68ee4bb3fb9bee08b93b6d70'), + projectTemplateExternalId: 'PROJ19099023DGHG789SDASDFGHR4567-1760447411369_IMPORTED', + name: 'Conduct the Activity Assessment', + externalId: 'DPDTSC-HandBook-1-2025-Task4-1760447411369-1760447412206', + description: '', + sequenceNumber: '4', + tenantId: 'default', + orgId: 'default_code', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '01/08/2025', + endDate: '31/12/2025', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-10-14T13:10:12.210Z'), + createdAt: new Date('2025-10-14T13:10:11.825Z'), + __v: 0, + }, + { + _id: new ObjectId('68ee4bb4fb9bee08b93b6d86'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [ + { + name: 'walking', + link: 'https://drive.google.com/file/d/1eGLKxFb9BaeroTeIOlXoO8XCxyah7fM9/view?usp=sharing', + app: 'projectService', + id: 'view?usp=sharing', + }, + ], + deleted: false, + type: 'content', + projectTemplateId: new ObjectId('68ee4bb3fb9bee08b93b6d70'), + projectTemplateExternalId: 'PROJ19099023DGHG789SDASDFGHR4567-1760447411369_IMPORTED', + name: "Log into the scanner app and scan the OMR sheets (check that the students' names are appearing on scanning the OMR)", + externalId: 'DPDTSC-HandBook-1-2025-Task5-1760447411369-1760447412214', + description: '', + sequenceNumber: '5', + tenantId: 'default', + orgId: 'default_code', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '01/08/2025', + endDate: '31/12/2025', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-10-14T13:10:12.218Z'), + createdAt: new Date('2025-10-14T13:10:11.833Z'), + __v: 0, + }, + { + _id: new ObjectId('68e8c635201642091e014926'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [ + { + name: 'Activity Steps (Video)', + link: 'https://youtu.be/MNvM_H9zD3Y?si=BdfslSzCkmDCggih', + app: 'projectService', + id: 'MNvM_H9zD3Y?si=BdfslSzCkmDCggih', + }, + ], + deleted: false, + type: 'content', + projectTemplateId: new ObjectId('68e8c635201642091e01491c'), + projectTemplateExternalId: 'PROJ190909764HJHF123FGHHcvvbgd-1760085557008_IMPORTED', + name: 'Watch the Activity Video', + externalId: 'DPDTSC-HandBook-1-2025-Task2-1760085557008-1760085557809', + description: '', + sequenceNumber: '2', + tenantId: 'default', + orgId: 'default_code', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '01/08/2026', + endDate: '31/12/2026', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-10-10T08:39:17.813Z'), + createdAt: new Date('2025-10-10T08:39:17.430Z'), + __v: 0, + }, + { + _id: new ObjectId('68e8c635201642091e01492a'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [], + deleted: false, + type: 'simple', + projectTemplateId: new ObjectId('68e8c635201642091e01491c'), + projectTemplateExternalId: 'PROJ190909764HJHF123FGHHcvvbgd-1760085557008_IMPORTED', + name: 'Conduct the Activity with students', + externalId: 'DPDTSC-HandBook-1-2025-Task3-1760085557008-1760085557818', + description: '', + sequenceNumber: '3', + tenantId: 'default', + orgId: 'default_code', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '01/08/2027', + endDate: '31/12/2027', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-10-10T08:39:17.822Z'), + createdAt: new Date('2025-10-10T08:39:17.439Z'), + __v: 0, + }, + { + _id: new ObjectId('68e8c635201642091e01492e'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [ + { + name: 'learn', + link: 'https://drive.google.com/file/d/1HOaFxlahxEzc5HOeFqVTw3V_yszmHFbZ/view?usp=drive_link', + app: 'projectService', + id: 'view?usp=drive_link', + }, + ], + deleted: false, + type: 'content', + projectTemplateId: new ObjectId('68e8c635201642091e01491c'), + projectTemplateExternalId: 'PROJ190909764HJHF123FGHHcvvbgd-1760085557008_IMPORTED', + name: 'Conduct the Activity Assessment', + externalId: 'DPDTSC-HandBook-1-2025-Task4-1760085557008-1760085557827', + description: '', + sequenceNumber: '4', + tenantId: 'default', + orgId: 'default_code', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '01/08/2028', + endDate: '31/12/2028', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-10-10T08:39:17.831Z'), + createdAt: new Date('2025-10-10T08:39:17.449Z'), + __v: 0, + }, + { + _id: new ObjectId('68e8c635201642091e014932'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [ + { + name: 'walking', + link: 'https://drive.google.com/file/d/1eGLKxFb9BaeroTeIOlXoO8XCxyah7fM9/view?usp=sharing', + app: 'projectService', + id: 'view?usp=sharing', + }, + ], + deleted: false, + type: 'content', + projectTemplateId: new ObjectId('68e8c635201642091e01491c'), + projectTemplateExternalId: 'PROJ190909764HJHF123FGHHcvvbgd-1760085557008_IMPORTED', + name: "Log into the scanner app and scan the OMR sheets (check that the students' names are appearing on scanning the OMR)", + externalId: 'DPDTSC-HandBook-1-2025-Task5-1760085557008-1760085557835', + description: '', + sequenceNumber: '5', + tenantId: 'default', + orgId: 'default_code', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '01/08/2029', + endDate: '31/12/2029', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-10-10T08:39:17.840Z'), + createdAt: new Date('2025-10-10T08:39:17.458Z'), + __v: 0, + }, + { + _id: new ObjectId('68c98d9538aee0086ee610a2'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [ + { + name: 'Activity Manual (PDF)', + link: 'https://docs.google.com/document/d/1NCUdj9nPAz82sPV5q2BJ8At31sFJdSDwocrDCh_g7W0/edit?tab=t.0', + app: 'projectService', + id: 'edit?tab=t.0', + }, + ], + deleted: false, + type: 'content', + projectTemplateId: new ObjectId('68c98d9538aee0086ee6109e'), + projectTemplateExternalId: 'ProjectIdtestKey1-1758039445176_IMPORTED', + name: 'Review the Activity Manual', + externalId: 'Task1-1758039445176-1758039445561', + description: '', + sequenceNumber: '1', + tenantId: 'default', + orgId: 'default_code', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '28/07/2025', + endDate: '30/01/2026', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-09-16T16:17:25.564Z'), + createdAt: new Date('2025-09-16T16:17:25.375Z'), + __v: 0, + }, + { + _id: new ObjectId('68c98d9538aee0086ee610a6'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [ + { + name: 'Activity Steps (Video)', + link: 'https://youtu.be/MNvM_H9zD3Y?si=BdfslSzCkmDCggih', + app: 'projectService', + id: 'MNvM_H9zD3Y?si=BdfslSzCkmDCggih', + }, + ], + deleted: false, + type: 'content', + projectTemplateId: new ObjectId('68c98d9538aee0086ee6109e'), + projectTemplateExternalId: 'ProjectIdtestKey1-1758039445176_IMPORTED', + name: 'Watch the Activity Video', + externalId: 'Task2-1758039445176-1758039445567', + description: '', + sequenceNumber: '2', + tenantId: 'default', + orgId: 'default_code', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '29/07/2025', + endDate: '30/01/2027', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-09-16T16:17:25.571Z'), + createdAt: new Date('2025-09-16T16:17:25.386Z'), + __v: 0, + }, + { + _id: new ObjectId('68c98d9538aee0086ee610aa'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [], + deleted: false, + type: 'simple', + projectTemplateId: new ObjectId('68c98d9538aee0086ee6109e'), + projectTemplateExternalId: 'ProjectIdtestKey1-1758039445176_IMPORTED', + name: 'Conduct the Activity with students', + externalId: 'Task3-1758039445176-1758039445575', + description: '', + sequenceNumber: '3', + tenantId: 'default', + orgId: 'default_code', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '30/07/2025', + endDate: '30/01/2028', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-09-16T16:17:25.579Z'), + createdAt: new Date('2025-09-16T16:17:25.396Z'), + __v: 0, + }, + { + _id: new ObjectId('68d3b9ad2ba17cc3cb238837'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [], + deleted: false, + type: 'simple', + projectTemplateId: new ObjectId('68d3b9a92ba17cc3cb238829'), + projectTemplateExternalId: 'DPDTSCH012025-1758706081315_IMPORTED', + name: 'Conduct the Activity with students', + externalId: 'DPDTSC-HandBook-1/2025-Task3-1758706081315-1758706093343', + description: '', + sequenceNumber: '3', + tenantId: 'default', + orgId: 'default_code', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '30/07/2025', + endDate: '30/12/2025', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-09-24T09:28:13.534Z'), + createdAt: new Date('2025-09-24T09:28:06.227Z'), + __v: 0, + }, + { + _id: new ObjectId('68d3b9ad2ba17cc3cb23883b'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [ + { + name: 'Activity Assessment (PDF)', + link: 'https://sunbirdsaaspublic.blob.core.windows.net/content/content/assets/do_2143687931908833281255/dpdt-switch-car.pdf', + app: 'projectService', + id: 'dpdt-switch-car.pdf', + }, + { + name: 'Activity OMR Sheet (PDF)', + link: 'https://drive.google.com/file/d/1-f7Tg8bmZd-xlcxlhfOcf2ZO6vpc6qkH/view', + app: 'projectService', + id: 'view', + }, + ], + deleted: false, + type: 'content', + projectTemplateId: new ObjectId('68d3b9a92ba17cc3cb238829'), + projectTemplateExternalId: 'DPDTSCH012025-1758706081315_IMPORTED', + name: 'Conduct the Activity Assessment', + externalId: 'DPDTSC-HandBook-1/2025-Task4-1758706081315-1758706093849', + description: '', + sequenceNumber: '4', + tenantId: 'default', + orgId: 'default_code', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '30/07/2025', + endDate: '30/12/2025', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-09-24T09:28:13.967Z'), + createdAt: new Date('2025-09-24T09:28:06.583Z'), + __v: 0, + }, + { + _id: new ObjectId('68d3b9ae2ba17cc3cb23883f'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [], + deleted: false, + type: 'simple', + projectTemplateId: new ObjectId('68d3b9a92ba17cc3cb238829'), + projectTemplateExternalId: 'DPDTSCH012025-1758706081315_IMPORTED', + name: "Log into the scanner app and scan the OMR sheets (check that the students' names are appearing on scanning the OMR)", + externalId: 'DPDTSC-HandBook-1/2025-Task5-1758706081315-1758706094241', + description: '', + sequenceNumber: '5', + tenantId: 'default', + orgId: 'default_code', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '30/07/2025', + endDate: '30/12/2025', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-09-24T09:28:14.374Z'), + createdAt: new Date('2025-09-24T09:28:07.083Z'), + __v: 0, + }, +] + +let certificateTemplatesData = [ + { + _id: new ObjectId('68ee4bf5fb9bee08b93b6d97'), + status: 'active', + deleted: false, + criteria: { + validationText: 'Complete validation message', + expression: 'C1&&(C3||C4||C5||C6)', + conditions: { + C1: { + validationText: 'Submit your project.', + expression: 'C1', + conditions: { + C1: { + scope: 'project', + key: 'status', + operator: '==', + value: 'submitted', + }, + }, + }, + C3: { + expression: 'C1', + conditions: { + C1: { + scope: 'task', + key: 'attachments', + function: 'count', + filter: { + key: 'type', + value: 'all', + }, + operator: '>=', + value: 2, + taskDetails: ['68ee4bb3fb9bee08b93b6d53'], + }, + }, + validationText: 'Add 2 evidence for any task', + }, + C4: { + expression: 'C1', + conditions: { + C1: { + scope: 'task', + key: 'attachments', + function: 'count', + filter: { + key: 'type', + value: 'all', + }, + operator: '>=', + value: 2, + taskDetails: ['68ee4bb3fb9bee08b93b6d57'], + }, + }, + }, + C5: { + expression: 'C1', + conditions: { + C1: { + scope: 'task', + key: 'attachments', + function: 'count', + filter: { + key: 'type', + value: 'all', + }, + operator: '>=', + value: 2, + taskDetails: ['68ee4bb3fb9bee08b93b6d5b'], + }, + }, + }, + C6: { + expression: 'C1', + conditions: { + C1: { + scope: 'task', + key: 'attachments', + function: 'count', + filter: { + key: 'type', + value: 'all', + }, + operator: '>=', + value: 2, + taskDetails: ['68ee4bb3fb9bee08b93b6d63'], + }, + }, + }, + }, + }, + issuer: { + name: 'default_code', + }, + solutionId: new ObjectId('68ee4bb3fb9bee08b93b6d68'), + programId: new ObjectId('68ee4b79fb9bee08b93b6d34'), + baseTemplateId: new ObjectId('68c008dfd113c30c11f1aca2'), + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-10-14T13:11:17.793Z'), + createdAt: new Date('2025-10-14T13:11:17.628Z'), + __v: 0, + templateUrl: + 'certificate/aa8529e3-6754-4432-a669-72b73d358e2f/1/7042c718-a1bf-43e3-b296-586de247a440/68ee4bf5fb9bee08b93b6d97/14-9-2025-1760447477692_Dowloaded.svg', + }, + { + _id: new ObjectId('68e8c676201642091e014943'), + status: 'active', + deleted: false, + criteria: { + validationText: 'Complete validation message', + expression: 'C1&&(C3||C4||C5||C6||C7)', + conditions: { + C1: { + validationText: 'Submit your project.', + expression: 'C1', + conditions: { + C1: { + scope: 'project', + key: 'status', + operator: '==', + value: 'submitted', + }, + }, + }, + C3: { + expression: 'C1', + conditions: { + C1: { + scope: 'task', + key: 'attachments', + function: 'count', + filter: { + key: 'type', + value: 'all', + }, + operator: '>=', + value: 2, + taskDetails: ['68e8c635201642091e0148ff'], + }, + }, + validationText: 'Add 2 evidence for any task', + }, + C4: { + expression: 'C1', + conditions: { + C1: { + scope: 'task', + key: 'attachments', + function: 'count', + filter: { + key: 'type', + value: 'all', + }, + operator: '>=', + value: 2, + taskDetails: ['68e8c635201642091e014903'], + }, + }, + }, + C5: { + expression: 'C1', + conditions: { + C1: { + scope: 'task', + key: 'attachments', + function: 'count', + filter: { + key: 'type', + value: 'all', + }, + operator: '>=', + value: 2, + taskDetails: ['68e8c635201642091e014907'], + }, + }, + }, + C6: { + expression: 'C1', + conditions: { + C1: { + scope: 'task', + key: 'attachments', + function: 'count', + filter: { + key: 'type', + value: 'all', + }, + operator: '>=', + value: 2, + taskDetails: ['68e8c635201642091e01490b'], + }, + }, + }, + C7: { + expression: 'C1', + conditions: { + C1: { + scope: 'task', + key: 'attachments', + function: 'count', + filter: { + key: 'type', + value: 'all', + }, + operator: '>=', + value: 2, + taskDetails: ['68e8c635201642091e01490f'], + }, + }, + }, + }, + }, + issuer: { + name: 'default_code', + }, + solutionId: new ObjectId('68e8c635201642091e014914'), + programId: new ObjectId('68e8c284201642091e0148c1'), + baseTemplateId: new ObjectId('68c008dfd113c30c11f1aca2'), + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-10-10T08:40:22.454Z'), + createdAt: new Date('2025-10-10T08:40:22.298Z'), + __v: 0, + templateUrl: + 'certificate/0bcc856d-0145-448c-8188-300ca3f3250e/1/58cfdf3c-f1a2-4a94-bbb5-21dcd7286913/68e8c676201642091e014943/10-9-2025-1760085622353_Dowloaded.svg', + }, +] + +let certificateBaseTemplatesData = [ + { + _id: new ObjectId('68c008dfd113c30c11f1aca2'), + deleted: false, + code: 'onelogo_onesign', + name: 'onelogo_onesign', + url: 'certificate/ef2058a1-92e0-4a63-af5f-b712f992bf90/1/81fc35ad-9519-4ec4-87bb-6cef64b940f0/9-8-2025-1757415647754_sl_s1l1.svg', + tenantId: 'default', + orgId: 'slorg', + updatedAt: new Date('2025-09-09T11:00:47.878Z'), + createdAt: new Date('2025-09-09T11:00:47.878Z'), + __v: 0, + }, +] + +let projectCategoriesData = [ + { + _id: new ObjectId('685ae6a0cb7c7200145dadae'), + createdBy: 'SYSTEM', + updatedBy: 'SYSTEM', + isDeleted: false, + isVisible: true, + status: 'active', + icon: '', + noOfProjects: 361, + evidences: [], + deleted: false, + name: 'teachers', + externalId: 'teachers', + tenantId: 'default', + orgId: 'slorg', + updatedAt: new Date('2025-06-24T17:55:44.720Z'), + createdAt: new Date('2025-06-24T17:55:44.720Z'), + __v: 0, + }, +] + +let configurationData = [ + { + _id: new ObjectId('6825a1982d46aa6df0cc36a8'), + code: 'keysAllowedForTargeting', + __v: 0, + createdAt: new Date('2025-05-15T08:11:04.674Z'), + meta: { + profileKeys: [ + 'state', + 'district', + 'block', + 'cluster', + 'school', + 'professional_role', + 'professional_subroles', + 'roles', + 'subject', + 'organizations', + ], + }, + updatedAt: new Date('2025-05-26T10:56:17.021Z'), + }, +] +module.exports = { + solutionData, + programData, + projectTemplatesData, + projectTemplateTasksData, + certificateTemplatesData, + certificateBaseTemplatesData, + projectCategoriesData, + configurationData, +} diff --git a/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/replace_volume_path.sh b/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/replace_volume_path.sh new file mode 100644 index 00000000..e427fe5e --- /dev/null +++ b/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/replace_volume_path.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# Define the path of your docker-compose file +DOCKER_COMPOSE_FILE="docker-compose-project.yml" + +# Check if the Docker Compose file exists +if [ ! -f "$DOCKER_COMPOSE_FILE" ]; then + echo "Error: Docker Compose file '$DOCKER_COMPOSE_FILE' does not exist." + exit 1 +fi + +# Get the current directory path +CURRENT_DIR=$(pwd) + +# Escape the current directory path to be used in a sed expression +ESCAPED_CURRENT_DIR=$(printf '%s\n' "$CURRENT_DIR" | sed -e 's/[\/&]/\\&/g') + +# Use sed to replace the path leading up to 'env.js' in the docker-compose file +# The pattern ensures that it only replaces the path component up to ':/usr/src/app/www/assets/env/env.js' +sed -i -e "s|/[^:]*\(\/env\.js\):/usr/src/app/www/assets/env/env.js|$ESCAPED_CURRENT_DIR\1:/usr/src/app/www/assets/env/env.js|" "$DOCKER_COMPOSE_FILE" +echo "Updated volume path for 'env.js' in $DOCKER_COMPOSE_FILE" \ No newline at end of file diff --git a/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/setup_project.sh b/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/setup_project.sh new file mode 100644 index 00000000..b0e3d124 --- /dev/null +++ b/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/setup_project.sh @@ -0,0 +1,84 @@ +#!/bin/bash + +# Logging function +log() { + echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" >> setup_log.txt +} + +# Step 1: Download Docker Compose file +log "Downloading Docker Compose file..." +curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/dockerized/dockerFiles/stand-alone/docker-compose-project.yml +log "Docker Compose file downloaded." + +# Step 2: Download environment files +log "Downloading environment files..." +curl -L \ + -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/dockerized/envs/interface_env \ + -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/dockerized/envs/entity_management_env \ + -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/dockerized/envs/project_env \ + -O https://github.com/ELEVATE-Project/project-service/raw/main/documentation/1.0.0/dockerized/envs/notification_env \ + -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/dockerized/envs/scheduler_env \ + -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/dockerized/envs/user_env \ + -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/dockerized/envs/env.js +log "Environment files downloaded." + +# Step 3: Download replace_volume_path.sh script +log "Downloading replace_volume_path.sh script..." +curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/main/documentation/1.0.0/dockerized/scripts/mac-linux/replace_volume_path.sh +log "replace_volume_path.sh script downloaded." + +# Step 4: Make replace_volume_path.sh executable +log "Making replace_volume_path.sh executable..." +chmod +x replace_volume_path.sh +log "Made replace_volume_path.sh executable." + +# Step 5: Run replace_volume_path.sh script +log "Running replace_volume_path.sh script..." +./replace_volume_path.sh +log "replace_volume_path.sh script executed." + +# Step 6: Download additional scripts +log "Downloading docker-compose scripts..." +curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/docker-compose-up.sh +curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/docker-compose-down.sh +log "docker-compose scripts downloaded." + +# Step 7: Make the scripts executable +log "Making docker-compose scripts executable..." +chmod +x docker-compose-up.sh +chmod +x docker-compose-down.sh +log "Made docker-compose scripts executable." + +# Step 8: Create user directory and download SQL file +log "Creating user directory and downloading distributionColumns.sql..." +mkdir -p user && curl -o ./user/distributionColumns.sql -JL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/distribution-columns/user/distributionColumns.sql +log "User directory created and distributionColumns.sql downloaded." + +# Step 9: Download and make citus_setup.sh executable +log "Downloading citus_setup.sh..." +curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/citus_setup.sh +chmod +x citus_setup.sh + +# Install MongoDB driver (usually needed if connecting directly to MongoDB/Citus) +npm install mongodb + +# Install Mongoose (Object Data Modeling library, if the scripts use it) +npm install mongoose + +# Step 11: Download additional scripts to add data +log "Downloading sample data scripts..." +curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/entity_sampleData.js +curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/project_sampleData.js +curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/insert_sample_solutions.js +curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/insert_sample_data.sh +log "sample data scripts downloaded." + + +log "Downloading config.json file..." +curl -L https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/configFile.json -o config.json +log "config.json file is downloaded." + +# Step 13: Run docker-compose-up.sh script +log "Running docker-compose-up.sh script..." +./docker-compose-up.sh +log "docker-compose-up.sh script executed." diff --git a/documentation/3.4.0/native/envs/non-citus/notification_env b/documentation/3.4.0/native/envs/non-citus/notification_env new file mode 100644 index 00000000..419184a2 --- /dev/null +++ b/documentation/3.4.0/native/envs/non-citus/notification_env @@ -0,0 +1,14 @@ +API_DOC_URL=/api-doc +APPLICATION_BASE_URL=/notification/ +APPLICATION_ENV=development +APPLICATION_PORT=3002 +DEV_DATABASE_URL=postgres://postgres:postgres@localhost:5432/notification +DISABLE_LOG=false +ENABLE_LOG=true +ERROR_LOG_LEVEL=silly +INTERNAL_ACCESS_TOKEN=internal_access_token +KAFKA_GROUP_ID=notification +KAFKA_HOST=kafka:9092 +KAFKA_TOPIC=develop.notifications +SENDGRID_API_KEY=SG.asd9f87a9s8d7f. +SENDGRID_FROM_MAIL=no-reply@some.org \ No newline at end of file diff --git a/documentation/3.4.0/native/envs/non-citus/user_env b/documentation/3.4.0/native/envs/non-citus/user_env new file mode 100644 index 00000000..e9bc7827 --- /dev/null +++ b/documentation/3.4.0/native/envs/non-citus/user_env @@ -0,0 +1,74 @@ +ACCESS_TOKEN_EXPIRY=30m +ACCESS_TOKEN_SECRET=hsghasghjab1273JHajnbabsjdj1273981273jhajksdh8y3123yhjkah812398yhjqwe7617237yuhdhhdqwu271 +ADMIN_INVITEE_UPLOAD_EMAIL_TEMPLATE_CODE=test +ADMIN_SECRET_CODE=a98sd76fasdfasd +API_DOC_URL=/user/api-doc +APPLICATION_ENV=development +APPLICATION_HOST=localhost +APPLICATION_PORT=3001 +APP_NAME=ELEVATE-Project +AZURE_ACCOUNT_KEY=asd897gfa09sd87f09as8d +AZURE_ACCOUNT_NAME=mentoring +AWS_ACCESS_KEY_ID=adsfg98a7sdfg +AWS_BUCKET_ENDPOINT=s3.ap-south-1.amazonaws.com +AWS_BUCKET_REGION=ap-south-1 +AWS_SECRET_ACCESS_KEY=asd9786fg9a8sd/asdfg9a8sd7fg +CAPTCHA_ENABLE=false +CHANGE_PASSWORD_TEMPLATE_CODE=change_password +CLEAR_INTERNAL_CACHE=userinternal +DEFAULT_ORGANISATION_CODE=default_code +DEFAULT_ORG_ID=1 +DEFAULT_ROLE=mentee +DEFAULT_QUEUE=test +DEV_DATABASE_URL=postgres://postgres:postgres@localhost:5432/users +DISABLE_LOG=false +EMAIL_ID_ENCRYPTION_ALGORITHM=aes-256-cbc +EMAIL_ID_ENCRYPTION_IV=c9c7bd480494409071847264652f5c95 +EMAIL_ID_ENCRYPTION_KEY=eef7e009626c18724be86afa41a2620e0718561a508c61f92d7ee0377177ef7b +ENABLE_EMAIL_OTP_VERIFICATION=false +ENABLE_LOG=true +ERROR_LOG_LEVEL=silly +EVENT_ENABLE_ORG_EVENTS=true +EVENT_ORG_LISTENER_URLS=http://localhost:3567/mentoring/v1/organization/eventListener +GCP_PATH=gcp.json +GCP_PROJECT_ID=sl-dev-project +INTERNAL_ACCESS_TOKEN=internal_access_token +INTERNAL_CACHE_EXP_TIME=86400 +INVITEE_EMAIL_TEMPLATE_CODE=test +IV=09sdf8g098sdf/Q== +KAFKA_GROUP_ID=projects +KAFKA_TOPIC= +KAFKA_URL=localhost:9092 +KEY=fasd98fg9a8sydg98a7usd89fg +MENTEE_INVITATION_EMAIL_TEMPLATE_CODE=test +MENTOR_INVITATION_EMAIL_TEMPLATE_CODE=test +MENTOR_REQUEST_ACCEPTED_EMAIL_TEMPLATE_CODE=mentor_request_accepted +MENTOR_REQUEST_REJECTED_EMAIL_TEMPLATE_CODE=mentor_request_rejected +MENTORING_SERVICE_URL=http://mentoring:3000 +NOTIFICATION_KAFKA_TOPIC=develop.notifications +ORG_ADMIN_INVITATION_EMAIL_TEMPLATE_CODE=invite_org_admin +OTP_EMAIL_TEMPLATE_CODE=emailotp +OTP_EXP_TIME=86400 +PORTAL_URL=https://mentored.some.org/auth/login +RECAPTCHA_SECRET_KEY=temporary_recaptcha_secret_key +REFRESH_TOKEN_EXPIRY=7 +REFRESH_TOKEN_SECRET=as9d87fa9s87df98as7d9f87a9sd87f98as7dg987asf +REFRESH_VIEW_INTERVAL=540000 +REDIS_HOST=http://localhost:6379 +REGISTRATION_EMAIL_TEMPLATE_CODE=registration +REGISTRATION_OTP_EMAIL_TEMPLATE_CODE=registrationotp +SAMPLE_CSV_FILE_PATH=sample/bulk_user_creation.csv +SCHEDULER_SERVICE_BASE_URL= /scheduler/ +SCHEDULER_SERVICE_ERROR_REPORTING_EMAIL_ID=rakesh.k@some.com +SCHEDULER_SERVICE_HOST=http://localhost:4000 +SCHEDULER_SERVICE_URL=http://localhost:4000/jobs/scheduleJob +ALLOWED_HOST=http://localhost:8100 +CLOUD_STORAGE=GCP +CLOUD_STORAGE_ACCOUNTNAME=sl-mentoring-dev-storage@sl-dev-project.iam.gserviceaccount.com +CLOUD_STORAGE_BUCKETNAME=mentoring-dev-storage-private +CLOUD_STORAGE_BUCKET_TYPE=private +CLOUD_STORAGE_PROJECT=sl-dev-project +CLOUD_STORAGE_PROVIDER=gcloud +CLOUD_STORAGE_SECRET=qwrthgafyadady +APPLICATION_BASE_URL='/user' +PUBLIC_ASSET_BUCKETNAME=check \ No newline at end of file diff --git a/documentation/3.4.0/native/envs/stand-alone/elevate_portal_env b/documentation/3.4.0/native/envs/stand-alone/elevate_portal_env new file mode 100644 index 00000000..14b3959f --- /dev/null +++ b/documentation/3.4.0/native/envs/stand-alone/elevate_portal_env @@ -0,0 +1,48 @@ +AUTH_API_TOKEN= "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJPc3NtSUhXaW1NMDN2MUxsVnFvNHBqaS0ydEMwTGhLY0o5dmtwQTlJZV9zIn0.eyJleHAiOjE3MzI4NjE5ODcsImlhdCI6MTczMjc3NTU4NywianRpIjoiOTM5NWM4N2QtOTliYy00YTRkLWIyNTUtNDQ4NjFhYTBjYWE2IiwiaXNzIjoiaHR0cHM6Ly9xYS5wcmF0aGFtdGVhY2hlcmFwcC50ZWtkaW5leHQuY29tL2F1dGgvcmVhbG1zL3ByYXRoYW0iLCJhdWQiOiJhY2NvdW50Iiwic3ViIjoiY2IwN2RlNjItZWM0Yy00YmRlLWI5YjYtOWIwZjM3OWMwMTExIiwidHlwIjoiQmVhcmVyIiwiYXpwIjoicHJhdGhhbSIsInNlc3Npb25fc3RhdGUiOiI2MzQ0ZWZjNS05NmUwLTQyNzYtYjViYi1hNTcyMGI0YzVmYjkiLCJhY3IiOiIxIiwiYWxsb3dlZC1vcmlnaW5zIjpbIi8qIl0sInJlYWxtX2FjY2VzcyI6eyJyb2xlcyI6WyJvZmZsaW5lX2FjY2VzcyIsInVtYV9hdXRob3JpemF0aW9uIiwiZGVmYXVsdC1yb2xlcy1wcmF0aGFtIl19LCJyZXNvdXJjZV9hY2Nlc3MiOnsiYWNjb3VudCI6eyJyb2xlcyI6WyJtYW5hZ2UtYWNjb3VudCIsIm1hbmFnZS1hY2NvdW50LWxpbmtzIiwidmlldy1wcm9maWxlIl19fSwic2NvcGUiOiJlbWFpbCBwcm9maWxlIiwic2lkIjoiNjM0NGVmYzUtOTZlMC00Mjc2LWI1YmItYTU3MjBiNGM1ZmI5IiwiZW1haWxfdmVyaWZpZWQiOmZhbHNlLCJuYW1lIjoiUmFqbmlzaCIsInByZWZlcnJlZF91c2VybmFtZSI6InJham5pc2g5ODc2MSIsImdpdmVuX25hbWUiOiJSYWpuaXNoIiwiZmFtaWx5X25hbWUiOiIifQ.OpTwdzG8sWhVK_VY6iAYy1klR2cfSLn2gYCqgnu9FJi4zTjPY-B0d8F--cEPVGZ4HdJiSZnGvfOgalICPKxthG-HfYR-cwznGWJVfte4HsvL5UbteOq5KDT3lsyzUkScgQ0bTKztSsePdhU2ctAGXv52DtPK8u7xWkKD6GYDeQCIHJlFS2JgR9v50d6Mva-stvtDRS7LEFgoes1hKQ0_k_C-5g1w7Rh084XJQC7tPmczap_Q-RqI-jkJZvUl_cAJK6NppZArSFA0AePkY-0_pZKBx82nBJbho2IETMIa7KzvnhdRCtjP0ynoTY-YJ4eL3jYhmIJ5DzWj3FpOZkrpSw" +AWS_ACCESS_KEY_ID= "AWS_ACCESS_KEY_ID" +AWS_ACCESS_SECRET_KEY= "AWS_ACCESS_SECRET_KEY" +AWS_BUCKET_NAME= "qa-knowlg-inquiry" +AWS_REGION= "ap-south-1" +BASE_URL= "https://qa-middleware.tekdinext.com" +NEXT_API_BASE_URL= "https://middleware.prathamdigital.org" +NEXT_PRIVATE_LOCAL_WEBPACK= "true" +NEXT_PUBLIC_AUTH= "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiI5dndaeklzS3U0ZzRjSWxoZnE1MWQ2SlR1d0w4dktlZCJ9.4jPaZhi9dHMzqqoZAZvfD5t5QPAVAuWOr9SDf1apZb8" +NEXT_PUBLIC_BASE_URL= "https://dev.elevate-apis.shikshalokam.org" +NEXT_PUBLIC_BASE_URL_ENTITY= "https://shiksha-dev-interface.tekdinext.com/entity-management" +NEXT_PUBLIC_BASE_URL_READ= "https://saas-dev-interface.tekdinext.com" +NEXT_PUBLIC_BASE_URL_SCHEMA= "https://qa-interface.prathamdigital.org" +NEXT_PUBLIC_CHANNEL_ID= "scp-channel" +NEXT_PUBLIC_CLIENT_ID= "implementation" +NEXT_PUBLIC_CLIENT_SECRET= "3e92df83-a773-4e3e-89c6-3a9afe81211a" +NEXT_PUBLIC_CLOUD_STORAGE_URL= "https://qa-knowlg-inquiry.s3-ap-south-1.amazonaws.com/" +NEXT_PUBLIC_CONTENT= "http://localhost:8000/shikshalokam/content" +NEXT_PUBLIC_CONTENT_FRAMEWORK_ID= "level1arning-framework" +NEXT_PUBLIC_DELETE_USER= "/api/user/v1/block" +NEXT_PUBLIC_FORGOT_PASSWORD= "https://dev.sunbirdsaas.com/recover/identify/account" +NEXT_PUBLIC_FRAMEWORK_ID= "shiksha-fw" +NEXT_PUBLIC_GENRATE_OTP= "/api/otp/v2/generate" +NEXT_PUBLIC_GRANT_TYPE= "password" +NEXT_PUBLIC_LOCATION_SEARCH= "/api/data/v1/location/search" +NEXT_PUBLIC_LOGINPAGE= "https://dev.elevate-apis.shikshalokam.org/" +NEXT_PUBLIC_LOGIN_PATH= "/auth/realms/sunbird/protocol/openid-connect/token" +NEXT_PUBLIC_NEW_REGISTRATION= "/interface/v1/account/create" +NEXT_PUBLIC_ORGID= "1" +NEXT_PUBLIC_PROGRAM_BASE_URL= "https://dev.elevate-sandbox.shikshalokam.org" +NEXT_PUBLIC_PWA= "http://localhost:8000/shikshalokam/pwa" +NEXT_PUBLIC_READ_USER= "/api/user/v1/search" +NEXT_PUBLIC_REGISTRATION= "http://localhost:8000/shikshalokam/registration/newUser" +NEXT_PUBLIC_SEARCH_LOCATION= "/interface/v1/user/locations/search" +NEXT_PUBLIC_SEND_OTP= "/api/otp/v1/generate" +NEXT_PUBLIC_SHIKSHAGRAHA_BASEPATH= "/shikshalokam" +NEXT_PUBLIC_SSUNBIRD_BASE_URL= "https://saas-qa.tekdinext.com/interface/v1" +NEXT_PUBLIC_SSUNBIRD_HIERARCHY_PATH= "/api/course/v1/" +NEXT_PUBLIC_TELEMETRY_URL= "https://qa.prathamteacherapp.tekdinext.com/telemetry" +NEXT_PUBLIC_TENANT_ID= "ef99949b-7f3a-4a5f-806a-e67e683e38f3" +NEXT_PUBLIC_TRACKING_BASE_URL= "https://shiksha2-dev.tekdinext.com/tracking" +NEXT_PUBLIC_UPDATE_USER= "/api/framework/v1/update" +NEXT_PUBLIC_VERIFT_OTP= "/api/otp/v2/verify" +NEXT_PUBLIC_VERIFY_OTP= "/api/otp/v1/verify" +created_time= "2025-06-18T08:50:04.71092372Z" +custom_metadata= "null" +destroyed= "false" +version= "5" \ No newline at end of file diff --git a/documentation/3.4.0/native/envs/stand-alone/entity_management_env b/documentation/3.4.0/native/envs/stand-alone/entity_management_env new file mode 100644 index 00000000..c8b99600 --- /dev/null +++ b/documentation/3.4.0/native/envs/stand-alone/entity_management_env @@ -0,0 +1,23 @@ +APPLICATION_PORT = 5001 +APPLICATION_ENV ="development" +APPLICATION_BASE_URL='/entity-management/' +INTERNAL_ACCESS_TOKEN =xahusub12yexlashsbxAXADHBlaj +ACCESS_TOKEN_SECRET=bsj82AHBxahusub12yexlashsbxAXADHBlaj +MONGODB_URL=mongodb://localhost:27017/elevate-entity +AUTH_METHOD = native +USER_SERVICE_URL = http://localhost:3569 +USER_SERVICE_BASE_URL=/user +KAFKA_HEALTH_CHECK_TOPIC=test +SERVICE_NAME = elevate-entity-service +API_DOC_URL="http://localhost:3569/entity-management/api-doc" +APPLICATION_HOST=localhost +IS_AUTH_TOKEN_BEARER="false" +ADMIN_ACCESS_TOKEN=rwwee3$123 +ADMIN_TOKEN_HEADER_NAME="admin-auth-token" +INTERFACE_SERVICE_URL=http://localhost:3569 +KAFKA_HEALTH_CHECK_TOPIC = entity-health-check-topic-check +KAFKA_COMMUNICATIONS_ON_OFF = ON +KAFKA_URL = kafka:9092 +KAFKA_COMMUNICATIONS_ON_OFF = ON +KAFKA_GROUP_ID = entity +HEALTH_CHECK_DEBUG_MODE = true \ No newline at end of file diff --git a/documentation/3.4.0/native/envs/stand-alone/interface_env b/documentation/3.4.0/native/envs/stand-alone/interface_env new file mode 100644 index 00000000..62f2bbf6 --- /dev/null +++ b/documentation/3.4.0/native/envs/stand-alone/interface_env @@ -0,0 +1,24 @@ +API_DOC_URL=/interface/api-doc +APPLICATION_ENV=development +APPLICATION_PORT=3569 +ELEVATE_NOTIFICATION_KAFKA_BROKERS=localhost:9092 +ELEVATE_NOTIFICATION_KAFKA_GROUP_ID=dev.mentoring +ELEVATE_NOTIFICATION_KAFKA_TOPIC=dev.notification +ENTITY_SERVICE_BASE_URL=http://localhost:5001 +INSTALLED_PACKAGES=elevate-mentoring elevate-survey-observation@1.0.1 elevate-self-creation-portal +NOTIFICATION_SERVICE_BASE_URL=http://localhost:7201 +PROJECT_SERVICE_BASE_URL=http://localhost:6000 +RATE_LIMITER_ENABLED=true +RATE_LIMITER_GENERAL_LIMIT=500 +RATE_LIMITER_NUMBER_OF_PROXIES=3 +RATE_LIMITER_PUBLIC_LOW_LIMIT=5 +REQUIRED_BASE_PACKAGES=elevate-mentoring elevate-project elevate-survey-observation self-creation-portal +REQUIRED_PACKAGES=elevate-mentoring@1.2.90 elevate-survey-observation@1.0.22 elevate-project@1.1.53 shiksha-notification@1.1.3 elevate-self-creation-portal@1.0.70 +ROUTE_CONFIG_JSON_URLS_PATHS=https://raw.githubusercontent.com/ELEVATE-Project/utils/refs/heads/develop/interface-routes/elevate-routes.json +SAAS_NOTIFICATION_BASE_URL=interface/v1/notification/send-raw +SAAS_NOTIFICATION_SEND_EMAIL_ROUTE=interface/v1/notification/send-raw +SAMIKSHA_SERVICE_BASE_URL=http://localhost:5007 +SCHEDULER_SERVICE_BASE_URL=http://localhost:7401 +SUPPORTED_HTTP_TYPES=GET POST PUT PATCH DELETE +SURVEY_SERVICE_BASE_URL=http://localhost:5007 +USER_SERVICE_BASE_URL=http://localhost:3001 \ No newline at end of file diff --git a/documentation/3.4.0/native/envs/stand-alone/notification_env b/documentation/3.4.0/native/envs/stand-alone/notification_env new file mode 100644 index 00000000..18cf3570 --- /dev/null +++ b/documentation/3.4.0/native/envs/stand-alone/notification_env @@ -0,0 +1,17 @@ +API_DOC_URL=/api-doc +APPLICATION_BASE_URL=/notification/ +APPLICATION_ENV=development +APPLICATION_PORT=3002 +DEV_DATABASE_URL=postgres://postgres:postgres@localhost:5432/notification +DISABLE_LOG=false +ENABLE_LOG=true +ERROR_LOG_LEVEL=silly +INTERNAL_ACCESS_TOKEN=xahusub12yexlashsbxAXADHBlaj +KAFKA_GROUP_ID=notification +KAFKA_HOST=localhost:9092 +KAFKA_TOPIC=develop.notifications +SENDGRID_API_KEY=SG.asd9f87a9s8d7f. +SENDGRID_FROM_MAIL=no-reply@some.org +ZEST_ENV=ZEST_ENV +EMAIL_SERVICE=email +FROM_EMAIL=email diff --git a/documentation/3.4.0/native/envs/stand-alone/observation_portal_env b/documentation/3.4.0/native/envs/stand-alone/observation_portal_env new file mode 100644 index 00000000..50d7ba42 --- /dev/null +++ b/documentation/3.4.0/native/envs/stand-alone/observation_portal_env @@ -0,0 +1,4 @@ +window["env"] = { + production: true, + surveyBaseURL:"https://qa.elevate-apis.shikshalokam.org" +} \ No newline at end of file diff --git a/documentation/3.4.0/native/envs/stand-alone/observation_survey_projects_pwa_env b/documentation/3.4.0/native/envs/stand-alone/observation_survey_projects_pwa_env new file mode 100644 index 00000000..156e3796 --- /dev/null +++ b/documentation/3.4.0/native/envs/stand-alone/observation_survey_projects_pwa_env @@ -0,0 +1,18 @@ +window["env"] = { + production: true, + baseURL: 'https://qa.elevate-apis.shikshalokam.org', + // baseURL: 'https://saas-qa.tekdinext.com', + capabilities: 'all', + restrictedPages: ['DOWNLOADS','AUTH_PAGES'], + unauthorizedRedirectUrl: "/", + isAuthBypassed: true, + profileRedirectPath: "/profile-edit", + showHeader: true, + config:{ + logoPath:'assets/images/logo.png', + faviconPath:'assets/icons/elevate-logo.png', + title:"Elevate", + redirectUrl:"/home" + }, + hostPath:'/ml/' +}; \ No newline at end of file diff --git a/documentation/3.4.0/native/envs/stand-alone/project_env b/documentation/3.4.0/native/envs/stand-alone/project_env new file mode 100644 index 00000000..59ef2b74 --- /dev/null +++ b/documentation/3.4.0/native/envs/stand-alone/project_env @@ -0,0 +1,47 @@ +APPLICATION_PORT = 6000 +APPLICATION_ENV = development +ACCESS_TOKEN_SECRET=bsj82AHBxahusub12yexlashsbxAXADHBlaj +INTERNAL_ACCESS_TOKEN =xahusub12yexlashsbxAXADHBlaj +MONGODB_URL = mongodb://localhost:27017/elevate-project +KEYCLOAK_PUBLIC_KEY_PATH = keycloak-public-keys +KAFKA_COMMUNICATIONS_ON_OFF = ON +KAFKA_URL=localhost:9092 +KAFKA_GROUP_ID = projects +KAFKA_HEALTH_CHECK_TOPIC = project-health-check-topic-check +PROJECT_SUBMISSION_TOPIC=sl-improvement-project-submission-dev +SUBMISSION_TOPIC = Projectsubmissions +PROJECT_CERTIFICATE_TOPIC = generateProjectCertificate +ELEVATE_PROJECT_SERVICE_URL= 'http://localhost:6000' +SERVICE_NAME = project +USER_DELETE_TOPIC = deleteuser +TELEMETRY_TOPIC=telemetry.raw +ID = projectservice +TELEMETRY_ON_OFF=ON +USER_DELETE_ON_OFF=OFF +CLOUD_STORAGE=ON +TIMEZONE_DIFFRENECE_BETWEEN_LOCAL_TIME_AND_UTC = +05:30 +VALIDATE_ENTITIES = ON +APP_PORTAL_BASE_URL = "http://localhost:7007" +NO_OF_MINUTES = 30 +NO_OF_EXPIRY_TIME = 60 +DEFAULT_ORGANISATION_CODE = 1 +GOTENBERG_URL=http://localhost:3000 +API_DOC_URL="http://http://localhost:3569/project/api-doc" +INTERFACE_SERVICE_URL=http://localhost:3569 +USER_SERVICE_BASE_URL = "/user" +ENTITY_MANAGEMENT_SERVICE_BASE_URL = "/entity-management" +SURVEY_SERVICE_URL = http://localhost:4301/survey +CLOUD_STORAGE_PROVIDER=gcloud +CLOUD_STORAGE_ACCOUNTNAME=CLOUD_STORAGE_ACCOUNTNAME +CLOUD_STORAGE_SECRET="-----BEGIN PRIVATE KEY-----\n" +CLOUD_STORAGE_PROJECT =sl-dev-project +CLOUD_STORAGE_BUCKETNAME=mentoring-dev-storage-private +CLOUD_STORAGE_BUCKET_TYPE=private +ADMIN_ACCESS_TOKEN = N0DM5NAwwCN5KNXKJwlwu6c0nQQt6Rcl +ADMIN_AUTH_TOKEN = N0DM5NAwwCN5KNXKJwlwu6c0nQQt6Rcl +ADMIN_TOKEN_HEADER_NAME = 'admin-auth-token' +IS_AUTH_TOKEN_BEARER = false +AUTH_METHOD = native +REDIS_HOST=redis://127.0.0.1:6379 +USER_SERVICE_URL = http://localhost:3569 +RESOURCE_DELETION_TOPIC=RESOURCE_DELETION_TOPIC diff --git a/documentation/3.4.0/native/envs/stand-alone/scheduler_env b/documentation/3.4.0/native/envs/stand-alone/scheduler_env new file mode 100644 index 00000000..fa7dbfa1 --- /dev/null +++ b/documentation/3.4.0/native/envs/stand-alone/scheduler_env @@ -0,0 +1,13 @@ +API_DOC_URL=/api-doc +APPLICATION_BASE_URL=/scheduler/ +APPLICATION_ENV=development +APPLICATION_PORT=4000 +DEFAULT_QUEUE=email +DISABLE_LOG=false +ENABLE_LOG=true +ERROR_LOG_LEVEL=silly +KAFKA_URL=localhost:9092 +NOTIFICATION_KAFKA_TOPIC=develop.notifications +REDIS_HOST=localhost +REDIS_PORT=6379 +MONGODB_URL="mongodb://localhost:27017/tl-cron-rest" diff --git a/documentation/3.4.0/native/envs/stand-alone/user_env b/documentation/3.4.0/native/envs/stand-alone/user_env new file mode 100644 index 00000000..193d7859 --- /dev/null +++ b/documentation/3.4.0/native/envs/stand-alone/user_env @@ -0,0 +1,82 @@ +ACCESS_TOKEN_EXPIRY='30m' +ACCESS_TOKEN_SECRET=bsj82AHBxahusub12yexlashsbxAXADHBlaj +API_DOC_URL=/user/api-doc +APP_NAME=MentorED +APPLICATION_ENV=development +APPLICATION_PORT=3001 +CLOUD_STORAGE_PROVIDER = aws +CLOUD_STORAGE_BUCKETNAME =mentoring-prod-storage-private +CLOUD_STORAGE_SECRET= CLOUD_STORAGE_SECRET +CLOUD_STORAGE_REGION =ap-south-1 +CLOUD_ENDPOINT =CLOUD_ENDPOINT +CLOUD_STORAGE_ACCOUNTNAME =CLOUD_STORAGE_ACCOUNTNAME +CLOUD_STORAGE_BUCKET_TYPE = private +PUBLIC_ASSET_BUCKETNAME=mentoring-prod-storage-private +AZURE_ACCOUNT_KEY='AZURE_ACCOUNT_KEY' +AZURE_ACCOUNT_NAME=elevatementoringaccount +CLEAR_INTERNAL_CACHE=userinternal +CLOUD_STORAGE=GCP +DEFAULT_AZURE_CONTAINER_NAME=mentoring-azure-private +DEFAULT_GCP_BUCKET_NAME=DEFAULT_GCP_BUCKET_NAME +ENABLE_EMAIL_OTP_VERIFICATION=false +ENABLE_LOG=true +GCP_PATH=gcp.json +GCP_PROJECT_ID=sl-project +INTERNAL_ACCESS_TOKEN=xahusub12yexlashsbxAXADHBlaj +INTERNAL_CACHE_EXP_TIME=86400 +IV=LHYOA5YnTonqcgrm15k3/Q== +KAFKA_GROUP_ID=mentoring +KAFKA_TOPIC= +KAFKA_URL= localhost:9092 +KEY=E/m3RD/aM3Ed3lLfYVcKizakG9R+bFybAPZSLjIP2hY= +MENTOR_SECRET_CODE=4567 +MONGODB_URL=mongodb://localhost:27017/elevate-users +NOTIFICATION_KAFKA_TOPIC=notifications +OTP_EMAIL_TEMPLATE_CODE=emailotp +OTP_EXP_TIME=86400 +RATING_KAFKA_TOPIC=mentor_rating +REDIS_HOST=redis://localhost:6379 +REFRESH_TOKEN_EXPIRY=183 +REFRESH_TOKEN_SECRET=371hkjkjady2y3ihdkajshdkiq23iuekw71yekhaskdvkvegavy23t78veqwexqvxveit6ttxyeeytt62tx236vv +REGISTRATION_EMAIL_TEMPLATE_CODE=registration +REGISTRATION_OTP_EMAIL_TEMPLATE_CODE=registrationotp +SALT_ROUNDS=10 +MENTORING_SERVICE_URL='localhost' +DEFAULT_OCI_BUCKET_NAME=mentoring-oci-private +OCI_ACCESS_KEY_ID= 81a4c2553026982360af6b24497c489b0fea9436 +OCI_BUCKET_ENDPOINT=https://axgqmpkrpmt5.compat.objectstorage.ap-hyderabad-1.oraclecloud.com +OCI_BUCKET_REGION= ap-hyderabad-1 +OCI_SECRET_ACCESS_KEY='+U4O+CjiC6M/mOcGjYh7K/9XjfSdJ79OoLuQrABPOJ8=' +ERROR_LOG_LEVEL= silly +DISABLE_LOG= false +DEFAULT_ORGANISATION_CODE=default_code +DEV_DATABASE_URL=postgres://postgres:postgres@localhost:5432/users +ADMIN_SECRET_CODE=W5bF7gesuS0xsNWmpsKy +INVITEE_EMAIL_TEMPLATE_CODE="emailcode" +ADMIN_INVITEE_UPLOAD_EMAIL_TEMPLATE_CODE="coeadmin" +DEFAULT_QUEUE="defaultque" +MENTOR_INVITATION_EMAIL_TEMPLATE_CODE="mentorinvitationTemplateCode" +MENTEE_INVITATION_EMAIL_TEMPLATE_CODE="mentee invitationTemplateCode" +DEFAULT_ROLE="mentee" +SAMPLE_CSV_FILE_PATH="sample path" +ORG_ADMIN_INVITATION_EMAIL_TEMPLATE_CODE = "code5" +DEFAULT_ORG_ID = 1 +IS_AUTH_TOKEN_BEARER=false +PORTAL_URL = "portaladdress" +SCHEDULER_SERVICE_HOST = "host" +SCHEDULER_SERVICE_BASE_URL = "/scheduler/" +REFRESH_VIEW_INTERVAL = 100000 +EMAIL_ID_ENCRYPTION_IV = 'a390328e496f025249a88384f318a536' +EMAIL_ID_ENCRYPTION_KEY = '9bbf4698e081176b4e38c3f04f9c0cff6ae80b1960e5ac868cc234ac8537aa66' +EMAIL_ID_ENCRYPTION_ALGORITHM = 'aes-256-cbc' +GENERIC_INVITATION_EMAIL_TEMPLATE_CODE = 'check_code' +EVENT_ORG_LISTENER_URLS = "sample url" +EVENT_ENABLE_ORG_EVENTS = false +DOWNLOAD_URL_EXPIRATION_DURATION = 300 +APPLICATION_HOST= "localhost" +CHANGE_PASSWORD_TEMPLATE_CODE = "change_password" +CAPTCHA_ENABLE = false +RECAPTCHA_SECRET_KEY= "6LfWEKYpAAAAAJS0eukS2Su_5vwlXRs5vPbC34W0" +ALLOWED_IDLE_TIME=1200000 +APPLICATION_BASE_URL="/user" +ENTITY_MANAGEMENT_SERVICE_BASE_URL="http://localhost:3569/entity-management/" \ No newline at end of file diff --git a/documentation/3.4.0/native/scripts/stand-alone/ubuntu/check-dependencies.sh b/documentation/3.4.0/native/scripts/stand-alone/ubuntu/check-dependencies.sh new file mode 100644 index 00000000..98ff5e8b --- /dev/null +++ b/documentation/3.4.0/native/scripts/stand-alone/ubuntu/check-dependencies.sh @@ -0,0 +1,139 @@ +#!/bin/bash + +# Define ANSI color codes for output formatting +GREEN='\033[0;32m' +RED='\033[0;31m' +NC='\033[0m' # No Color + +# Function to check Node.js installation +check_nodejs() { + if command -v node > /dev/null 2>&1; then + echo -e "${GREEN}Node.js is installed. Version: $(node --version)${NC}" + else + echo -e "${RED}Node.js is not installed.${NC}" + fi +} + +# Function to check Apache Kafka and Zookeeper installation +check_kafka() { + if [ -d "/opt/kafka" ]; then + echo -e "${GREEN}Kafka directory exists.${NC}" + else + echo -e "${RED}Kafka directory does not exist.${NC}" + fi + + if systemctl is-active --quiet zookeeper; then + echo -e "${GREEN}Zookeeper service is running.${NC}" + else + echo -e "${RED}Zookeeper service is not running.${NC}" + fi + + if systemctl is-active --quiet kafka; then + echo -e "${GREEN}Kafka service is running.${NC}" + else + echo -e "${RED}Kafka service is not running.${NC}" + fi +} + +# Function to check Redis installation and service status +check_redis() { + if command -v redis-server > /dev/null 2>&1; then + echo -e "${GREEN}Redis server is installed. Version: $(redis-server --version)${NC}" + else + echo -e "${RED}Redis server is not installed.${NC}" + return + fi + + if systemctl status redis-server.service &> /dev/null; then + echo -e "${GREEN}Redis service is running.${NC}" + else + echo -e "${RED}Redis service is not running or inactive.${NC}" + fi +} + +# Function to check Citus installation +check_citus() { + if sudo su - postgres -c "psql -p 9700 -c 'SELECT citus_version();'" &> /dev/null; then + echo -e "${GREEN}Citus is running on port 9700.${NC}" + else + echo -e "${RED}Citus is not running or not installed.${NC}" + fi +} + +# Function to check PM2 installation +check_pm2() { + if command -v pm2 > /dev/null 2>&1; then + echo -e "${GREEN}PM2 is installed. Version: $(pm2 -v)${NC}" + else + echo -e "${RED}PM2 is not installed.${NC}" + fi +} + +# Function to check PostgreSQL installation and service +check_postgres() { + if command -v psql > /dev/null 2>&1; then + echo -e "${GREEN}PostgreSQL is installed. Version: $(psql --version)${NC}" + else + echo -e "${RED}PostgreSQL is not installed.${NC}" + fi + + if systemctl is-active --quiet postgresql; then + echo -e "${GREEN}PostgreSQL service is running.${NC}" + else + echo -e "${RED}PostgreSQL service is not running.${NC}" + fi +} + +# Function to check MongoDB installation and service +check_mongo() { + if command -v mongod > /dev/null 2>&1; then + echo -e "${GREEN}MongoDB is installed. Version: $(mongod --version | head -n 1)${NC}" + else + echo -e "${RED}MongoDB is not installed.${NC}" + return + fi + + if systemctl is-active --quiet mongod; then + echo -e "${GREEN}MongoDB service is running.${NC}" + else + echo -e "${RED}MongoDB service is not running.${NC}" + fi +} + +# Function to check if Redis BullMQ is installed (in Node.js context) +check_bullmq() { + if npm list -g | grep -q bullmq; then + echo -e "${GREEN}Redis BullMQ is installed globally.${NC}" + else + echo -e "${RED}Redis BullMQ is not installed globally.${NC}" + fi +} + +# Function to check Gotenberg installation and service status +check_gotenberg() { + if command -v docker > /dev/null 2>&1; then + echo -e "${GREEN}Docker is installed. Version: $(docker --version)${NC}" + else + echo -e "${RED}Docker is not installed.${NC}" + return + fi + + if docker ps | grep -q gotenberg; then + echo -e "${GREEN}Gotenberg Docker container is running.${NC}" + else + echo -e "${RED}Gotenberg Docker container is not running.${NC}" + fi +} + +# Main execution flow of the script +echo "ELEVATE-Project Dependencies Status" + +check_nodejs +check_kafka +check_redis +check_pm2 +check_postgres +check_citus +check_mongo +# check_bullmq +check_gotenberg diff --git a/documentation/3.4.0/native/scripts/stand-alone/ubuntu/citus_setup.sh b/documentation/3.4.0/native/scripts/stand-alone/ubuntu/citus_setup.sh new file mode 100644 index 00000000..3e9996ac --- /dev/null +++ b/documentation/3.4.0/native/scripts/stand-alone/ubuntu/citus_setup.sh @@ -0,0 +1,133 @@ +#!/bin/bash + +# Exit immediately if a command exits with a non-zero status. +set -e + +# --- 1. ARGUMENT VALIDATION --- +if [ $# -lt 2 ]; then + echo "Error: Folder name and database URL not provided." >&2 + echo "Usage: $0 " >&2 + exit 1 +fi + +FOLDER_NAME="$1" +DEV_DATABASE_URL="$2" + +# Check if folder exists +if [ ! -d "$FOLDER_NAME" ]; then + echo "Error: Folder '$FOLDER_NAME' not found." >&2 + exit 1 +fi + +# --- 2. HIGHLY RELIABLE DATABASE URL PARSING --- +echo "Parsing database URL..." + +# Remove protocol (postgres://) +DB_CLEAN_URL=$(echo "$DEV_DATABASE_URL" | sed 's/.*:\/\///') + +# Extract DB_NAME +DB_NAME=$(echo "$DB_CLEAN_URL" | awk -F '/' '{print $NF}') + +# Remove DB_NAME from path +HOST_PORT_PATH=$(echo "$DB_CLEAN_URL" | sed "s/\/$DB_NAME//") + +# Extract components +DB_USER=$(echo "$HOST_PORT_PATH" | awk -F '[:@]' '{print $1}') +DB_PASSWORD=$(echo "$HOST_PORT_PATH" | awk -F '[:@]' '{print $2}') +DB_HOST=$(echo "$HOST_PORT_PATH" | awk -F '[:@]' '{print $3}') +DB_PORT=$(echo "$HOST_PORT_PATH" | awk -F '[:@]' '{print $4}') + +# Log extracted values (excluding password) +echo "Extracted Database Variables:" +echo "DB_USER: $DB_USER" +echo "DB_HOST: $DB_HOST" +echo "DB_PORT: $DB_PORT" +echo "DB_NAME: $DB_NAME" +echo "" + +if [[ -z "$DB_PORT" ]]; then + echo "Error: Could not extract database port. Check URL format." >&2 + exit 1 +fi + +# --- 3. WAIT FOR LOCAL POSTGRESQL --- + +echo "Waiting for PostgreSQL on $DB_HOST:$DB_PORT to accept connections..." +until pg_isready -h "$DB_HOST" -p "$DB_PORT" -U "$DB_USER" > /dev/null 2>&1; do + echo -n "." + sleep 1 +done +echo -e "\nPostgreSQL is ready." + +# Wait until database exists +echo "Checking existence of database '$DB_NAME'..." +until PGPASSWORD="$DB_PASSWORD" psql \ + -h "$DB_HOST" \ + -U "$DB_USER" \ + -p "$DB_PORT" \ + -d postgres \ + -lqt | awk '{print $1}' | grep -qw "$DB_NAME"; do + echo -n "." + sleep 5 +done +echo -e "\nDatabase '$DB_NAME' exists." + +# --- 4. CITUS EXTENSION SETUP --- + +DISTRIBUTION_COLUMNS_FILE="$FOLDER_NAME/distributionColumns.sql" +if [ ! -f "$DISTRIBUTION_COLUMNS_FILE" ]; then + echo "Error: distributionColumns.sql not found in folder '$FOLDER_NAME'." >&2 + exit 1 +fi + +echo "Creating Citus extension (if not exists)..." +PGPASSWORD="$DB_PASSWORD" psql \ + -h "$DB_HOST" \ + -U "$DB_USER" \ + -d "$DB_NAME" \ + -p "$DB_PORT" \ + --set ON_ERROR_STOP=1 \ + -c "CREATE EXTENSION IF NOT EXISTS citus;" + +# --- 5. EXECUTE SQL FILE WITH ROBUST TABLE CHECK --- + +check_table() { + local table_name=$1 + PGPASSWORD="$DB_PASSWORD" psql \ + -h "$DB_HOST" \ + -U "$DB_USER" \ + -d "$DB_NAME" \ + -p "$DB_PORT" \ + -q -t \ + --set ON_ERROR_STOP=1 \ + -c "SELECT 1 FROM $table_name LIMIT 1;" \ + > /dev/null 2>&1 +} + +echo "Starting creation of distributed tables..." + +while IFS= read -r line; do + trimmed_line=$(echo "$line" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//') + + if [[ "$trimmed_line" =~ ^create_distributed_table\(\'([^\']+)\', ]]; then + table="${BASH_REMATCH[1]}" + echo "Processing table: '$table'" + + # Wait until table exists + until check_table "$table"; do + echo "Table '$table' does not exist yet (waiting for migration)..." + sleep 1 + done + + echo "Table '$table' exists. Applying Citus distribution..." + PGPASSWORD="$DB_PASSWORD" psql \ + -h "$DB_HOST" \ + -U "$DB_USER" \ + -d "$DB_NAME" \ + -p "$DB_PORT" \ + --set ON_ERROR_STOP=1 \ + -c "$trimmed_line" + fi +done < "$DISTRIBUTION_COLUMNS_FILE" + +echo "✅ Local PostgreSQL Citus setup and table distribution completed successfully!" diff --git a/documentation/3.4.0/native/scripts/stand-alone/ubuntu/common.js b/documentation/3.4.0/native/scripts/stand-alone/ubuntu/common.js new file mode 100644 index 00000000..0e70fb2e --- /dev/null +++ b/documentation/3.4.0/native/scripts/stand-alone/ubuntu/common.js @@ -0,0 +1,39 @@ +function getEndDate(date) { + let endDate = date.split(' ') + if (endDate[1] === '' || endDate[1] === undefined) { + date = endDate[0] + ' 23:59:59' + } + date = new Date(date) + date = addOffsetToDateTime(date, '+05:30') + console.log(date, 'this is date') + return date +} + +function addOffsetToDateTime(time, timeZoneDifference) { + //get the offset time from env with respect UTC + let localTimeZone = timeZoneDifference + //convert offset time to minutes + let localTime = localTimeZone.split(':') + let localHourDifference = Number(localTime[0]) + let getTimeDiffInMinutes = + localHourDifference * 60 + (localHourDifference / Math.abs(localHourDifference)) * Number(localTime[1]) + //get server offset time w.r.t. UTC time + let timeDifference = new Date().getTimezoneOffset() + //get actual time difference in minutes + let differenceWithLocal = timeDifference + getTimeDiffInMinutes + // if its 0 then return same time + if (differenceWithLocal === 0) { + return time + } else { + // set time difference + let getMinutes = differenceWithLocal % 60 + let getHours = (differenceWithLocal - getMinutes) / 60 + time.setHours(time.getHours() - getHours) + time.setMinutes(time.getMinutes() - getMinutes) + return time + } +} + +module.exports = { + getEndDate, +} diff --git a/documentation/3.4.0/native/scripts/stand-alone/ubuntu/configFile.json b/documentation/3.4.0/native/scripts/stand-alone/ubuntu/configFile.json new file mode 100644 index 00000000..b3d32b2f --- /dev/null +++ b/documentation/3.4.0/native/scripts/stand-alone/ubuntu/configFile.json @@ -0,0 +1,11 @@ +{ + "authTokenUserInformation": { + "userId": "data.id", + "userName": "data.name", + "firstName": "data.name", + "organization_id": "data.organization_codes[0]", + "roles": "data.organizations[?code={{organization_id}}].roles", + "organizations": "data.organizations", + "tenant_id": "data.tenant_code" + } +} diff --git a/documentation/3.4.0/native/scripts/stand-alone/ubuntu/create-databases.sh b/documentation/3.4.0/native/scripts/stand-alone/ubuntu/create-databases.sh new file mode 100644 index 00000000..2ce07163 --- /dev/null +++ b/documentation/3.4.0/native/scripts/stand-alone/ubuntu/create-databases.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# Run commands as the postgres user +sudo -u postgres psql -p 5432 -c "CREATE USER postgres WITH ENCRYPTED PASSWORD 'postgres';" + +# Create the user database and assign privileges +sudo -u postgres psql -p 5432 -c "CREATE DATABASE users;" +sudo -u postgres psql -p 5432 -d users -c "GRANT ALL PRIVILEGES ON DATABASE users TO postgres;" +sudo -u postgres psql -p 5432 -d users -c "GRANT ALL ON SCHEMA public TO postgres;" + +# Create the notification database and assign privileges +sudo -u postgres psql -p 5432 -c "CREATE DATABASE notification;" +sudo -u postgres psql -p 5432 -d notification -c "GRANT ALL PRIVILEGES ON DATABASE notification TO postgres;" +sudo -u postgres psql -p 5432 -d notification -c "GRANT ALL ON SCHEMA public TO postgres;" + +echo "Database setup complete." diff --git a/documentation/3.4.0/native/scripts/stand-alone/ubuntu/entity_sampleData.js b/documentation/3.4.0/native/scripts/stand-alone/ubuntu/entity_sampleData.js new file mode 100644 index 00000000..8bcbfcb6 --- /dev/null +++ b/documentation/3.4.0/native/scripts/stand-alone/ubuntu/entity_sampleData.js @@ -0,0 +1,290 @@ +const { ObjectId } = require('mongodb') + +let entityType = [ + { + _id: new ObjectId('6825914b97b5680013e6a140'), + profileForm: [], + profileFields: [], + types: [], + callResponseTypes: [], + isObservable: true, + immediateChildrenEntityType: ['district'], + createdBy: '49', + updatedBy: '49', + deleted: false, + isDeleted: false, + name: 'state', + toBeMappedToParentEntities: true, + tenantId: 'default', + updatedAt: new Date('2025-05-15T07:01:31.680Z'), + createdAt: new Date('2025-05-15T07:01:31.680Z'), + __v: 0, + orgId: 'default_code', + }, + { + _id: new ObjectId('6825915197b5680013e6a142'), + profileForm: [], + profileFields: [], + types: [], + callResponseTypes: [], + isObservable: true, + immediateChildrenEntityType: ['district'], + createdBy: '49', + updatedBy: '49', + deleted: false, + isDeleted: false, + name: 'district', + toBeMappedToParentEntities: true, + tenantId: 'default', + updatedAt: new Date('2025-05-15T07:01:37.892Z'), + createdAt: new Date('2025-05-15T07:01:37.892Z'), + __v: 0, + orgId: 'default_code', + }, + { + _id: new ObjectId('682591cc97b5680013e6a15c'), + profileForm: [], + profileFields: [], + types: [], + callResponseTypes: [], + isObservable: true, + immediateChildrenEntityType: ['district'], + createdBy: '49', + updatedBy: '49', + deleted: false, + isDeleted: false, + name: 'professional_role', + toBeMappedToParentEntities: true, + tenantId: 'default', + updatedAt: new Date('2025-05-15T07:03:40.376Z'), + createdAt: new Date('2025-05-15T07:03:40.376Z'), + __v: 0, + orgId: 'default_code', + }, + { + _id: new ObjectId('682591d397b5680013e6a15e'), + profileForm: [], + profileFields: [], + types: [], + callResponseTypes: [], + isObservable: true, + immediateChildrenEntityType: ['district'], + createdBy: '49', + updatedBy: '49', + deleted: false, + isDeleted: false, + name: 'professional_subroles', + toBeMappedToParentEntities: true, + tenantId: 'default', + updatedAt: new Date('2025-05-15T07:03:47.062Z'), + createdAt: new Date('2025-05-15T07:03:47.062Z'), + __v: 0, + orgId: 'default_code', + }, +] + +let entities = [ + { + _id: new ObjectId('6852c86c7248c20014b38a4d'), + metaInformation: { + targetedEntityTypes: [], + externalId: '16', + name: 'Tripura', + }, + childHierarchyPath: ['district', 'block', 'cluster', 'school'], + createdBy: '20', + updatedBy: '20', + deleted: false, + entityTypeId: new ObjectId('6825914b97b5680013e6a140'), + entityType: 'state', + registryDetails: { + code: '16', + locationId: '16', + }, + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-06-18T14:29:00.266Z'), + createdAt: new Date('2025-06-18T14:08:44.438Z'), + __v: 0, + groups: { + district: [new ObjectId('6852c8ae7248c20014b38a57')], + block: [new ObjectId('6852c8de7248c20014b38a9d')], + cluster: [new ObjectId('6852c9027248c20014b38c34')], + school: [new ObjectId('6852c9237248c20014b39fa0')], + }, + }, + { + _id: new ObjectId('6852c8ae7248c20014b38a57'), + metaInformation: { + targetedEntityTypes: [], + externalId: 'westTripura', + name: 'West Tripura', + }, + childHierarchyPath: ['block', 'cluster', 'school'], + createdBy: '20', + updatedBy: '20', + deleted: false, + entityTypeId: new ObjectId('6825915197b5680013e6a142'), + entityType: 'district', + registryDetails: { + code: 'westTripura', + locationId: 'westTripura', + }, + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-06-18T14:27:43.218Z'), + createdAt: new Date('2025-06-18T14:09:50.337Z'), + __v: 0, + groups: { + block: [new ObjectId('6852c8de7248c20014b38a9d')], + cluster: [new ObjectId('6852c9027248c20014b38c34')], + school: [new ObjectId('6852c9237248c20014b39fa0')], + }, + }, + { + _id: new ObjectId('6852c8de7248c20014b38a9d'), + metaInformation: { + targetedEntityTypes: [], + externalId: '160101', + name: 'AGARTALA MUNICIPAL COORPORATION', + }, + childHierarchyPath: ['cluster', 'school'], + createdBy: '20', + updatedBy: '20', + deleted: false, + entityTypeId: new ObjectId('6825915597b5680013e6a144'), + entityType: 'block', + registryDetails: { + code: '160101', + locationId: '160101', + }, + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-06-18T14:24:30.469Z'), + createdAt: new Date('2025-06-18T14:10:38.736Z'), + __v: 0, + groups: { + cluster: [new ObjectId('6852c9027248c20014b38c34')], + school: [new ObjectId('6852c9237248c20014b39fa0')], + }, + }, + { + _id: new ObjectId('6852c9027248c20014b38c34'), + metaInformation: { + targetedEntityTypes: [], + externalId: '1601010004', + name: 'ACHARYA PRAFULLA CHANDRA H/S SCHOOL', + }, + childHierarchyPath: ['school'], + createdBy: '20', + updatedBy: '20', + deleted: false, + entityTypeId: new ObjectId('6825915897b5680013e6a146'), + entityType: 'cluster', + registryDetails: { + code: '1601010004', + locationId: '1601010004', + }, + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-06-18T14:22:16.044Z'), + createdAt: new Date('2025-06-18T14:11:14.746Z'), + __v: 0, + groups: { + school: [new ObjectId('6852c9237248c20014b39fa0')], + }, + }, + { + _id: new ObjectId('6852c9237248c20014b39fa0'), + metaInformation: { + targetedEntityTypes: [], + externalId: '16010100422', + name: 'ABINASH GOPE SMRITI (SAROJANI) JB SCHOOL', + }, + childHierarchyPath: [], + createdBy: '20', + updatedBy: '20', + deleted: false, + entityTypeId: new ObjectId('6825915c97b5680013e6a148'), + entityType: 'school', + registryDetails: { + code: '16010100422', + locationId: '16010100422', + }, + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-06-18T14:11:49.194Z'), + createdAt: new Date('2025-06-18T14:11:49.194Z'), + __v: 0, + }, + { + _id: new ObjectId('68876746b19aea00144c2af9'), + metaInformation: { + targetedEntityTypes: [ + { + entityTypeId: '6825915197b5680013e6a142', + entityType: 'district', + }, + ], + externalId: 'Facilitator', + name: 'Facilitator', + }, + childHierarchyPath: ['professional_role', 'professional_subroles'], + createdBy: '1', + updatedBy: '1', + deleted: false, + entityTypeId: new ObjectId('682591cc97b5680013e6a15c'), + entityType: 'professional_role', + registryDetails: { + locationId: 'Facilitator', + code: 'Facilitator', + }, + userId: '1', + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-07-28T12:08:56.065Z'), + createdAt: new Date('2025-07-28T12:04:22.011Z'), + __v: 0, + groups: { + professional_subroles: [new ObjectId('688767deb19aea00144c2b08')], + }, + }, + { + _id: new ObjectId('688767deb19aea00144c2b08'), + metaInformation: { + targetedEntityTypes: [ + { + entityType: 'Handbook1_Activity', + entityTypeId: '688762feb19aea00144c2a81', + }, + { + entityType: 'Handbook2_Activity', + entityTypeId: '68887766b19aea00144c3631', + }, + ], + externalId: 'facilitator', + name: 'Facilitator', + }, + childHierarchyPath: ['professional_subroles'], + createdBy: '1', + updatedBy: '1', + deleted: false, + entityTypeId: new ObjectId('682591d397b5680013e6a15e'), + entityType: 'professional_subroles', + registryDetails: { + locationId: 'facilitator', + code: 'facilitator', + }, + userId: '1', + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-07-29T07:28:05.355Z'), + createdAt: new Date('2025-07-28T12:06:54.072Z'), + __v: 0, + }, +] + +module.exports = { + entities, + entityType, +} diff --git a/documentation/3.4.0/native/scripts/stand-alone/ubuntu/import_forms.js b/documentation/3.4.0/native/scripts/stand-alone/ubuntu/import_forms.js new file mode 100644 index 00000000..96ed977b --- /dev/null +++ b/documentation/3.4.0/native/scripts/stand-alone/ubuntu/import_forms.js @@ -0,0 +1,51 @@ +const mongoose = require('mongoose') +const axios = require('axios') + +// MongoDB URL and Collection +const mongoURL = 'mongodb://localhost:27017/elevate-samiksha' +const collectionName = 'forms' + +// Connect to MongoDB +mongoose + .connect(mongoURL, { + useNewUrlParser: true, + useUnifiedTopology: true, + }) + .then(() => { + console.log('Connected to MongoDB') + }) + .catch((err) => { + console.error('Failed to connect to MongoDB', err) + }) + +// Define schema for forms collection (adjust fields based on JSON structure) +const formSchema = new mongoose.Schema({}, { strict: false }) +const Form = mongoose.model(collectionName, formSchema) + +// Fetch JSON data from URL and insert into MongoDB +async function fetchAndInsertData() { + try { + const response = await axios.get( + 'https://raw.githubusercontent.com/ELEVATE-Project/observation-survey-projects-pwa/refs/heads/release-2.0.0/forms.json' + ) + const data = response.data + + const modifiedData = data.map((form) => ({ + ...form, + organizationId: 1, + deleted: false, + version: 0, + })) + + // Insert modified data into the forms collection + await Form.insertMany(modifiedData) + console.log('Data inserted successfully') + } catch (error) { + console.error('Error fetching or inserting data:', error) + } finally { + mongoose.connection.close() + } +} + +// Execute the function +fetchAndInsertData() diff --git a/documentation/3.4.0/native/scripts/stand-alone/ubuntu/insert_sample_data.sh b/documentation/3.4.0/native/scripts/stand-alone/ubuntu/insert_sample_data.sh new file mode 100644 index 00000000..fabcff4d --- /dev/null +++ b/documentation/3.4.0/native/scripts/stand-alone/ubuntu/insert_sample_data.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +# --- 0. PRE-REQUISITE: INSERT MISSING ROLES (for foreign key resolution) --- +# NOTE: Role IDs 1 and 8 are required for subsequent inserts. +# You should verify the tenant_code column and other required fields for user_roles table. +# Assuming the necessary role records (1 and 8) are missing and need to be created first. + +# --- 1. INSERT INTO public.users --- +# These inserts appear correct and should result in 'INSERT 0 1' output. +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (1, 'Rahul R B', 'a0db5e0a39ee13db7fc5d1309e637f2c', false, '{8,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default',NULL,NULL, NULL);" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (2, 'Prajwal C S', 'c4113be1bc2cef51981a6ec687302e42fc4f87f4dfac4276584844d9e3e0f5ae', false, '{8,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default',NULL,NULL, NULL);" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (3, 'Vishnu V P', '1092be87fd483fce1deba56c8cdefa79bed4f70a4b110fc4e7947c57aacff219', false, '{8,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default',NULL,NULL, NULL);" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (4, 'Mallanagouda R B', 'e5fc674d4b1a54c6cf772485e3bca6f7ae14b60de32b9f0cd9f955ee469345bc', false, '{8,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default',NULL,NULL, NULL);" + +# --- 2. INSERT INTO public.user_organizations --- +# These inserts should be fine. +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organizations (user_id,organization_code, tenant_code, created_at, updated_at, deleted_at) VALUES (1, 'default_code', 'default', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organizations (user_id,organization_code, tenant_code, created_at, updated_at, deleted_at) VALUES (2, 'default_code', 'default', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organizations (user_id,organization_code, tenant_code, created_at, updated_at, deleted_at) VALUES (3, 'default_code', 'default', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organizations (user_id,organization_code, tenant_code, created_at, updated_at, deleted_at) VALUES (4, 'default_code', 'default', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" + +# --- 3. UPDATE public.tenants --- +# FIX: Changed -d user to -d users +sudo -u postgres psql -p 5432 -d users -c " +UPDATE public.tenants +SET meta = '{ + \"factors\": [\"professional_role\", \"professional_subroles\"], + \"observableEntityKeys\": [\"professional_subroles\"], + \"optional_factors\": [\"state\", \"district\", \"block\", \"cluster\", \"school\"], + \"validationExcludedScopeKeys\": [\"language\", \"gender\"], + \"portalSignInUrl\": \"https://shikshagrah-qa.tekdinext.com/register\" +}' +WHERE code = 'default'; +" + +# --- 4. INSERT INTO public.user_organization_roles --- +# These inserts now occur AFTER the required user_roles (ID 1 and 8) have been added. +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 2, 'default_code', 1, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 3, 'default_code', 3, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 2, 'default_code', 3, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 4, 'default_code', 3, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL);" + + +# --- 5. INSERT INTO public.entity_types --- +# FIX: Added 'tenant_code' to the columns list and provided the value 'default'. +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.entity_types (id, value, label, status, created_by, updated_by, allow_filtering, data_type, organization_id, parent_id, has_entities, allow_custom_entities, model_names, created_at, updated_at, deleted_at, meta, external_entity_type, required, regex, tenant_code,organization_code) VALUES (5, 'state', 'State', 'ACTIVE', 0, 0, true, 'STRING', 1, NULL, true, true, '{User}', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, '{\"service\": \"entity-management-service\",\"endPoint\": \"v1/entities/find\"}', true, false, NULL,'default', 'default_code');" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.entity_types (id, value, label, status, created_by, updated_by, allow_filtering, data_type, organization_id, parent_id, has_entities, allow_custom_entities, model_names, created_at, updated_at, deleted_at, meta, external_entity_type, required, regex, tenant_code,organization_code) VALUES (6, 'block', 'Block', 'ACTIVE', 0, 0, true, 'STRING', 1, NULL, true, true, '{User}', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, '{\"service\": \"entity-management-service\",\"endPoint\": \"v1/entities/find\"}', true, false, NULL,'default', 'default_code');" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.entity_types (id, value, label, status, created_by, updated_by, allow_filtering, data_type, organization_id, parent_id, has_entities, allow_custom_entities, model_names, created_at, updated_at, deleted_at, meta, external_entity_type, required, regex, tenant_code,organization_code) VALUES (7, 'school', 'School', 'ACTIVE', 0, 0, true, 'STRING', 1, NULL, true, true, '{User}', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, '{\"service\": \"entity-management-service\",\"endPoint\": \"v1/entities/find\"}', true, false, NULL,'default', 'default_code');" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.entity_types (id, value, label, status, created_by, updated_by, allow_filtering, data_type, organization_id, parent_id, has_entities, allow_custom_entities, model_names, created_at, updated_at, deleted_at, meta, external_entity_type, required, regex, tenant_code,organization_code) VALUES (8, 'district', 'District', 'ACTIVE', 0, 0, true, 'STRING', 1, NULL, true, true, '{User}', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, '{\"service\": \"entity-management-service\",\"endPoint\": \"v1/entities/find\"}', true, false, NULL,'default', 'default_code');" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.entity_types (id, value, label, status, created_by, updated_by, allow_filtering, data_type, organization_id, parent_id, has_entities, allow_custom_entities, model_names, created_at, updated_at, deleted_at, meta, external_entity_type, required, regex, tenant_code,organization_code) VALUES (9, 'cluster', 'Cluster', 'ACTIVE', 0, 0, true, 'STRING', 1, NULL, true, true, '{User}', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, '{\"service\": \"entity-management-service\",\"endPoint\": \"v1/entities/find\"}', true, false, NULL,'default', 'default_code');" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.entity_types (id, value, label, status, created_by, updated_by, allow_filtering, data_type, organization_id, parent_id, has_entities, allow_custom_entities, model_names, created_at, updated_at, deleted_at, meta, external_entity_type, required, regex, tenant_code,organization_code) VALUES (10, 'professional_role','Professional Role','ACTIVE', 0, 0, true, 'STRING', 1, NULL, true, true, '{User}', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, '{\"service\": \"entity-management-service\",\"endPoint\": \"v1/entities/find\"}', true, false, NULL,'default', 'default_cod');" +sudo -u postgres psql -p 5432 -d users -c "INSERT INTO public.entity_types (id, value, label, status, created_by, updated_by, allow_filtering, data_type, organization_id, parent_id, has_entities, allow_custom_entities, model_names, created_at, updated_at, deleted_at, meta, external_entity_type, required, regex, tenant_code,organization_code) VALUES (11, 'professional_subroles','Professional Subroles', 'ACTIVE', 0, 0, true, 'STRING', 1, NULL, true, true, '{User}', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, '{\"service\": \"entity-management-service\",\"endPoint\": \"v1/entities/find\"}', true, false, NULL,'default', 'default_cod');" + +# --- 6. Final Commands --- +sudo -u postgres psql -p 5432 -d users -c "SELECT nextval('users_id_seq'::regclass) FROM public.users;" +sudo -u postgres psql -p 5432 -d users -c "SELECT nextval('users_credentials_id_seq'::regclass) FROM public.users_credentials;" +sudo -u postgres psql -p 5432 -d users -c "UPDATE role_permission_mapping SET role_title = 'state_education_officer' WHERE role_title = 'mentor';" +sudo -u postgres psql -p 5432 -d users -c "SELECT NULL;" \ No newline at end of file diff --git a/documentation/3.4.0/native/scripts/stand-alone/ubuntu/insert_sample_solutions.js b/documentation/3.4.0/native/scripts/stand-alone/ubuntu/insert_sample_solutions.js new file mode 100644 index 00000000..6eeed017 --- /dev/null +++ b/documentation/3.4.0/native/scripts/stand-alone/ubuntu/insert_sample_solutions.js @@ -0,0 +1,170 @@ +const { MongoClient } = require('mongodb') + +const url = 'mongodb://localhost:27017/' // MongoDB URL +const dbName = 'elevate-project' +const dbName2 = 'elevate-entity' +const entityData = require('./entity_sampleData.js') +const projectData = require('./project_sampleData.js') + +// MongoDB Error Code for Duplicate Key +const DUPLICATE_KEY_ERROR_CODE = 11000 + +// --- UTILITY FUNCTIONS --- + +/** + * Drops the specified collection, effectively deleting all data. + * @param {string} collectionName The name of the collection to drop. + * @param {string} currentDB The name of the database. + */ +async function cleanData(collectionName, currentDB) { + const client = new MongoClient(url) + try { + await client.connect() + const db = client.db(currentDB) + const collection = db.collection(collectionName) + + const exists = await collection.findOne({}) + if (exists) { + await collection.drop() + console.log(`🗑️ Successfully dropped collection: ${currentDB}.${collectionName}`) + } else { + // Use .listCollections for a more definitive check if needed, but drop() is usually safe. + console.log(`ℹ️ Collection ${collectionName} in ${currentDB} does not exist or is empty. Skipping drop.`) + } + } catch (error) { + // This catches general connection or other drop errors + console.error(`❌ Error dropping collection ${collectionName} in ${currentDB}: ${error.message}`) + } finally { + await client.close() + } +} + +/** + * Inserts data into the specified collection and provides detailed status messages. + * (This function is kept the same as your previous version for insertion logic) + * @param {string} collectionName The name of the collection. + * @param {Array} dataFile The array of documents to insert. + * @param {string} currentDB The name of the database. + */ +async function insertData(collectionName, dataFile, currentDB = dbName) { + const client = new MongoClient(url) + + try { + await client.connect() + const db = client.db(currentDB) + const collection = db.collection(collectionName) + + const data = dataFile + + if (!data || data.length === 0) { + return + } + + console.log(`\n--- Attempting insertion into: ${currentDB}.${collectionName} ---`) + + const results = [] + await Promise.all( + data.map(async (doc, index) => { + const tempId = doc._id || `(Document Index: ${index})` + + try { + const result = await collection.insertOne(doc) + const finalId = result.insertedId || doc._id + + results.push({ + id: finalId, + status: 'SUCCESS', + message: `Document successfully created with _id: ${finalId}`, + }) + } catch (error) { + if (error.code === DUPLICATE_KEY_ERROR_CODE) { + results.push({ + id: tempId, + status: 'DUPLICATE', + message: `The data with identifier ${tempId} is already present in the DB. Please ensure unique identifiers are provided or clean the existing data.`, + }) + } else { + // Catch other errors (e.g., validation failure, connection issues) + results.push({ + id: tempId, + status: 'FAILURE', + message: `Error inserting document ${tempId}: ${error.message}`, + }) + } + } + }) + ) + + // Print the detailed results + results.forEach((res) => { + let message = '' + if (res.status === 'SUCCESS') { + message = `✅ SUCCESS: ${res.message}` + } else if (res.status === 'DUPLICATE') { + message = `⚠️ DUPLICATE: ${res.message}` + } else { + message = `❌ FAILURE: ${res.message}` + } + console.log(message) + }) + } catch (globalError) { + console.error(`\nFatal error connecting to or operating on the database: ${globalError.message}`) + } finally { + await client.close() + } +} + +async function main({ dataToBeInserted }) { + const collectionsToInsert = [ + { name: 'entities', data: dataToBeInserted.entities, db: dbName2 }, + { name: 'entityTypes', data: dataToBeInserted.entityType, db: dbName2 }, + { name: 'programs', data: dataToBeInserted.programData, db: dbName }, + { name: 'solutions', data: dataToBeInserted.solutionData, db: dbName }, + { name: 'projectTemplates', data: dataToBeInserted.projectTemplatesData, db: dbName }, + { name: 'projectTemplateTasks', data: dataToBeInserted.projectTemplateTasksData, db: dbName }, + { name: 'certificateTemplates', data: dataToBeInserted.certificateTemplatesData, db: dbName }, + { name: 'certificateBaseTemplates', data: dataToBeInserted.certificateBaseTemplatesData, db: dbName }, + { name: 'projectCategories', data: dataToBeInserted.projectCategoriesData, db: dbName }, + { name: 'configurations', data: dataToBeInserted.configurationData, db: dbName }, + ] + + console.log(`\n=================================================`) + console.log( + `🗑️ Starting CLEANUP for ${dataToBeInserted === entityData ? 'Entity Data' : 'Project Data'} Collections...` + ) + console.log(`=================================================`) + + for (const item of collectionsToInsert) { + if (item.data) { + await cleanData(item.name, item.db) + } + } + + console.log(`\n=================================================`) + console.log( + `➕ Starting INSERTION for ${dataToBeInserted === entityData ? 'Entity Data' : 'Project Data'} Collections...` + ) + console.log(`=================================================`) + + for (const item of collectionsToInsert) { + if (item.data) { + await insertData(item.name, item.data, item.db) + } + } +} + +main({ dataToBeInserted: entityData }) + .then(() => { + console.log('\n=======================================') + console.log('✅ Entity data population process finished.') + console.log('=======================================') + }) + .catch(console.error) + +main({ dataToBeInserted: projectData }) + .then(() => { + console.log('\n=======================================') + console.log('✅ Project data population process finished.') + console.log('=======================================') + }) + .catch(console.error) diff --git a/documentation/3.4.0/native/scripts/stand-alone/ubuntu/install-dependencies.sh b/documentation/3.4.0/native/scripts/stand-alone/ubuntu/install-dependencies.sh new file mode 100644 index 00000000..f6cf5dd9 --- /dev/null +++ b/documentation/3.4.0/native/scripts/stand-alone/ubuntu/install-dependencies.sh @@ -0,0 +1,206 @@ +#!/bin/bash + +echo "Starting the installation script..." + +# Function to install Node.js LTS +install_nodejs() { + echo "Installing Node.js version 20..." + curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - + sudo DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs + sudo DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential +} + + +# Function to install Kafka +install_kafka() { + echo "Installing Kafka..." + sudo DEBIAN_FRONTEND=noninteractive apt install -y openjdk-11-jdk + sudo wget https://archive.apache.org/dist/kafka/3.5.0/kafka_2.12-3.5.0.tgz -O kafka.tgz + sudo tar xzf kafka.tgz -C /opt + sudo mv /opt/kafka_2.12-3.5.0 /opt/kafka + + echo "Creating Zookeeper service..." + sudo bash -c 'cat > /etc/systemd/system/zookeeper.service << EOF +[Unit] +Description=Apache Zookeeper service +Documentation=http://zookeeper.apache.org +Requires=network.target remote-fs.target +After=network.target remote-fs.target + +[Service] +Type=simple +ExecStart=/opt/kafka/bin/zookeeper-server-start.sh /opt/kafka/config/zookeeper.properties +ExecStop=/opt/kafka/bin/zookeeper-server-stop.sh +Restart=on-abnormal + +[Install] +WantedBy=multi-user.target +EOF' + + echo "Creating Kafka service..." + sudo bash -c 'cat > /etc/systemd/system/kafka.service << EOF +[Unit] +Description=Apache Kafka Service +Documentation=http://kafka.apache.org/documentation.html +Requires=zookeeper.service + +[Service] +Type=simple +Environment="JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64" +ExecStart=/opt/kafka/bin/kafka-server-start.sh /opt/kafka/config/server.properties +ExecStop=/opt/kafka/bin/kafka-server-stop.sh + +[Install] +WantedBy=multi-user.target +EOF' + + sudo systemctl daemon-reload + sudo systemctl start zookeeper + sudo systemctl start kafka +} + +# Function to install Redis +install_redis() { + echo "Installing Redis..." + sudo apt update + sudo DEBIAN_FRONTEND=noninteractive apt install -y redis-server + sudo sed -i 's/^# *supervised .*/supervised systemd/' /etc/redis/redis.conf + sudo systemctl restart redis.service +} + +# Function to install Redis BullMQ (as a global Node.js package) +install_bullmq() { + echo "Installing Redis BullMQ..." + sudo npm install -g bullmq + echo "Redis BullMQ has been installed globally." +} + +# Function to install Citus +install_citus() { + echo "Installing Citus..." + + # Ensure the 'postgres' user exists + if ! id "postgres" &>/dev/null; then + echo "Creating postgres user..." + sudo useradd -m -s /bin/bash postgres + echo "postgres user created." + else + echo "postgres user already exists." + fi + + # Download and install the Citus repository setup script + curl https://install.citusdata.com/community/deb.sh | sudo bash + + # Install Citus along with PostgreSQL + sudo DEBIAN_FRONTEND=noninteractive apt-get install -y postgresql-16-citus-12.1 + + # Switch to the postgres user + sudo su - postgres <> ~/citus/postgresql.conf + + # Start the Citus server + pg_ctl -D ~/citus -o "-p 9700" -l ~/citus_logfile start + + # Create the Citus extension + psql -p 9700 -c "CREATE EXTENSION citus;" + + # Check the Citus version + PSQL_OUTPUT=\$(psql -p 9700 -c "select citus_version();") + echo "\$PSQL_OUTPUT" + +EOF +} + +# Function to install PM2 +install_pm2() { + echo "Installing PM2..." + sudo npm install pm2@latest -g +} + +# Function to install MongoDB +install_mongo() { + echo "Installing MongoDB 4.4.14..." + + # Import MongoDB public GPG key + wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add - + + # Create the MongoDB source list for Ubuntu (MongoDB 4.4) + echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu $(lsb_release -cs)/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list + + # Update apt and install MongoDB version 4.4.14 + sudo apt update + sudo DEBIAN_FRONTEND=noninteractive apt install -y mongodb-org=4.4.14 mongodb-org-server=4.4.14 mongodb-org-shell=4.4.14 mongodb-org-mongos=4.4.14 mongodb-org-tools=4.4.14 + + # Start and enable MongoDB service + sudo systemctl start mongod + sudo systemctl enable mongod + echo "MongoDB 4.4.14 has been installed and started." +} + + +# Function to install Gotenberg (via Docker) +install_gotenberg() { + echo "Installing Docker (required for Gotenberg)..." + + # Install Docker + sudo apt update + sudo DEBIAN_FRONTEND=noninteractive apt install -y docker.io + + # Start and enable Docker service + sudo systemctl start docker + sudo systemctl enable docker + + echo "Docker installed. Pulling Gotenberg Docker image..." + + # Pull and run Gotenberg Docker container + sudo docker pull gotenberg/gotenberg:7 + sudo docker run -d --name gotenberg -p 3000:3000 gotenberg/gotenberg:7 + + echo "Gotenberg has been installed and started on port 3000." +} + +# Function to display options +display_menu() { + echo "Please select an installation option:" + options=("Install Node.js" "Install Kafka" "Install Redis" "Install Citus" "Install PM2" "Install MongoDB" "Install Gotenberg" "Exit") + for i in ${!options[@]}; do + echo "$((i+1)). ${options[i]}" + done +} + +# Main menu +display_menu + +while true; do + read -p "Enter your choice (1-${#options[@]}): " choice + if (( choice > 0 && choice <= ${#options[@]} )); then + case $choice in + 1) install_nodejs ;; + 2) install_kafka ;; + 3) install_redis ;; + 4) install_citus ;; + 5) install_pm2 ;; + 6) install_mongo ;; + 7) install_gotenberg ;; + 8) echo "Exiting the installation script."; break ;; + *) echo "Invalid option. Please try again." ;; + esac + echo "Operation completed. Here are the next options:" + display_menu + else + echo "Invalid option. Please try again." + fi +done + +echo "Installation script completed." diff --git a/documentation/3.4.0/native/scripts/stand-alone/ubuntu/project_entity_sample_data.sh b/documentation/3.4.0/native/scripts/stand-alone/ubuntu/project_entity_sample_data.sh new file mode 100644 index 00000000..035742a6 --- /dev/null +++ b/documentation/3.4.0/native/scripts/stand-alone/ubuntu/project_entity_sample_data.sh @@ -0,0 +1,57 @@ +#!/bin/bash +# ---------------------------------------------------------------------- +# ELEVATE Project Data Setup Script +# +# This script performs the following actions: +# 1. Downloads sample data files from the ELEVATE-Project GitHub repository. +# 2. Installs the 'mongoose' package (required to run the sample scripts). +# 3. Executes the sample data insertion script using Node.js. +# ---------------------------------------------------------------------- + +# Exit immediately if a command exits with a non-zero status (ensures script stops on download failure) +set -e + +echo "Starting data setup script..." + +# --- 1. Define URL and Files --- +BASE_URL="https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/scripts/stand-alone/ubuntu" + +ENTITY_FILE="entity_sampleData.js" +PROJECT_FILE="project_sampleData.js" +INSERT_SCRIPT="insert_sample_solutions.js" + +# --- 2. Download Files --- +echo "1. Downloading sample data files..." + +# Download entity_sampleData.js +curl -L "${BASE_URL}/${ENTITY_FILE}" -o "${ENTITY_FILE}" +echo "Downloaded ${ENTITY_FILE}" + +# Download project_sampleData.js +curl -L "${BASE_URL}/${PROJECT_FILE}" -o "${PROJECT_FILE}" +echo "Downloaded ${PROJECT_FILE}" + +# Download insert_sample_solutions.js (saved correctly to be run by node) +curl -L "${BASE_URL}/${INSERT_SCRIPT}" -o "${INSERT_SCRIPT}" +echo "Downloaded ${INSERT_SCRIPT}" + +# NOTE on Original Request: If you need to populate 'user/src/.env' with a specific file, +# you would add another 'curl' command here, but the file you linked was a JS script. + +echo "" +echo "2. Installing required Node packages (mongoose, mongodb)..." + +# Initialize a package.json file if one doesn't exist to prevent climbing up the directory tree +if [ ! -f "package.json" ]; then + npm init -y > /dev/null +fi +npm install mongoose +npm install mongodb + +# --- 4. Run Insertion Script --- +echo "" +echo "3. Running the sample data insertion script..." +node "${INSERT_SCRIPT}" + +echo "" +echo "--- Data setup complete! ---" \ No newline at end of file diff --git a/documentation/3.4.0/native/scripts/stand-alone/ubuntu/project_sampleData.js b/documentation/3.4.0/native/scripts/stand-alone/ubuntu/project_sampleData.js new file mode 100644 index 00000000..513763ae --- /dev/null +++ b/documentation/3.4.0/native/scripts/stand-alone/ubuntu/project_sampleData.js @@ -0,0 +1,1631 @@ +const { ObjectId } = require('mongodb') + +let solutionData = [ + { + _id: new ObjectId('68ee4bb3fb9bee08b93b6d68'), + resourceType: ['Improvement Project Solution'], + language: ['English'], + keywords: ['Improvement Project'], + concepts: [], + themes: [], + flattenedThemes: [], + entities: [], + registry: [], + isRubricDriven: false, + enableQuestionReadOut: false, + captureGpsLocationAtQuestionLevel: false, + isAPrivateProgram: false, + allowMultipleAssessemts: false, + isDeleted: false, + pageHeading: 'Domains', + minNoOfSubmissionsRequired: 1, + rootOrganisations: [], + createdFor: [], + submissionLevel: 'USER', + availableForPrivateConsumption: true, + parentEntityKey: null, + deleted: false, + programExternalId: 'Testing_for_prTGCEBGFFRYVBDFGJ7DGDGF12SDFGHJ345CVBNMDRGYY', + entityType: 'school', + externalId: 'PROJ19099023DGHG789SDASDFGHR4567-1760447411369-PROJECT-SOLUTION', + name: 'pro with obsasatask oct 8 facilitator only 2nd', + description: 'To construct a wired car using a DPDT switch.', + isReusable: false, + startDate: new Date('2025-09-09T00:00:00.000Z'), + endDate: new Date('2026-09-09T18:29:59.000Z'), + subType: 'improvementProject', + type: 'improvementProject', + programId: new ObjectId('68ee4b79fb9bee08b93b6d34'), + programName: 'custom observation as a task check on oct 14th facilitator', + programDescription: 'custom observation as a task check on oct 14th facilitator', + status: 'active', + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-10-14T13:11:17.993Z'), + createdAt: new Date('2025-10-14T13:10:11.897Z'), + __v: 0, + scope: { + professional_role: ['68876746b19aea00144c2af9'], + professional_subroles: ['688767deb19aea00144c2b08'], + organizations: ['default_code'], + state: ['6852c86c7248c20014b38a4d'], + district: ['6852c8ae7248c20014b38a57'], + block: ['ALL'], + cluster: ['ALL'], + school: ['ALL'], + }, + projectTemplateId: new ObjectId('68ee4bb3fb9bee08b93b6d70'), + updatedBy: '1', + author: '1', + creator: 'Mallanagouda', + certificateTemplateId: new ObjectId('68ee4bf5fb9bee08b93b6d97'), + link: 'f8a8e9ba397a29cf75ad5057db6cb7f9', + }, + { + _id: new ObjectId('68e8c635201642091e014914'), + resourceType: ['Improvement Project Solution'], + language: ['English'], + keywords: ['Improvement Project'], + concepts: [], + themes: [], + flattenedThemes: [], + entities: [], + registry: [], + isRubricDriven: false, + enableQuestionReadOut: false, + captureGpsLocationAtQuestionLevel: false, + isAPrivateProgram: false, + allowMultipleAssessemts: false, + isDeleted: false, + pageHeading: 'Domains', + minNoOfSubmissionsRequired: 1, + rootOrganisations: [], + createdFor: [], + submissionLevel: 'USER', + availableForPrivateConsumption: true, + parentEntityKey: null, + deleted: false, + programExternalId: 'Testing_for_prTGCEBGFFRYVBDFGJ7DGDGF123456', + entityType: 'school', + externalId: 'PROJ190909764HJHF123FGHHcvvbgd-1760085557008-PROJECT-SOLUTION', + name: 'Testing Project For LED IMP facilitator only', + description: 'To construct a wired car using a DPDT switch.', + isReusable: false, + startDate: new Date('2025-09-09T00:00:00.000Z'), + endDate: new Date('2026-09-09T18:29:59.000Z'), + subType: 'improvementProject', + type: 'improvementProject', + programId: new ObjectId('68e8c284201642091e0148c1'), + programName: 'custom observation as a task check on oct 10th facilitator', + programDescription: 'custom observation as a task check on oct 10th facilitator', + status: 'active', + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-10-10T08:40:22.617Z'), + createdAt: new Date('2025-10-10T08:39:17.519Z'), + __v: 0, + scope: { + professional_role: ['68876746b19aea00144c2af9'], + professional_subroles: ['688767deb19aea00144c2b08'], + organizations: ['default_code'], + state: ['6852c86c7248c20014b38a4d'], + district: ['6852c8ae7248c20014b38a57'], + block: ['ALL'], + cluster: ['ALL'], + school: ['ALL'], + }, + projectTemplateId: new ObjectId('68e8c635201642091e01491c'), + updatedBy: '1', + author: '1', + creator: 'Mallanagouda', + certificateTemplateId: new ObjectId('68e8c676201642091e014943'), + link: '178ac1fdff5b367ef3335ce0e1665a6c', + }, + { + _id: new ObjectId('68c98d9538aee0086ee61096'), + resourceType: ['Improvement Project Solution'], + language: ['English'], + keywords: ['Improvement Project'], + concepts: [], + themes: [], + flattenedThemes: [], + entities: [], + registry: [], + isRubricDriven: false, + enableQuestionReadOut: false, + captureGpsLocationAtQuestionLevel: false, + isAPrivateProgram: false, + allowMultipleAssessemts: false, + isDeleted: false, + pageHeading: 'Domains', + minNoOfSubmissionsRequired: 1, + rootOrganisations: [], + createdFor: [], + submissionLevel: 'USER', + availableForPrivateConsumption: true, + parentEntityKey: null, + deleted: false, + programExternalId: 'ProgramTestKey1', + entityType: 'school', + externalId: 'ProjectIdtestKey1-1758039445176-PROJECT-SOLUTION', + name: 'Project name sep 16 9 30', + description: + 'Gathers insights from teachers regarding available resources, training needs, and challenges faced in classrooms.', + isReusable: false, + startDate: new Date('2025-07-29T18:30:00.000Z'), + endDate: new Date('2026-01-30T18:29:59.000Z'), + subType: 'improvementProject', + type: 'improvementProject', + programId: new ObjectId('68c98d8f38aee0086ee61070'), + programName: 'Program name is sep 16 9 30', + programDescription: 'Description of the Program', + status: 'active', + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-09-16T16:17:25.599Z'), + createdAt: new Date('2025-09-16T16:17:25.472Z'), + __v: 0, + scope: { + professional_role: ['ALL'], + professional_subroles: ['ALL'], + organizations: ['default_code'], + state: ['ALL'], + district: ['ALL'], + block: ['ALL'], + cluster: ['ALL'], + school: ['ALL'], + }, + projectTemplateId: new ObjectId('68c98d9538aee0086ee6109e'), + }, + { + _id: new ObjectId('68d3b9a72ba17cc3cb238821'), + resourceType: ['Improvement Project Solution'], + language: ['English'], + keywords: ['Improvement Project'], + concepts: [], + themes: [], + flattenedThemes: [], + entities: [], + registry: [], + isRubricDriven: false, + enableQuestionReadOut: false, + captureGpsLocationAtQuestionLevel: false, + isAPrivateProgram: false, + allowMultipleAssessemts: false, + isDeleted: false, + pageHeading: 'Domains', + minNoOfSubmissionsRequired: 1, + rootOrganisations: [], + createdFor: [], + submissionLevel: 'USER', + availableForPrivateConsumption: true, + parentEntityKey: null, + deleted: false, + programExternalId: 'SUP_as_a_task_test_sept_24_1500', + entityType: 'school', + externalId: 'DPDTSCH012025-1758706081315-PROJECT-SOLUTION', + name: 'project sup test with obs or sur tasks sep 23 1520', + description: 'To construct a wired car using a DPDT switch.', + isReusable: false, + startDate: new Date('2025-07-29T18:30:00.000Z'), + endDate: new Date('2025-12-30T18:29:59.000Z'), + subType: 'improvementProject', + type: 'improvementProject', + programId: new ObjectId('68d3b9681e09f9b5b1e0693d'), + programName: 'SUP_as_a_task_test_sept_24_1500', + programDescription: 'This is the description of the program.', + status: 'active', + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-09-24T09:28:19.783Z'), + createdAt: new Date('2025-09-24T09:28:07.900Z'), + __v: 0, + scope: { + professional_role: ['ALL'], + professional_subroles: ['688767deb19aea00144c2b08'], + organizations: ['default_code'], + state: ['ALL'], + district: ['ALL', '6852c8ae7248c20014b38a57'], + block: ['ALL'], + cluster: ['ALL'], + school: ['ALL'], + }, + projectTemplateId: new ObjectId('68d3b9a92ba17cc3cb238829'), + updatedBy: '1', + author: '1', + creator: 'Mallanagouda', + link: 'a0acc357edbcf3287e9767d20a7d9f12', + }, +] + +let programData = [ + { + _id: new ObjectId('68ee4b79fb9bee08b93b6d34'), + resourceType: ['program'], + language: ['English'], + keywords: ['CBSE', 'SQAA'], + concepts: [], + components: [ + { + _id: new ObjectId('68ee4bb3fb9bee08b93b6d68'), + order: 1, + }, + ], + isAPrivateProgram: false, + isDeleted: false, + requestForPIIConsent: true, + rootOrganisations: [], + createdFor: [], + deleted: false, + status: 'active', + owner: '1', + createdBy: '1', + updatedBy: '1', + externalId: 'Testing_for_prTGCEBGFFRYVBDFGJ7DGDGF12SDFGHJ345CVBNMDRGYY', + name: 'custom observation as a task check on oct 14th facilitator', + description: 'custom observation as a task check on oct 14th facilitator', + startDate: new Date('2025-09-08T18:30:00.000Z'), + endDate: new Date('2026-09-09T18:29:59.000Z'), + imageCompression: { + quality: 10, + }, + metaInformation: { + state: ['Tripura'], + recommendedFor: ['Facilitator'], + }, + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-10-14T13:18:46.936Z'), + createdAt: new Date('2025-10-14T13:09:13.649Z'), + __v: 0, + scope: { + professional_role: ['68876746b19aea00144c2af9'], + professional_subroles: ['688767deb19aea00144c2b08'], + organizations: ['default_code'], + state: ['6852c86c7248c20014b38a4d'], + district: ['6852c8ae7248c20014b38a57'], + block: ['ALL'], + cluster: ['ALL'], + school: ['ALL'], + }, + }, + { + _id: new ObjectId('68e8c284201642091e0148c1'), + resourceType: ['program'], + language: ['English'], + keywords: ['CBSE', 'SQAA'], + concepts: [], + components: [ + { + _id: new ObjectId('68e8c635201642091e014914'), + order: 1, + }, + ], + isAPrivateProgram: false, + isDeleted: false, + requestForPIIConsent: true, + rootOrganisations: [], + createdFor: [], + deleted: false, + status: 'active', + owner: '1', + createdBy: '1', + updatedBy: '1', + externalId: 'Testing_for_prTGCEBGFFRYVBDFGJ7DGDGF123456', + name: 'custom observation as a task check on oct 10th facilitator', + description: 'custom observation as a task check on oct 10th facilitator', + startDate: new Date('2025-09-08T18:30:00.000Z'), + endDate: new Date('2026-09-09T18:29:59.000Z'), + imageCompression: { + quality: 10, + }, + metaInformation: { + state: ['Tripura'], + recommendedFor: ['Facilitator'], + }, + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-10-10T08:44:35.535Z'), + createdAt: new Date('2025-10-10T08:23:32.295Z'), + __v: 0, + scope: { + professional_role: ['68876746b19aea00144c2af9'], + professional_subroles: ['688767deb19aea00144c2b08'], + organizations: ['default_code'], + state: ['6852c86c7248c20014b38a4d'], + district: ['6852c8ae7248c20014b38a57'], + block: ['ALL'], + cluster: ['ALL'], + school: ['ALL'], + }, + }, + { + _id: new ObjectId('68c98d8f38aee0086ee61070'), + resourceType: ['program'], + language: ['English'], + keywords: [], + concepts: [], + components: [ + { + _id: new ObjectId('68c98d9538aee0086ee61096'), + order: 1, + }, + ], + isAPrivateProgram: false, + isDeleted: false, + requestForPIIConsent: true, + rootOrganisations: [], + createdFor: [], + deleted: false, + status: 'active', + owner: '1', + createdBy: '1', + updatedBy: '1', + externalId: 'ProgramTestKey1', + name: 'Program name is sep 16 9 30', + description: 'Description of the Program', + metaInformation: { + state: ['Tripura'], + recommendedFor: ['functionaries-officials', 'teacher-educators-coordinators'], + }, + imageCompression: { + quality: 10, + }, + startDate: new Date('2025-07-29T18:30:00.000Z'), + endDate: new Date('2026-01-30T18:29:59.000Z'), + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-09-16T17:06:14.752Z'), + createdAt: new Date('2025-09-16T16:17:19.239Z'), + __v: 0, + scope: { + professional_role: ['68876746b19aea00144c2af9'], + professional_subroles: ['688767deb19aea00144c2b08'], + organizations: ['default_code'], + state: ['6852c86c7248c20014b38a4d'], + district: ['6852c8ae7248c20014b38a57'], + block: ['ALL'], + cluster: ['ALL'], + school: ['ALL'], + }, + }, + { + _id: new ObjectId('68d3b9681e09f9b5b1e0693d'), + resourceType: ['program'], + language: ['English'], + keywords: [], + concepts: [], + components: [ + { + _id: new ObjectId('68d3b9a72ba17cc3cb238821'), + order: 1, + }, + ], + isAPrivateProgram: false, + isDeleted: false, + requestForPIIConsent: true, + rootOrganisations: [], + createdFor: [], + deleted: false, + status: 'active', + owner: '1', + createdBy: '1', + updatedBy: '1', + externalId: 'SUP_as_a_task_test_sept_24_1500', + name: 'SUP_as_a_task_test_sept_24_1500 oct 3', + description: 'This is the description of the program.', + metaInformation: { + state: ['Tripura'], + recommendedFor: ['functionaries-officials'], + }, + imageCompression: { + quality: 10, + }, + startDate: new Date('2025-07-29T18:30:00.000Z'), + endDate: new Date('2025-12-30T18:29:59.000Z'), + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-10-03T09:20:39.907Z'), + createdAt: new Date('2025-09-24T09:27:04.322Z'), + __v: 0, + scope: { + professional_role: ['68876746b19aea00144c2af9'], + professional_subroles: ['688767deb19aea00144c2b08'], + organizations: ['default_code'], + state: ['6852c86c7248c20014b38a4d'], + district: ['6852c8ae7248c20014b38a57'], + block: ['ALL'], + cluster: ['ALL'], + school: ['ALL'], + }, + }, +] + +let projectTemplatesData = [ + { + _id: new ObjectId('68ee4bb3fb9bee08b93b6d70'), + description: 'To construct a wired car using a DPDT switch.', + concepts: [''], + keywords: ['Science, Activity Based Learning, STEM Education, STEM Lab, DPDT Switch Car'], + isDeleted: false, + recommendedFor: ['Learner'], + tasks: [ + new ObjectId('68ee4bb4fb9bee08b93b6d7a'), + new ObjectId('68ee4bb4fb9bee08b93b6d7e'), + new ObjectId('68ee4bb4fb9bee08b93b6d82'), + new ObjectId('68ee4bb4fb9bee08b93b6d86'), + ], + createdBy: '1', + updatedBy: '1', + learningResources: [], + isReusable: false, + taskSequence: [ + 'DPDTSC-HandBook-1-2025-Task2-1760447411369-1760447412188', + 'DPDTSC-HandBook-1-2025-Task3-1760447411369-1760447412197', + 'DPDTSC-HandBook-1-2025-Task4-1760447411369-1760447412206', + 'DPDTSC-HandBook-1-2025-Task5-1760447411369-1760447412214', + ], + averageRating: 0, + noOfRatings: 0, + ratings: { + 1: 0, + 2: 0, + 3: 0, + 4: 0, + 5: 0, + }, + importCount: 0, + evidences: [], + isPrivate: false, + hasSpotlight: false, + hasStory: false, + text: [], + visibility: 'CURRENT', + visibleToOrganizations: ['default_code'], + deleted: false, + title: 'pro with obsasatask oct 8 facilitator only 2nd', + externalId: 'PROJ19099023DGHG789SDASDFGHR4567-1760447411369_IMPORTED', + categories: [ + { + _id: new ObjectId('685ae6a0cb7c7200145dadae'), + externalId: 'teachers', + name: 'teachers', + }, + ], + entityType: '', + taskCreationForm: '', + durationInDays: 365, + metaInformation: { + testimonials: [], + goal: 'TEMP', + rationale: '', + primaryAudience: '', + duration: '1 year', + successIndicators: '', + risks: '', + approaches: '', + }, + status: 'published', + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-10-14T13:11:17.899Z'), + createdAt: new Date('2025-10-14T13:10:11.630Z'), + __v: 0, + solutionId: new ObjectId('68ee4bb3fb9bee08b93b6d68'), + solutionExternalId: 'PROJ19099023DGHG789SDASDFGHR4567-1760447411369-PROJECT-SOLUTION', + programId: new ObjectId('68ee4b79fb9bee08b93b6d34'), + programExternalId: 'Testing_for_prTGCEBGFFRYVBDFGJ7DGDGF12SDFGHJ345CVBNMDRGYY', + parentTemplateId: new ObjectId('68ee4bb3fb9bee08b93b6d4c'), + certificateTemplateId: new ObjectId('68ee4bf5fb9bee08b93b6d97'), + }, + { + _id: new ObjectId('68e8c635201642091e01491c'), + description: 'To construct a wired car using a DPDT switch.', + concepts: [''], + keywords: ['Science, Activity Based Learning, STEM Education, STEM Lab, DPDT Switch Car'], + isDeleted: false, + recommendedFor: ['Learner'], + tasks: [ + new ObjectId('68e8c635201642091e014926'), + new ObjectId('68e8c635201642091e01492a'), + new ObjectId('68e8c635201642091e01492e'), + new ObjectId('68e8c635201642091e014932'), + ], + createdBy: '1', + updatedBy: '1', + learningResources: [], + isReusable: false, + taskSequence: [ + 'DPDTSC-HandBook-1-2025-Task2-1760085557008-1760085557809', + 'DPDTSC-HandBook-1-2025-Task3-1760085557008-1760085557818', + 'DPDTSC-HandBook-1-2025-Task4-1760085557008-1760085557827', + 'DPDTSC-HandBook-1-2025-Task5-1760085557008-1760085557835', + ], + averageRating: 0, + noOfRatings: 0, + ratings: { + 1: 0, + 2: 0, + 3: 0, + 4: 0, + 5: 0, + }, + importCount: 0, + evidences: [], + isPrivate: false, + hasSpotlight: false, + hasStory: false, + text: [], + visibility: 'CURRENT', + visibleToOrganizations: ['default_code'], + deleted: false, + title: 'Testing Project For LED IMP facilitator only', + externalId: 'PROJ190909764HJHF123FGHHcvvbgd-1760085557008_IMPORTED', + categories: [ + { + _id: new ObjectId('685ae6a0cb7c7200145dadae'), + externalId: 'teachers', + name: 'teachers', + }, + ], + entityType: '', + taskCreationForm: '', + durationInDays: 365, + metaInformation: { + testimonials: [], + goal: 'TEMP', + rationale: '', + primaryAudience: '', + duration: '1 year', + successIndicators: '', + risks: '', + approaches: '', + }, + status: 'published', + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-10-10T08:40:22.544Z'), + createdAt: new Date('2025-10-10T08:39:17.260Z'), + __v: 0, + solutionId: new ObjectId('68e8c635201642091e014914'), + solutionExternalId: 'PROJ190909764HJHF123FGHHcvvbgd-1760085557008-PROJECT-SOLUTION', + programId: new ObjectId('68e8c284201642091e0148c1'), + programExternalId: 'Testing_for_prTGCEBGFFRYVBDFGJ7DGDGF123456', + parentTemplateId: new ObjectId('68e8c635201642091e0148f8'), + certificateTemplateId: new ObjectId('68e8c676201642091e014943'), + }, + { + _id: new ObjectId('68c98d9538aee0086ee6109e'), + description: + 'Gathers insights from teachers regarding available resources, training needs, and challenges faced in classrooms.', + concepts: [''], + keywords: ['Science, Activity Based Learning, STEM Education, STEM Lab, DPDT Switch Car'], + isDeleted: false, + recommendedFor: [''], + tasks: [ + new ObjectId('68c98d9538aee0086ee610a2'), + new ObjectId('68c98d9538aee0086ee610a6'), + new ObjectId('68c98d9538aee0086ee610aa'), + ], + createdBy: '1', + updatedBy: '1', + learningResources: [], + isReusable: false, + taskSequence: [ + 'Task1-1758039445176-1758039445561', + 'Task2-1758039445176-1758039445567', + 'Task3-1758039445176-1758039445575', + ], + averageRating: 0, + noOfRatings: 0, + ratings: { + 1: 0, + 2: 0, + 3: 0, + 4: 0, + 5: 0, + }, + importCount: 0, + evidences: [], + isPrivate: false, + hasSpotlight: false, + hasStory: false, + text: [], + deleted: false, + title: 'Project name sep 16 9 30', + externalId: 'ProjectIdtestKey1-1758039445176_IMPORTED', + categories: [ + { + _id: new ObjectId('685ae6a0cb7c7200145dadae'), + externalId: 'teachers', + name: 'teachers', + }, + ], + entityType: '', + taskCreationForm: '', + durationInDays: 365, + metaInformation: { + testimonials: [], + goal: 'TEMP', + rationale: '', + primaryAudience: '', + duration: '1 year', + successIndicators: '', + risks: '', + approaches: '', + }, + status: 'published', + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-09-16T16:17:25.596Z'), + createdAt: new Date('2025-09-16T16:17:25.301Z'), + __v: 0, + solutionId: new ObjectId('68c98d9538aee0086ee61096'), + solutionExternalId: 'ProjectIdtestKey1-1758039445176-PROJECT-SOLUTION', + programId: new ObjectId('68c98d8f38aee0086ee61070'), + programExternalId: 'ProgramTestKey1', + parentTemplateId: new ObjectId('68c98d9538aee0086ee6107a'), + }, + { + _id: new ObjectId('68d3b9a92ba17cc3cb238829'), + description: 'To construct a wired car using a DPDT switch.', + concepts: [''], + keywords: ['Science, Activity Based Learning, STEM Education, STEM Lab, DPDT Switch Car'], + isDeleted: false, + recommendedFor: ['Learner'], + tasks: [ + new ObjectId('68d3b9ad2ba17cc3cb238837'), + new ObjectId('68d3b9ad2ba17cc3cb23883b'), + new ObjectId('68d3b9ae2ba17cc3cb23883f'), + ], + createdBy: '1', + updatedBy: '1', + learningResources: [], + isReusable: false, + taskSequence: [ + 'DPDTSC-HandBook-1/2025-Task3-1758706081315-1758706093343', + 'DPDTSC-HandBook-1/2025-Task4-1758706081315-1758706093849', + 'DPDTSC-HandBook-1/2025-Task5-1758706081315-1758706094241', + ], + averageRating: 0, + noOfRatings: 0, + ratings: { + 1: 0, + 2: 0, + 3: 0, + 4: 0, + 5: 0, + }, + importCount: 0, + evidences: [], + isPrivate: false, + hasSpotlight: false, + hasStory: false, + text: [], + deleted: false, + title: 'project sup test with obs or sur tasks sep 23 1520', + externalId: 'DPDTSCH012025-1758706081315_IMPORTED', + categories: [ + { + _id: new ObjectId('685ae6a0cb7c7200145dadae'), + externalId: 'teachers', + name: 'teachers', + }, + ], + entityType: '', + taskCreationForm: '', + durationInDays: 365, + metaInformation: { + testimonials: [], + goal: 'TEMP', + rationale: '', + primaryAudience: '', + duration: '1 year', + successIndicators: '', + risks: '', + approaches: '', + }, + status: 'published', + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-09-24T09:28:14.561Z'), + createdAt: new Date('2025-09-24T09:28:03.404Z'), + __v: 0, + solutionId: new ObjectId('68d3b9a72ba17cc3cb238821'), + solutionExternalId: 'DPDTSCH012025-1758706081315-PROJECT-SOLUTION', + programId: new ObjectId('68d3b9681e09f9b5b1e0693d'), + programExternalId: 'SUP_as_a_task_test_sept_24_1500', + parentTemplateId: new ObjectId('68d3b9a32ba17cc3cb238805'), + }, +] + +let projectTemplateTasksData = [ + { + _id: new ObjectId('68ee4bb4fb9bee08b93b6d7a'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [ + { + name: 'Activity Steps (Video)', + link: 'https://youtu.be/MNvM_H9zD3Y?si=BdfslSzCkmDCggih', + app: 'projectService', + id: 'MNvM_H9zD3Y?si=BdfslSzCkmDCggih', + }, + ], + deleted: false, + type: 'content', + projectTemplateId: new ObjectId('68ee4bb3fb9bee08b93b6d70'), + projectTemplateExternalId: 'PROJ19099023DGHG789SDASDFGHR4567-1760447411369_IMPORTED', + name: 'Watch the Activity Video', + externalId: 'DPDTSC-HandBook-1-2025-Task2-1760447411369-1760447412188', + description: '', + sequenceNumber: '2', + tenantId: 'default', + orgId: 'default_code', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '01/08/2025', + endDate: '31/12/2025', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-10-14T13:10:12.192Z'), + createdAt: new Date('2025-10-14T13:10:11.805Z'), + __v: 0, + }, + { + _id: new ObjectId('68ee4bb4fb9bee08b93b6d7e'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [], + deleted: false, + type: 'simple', + projectTemplateId: new ObjectId('68ee4bb3fb9bee08b93b6d70'), + projectTemplateExternalId: 'PROJ19099023DGHG789SDASDFGHR4567-1760447411369_IMPORTED', + name: 'Conduct the Activity with students', + externalId: 'DPDTSC-HandBook-1-2025-Task3-1760447411369-1760447412197', + description: '', + sequenceNumber: '3', + tenantId: 'default', + orgId: 'default_code', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '01/08/2025', + endDate: '31/12/2025', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-10-14T13:10:12.202Z'), + createdAt: new Date('2025-10-14T13:10:11.813Z'), + __v: 0, + }, + { + _id: new ObjectId('68ee4bb4fb9bee08b93b6d82'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [ + { + name: 'learn', + link: 'https://drive.google.com/file/d/1HOaFxlahxEzc5HOeFqVTw3V_yszmHFbZ/view?usp=drive_link', + app: 'projectService', + id: 'view?usp=drive_link', + }, + ], + deleted: false, + type: 'content', + projectTemplateId: new ObjectId('68ee4bb3fb9bee08b93b6d70'), + projectTemplateExternalId: 'PROJ19099023DGHG789SDASDFGHR4567-1760447411369_IMPORTED', + name: 'Conduct the Activity Assessment', + externalId: 'DPDTSC-HandBook-1-2025-Task4-1760447411369-1760447412206', + description: '', + sequenceNumber: '4', + tenantId: 'default', + orgId: 'default_code', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '01/08/2025', + endDate: '31/12/2025', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-10-14T13:10:12.210Z'), + createdAt: new Date('2025-10-14T13:10:11.825Z'), + __v: 0, + }, + { + _id: new ObjectId('68ee4bb4fb9bee08b93b6d86'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [ + { + name: 'walking', + link: 'https://drive.google.com/file/d/1eGLKxFb9BaeroTeIOlXoO8XCxyah7fM9/view?usp=sharing', + app: 'projectService', + id: 'view?usp=sharing', + }, + ], + deleted: false, + type: 'content', + projectTemplateId: new ObjectId('68ee4bb3fb9bee08b93b6d70'), + projectTemplateExternalId: 'PROJ19099023DGHG789SDASDFGHR4567-1760447411369_IMPORTED', + name: "Log into the scanner app and scan the OMR sheets (check that the students' names are appearing on scanning the OMR)", + externalId: 'DPDTSC-HandBook-1-2025-Task5-1760447411369-1760447412214', + description: '', + sequenceNumber: '5', + tenantId: 'default', + orgId: 'default_code', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '01/08/2025', + endDate: '31/12/2025', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-10-14T13:10:12.218Z'), + createdAt: new Date('2025-10-14T13:10:11.833Z'), + __v: 0, + }, + { + _id: new ObjectId('68e8c635201642091e014926'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [ + { + name: 'Activity Steps (Video)', + link: 'https://youtu.be/MNvM_H9zD3Y?si=BdfslSzCkmDCggih', + app: 'projectService', + id: 'MNvM_H9zD3Y?si=BdfslSzCkmDCggih', + }, + ], + deleted: false, + type: 'content', + projectTemplateId: new ObjectId('68e8c635201642091e01491c'), + projectTemplateExternalId: 'PROJ190909764HJHF123FGHHcvvbgd-1760085557008_IMPORTED', + name: 'Watch the Activity Video', + externalId: 'DPDTSC-HandBook-1-2025-Task2-1760085557008-1760085557809', + description: '', + sequenceNumber: '2', + tenantId: 'default', + orgId: 'default_code', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '01/08/2026', + endDate: '31/12/2026', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-10-10T08:39:17.813Z'), + createdAt: new Date('2025-10-10T08:39:17.430Z'), + __v: 0, + }, + { + _id: new ObjectId('68e8c635201642091e01492a'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [], + deleted: false, + type: 'simple', + projectTemplateId: new ObjectId('68e8c635201642091e01491c'), + projectTemplateExternalId: 'PROJ190909764HJHF123FGHHcvvbgd-1760085557008_IMPORTED', + name: 'Conduct the Activity with students', + externalId: 'DPDTSC-HandBook-1-2025-Task3-1760085557008-1760085557818', + description: '', + sequenceNumber: '3', + tenantId: 'default', + orgId: 'default_code', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '01/08/2027', + endDate: '31/12/2027', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-10-10T08:39:17.822Z'), + createdAt: new Date('2025-10-10T08:39:17.439Z'), + __v: 0, + }, + { + _id: new ObjectId('68e8c635201642091e01492e'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [ + { + name: 'learn', + link: 'https://drive.google.com/file/d/1HOaFxlahxEzc5HOeFqVTw3V_yszmHFbZ/view?usp=drive_link', + app: 'projectService', + id: 'view?usp=drive_link', + }, + ], + deleted: false, + type: 'content', + projectTemplateId: new ObjectId('68e8c635201642091e01491c'), + projectTemplateExternalId: 'PROJ190909764HJHF123FGHHcvvbgd-1760085557008_IMPORTED', + name: 'Conduct the Activity Assessment', + externalId: 'DPDTSC-HandBook-1-2025-Task4-1760085557008-1760085557827', + description: '', + sequenceNumber: '4', + tenantId: 'default', + orgId: 'default_code', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '01/08/2028', + endDate: '31/12/2028', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-10-10T08:39:17.831Z'), + createdAt: new Date('2025-10-10T08:39:17.449Z'), + __v: 0, + }, + { + _id: new ObjectId('68e8c635201642091e014932'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [ + { + name: 'walking', + link: 'https://drive.google.com/file/d/1eGLKxFb9BaeroTeIOlXoO8XCxyah7fM9/view?usp=sharing', + app: 'projectService', + id: 'view?usp=sharing', + }, + ], + deleted: false, + type: 'content', + projectTemplateId: new ObjectId('68e8c635201642091e01491c'), + projectTemplateExternalId: 'PROJ190909764HJHF123FGHHcvvbgd-1760085557008_IMPORTED', + name: "Log into the scanner app and scan the OMR sheets (check that the students' names are appearing on scanning the OMR)", + externalId: 'DPDTSC-HandBook-1-2025-Task5-1760085557008-1760085557835', + description: '', + sequenceNumber: '5', + tenantId: 'default', + orgId: 'default_code', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '01/08/2029', + endDate: '31/12/2029', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-10-10T08:39:17.840Z'), + createdAt: new Date('2025-10-10T08:39:17.458Z'), + __v: 0, + }, + { + _id: new ObjectId('68c98d9538aee0086ee610a2'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [ + { + name: 'Activity Manual (PDF)', + link: 'https://docs.google.com/document/d/1NCUdj9nPAz82sPV5q2BJ8At31sFJdSDwocrDCh_g7W0/edit?tab=t.0', + app: 'projectService', + id: 'edit?tab=t.0', + }, + ], + deleted: false, + type: 'content', + projectTemplateId: new ObjectId('68c98d9538aee0086ee6109e'), + projectTemplateExternalId: 'ProjectIdtestKey1-1758039445176_IMPORTED', + name: 'Review the Activity Manual', + externalId: 'Task1-1758039445176-1758039445561', + description: '', + sequenceNumber: '1', + tenantId: 'default', + orgId: 'default_code', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '28/07/2025', + endDate: '30/01/2026', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-09-16T16:17:25.564Z'), + createdAt: new Date('2025-09-16T16:17:25.375Z'), + __v: 0, + }, + { + _id: new ObjectId('68c98d9538aee0086ee610a6'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [ + { + name: 'Activity Steps (Video)', + link: 'https://youtu.be/MNvM_H9zD3Y?si=BdfslSzCkmDCggih', + app: 'projectService', + id: 'MNvM_H9zD3Y?si=BdfslSzCkmDCggih', + }, + ], + deleted: false, + type: 'content', + projectTemplateId: new ObjectId('68c98d9538aee0086ee6109e'), + projectTemplateExternalId: 'ProjectIdtestKey1-1758039445176_IMPORTED', + name: 'Watch the Activity Video', + externalId: 'Task2-1758039445176-1758039445567', + description: '', + sequenceNumber: '2', + tenantId: 'default', + orgId: 'default_code', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '29/07/2025', + endDate: '30/01/2027', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-09-16T16:17:25.571Z'), + createdAt: new Date('2025-09-16T16:17:25.386Z'), + __v: 0, + }, + { + _id: new ObjectId('68c98d9538aee0086ee610aa'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [], + deleted: false, + type: 'simple', + projectTemplateId: new ObjectId('68c98d9538aee0086ee6109e'), + projectTemplateExternalId: 'ProjectIdtestKey1-1758039445176_IMPORTED', + name: 'Conduct the Activity with students', + externalId: 'Task3-1758039445176-1758039445575', + description: '', + sequenceNumber: '3', + tenantId: 'default', + orgId: 'default_code', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '30/07/2025', + endDate: '30/01/2028', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-09-16T16:17:25.579Z'), + createdAt: new Date('2025-09-16T16:17:25.396Z'), + __v: 0, + }, + { + _id: new ObjectId('68d3b9ad2ba17cc3cb238837'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [], + deleted: false, + type: 'simple', + projectTemplateId: new ObjectId('68d3b9a92ba17cc3cb238829'), + projectTemplateExternalId: 'DPDTSCH012025-1758706081315_IMPORTED', + name: 'Conduct the Activity with students', + externalId: 'DPDTSC-HandBook-1/2025-Task3-1758706081315-1758706093343', + description: '', + sequenceNumber: '3', + tenantId: 'default', + orgId: 'default_code', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '30/07/2025', + endDate: '30/12/2025', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-09-24T09:28:13.534Z'), + createdAt: new Date('2025-09-24T09:28:06.227Z'), + __v: 0, + }, + { + _id: new ObjectId('68d3b9ad2ba17cc3cb23883b'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [ + { + name: 'Activity Assessment (PDF)', + link: 'https://sunbirdsaaspublic.blob.core.windows.net/content/content/assets/do_2143687931908833281255/dpdt-switch-car.pdf', + app: 'projectService', + id: 'dpdt-switch-car.pdf', + }, + { + name: 'Activity OMR Sheet (PDF)', + link: 'https://drive.google.com/file/d/1-f7Tg8bmZd-xlcxlhfOcf2ZO6vpc6qkH/view', + app: 'projectService', + id: 'view', + }, + ], + deleted: false, + type: 'content', + projectTemplateId: new ObjectId('68d3b9a92ba17cc3cb238829'), + projectTemplateExternalId: 'DPDTSCH012025-1758706081315_IMPORTED', + name: 'Conduct the Activity Assessment', + externalId: 'DPDTSC-HandBook-1/2025-Task4-1758706081315-1758706093849', + description: '', + sequenceNumber: '4', + tenantId: 'default', + orgId: 'default_code', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '30/07/2025', + endDate: '30/12/2025', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-09-24T09:28:13.967Z'), + createdAt: new Date('2025-09-24T09:28:06.583Z'), + __v: 0, + }, + { + _id: new ObjectId('68d3b9ae2ba17cc3cb23883f'), + createdBy: '1', + updatedBy: '1', + isDeleted: false, + isDeletable: false, + taskSequence: [], + children: [], + visibleIf: [], + hasSubTasks: false, + learningResources: [], + deleted: false, + type: 'simple', + projectTemplateId: new ObjectId('68d3b9a92ba17cc3cb238829'), + projectTemplateExternalId: 'DPDTSCH012025-1758706081315_IMPORTED', + name: "Log into the scanner app and scan the OMR sheets (check that the students' names are appearing on scanning the OMR)", + externalId: 'DPDTSC-HandBook-1/2025-Task5-1758706081315-1758706094241', + description: '', + sequenceNumber: '5', + tenantId: 'default', + orgId: 'default_code', + metaInformation: { + hasAParentTask: 'NO', + parentTaskOperator: '', + parentTaskValue: '', + parentTaskId: '', + startDate: '30/07/2025', + endDate: '30/12/2025', + isAnExternalTask: '', + minNoOfSubmissionsRequired: '', + redirectLink: '', + buttonLabel: '', + }, + updatedAt: new Date('2025-09-24T09:28:14.374Z'), + createdAt: new Date('2025-09-24T09:28:07.083Z'), + __v: 0, + }, +] + +let certificateTemplatesData = [ + { + _id: new ObjectId('68ee4bf5fb9bee08b93b6d97'), + status: 'active', + deleted: false, + criteria: { + validationText: 'Complete validation message', + expression: 'C1&&(C3||C4||C5||C6)', + conditions: { + C1: { + validationText: 'Submit your project.', + expression: 'C1', + conditions: { + C1: { + scope: 'project', + key: 'status', + operator: '==', + value: 'submitted', + }, + }, + }, + C3: { + expression: 'C1', + conditions: { + C1: { + scope: 'task', + key: 'attachments', + function: 'count', + filter: { + key: 'type', + value: 'all', + }, + operator: '>=', + value: 2, + taskDetails: ['68ee4bb3fb9bee08b93b6d53'], + }, + }, + validationText: 'Add 2 evidence for any task', + }, + C4: { + expression: 'C1', + conditions: { + C1: { + scope: 'task', + key: 'attachments', + function: 'count', + filter: { + key: 'type', + value: 'all', + }, + operator: '>=', + value: 2, + taskDetails: ['68ee4bb3fb9bee08b93b6d57'], + }, + }, + }, + C5: { + expression: 'C1', + conditions: { + C1: { + scope: 'task', + key: 'attachments', + function: 'count', + filter: { + key: 'type', + value: 'all', + }, + operator: '>=', + value: 2, + taskDetails: ['68ee4bb3fb9bee08b93b6d5b'], + }, + }, + }, + C6: { + expression: 'C1', + conditions: { + C1: { + scope: 'task', + key: 'attachments', + function: 'count', + filter: { + key: 'type', + value: 'all', + }, + operator: '>=', + value: 2, + taskDetails: ['68ee4bb3fb9bee08b93b6d63'], + }, + }, + }, + }, + }, + issuer: { + name: 'default_code', + }, + solutionId: new ObjectId('68ee4bb3fb9bee08b93b6d68'), + programId: new ObjectId('68ee4b79fb9bee08b93b6d34'), + baseTemplateId: new ObjectId('68c008dfd113c30c11f1aca2'), + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-10-14T13:11:17.793Z'), + createdAt: new Date('2025-10-14T13:11:17.628Z'), + __v: 0, + templateUrl: + 'certificate/aa8529e3-6754-4432-a669-72b73d358e2f/1/7042c718-a1bf-43e3-b296-586de247a440/68ee4bf5fb9bee08b93b6d97/14-9-2025-1760447477692_Dowloaded.svg', + }, + { + _id: new ObjectId('68e8c676201642091e014943'), + status: 'active', + deleted: false, + criteria: { + validationText: 'Complete validation message', + expression: 'C1&&(C3||C4||C5||C6||C7)', + conditions: { + C1: { + validationText: 'Submit your project.', + expression: 'C1', + conditions: { + C1: { + scope: 'project', + key: 'status', + operator: '==', + value: 'submitted', + }, + }, + }, + C3: { + expression: 'C1', + conditions: { + C1: { + scope: 'task', + key: 'attachments', + function: 'count', + filter: { + key: 'type', + value: 'all', + }, + operator: '>=', + value: 2, + taskDetails: ['68e8c635201642091e0148ff'], + }, + }, + validationText: 'Add 2 evidence for any task', + }, + C4: { + expression: 'C1', + conditions: { + C1: { + scope: 'task', + key: 'attachments', + function: 'count', + filter: { + key: 'type', + value: 'all', + }, + operator: '>=', + value: 2, + taskDetails: ['68e8c635201642091e014903'], + }, + }, + }, + C5: { + expression: 'C1', + conditions: { + C1: { + scope: 'task', + key: 'attachments', + function: 'count', + filter: { + key: 'type', + value: 'all', + }, + operator: '>=', + value: 2, + taskDetails: ['68e8c635201642091e014907'], + }, + }, + }, + C6: { + expression: 'C1', + conditions: { + C1: { + scope: 'task', + key: 'attachments', + function: 'count', + filter: { + key: 'type', + value: 'all', + }, + operator: '>=', + value: 2, + taskDetails: ['68e8c635201642091e01490b'], + }, + }, + }, + C7: { + expression: 'C1', + conditions: { + C1: { + scope: 'task', + key: 'attachments', + function: 'count', + filter: { + key: 'type', + value: 'all', + }, + operator: '>=', + value: 2, + taskDetails: ['68e8c635201642091e01490f'], + }, + }, + }, + }, + }, + issuer: { + name: 'default_code', + }, + solutionId: new ObjectId('68e8c635201642091e014914'), + programId: new ObjectId('68e8c284201642091e0148c1'), + baseTemplateId: new ObjectId('68c008dfd113c30c11f1aca2'), + tenantId: 'default', + orgId: 'default_code', + updatedAt: new Date('2025-10-10T08:40:22.454Z'), + createdAt: new Date('2025-10-10T08:40:22.298Z'), + __v: 0, + templateUrl: + 'certificate/0bcc856d-0145-448c-8188-300ca3f3250e/1/58cfdf3c-f1a2-4a94-bbb5-21dcd7286913/68e8c676201642091e014943/10-9-2025-1760085622353_Dowloaded.svg', + }, +] + +let certificateBaseTemplatesData = [ + { + _id: new ObjectId('68c008dfd113c30c11f1aca2'), + deleted: false, + code: 'onelogo_onesign', + name: 'onelogo_onesign', + url: 'certificate/ef2058a1-92e0-4a63-af5f-b712f992bf90/1/81fc35ad-9519-4ec4-87bb-6cef64b940f0/9-8-2025-1757415647754_sl_s1l1.svg', + tenantId: 'default', + orgId: 'slorg', + updatedAt: new Date('2025-09-09T11:00:47.878Z'), + createdAt: new Date('2025-09-09T11:00:47.878Z'), + __v: 0, + }, +] + +let projectCategoriesData = [ + { + _id: new ObjectId('685ae6a0cb7c7200145dadae'), + createdBy: 'SYSTEM', + updatedBy: 'SYSTEM', + isDeleted: false, + isVisible: true, + status: 'active', + icon: '', + noOfProjects: 361, + evidences: [], + deleted: false, + name: 'teachers', + externalId: 'teachers', + tenantId: 'default', + orgId: 'slorg', + updatedAt: new Date('2025-06-24T17:55:44.720Z'), + createdAt: new Date('2025-06-24T17:55:44.720Z'), + __v: 0, + }, +] + +let configurationData = [ + { + _id: new ObjectId('6825a1982d46aa6df0cc36a8'), + code: 'keysAllowedForTargeting', + __v: 0, + createdAt: new Date('2025-05-15T08:11:04.674Z'), + meta: { + profileKeys: [ + 'state', + 'district', + 'block', + 'cluster', + 'school', + 'professional_role', + 'professional_subroles', + 'roles', + 'subject', + 'organizations', + ], + }, + updatedAt: new Date('2025-05-26T10:56:17.021Z'), + }, +] +module.exports = { + solutionData, + programData, + projectTemplatesData, + projectTemplateTasksData, + certificateTemplatesData, + certificateBaseTemplatesData, + projectCategoriesData, + configurationData, +} diff --git a/documentation/3.4.0/native/scripts/stand-alone/ubuntu/uninstall-dependencies.sh b/documentation/3.4.0/native/scripts/stand-alone/ubuntu/uninstall-dependencies.sh new file mode 100644 index 00000000..c14a313a --- /dev/null +++ b/documentation/3.4.0/native/scripts/stand-alone/ubuntu/uninstall-dependencies.sh @@ -0,0 +1,131 @@ +#!/bin/bash + +# Define color codes +RED='\033[0;31m' +GREEN='\033[0;32m' +NC='\033[0m' # No Color + +# Function to show the menu +show_menu() { + echo -e "${GREEN}Please choose an option to uninstall:${NC}" + echo "1) PM2" + echo "2) Node.js and npm" + echo "3) Kafka and Zookeeper" + echo "4) Redis" + echo "5) MongoDB" + echo "6) Citus and PostgreSQL" + echo "7) Gotenberg" + echo "8) Exit" + echo -e "${GREEN}Enter your choice [1-8]: ${NC}" +} + +# Function to uninstall PM2 +uninstall_pm2() { + echo -e "${RED}Uninstalling PM2...${NC}" + sudo npm uninstall -g pm2 +} + +# Function to uninstall Node.js and npm +uninstall_nodejs() { + echo -e "${RED}Uninstalling Node.js and npm...${NC}" + sudo apt-get remove -y nodejs + sudo apt-get purge -y nodejs + sudo apt-get autoremove -y +} + +# Function to uninstall Kafka and Zookeeper +uninstall_kafka_zookeeper() { + echo -e "${RED}Removing Kafka and Zookeeper...${NC}" + sudo systemctl stop kafka + sudo systemctl disable kafka + sudo systemctl stop zookeeper + sudo systemctl disable zookeeper + sudo rm /etc/systemd/system/kafka.service + sudo rm /etc/systemd/system/zookeeper.service + sudo rm -rf /opt/kafka + sudo systemctl daemon-reload +} + +# Function to uninstall Redis +uninstall_redis() { + echo -e "${RED}Uninstalling Redis...${NC}" + sudo systemctl stop redis + sudo systemctl disable redis + sudo apt-get remove -y redis-server + sudo apt-get purge -y redis-server + sudo apt-get autoremove -y +} + +# Function to uninstall Redis BullMQ +uninstall_bullmq() { + echo -e "${RED}Uninstalling Redis BullMQ...${NC}" + sudo npm uninstall -g bullmq + echo -e "${GREEN}Redis BullMQ has been uninstalled.${NC}" +} + +# Function to uninstall MongoDB +uninstall_mongodb() { + echo -e "${RED}Uninstalling MongoDB...${NC}" + sudo systemctl stop mongod + sudo systemctl disable mongod + sudo apt-get remove -y mongodb-org + sudo apt-get purge -y mongodb-org + sudo apt-get autoremove -y + sudo rm -rf /var/log/mongodb + sudo rm -rf /var/lib/mongodb + sudo rm /etc/apt/sources.list.d/mongodb-org-*.list + echo -e "${GREEN}MongoDB has been uninstalled.${NC}" +} + +# Function to uninstall Citus and PostgreSQL +uninstall_citus_postgresql() { + echo -e "${RED}Uninstalling Citus and PostgreSQL...${NC}" + sudo su - postgres -c "pg_ctl -D ~/citus stop" + sudo apt-get remove -y postgresql-16-citus-12.1 + sudo apt-get purge -y postgresql-16-citus-12.1 + sudo apt-get remove -y postgresql* + sudo apt-get purge -y postgresql* + sudo apt-get autoremove -y + sudo pkill -u postgres + sudo deluser --remove-home postgres +} + +# Function to uninstall Gotenberg +uninstall_gotenberg() { + echo -e "${RED}Uninstalling Gotenberg...${NC}" + + # Stop and remove the Gotenberg Docker container + sudo docker stop gotenberg + sudo docker rm gotenberg + + # Optionally uninstall Docker (if it's no longer needed) + echo -e "${GREEN}Do you also want to uninstall Docker? (y/n)${NC}" + read uninstall_docker + if [[ "$uninstall_docker" == "y" || "$uninstall_docker" == "Y" ]]; then + echo -e "${RED}Uninstalling Docker...${NC}" + sudo apt-get remove -y docker.io + sudo apt-get purge -y docker.io + sudo apt-get autoremove -y + sudo rm -rf /var/lib/docker + echo -e "${GREEN}Docker has been uninstalled.${NC}" + fi + echo -e "${GREEN}Gotenberg has been uninstalled.${NC}" +} + +# Main loop +while true; do + show_menu + read choice + case $choice in + 1) uninstall_pm2 ;; + 2) uninstall_nodejs ;; + 3) uninstall_kafka_zookeeper ;; + 4) uninstall_redis ;; + 5) uninstall_mongodb ;; + 6) uninstall_citus_postgresql ;; + 7) uninstall_gotenberg ;; + 8) echo -e "${GREEN}Exiting uninstallation process.${NC}"; exit ;; + *) echo -e "${RED}Invalid option, please try again.${NC}" ;; + esac + echo -e "${GREEN}Operation completed.${NC}" +done diff --git a/documentation/3.4.0/sample-data/mac-linux/user/sampleData.sql b/documentation/3.4.0/sample-data/mac-linux/user/sampleData.sql new file mode 100644 index 00000000..9744d2fe --- /dev/null +++ b/documentation/3.4.0/sample-data/mac-linux/user/sampleData.sql @@ -0,0 +1,23 @@ +INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (1, 'Rahul R B', 'a0db5e0a39ee13db7fc5d1309e637f2c', false, '{8,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default','53bc5d0ff0c53bee460c08b8afe087455050dc7529a2f1d4f7319c0da653a7e4','+91', NULL); +INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (2, 'Prajwal C S', 'c4113be1bc2cef51981a6ec687302e42fc4f87f4dfac4276584844d9e3e0f5ae', false, '{8,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default','53bc5d0ff0c53bee460c08b8afe087455050dc7529a2f1d4f7319c0da653a767','+91', NULL); +INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (3, 'Vishnu V P', '1092be87fd483fce1deba56c8cdefa79bed4f70a4b110fc4e7947c57aacff219', false, '{8,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default','53bc5d0ff0c53bee460c08b8afe087455050dc7529a2f1d4f7319c0da653a7e0','+91', NULL); +INSERT INTO public.users (id, name, email, email_verified, roles, status, password, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at, tenant_code, phone, phone_code, configs) VALUES (4, 'Mallanagouda R B', 'e5fc674d4b1a54c6cf772485e3bca6f7ae14b60de32b9f0cd9f955ee469345bc', false, '{8,2}', 'ACTIVE', '\$2a\$10\$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL, 'default','53bc5d0ff0c53bee460c08b8afe087455050dc7529a2f1d4f7319c0da653a700','+91', NULL); + +INSERT INTO public.user_organizations (user_id,organization_code, tenant_code, created_at, updated_at, deleted_at) VALUES (1, 'default_code', 'default', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL); +INSERT INTO public.user_organizations (user_id,organization_code, tenant_code, created_at, updated_at, deleted_at) VALUES (2, 'default_code', 'default', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL); +INSERT INTO public.user_organizations (user_id,organization_code, tenant_code, created_at, updated_at, deleted_at) VALUES (3, 'default_code', 'default', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL); +INSERT INTO public.user_organizations (user_id,organization_code, tenant_code, created_at, updated_at, deleted_at) VALUES (4, 'default_code', 'default', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL); + + +INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 2, 'default_code', 1, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL); +INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 3, 'default_code', 2, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL); +INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 2, 'default_code', 3, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL); +INSERT INTO public.user_organization_roles (tenant_code, user_id, organization_code,role_id, created_at, updated_at, deleted_at) VALUES ('default', 4, 'default_code', 3, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL); + + +INSERT INTO public.entity_types (id, value, label, status, created_by, updated_by, allow_filtering, data_type, organization_id, parent_id, has_entities, allow_custom_entities, model_names, created_at, updated_at, deleted_at, meta, external_entity_type, required, regex, tenant_code,organization_code) VALUES (5, 'state', 'State', 'ACTIVE', 0, 0, true, 'STRING', 1, NULL, true, true, '{User}', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, '{\"service\": \"entity-management-service\",\"endPoint\": \"v1/entities/find\"}', true, false, NULL,'default', 'default_code'); +INSERT INTO public.entity_types (id, value, label, status, created_by, updated_by, allow_filtering, data_type, organization_id, parent_id, has_entities, allow_custom_entities, model_names, created_at, updated_at, deleted_at, meta, external_entity_type, required, regex) VALUES (5, 'district', 'District', 'ACTIVE', 0, 0, true, 'STRING', 1, NULL, true, true, '{User}', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, NULL, true, false, NULL); +UPDATE public.entity_types SET status = 'INACTIVE' WHERE id = 3; +SELECT nextval('users_id_seq'::regclass) FROM public.users; +SELECT nextval('users_credentials_id_seq'::regclass) FROM public.users_credentials; +SELECT NULL; \ No newline at end of file diff --git a/documentation/3.4.0/sample-data/windows/user/sampleData.sql b/documentation/3.4.0/sample-data/windows/user/sampleData.sql new file mode 100644 index 00000000..43a991df --- /dev/null +++ b/documentation/3.4.0/sample-data/windows/user/sampleData.sql @@ -0,0 +1,21 @@ +INSERT INTO public.users (id, name, email, email_verified, roles, status, password, organization_id, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at) VALUES (1, 'Aarav Patel', '8d1f1e11989cf7b739c9daa972c56c5083b46d490f8023a67eb89d28a2b615ef', false, '{8,2}', 'ACTIVE', '$2a$10$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', 1, true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL); +INSERT INTO public.users (id, name, email, email_verified, roles, status, password, organization_id, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at) VALUES (2, 'Arunima Reddy', '0f34042735bb359f1c227b4497cf5074b372085830eef69db07dd80789c25dd5', false, '{8,2}', 'ACTIVE', '$2a$10$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', 1, true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL); +INSERT INTO public.users (id, name, email, email_verified, roles, status, password, organization_id, has_accepted_terms_and_conditions, about, location, languages, preferred_language, share_link, image, custom_entity_text, meta, created_at, updated_at, deleted_at) VALUES (3, 'Devika Singh', '1e8828f2f98d16ff63a424620f9d582a1de88268414606a0593c73eb5316543c', false, '{8,2}', 'ACTIVE', '$2a$10$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', 1, true, NULL, NULL, NULL, 'en', NULL, NULL, NULL, NULL, '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.426+00', NULL); +INSERT INTO public.users_credentials (id, email, password, organization_id, user_id, meta, created_at, updated_at, deleted_at, organization_user_invite_id) VALUES (1, '8d1f1e11989cf7b739c9daa972c56c5083b46d490f8023a67eb89d28a2b615ef', '$2a$10$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', 1, 1, NULL, '2024-04-18 08:12:19.407+00', '2024-04-18 08:12:19.407+00', NULL, NULL); +INSERT INTO public.users_credentials (id, email, password, organization_id, user_id, meta, created_at, updated_at, deleted_at, organization_user_invite_id) VALUES (2, '0f34042735bb359f1c227b4497cf5074b372085830eef69db07dd80789c25dd5', '$2a$10$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', 1, 2, NULL, '2024-04-18 08:12:19.407+00', '2024-04-18 08:12:19.407+00', NULL, NULL); +INSERT INTO public.users_credentials (id, email, password, organization_id, user_id, meta, created_at, updated_at, deleted_at, organization_user_invite_id) VALUES (3, '1e8828f2f98d16ff63a424620f9d582a1de88268414606a0593c73eb5316543c', '$2a$10$NTzc2CjEbwB4DavjEKU11eqJXJLrODnvAwvXWor9Dz/gXr55Pvyj.', 1, 3, NULL, '2024-04-18 08:12:19.407+00', '2024-04-18 08:12:19.407+00', NULL, NULL); +INSERT INTO public.entity_types (id, value, label, status, created_by, updated_by, allow_filtering, data_type, organization_id, parent_id, has_entities, allow_custom_entities, model_names, created_at, updated_at, deleted_at, meta, external_entity_type, required, regex) VALUES (4, 'state', 'State', 'ACTIVE', 0, 0, true, 'STRING', 1, NULL, true, true, '{User}', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, NULL, true, false, NULL); +INSERT INTO public.entity_types (id, value, label, status, created_by, updated_by, allow_filtering, data_type, organization_id, parent_id, has_entities, allow_custom_entities, model_names, created_at, updated_at, deleted_at, meta, external_entity_type, required, regex) VALUES (5, 'block', 'Block', 'ACTIVE', 0, 0, true, 'ARRAY', 1, NULL, true, true, '{User}', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, NULL, true, false, NULL); +INSERT INTO public.entity_types (id, value, label, status, created_by, updated_by, allow_filtering, data_type, organization_id, parent_id, has_entities, allow_custom_entities, model_names, created_at, updated_at, deleted_at, meta, external_entity_type, required, regex) VALUES (6, 'school', 'school', 'ACTIVE', 0, 0, true, 'ARRAY', 1, NULL, true, true, '{User}', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, NULL, true, false, NULL); +INSERT INTO public.entities (id, entity_type_id, value, label, status, type, created_by, updated_by, created_at, updated_at, deleted_at) VALUES (33, 3, 'bangalore','Bangalore' ,'ACTIVE', 'SYSTEM', 0, NULL, '2024-10-08 11:33:03.03+00', '2024-10-08 11:33:03.03+00', NULL); +INSERT INTO public.entity_types (id, value, label, status, created_by, updated_by, allow_filtering, data_type, organization_id, parent_id, has_entities, allow_custom_entities, model_names, created_at, updated_at, deleted_at, meta, external_entity_type, required, regex) VALUES (7, 'district', 'district', 'ACTIVE', 0, 0, true, 'STRING', 1, NULL, true, true, '{User}', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, NULL, true, false, NULL); +INSERT INTO public.entity_types (id, value, label, status, created_by, updated_by, allow_filtering, data_type, organization_id, parent_id, has_entities, allow_custom_entities, model_names, created_at, updated_at, deleted_at, meta, external_entity_type, required, regex) VALUES (8, 'cluster', 'Cluster', 'ACTIVE', 0, 0, true, 'ARRAY', 1, NULL, true, true, '{User}', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, NULL, true, false, NULL); +INSERT INTO public.user_roles (id, title, user_type, status, created_at, updated_at, deleted_at, visibility, organization_id, label) VALUES (8, 'state_education_officer', 0, 'ACTIVE', '2024-04-18 08:12:19.394+00', '2024-04-18 08:12:19.394+00', NULL, 'PUBLIC', 1, 'State Education Officer'); +SELECT nextval('users_id_seq'::regclass) FROM public.users; +SELECT nextval('users_credentials_id_seq'::regclass) FROM public.users_credentials; +SELECT nextval('entity_types_id_seq'::regclass) FROM public.entity_types; +SELECT nextval('entities_id_seq'::regclass) FROM public.entities; +SELECT nextval('user_roles_id_seq'::regclass) FROM public.user_roles; +UPDATE role_permission_mapping SET role_title = 'state_education_officer' WHERE role_title = 'mentor' +UPDATE public.entity_types SET status = 'INACTIVE' WHERE id = 3; +SELECT NULL; \ No newline at end of file diff --git a/documentation/3.4.0/setup/docker/stand-alone/ubuntu/README.md b/documentation/3.4.0/setup/docker/stand-alone/ubuntu/README.md new file mode 100644 index 00000000..629c8e10 --- /dev/null +++ b/documentation/3.4.0/setup/docker/stand-alone/ubuntu/README.md @@ -0,0 +1,231 @@ +
+ +# Projects Service + + + + + +![GitHub package.json version (subfolder of monorepo)](https://img.shields.io/github/package-json/v/ELEVATE-Project/mentoring?filename=src%2Fpackage.json) +[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT) + + + + +
+The Project building block facilitates the creation and engagement with micro-improvement projects. + +
+
+ +# Docker Setup Project Service - Stand Alone + +Expectation: By diligently following the outlined steps, you will successfully establish a fully operational Project application setup, including both the portal and backend services. + +## Prerequisites + +To set up the Project application, ensure you have Docker and Docker Compose installed on your system. For Linux users, detailed installation instructions for both can be found in the documentation here: [How To Install and Use Docker Compose on Linux](https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-compose-on-ubuntu-20-04). To install and use Nodejs in Linux machine, you can follow instructions here: [How To Install Nodejs in Linux](https://nodejs.org/en/download/package-manager). + +## Installation + +**Create project Directory:** Establish a directory titled **project**. + +> Example Command: `mkdir project && cd project/` + +> Note: All commands are run from the project directory. + +## Operating Systems: Linux + +> **Caution:** Before proceeding, please ensure that the ports given here are available and open. It is essential to verify their availability prior to moving forward. You can run below command in your terminal to check this + +``` +for port in 3001 3002 6000 5001 4000 9092 5432 7007 2181 27017 3569; do + if sudo lsof -iTCP:$port -sTCP:LISTEN &>/dev/null; then + echo "Port $port is IN USE" + else + echo "Port $port is available" + fi +done +``` + +1. **Download and execute main setup script:** Execute the following command in your terminal from the project directory. + ``` + curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/setup_project.sh && chmod +x setup_project.sh && sudo ./setup_project.sh + ``` + +> Note : The script will download all the essential files and launch the services in Docker. Once all services are successfully up and running, you can proceed to the next steps. + +**General Instructions :** + +1. All containers which are part of the docker-compose can be gracefully stopped by pressing Ctrl + c in the same terminal where the services are running. +2. All docker containers can be stopped and removed by using below command. + +``` +sudo ./docker-compose-down.sh +``` + +3. All services and dependencies can be started using below command. + +``` +sudo ./docker-compose-up.sh +``` + +**Keep the current terminal session active, and kindly open a new terminal window within the project directory.** + +**After successfully completing this, please move to the next section: [Enable Citus Extension](#enable-citus-extension-optional)** + +## Enable Citus Extension (Optional) + +User management service comes with this bundle relies on PostgreSQL as its core database system. To boost performance and scalability, users can opt to enable the Citus extension. This transforms PostgreSQL into a distributed database, spreading data across multiple nodes to handle large datasets more efficiently as demand grows. + +For more information, refer **[Citus Data](https://www.citusdata.com/)**. + +To enable the Citus extension for user services, follow these steps. + +1. Create a sub-directory named `user` and download `distributionColumns.sql` into it. (Skip this for linux) + + ``` + mkdir user && curl -o ./user/distributionColumns.sql -JL https://github.com/ELEVATE-Project/project-service/raw/main/documentation/1.0.0/distribution-columns/user/distributionColumns.sql + ``` + +2. Set up the citus_setup file by following the steps given below. + + 1. Enable Citus and set distribution columns for `user` database by running the `citus_setup.sh`with the following arguments. + + ``` + sudo ./citus_setup.sh user postgres://postgres:postgres@citus_master:5432/user + ``` + +## Update Cloud Credentials for Project Service + +To enable full functionality, including certificate generation and report storage, you must configure cloud credentials in the Project Service environment file. + + Path: project_env + +Add or update the following variables in the .env file, substituting the example values with your actual cloud credentials: + + CLOUD_STORAGE_PROVIDER=gcloud + CLOUD_STORAGE_ACCOUNTNAME=your_account_name + CLOUD_STORAGE_SECRET="-----BEGIN PRIVATE KEY-----\n..." + CLOUD_STORAGE_PROJECT=your_cloud_project_id + CLOUD_STORAGE_BUCKETNAME=your_bucket_name + CLOUD_STORAGE_BUCKET_TYPE=private + +> NOTE : This service is designed to support multiple cloud storage providers and offers flexible cloud integration capabilities. Based on your selected cloud provider, the service can be configured accordingly to enable seamless storage, certificate generation, and report handling. + +For detailed configuration options, supported cloud providers, and integration guidelines, please refer to the official documentation available in this [ReadMe](https://www.npmjs.com/package/client-cloud-services?activeTab=readme) + +## Persistence Of Database Data In Docker Container (Optional) + +To ensure the persistence of database data when running `docker compose down`, it is necessary to modify the `docker-compose-project.yml` file according to the steps given below: + +1. **Modification Of The `docker-compose-project.yml` File:** + + Begin by opening the `docker-compose-project.yml` file. Locate the section pertaining to the Citus and mongo container and proceed to uncomment the volume specification. This action is demonstrated in the snippet provided below: + + ```yaml + mongo: + image: 'mongo:4.4.14' + restart: 'always' + ports: + - '27017:27017' + networks: + - project_net + volumes: + - mongo-data:/data/db + logging: + driver: none + + citus: + image: citusdata/citus:11.2.0 + container_name: 'citus_master' + ports: + - 5432:5432 + volumes: + - citus-data:/var/lib/postgresql/data + ``` + +2. **Uncommenting Volume Names Under The Volumes Section:** + + Next, navigate to the volumes section of the file and proceed to uncomment the volume names as illustrated in the subsequent snippet: + + ```yaml + networks: + elevate_net: + external: false + + volumes: + citus-data: + mongo-data: + ``` + +By implementing these adjustments, the configuration ensures that when the `docker-compose down` command is executed, the database data is securely stored within the specified volumes. Consequently, this data will be retained and remain accessible, even after the containers are terminated and subsequently reinstated using the `docker-compose up` command. + +## Sample User Accounts Generation + +During the initial setup of Project services with the default configuration, you may encounter issues creating new accounts through the regular SignUp flow on the project portal. This typically occurs because the default SignUp process includes OTP verification to prevent abuse. Until the notification service is configured correctly to send actual emails, you will not be able to create new accounts. + +In such cases, you can generate sample user accounts using the steps below. This allows you to explore the Project services and portal immediately after setup. + +> **Warning:** Use this generator only immediately after the initial system setup and before any normal user accounts are created through the portal. It should not be used under any circumstances thereafter. + +``` +sudo chmod +x ./insert_sample_data.sh && sudo ./insert_sample_data.sh user postgres://postgres:postgres@citus_master:5432/user +``` + +After successfully running the script mentioned above, the following user accounts will be created and available for login: + +| Email ID | Password | Role | +| ---------------------- | ---------- | ----------------------- | +| mallanagouda@gmail.com | Password1@ | State Education Officer | +| prajwal@gmail.com | Password1@ | State Education Officer | +| vishnu@gmail.com | Password1@ | State Education Officer | + +## Sample Data Creation For Projects + +This step will guide us in implementing a sample project solution following the initial setup of the project service. + +1. **Insert Sample Data To Database:** + + ``` + node insert_sample_solutions.js + ``` + +## 🌐 Micro-Frontend (FE) Setup + +The ELEVATE application uses a micro-frontend architecture. After setting up the backend services, you must configure and run the frontend repositories to access the application via the portal. + +Follow the setup guides for the frontend repositories: + +- **Login Portal:** [elevate-portal](https://github.com/ELEVATE-Project/elevate-portal/tree/releaase-1.1.0) +- **Projects Program Module (PWA):** [observation-survey-projects-pwa](https://github.com/ELEVATE-Project/observation-survey-projects-pwa/tree/release-3.4.0) + +> **Warning:** In this setup, features such as **Sign-Up, Project Certificate, Project Sharing, and Project PDF Report** will not be available because cloud storage credentials have been masked in the environment files for security reasons. + +## Postman Collections + +- [Projects Service](https://github.com/ELEVATE-Project/project-service/tree/main/api-doc) + +## Adding New Projects to the System + +With implementation scripts, you can seamlessly add new projects to the system. Once a project is successfully added, it becomes visible on the portal, ready for use and interaction. For a comprehensive guide on setting up and using the implementation script, please refer to the [documentation here](https://github.com/ELEVATE-Project/project-service/tree/main/Project-Service-implementation-Script). + +# Team + + + + + +# Open Source Dependencies + +Several open source dependencies that have aided Projects's development: + +![NodeJS](https://img.shields.io/badge/node.js-6DA55F?style=for-the-badge&logo=node.js&logoColor=white) +![Apache Kafka](https://img.shields.io/badge/Apache%20Kafka-000?style=for-the-badge&logo=apachekafka) +![Redis](https://img.shields.io/badge/redis-%23DD0031.svg?style=for-the-badge&logo=redis&logoColor=white) +![Jest](https://img.shields.io/badge/-jest-%23C21325?style=for-the-badge&logo=jest&logoColor=white) +![Git](https://img.shields.io/badge/git-%23F05033.svg?style=for-the-badge&logo=git&logoColor=white) diff --git a/documentation/3.4.0/setup/native/stand-alone/ubuntu/README.md b/documentation/3.4.0/setup/native/stand-alone/ubuntu/README.md new file mode 100644 index 00000000..1cb3eb4e --- /dev/null +++ b/documentation/3.4.0/setup/native/stand-alone/ubuntu/README.md @@ -0,0 +1,285 @@ +
+ +# Projects Service + + + + + +![GitHub package.json version (subfolder of monorepo)](https://img.shields.io/github/package-json/v/ELEVATE-Project/mentoring?filename=src%2Fpackage.json) +[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT) + + + + +
+The Project building block facilitates the creation and engagement with micro-improvement projects. + +
+
+ +# Native Setup Project Service - Stand Alone + +## PM2 Managed Services & Natively Installed Dependencies + +### System Requirements + +- **Node.js®:** v20 +- **PostgreSQL:** 16 +- **Apache Kafka®:** 3.5.0 +- **MongoDB:** 4.4.14 +- **Gotenberg:** 8.5.0 + +Expectation: Upon following the prescribed steps, you will achieve a fully operational ELEVATE-Project application setup. Both the portal and backend services are managed using PM2, with all dependencies installed natively on the host system. + +## Prerequisites + +Before setting up the following ELEVATE-Project application, dependencies given below should be installed and verified to be running. Refer to the steps given below to install them and verify. + +1. Download dependency management scripts: + + ``` + curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/scripts/stand-alone/ubuntu/check-dependencies.sh && \ + curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/scripts/stand-alone/ubuntu/install-dependencies.sh && \ + curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/scripts/stand-alone/ubuntu/uninstall-dependencies.sh && \ + chmod +x check-dependencies.sh && \ + chmod +x install-dependencies.sh && \ + chmod +x uninstall-dependencies.sh + ``` + +2. Verify installed dependencies by running `check-dependencies.sh`: + + ``` + ./check-dependencies.sh + ``` + + > Note: Keep note of any missing dependencies. + +3. Install dependencies by running `install-dependencies.sh`: + ``` + ./install-dependencies.sh + ``` + > Note: Install all missing dependencies and use check-dependencies script to ensure everything is installed and running. +4. Uninstall dependencies by running `uninstall-dependencies.sh`: + + ``` + ./uninstall-dependencies.sh + ``` + + > Warning: Due to the destructive nature of the script (without further warnings), it should only be used during the initial setup of the dependencies. For example, Uninstalling PostgreSQL/Citus using script will lead to data loss. USE EXTREME CAUTION. + + > Warning: This script should only be used to uninstall dependencies that were installed via installation script in step 3. If same dependencies were installed using other methods, refrain from using this script. This script is provided in-order to reverse installation in-case issues arise from a bad install. + +## Installation + +1. **Create ELEVATE-Project Directory:** Create a directory named **ELEVATE-Project**. + + > Example Command: `mkdir ELEVATE-Project && cd ELEVATE-Project/` + +2. **Git Clone Services And Portal Repositories** + +``` +git clone -b develop https://github.com/ELEVATE-Project/project-service.git && \ +git clone -b develop https://github.com/ELEVATE-Project/entity-management.git && \ +git clone -b develop https://github.com/ELEVATE-Project/user.git && \ +git clone -b main https://github.com/ELEVATE-Project/interface-service.git && \ +git clone -b master https://github.com/ELEVATE-Project/scheduler.git +``` + +3. **Install NPM Packages** + +``` +cd project-service && npm install && cd ../ && \ +cd entity-management/src && npm install && cd ../.. && \ +cd user/src && npm install && cd ../.. && \ +cd interface-service/src && npm install && cd ../.. && \ +cd scheduler/src && npm install && cd ../.. +``` + +4. **Download Environment Files** + +``` +curl -L -o project-service/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/envs/stand-alone/project_env && \ +curl -L -o entity-management/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/envs/stand-alone/entity_management_env && \ +curl -L -o user/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/envs/stand-alone/user_env && \ +curl -L -o interface-service/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/envs/stand-alone/interface_env && \ +curl -L -o scheduler/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/envs/stand-alone/scheduler_env +``` + +> **Note:** Modify the environment files as necessary for your deployment using any text editor, ensuring that the values are appropriate for your environment. The default values provided in the current files are functional and serve as a good starting point. Refer to the sample env files provided at the [Project](https://github.com/ELEVATE-Project/project-service/blob/main/.env.sample), [User](https://github.com/ELEVATE-Project/user/blob/master/src/.env.sample), [Notification](https://github.com/ELEVATE-Project/notification/blob/master/src/.env.sample), [Scheduler](https://github.com/ELEVATE-Project/scheduler/blob/master/src/.env.sample), [Interface](https://github.com/ELEVATE-Project/interface-service/blob/main/src/.env.sample) and [Entity-Management](https://github.com/ELEVATE-Project/entity-management/blob/main/src/.env.sample) repositories for reference. + +> **Caution:** While the default values in the downloaded environment files enable the ELEVATE-Project Application to operate, certain features may not function correctly or could be impaired unless the adopter-specific environment variables are properly configured. + +> **Important:** As mentioned in the above linked document, the **User SignUp** functionality may be compromised if key environment variables are not set correctly during deployment. If you opt to skip this setup, consider using the sample user account generator detailed in the `Sample User Accounts Generation` section of this document. + +5. **Attaching Config File** + + ``` + curl -L -o project-service/config.json https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/scripts/stand-alone/ubuntu/configFile.json && \ + curl -L -o entity-management/src/config.json https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/scripts/stand-alone/ubuntu/configFile.json + ``` + +6. **Create Databases** + + 1. Download `create-databases.sh` Script File: + + ``` + curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/scripts/stand-alone/ubuntu/create-databases.sh + ``` + + 2. Make the executable by running the following command: + + ``` + chmod +x create-databases.sh + ``` + + 3. Run the script file: + + ``` + ./create-databases.sh + ``` + +7. **Run Migrations and Seed To Create Tables** + + 1. run migrations + + ``` + cd user/src && npx sequelize-cli db:migrate && cd ../.. + ``` + + 2. run Seed + ``` + cd user/src && npx sequelize-cli db:seed:all && cd ../../ + ``` + +8. **Enabling Citus And Setting Distribution Columns (Optional)** + + To boost performance and scalability, users can opt to enable the Citus extension. This transforms PostgreSQL into a distributed database, spreading data across multiple nodes to handle large datasets more efficiently as demand grows. + + > NOTE: Currently only available for Linux based operation systems. + + 1. Download user `distributionColumns.sql` file. + + ``` + curl -o ./user/distributionColumns.sql -JL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/distribution-columns/user/distributionColumns.sql + + ``` + + 2. Set up the `citus_setup` file by following the steps given below. + + 1. Download the `citus_setup.sh` file: + + ``` + curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/scripts/linux/citus_setup.sh + ``` + + 2. Make the setup file executable by running the following command: + + ``` + chmod +x citus_setup.sh + ``` + + 3. Enable Citus and set distribution columns for `user` database by running the `citus_setup.sh`with the following arguments. + ``` + ./citus_setup.sh user postgres://postgres:postgres@localhost:9700/users + ``` + +9. **Update Cloud Credentials for Project Service** + + To enable full functionality, including certificate generation and report storage, you must configure cloud credentials in the Project Service environment file. + + Path: ./ELEVATE-Project/project-service/.env + + Add or update the following variables in the .env file, substituting the example values with your actual cloud credentials: + + CLOUD_STORAGE_PROVIDER=gcloud + CLOUD_STORAGE_ACCOUNTNAME=your_account_name + CLOUD_STORAGE_SECRET="-----BEGIN PRIVATE KEY-----\n..." + CLOUD_STORAGE_PROJECT=your_cloud_project_id + CLOUD_STORAGE_BUCKETNAME=your_bucket_name + CLOUD_STORAGE_BUCKET_TYPE=private + + > NOTE : This service is designed to support multiple cloud storage providers and offers flexible cloud integration capabilities. Based on your selected cloud provider, the service can be configured accordingly to enable seamless storage, certificate generation, and report handling. + + For detailed configuration options, supported cloud providers, and integration guidelines, please refer to the official documentation available in this [ReadMe](https://www.npmjs.com/package/client-cloud-services?activeTab=readme) + +10. **Insert Initial Data** + + 1. Download `entity-project-sample-data.sh` Script File: + + ``` + curl -o project_entity_sample_data.sh https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/scripts/stand-alone/ubuntu/project_entity_sample_data.sh && \ + chmod +x project_entity_sample_data.sh && \ + ./project_entity_sample_data.sh + ``` + +11. **Start The Services** + + Following the steps given below, 2 instances of each ELEVATE-Project backend service will be deployed and be managed by PM2 process manager. + + ``` + (cd project-service && pm2 start app.js --name project-service && cd -) && \ + (cd entity-management/src && pm2 start app.js --name entity-management && cd -) && \ + (cd user/src && pm2 start app.js --name user && cd -) && \ + (cd interface-service/src && pm2 start app.js --name interface && cd -) && \ + (cd scheduler/src && pm2 start app.js --name scheduler && cd -) + ``` + +## 🌐 Micro-Frontend (FE) Setup + +The ELEVATE application uses a micro-frontend architecture. After setting up the backend services, you must configure and run the frontend repositories to access the application via the portal. + +Follow the setup guides for the frontend repositories: + +- **Login Portal:** [elevate-portal](https://github.com/ELEVATE-Project/elevate-portal/tree/releaase-1.1.0) +- **Projects Program Module (PWA):** [observation-survey-projects-pwa](https://github.com/ELEVATE-Project/observation-survey-projects-pwa/tree/release-3.4.0) + +## Sample User Accounts Generation + +During the initial setup of ELEVATE-Project services with the default configuration, you may encounter issues creating new accounts through the regular SignUp flow on the ELEVATE-Project portal. This typically occurs because the default SignUp process includes OTP verification to prevent abuse. Until the notification service is configured correctly to send actual emails, you will not be able to create new accounts. + +In such cases, you can generate sample user accounts using the steps below. This allows you to explore the ELEVATE-Project services and portal immediately after setup. + +> **Warning:** Use this generator only immediately after the initial system setup and before any normal user accounts are created through the portal. It should not be used under any circumstances thereafter. + +``` +curl -o insert_sample_data.sh https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/native/scripts/stand-alone/ubuntu/insert_sample_data.sh && \ +chmod +x insert_sample_data.sh && \ +./insert_sample_data.sh +``` + +After successfully running the script mentioned above, the following user accounts will be created and available for login: + +| Email ID | Password | Role | +| ---------------------- | ---------- | ----------------------- | +| mallanagouda@gmail.com | Password1@ | State Education Officer | +| prajwal@gmail.com | Password1@ | State Education Officer | +| vishnu@gmail.com | Password1@ | State Education Officer | + +## Postman Collections + +- [Projects Service](https://github.com/ELEVATE-Project/project-service/tree/main/api-doc) + +## Adding New Projects to the System + +With implementation scripts, you can seamlessly add new projects to the system. Once a project is successfully added, it becomes visible on the portal, ready for use and interaction. For a comprehensive guide on setting up and using the implementation script, please refer to the [documentation here](https://github.com/ELEVATE-Project/project-service/tree/main/Project-Service-implementation-Script). + +# Team + + + + + +# Open Source Dependencies + +Several open source dependencies that have aided Projects's development: + +![NodeJS](https://img.shields.io/badge/node.js-6DA55F?style=for-the-badge&logo=node.js&logoColor=white) +![Apache Kafka](https://img.shields.io/badge/Apache%20Kafka-000?style=for-the-badge&logo=apachekafka) +![Redis](https://img.shields.io/badge/redis-%23DD0031.svg?style=for-the-badge&logo=redis&logoColor=white) +![Jest](https://img.shields.io/badge/-jest-%23C21325?style=for-the-badge&logo=jest&logoColor=white) +![Git](https://img.shields.io/badge/git-%23F05033.svg?style=for-the-badge&logo=git&logoColor=white) From cca793ee7a77724270ef2604719eae03d5ba7bfb Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Mon, 6 Apr 2026 13:28:50 +0530 Subject: [PATCH 62/63] Update setup_project.sh to use main branch for file downloads and remove obsolete steps --- .../stand-alone/ubuntu/setup_project.sh | 49 +++++++------------ 1 file changed, 17 insertions(+), 32 deletions(-) diff --git a/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/setup_project.sh b/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/setup_project.sh index b0e3d124..120dae9b 100644 --- a/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/setup_project.sh +++ b/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/setup_project.sh @@ -7,40 +7,25 @@ log() { # Step 1: Download Docker Compose file log "Downloading Docker Compose file..." -curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/dockerized/dockerFiles/stand-alone/docker-compose-project.yml +curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/3.4.0/dockerized/dockerFiles/stand-alone/docker-compose-project.yml log "Docker Compose file downloaded." # Step 2: Download environment files log "Downloading environment files..." curl -L \ - -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/dockerized/envs/interface_env \ - -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/dockerized/envs/entity_management_env \ - -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/dockerized/envs/project_env \ - -O https://github.com/ELEVATE-Project/project-service/raw/main/documentation/1.0.0/dockerized/envs/notification_env \ - -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/dockerized/envs/scheduler_env \ - -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/dockerized/envs/user_env \ - -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/dockerized/envs/env.js + -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/3.4.0/dockerized/envs/interface_env \ + -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/3.4.0/dockerized/envs/entity_management_env \ + -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/3.4.0/dockerized/envs/project_env \ + -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/3.4.0/dockerized/envs/notification_env \ + -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/3.4.0/dockerized/envs/scheduler_env \ + -O https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/3.4.0/dockerized/envs/user_env log "Environment files downloaded." -# Step 3: Download replace_volume_path.sh script -log "Downloading replace_volume_path.sh script..." -curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/main/documentation/1.0.0/dockerized/scripts/mac-linux/replace_volume_path.sh -log "replace_volume_path.sh script downloaded." - -# Step 4: Make replace_volume_path.sh executable -log "Making replace_volume_path.sh executable..." -chmod +x replace_volume_path.sh -log "Made replace_volume_path.sh executable." - -# Step 5: Run replace_volume_path.sh script -log "Running replace_volume_path.sh script..." -./replace_volume_path.sh -log "replace_volume_path.sh script executed." # Step 6: Download additional scripts log "Downloading docker-compose scripts..." -curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/docker-compose-up.sh -curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/docker-compose-down.sh +curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/docker-compose-up.sh +curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/docker-compose-down.sh log "docker-compose scripts downloaded." # Step 7: Make the scripts executable @@ -51,12 +36,12 @@ log "Made docker-compose scripts executable." # Step 8: Create user directory and download SQL file log "Creating user directory and downloading distributionColumns.sql..." -mkdir -p user && curl -o ./user/distributionColumns.sql -JL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/distribution-columns/user/distributionColumns.sql +mkdir -p user && curl -o ./user/distributionColumns.sql -JL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/3.4.0/distribution-columns/user/distributionColumns.sql log "User directory created and distributionColumns.sql downloaded." # Step 9: Download and make citus_setup.sh executable log "Downloading citus_setup.sh..." -curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/citus_setup.sh +curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/citus_setup.sh chmod +x citus_setup.sh # Install MongoDB driver (usually needed if connecting directly to MongoDB/Citus) @@ -67,18 +52,18 @@ npm install mongoose # Step 11: Download additional scripts to add data log "Downloading sample data scripts..." -curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/entity_sampleData.js -curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/project_sampleData.js -curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/insert_sample_solutions.js -curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/insert_sample_data.sh +curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/3.4.0/common-files/dockerized/stand-alone/entity_sampleData.js +curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/3.4.0/common-files/dockerized/stand-alone/project_sampleData.js +curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/3.4.0/common-files/dockerized/stand-alone/insert_sample_solutions.js +curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/insert_sample_data.sh log "sample data scripts downloaded." log "Downloading config.json file..." -curl -L https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuide-3.4/documentation/3.4.0/dockerized/scripts/stand-alone/ubuntu/configFile.json -o config.json +curl -L https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/3.4.0/common-files/generics/configFile.json -o config.json log "config.json file is downloaded." # Step 13: Run docker-compose-up.sh script log "Running docker-compose-up.sh script..." ./docker-compose-up.sh -log "docker-compose-up.sh script executed." +log "docker-compose-up.sh script executed." \ No newline at end of file From 84e4b943bbfc498d2d8ebddbd9b3e124bb7e9db2 Mon Sep 17 00:00:00 2001 From: priyanka-TL Date: Tue, 19 May 2026 16:41:09 +0530 Subject: [PATCH 63/63] mac doc --- README.md | 4 +- .../3.4.0/setup/native/scp/mac/README.md | 374 ++++++++++++++++++ 2 files changed, 376 insertions(+), 2 deletions(-) create mode 100644 documentation/3.4.0/setup/native/scp/mac/README.md diff --git a/README.md b/README.md index 9c95f2a1..d8453790 100644 --- a/README.md +++ b/README.md @@ -124,13 +124,13 @@ Go to the detailed Windows Docker setup guide: **SETUP_SCP_NATIVE_UBUNTU.md** +Go to the detailed Ubuntu Native setup guide: **SETUP_SCP_NATIVE_UBUNTU.md**
2. macOS Setup
-Go to the detailed macOS Native setup guide: **SETUP_SCP_NATIVE_MACOS.md** +Go to the detailed macOS Native setup guide: **SETUP_SCP_NATIVE_MACOS.md**
diff --git a/documentation/3.4.0/setup/native/scp/mac/README.md b/documentation/3.4.0/setup/native/scp/mac/README.md new file mode 100644 index 00000000..12202b50 --- /dev/null +++ b/documentation/3.4.0/setup/native/scp/mac/README.md @@ -0,0 +1,374 @@ +
+ +# Projects Service + + + + + +![GitHub package.json version (subfolder of monorepo)](https://img.shields.io/github/package-json/v/ELEVATE-Project/mentoring?filename=src%2Fpackage.json) +[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT) + +
+ + +
+The Project building block facilitates the creation and engagement with micro-improvement projects. + + +
+ +# Native Setup - With Self Creation Portal + +## PM2 Managed Services & Natively Installed Dependencies + +### System Requirements + +- **Node.js®:** v20 +- **PostgreSQL:** 16 +- **Apache Kafka®:** 3.5.0 +- **MongoDB:** 4.4.14 +- **Gotenberg:** 8.5.0 +- **Redis:** 7.0.15 + +Expectation: Upon following the prescribed steps, you will achieve a fully operational ELEVATE-Project application setup. Both the portal and backend services are managed using PM2, with all dependencies installed natively on the host system. + +## Prerequisites + +Before setting up the following ELEVATE-Project application, dependencies given below should be installed and verified to be running. Refer to the steps given below to install them and verify. + +1. Download dependency management scripts: + + ``` + curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/scripts/scp/ubuntu/check-dependencies.sh && \ + curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/scripts/scp/ubuntu/install-dependencies.sh && \ + curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/scripts/scp/ubuntu/uninstall-dependencies.sh && \ + chmod +x check-dependencies.sh && \ + chmod +x install-dependencies.sh && \ + chmod +x uninstall-dependencies.sh + ``` + +2. Verify installed dependencies by running `check-dependencies.sh`: + + ``` + ./check-dependencies.sh + ``` + + > Note: Keep note of any missing dependencies. + +3. Install dependencies by running `install-dependencies.sh`: + ``` + ./install-dependencies.sh + ``` + > Note: Install all missing dependencies and use check-dependencies script to ensure everything is installed and running. +4. Uninstall dependencies by running `uninstall-dependencies.sh`: + + ``` + ./uninstall-dependencies.sh + ``` + + > Warning: Due to the destructive nature of the script (without further warnings), it should only be used during the initial setup of the dependencies. For example, Uninstalling PostgreSQL/Citus using script will lead to data loss. USE EXTREME CAUTION. + + > Warning: This script should only be used to uninstall dependencies that were installed via installation script in step 3. If same dependencies were installed using other methods, refrain from using this script. This script is provided in-order to reverse installation in-case issues arise from a bad install. + +## Installation + +1. **Create ELEVATE-Project Directory:** Create a directory named **ELEVATE-Project**. + + Example Command: + + ``` + mkdir ELEVATE-Project && cd ELEVATE-Project/ + ``` + +2. **Git Clone Services And Portal Repositories** + +``` +git clone -b release-1.0.0 https://github.com/ELEVATE-Project/survey-project-creation-service.git && \ +git clone -b develop https://github.com/ELEVATE-Project/project-service.git && \ +git clone -b develop https://github.com/ELEVATE-Project/entity-management.git && \ +git clone -b develop https://github.com/ELEVATE-Project/user.git && \ +git clone -b master https://github.com/ELEVATE-Project/notification.git && \ +git clone -b main https://github.com/ELEVATE-Project/interface-service.git && \ +git clone -b master https://github.com/ELEVATE-Project/scheduler.git && \ +git clone -b release-3.4.0 https://github.com/ELEVATE-Project/observation-survey-projects-pwa && \ +git clone -b releaase-1.1.0 https://github.com/ELEVATE-Project/elevate-portal && \ +git clone -b release-3.4.0 https://github.com/ELEVATE-Project/observation-portal +``` + +3. **Install NPM Packages** + +``` +cd survey-project-creation-service/src && npm install && cd ../.. && \ +cd project-service && npm install && cd ../ && \ +cd entity-management/src && npm install && cd ../.. && \ +cd user/src && npm install && cd ../.. && \ +cd notification/src && npm install && cd ../.. && \ +cd interface-service/src && npm install && cd ../.. && \ +cd scheduler/src && npm install && cd ../.. && \ +cd observation-survey-projects-pwa && npm install --force && cd .. && \ +cd observation-portal && npm install --force && cd .. && \ +cd elevate-portal && npm install --force && cd .. +``` + +4. **Download Environment Files** + +``` +curl -L -o survey-project-creation-service/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/envs/scp/survey_project_creation_env && \ +curl -L -o project-service/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/envs/scp/project_env && \ +curl -L -o entity-management/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/envs/scp/entity_management_env && \ +curl -L -o user/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/envs/scp/user_env && \ +curl -L -o notification/src/.env https://github.com/ELEVATE-Project/project-service/raw/refs/heads/setupGuideSCP/documentation/3.4.0/native/envs/scp/notification_env && \ +curl -L -o interface-service/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/envs/scp/interface_env && \ +curl -L -o scheduler/src/.env https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/envs/scp/scheduler_env && \ +curl -L -o observation-survey-projects-pwa/src/assets/env/env.js https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/envs/scp/observation_survey_projects_pwa_env && \ +curl -L -o elevate-portal/env.js https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/envs/scp/elevate_portal_env && \ +curl -L -o observation-portal/src/assets/env/env.js https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/3.4.0/native/envs/scp/observation_portal_env +``` + +> **Note:** Modify the environment files as necessary for your deployment using any text editor, ensuring that the values are appropriate for your environment. The default values provided in the current files are functional and serve as a good starting point. Refer to the sample env files provided at the +> [Survey Project Creation](https://github.com/ELEVATE-Project/survey-project-creation-service/blob/release-1.0.0/src/.env.sample), +> [Project](https://github.com/ELEVATE-Project/project-service/blob/main/.env.sample), [User](https://github.com/ELEVATE-Project/user/blob/master/src/.env.sample), [Notification](https://github.com/ELEVATE-Project/notification/blob/master/src/.env.sample), [Scheduler](https://github.com/ELEVATE-Project/scheduler/blob/master/src/.env.sample), [Interface](https://github.com/ELEVATE-Project/interface-service/blob/main/src/.env.sample) and [Entity-Management](https://github.com/ELEVATE-Project/entity-management/blob/main/src/.env.sample) repositories for reference. + +> **Caution:** While the default values in the downloaded environment files enable the ELEVATE-Project Application to operate, certain features may not function correctly or could be impaired unless the adopter-specific environment variables are properly configured. + +> **Important:** +> +> - The Self Creation Portal heavily depends on the cloud, and most of the data is stored there. So please update the cloud-related environment keys with the actual values before proceeding further. + +- As mentioned in the above linked document, the **User SignUp** functionality may be compromised if key environment variables are not set correctly during deployment. If you opt to skip this setup, consider using the sample user account generator detailed in the `Sample User Accounts Generation` section of this document. + +5. **Attaching Config File** + + ``` + curl -L -o survey-project-creation-service/src/config.json https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/scripts/scp/ubuntu/configSCP.json && \ + curl -L -o project-service/config.json https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/scripts/scp/ubuntu/configFile.json && \ + curl -L -o entity-management/src/config.json https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/scripts/scp/ubuntu/configFile.json + ``` + +6. **Create Databases** + + 1. Download `create-databases.sh` Script File: + + ``` + curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/scripts/scp/ubuntu/create-databases.sh + ``` + + 2. Make the executable by running the following command: + + ``` + chmod +x create-databases.sh + ``` + + 3. Run the script file: + + ``` + ./create-databases.sh + ``` + +7. **Run Migrations to Create Tables and Seed Default Values** + + ``` + cd user/src && npx sequelize-cli db:migrate && cd ../.. && \ + cd survey-project-creation-service/src && npx sequelize-cli db:migrate && cd ../.. && \ + cd notification/src && npx sequelize-cli db:migrate && cd ../.. + ``` + + To seed the default values, run the following command: + + ``` + cd user/src && npx sequelize-cli db:seed:all && cd ../../ + ``` + +8. **Enabling Citus And Setting Distribution Columns (Optional)** + + To boost performance and scalability, users can opt to enable the Citus extension. This transforms PostgreSQL into a distributed database, spreading data across multiple nodes to handle large datasets more efficiently as demand grows. + + > NOTE: Currently only available for Linux based operation systems. + + 1. Download user `distributionColumns.sql` file. + + ``` + curl -o ./user/distributionColumns.sql -JL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/distribution-columns/user/distributionColumns.sql + + ``` + + 2. Set up the `citus_setup` file by following the steps given below. + + 1. Download the `citus_setup.sh` file: + + ``` + curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/scripts/linux/citus_setup.sh + ``` + + 2. Make the setup file executable by running the following command: + + ``` + chmod +x citus_setup.sh + ``` + + 3. Enable Citus and set distribution columns for `user` database by running the `citus_setup.sh`with the following arguments. + ``` + ./citus_setup.sh user postgres://postgres:postgres@localhost:9700/users + ``` + + 3. Download survey-project-creation-service `distributionColumns.sql` file. + + ``` + curl -o ./survey-project-creation-service/distributionColumns.sql -JL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/distribution-columns/survey-project-creation/distributionColumns.sql + + ``` + + 4. Set up the `citus_setup` file by following the steps given below. + + 1. Download the `citus_setup.sh` file: + + ``` + curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/main/documentation/1.0.0/native/scripts/linux/citus_setup.sh + ``` + + 2. Make the setup file executable by running the following command: + + ``` + chmod +x citus_setup.sh + ``` + + 3. Enable Citus and set distribution columns for `scp` database by running the `citus_setup.sh`with the following arguments. + ``` + ./citus_setup.sh survey-project-creation-service postgres://postgres:postgres@localhost:9700/scp + ``` + +9. **Insert Initial Data** + + 1. Once you update the cloud credentials in the survey-project-creation-service environment, please run the script below to upload the certificate base templates to the cloud. + + ``` + cd survey-project-creation-service/src/scripts && node uploadCertificateBaseTemplate.js && cd ../../../ + ``` + + 2. If you are using the Self Creation Portal for the education sector, please run the script below to insert the relevant entities into the survey-project-creation-service database. + + ``` + cd survey-project-creation-service/src/scripts && node addDefaultEntitiesForEducationSector.js && cd ../../../ + ``` + + 3. Download `entity-project-sample-data.sh` Script File: + + ``` + curl -o project_entity_sample_data.sh https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/scripts/scp/ubuntu/project_entity_sample_data.sh && \ + chmod +x project_entity_sample_data.sh && \ + ./project_entity_sample_data.sh + ``` + +10. **Insert Forms Data into Database** + + If the `axios` package is not available in the current project directory, install it before running the import script: + + ```bash + npm install axios + ``` + + Then run the import script: + + ```bash + curl -s https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/scripts/linux/import_forms.js | node + ``` + +11. **Start The Services** + + Following the steps given below, 2 instances of each ELEVATE-Project backend service will be deployed and be managed by PM2 process manager. + + ``` + (cd survey-project-creation-service/src && pm2 start app.js --name survey-project-creation-service && cd -) && \ + (cd project-service && pm2 start app.js --name project-service && cd -) && \ + (cd entity-management/src && pm2 start app.js --name entity-management && cd -) && \ + (cd user/src && pm2 start app.js --name user && cd -) && \ + (cd notification/src && pm2 start app.js --name notification && cd -) && \ + (cd interface-service/src && pm2 start app.js --name interface && cd -) && \ + (cd scheduler/src && pm2 start app.js --name scheduler && cd -) + ``` + +12. **Start The Portal** + + ELEVATE-Project portal utilizes Ionic for building the browser bundle, follow the steps given below to install them and start the portal. + + 1. Install the Ionic framework: + + ``` + npm install -g ionic + ``` + + 2. Install the Ionic client: + + ``` + npm install -g @ionic/cli + ``` + + 3. Navigate to `observation-survey-projects-pwa` directory: + + ``` + cd observation-survey-projects-pwa + ``` + + 4. Run the project on your local system using the following command: + + ``` + ionic serve + ``` + + Navigate to http://localhost:8100 to access the ELEVATE-Project Portal. + +## Sample User Accounts Generation + +During the initial setup of ELEVATE-Project services with the default configuration, you may encounter issues creating new accounts through the regular SignUp flow on the ELEVATE-Project portal. This typically occurs because the default SignUp process includes OTP verification to prevent abuse. Until the notification service is configured correctly to send actual emails, you will not be able to create new accounts. + +In such cases, you can generate sample user accounts using the steps below. This allows you to explore the ELEVATE-Project services and portal immediately after setup. + +> **Warning:** Use this generator only immediately after the initial system setup and before any normal user accounts are created through the portal. It should not be used under any circumstances thereafter. + +``` +curl -o insert_sample_data.sh https://raw.githubusercontent.com/ELEVATE-Project/project-service/refs/heads/setupGuideSCP/documentation/3.4.0/native/scripts/scp/ubuntu/insert_sample_data.sh && \ +chmod +x insert_sample_data.sh && \ +./insert_sample_data.sh +``` + +After successfully running the script mentioned above, the following user accounts will be created and available for login: + +| Email ID | Password | Role | +| ---------------------- | ---------- | ----------------------- | +| mallanagouda@gmail.com | Password1@ | State Education Officer | +| prajwal@gmail.com | Password1@ | State Education Officer | +| vishnu@gmail.com | Password1@ | State Education Officer | +| priyanka@gmail.com | Password1@ | Program Designer | +| adithya@gmail.com | Password1@ | Content Creator | +| praveen@gmail.com | Password1@ | Reviewer | + +## Postman Collections + +- [Projects Service](https://github.com/ELEVATE-Project/project-service/tree/main/api-doc) + +- [Surevy Project Creation Service](https://github.com/ELEVATE-Project/survey-project-creation-service/tree/release-1.0.0/src/api-doc) + +## Adding New Projects to the System + +With implementation scripts, you can seamlessly add new projects to the system. Once a project is successfully added, it becomes visible on the portal, ready for use and interaction. For a comprehensive guide on setting up and using the implementation script, please refer to the [documentation here](https://github.com/ELEVATE-Project/project-service/tree/main/Project-Service-implementation-Script). + +# Team + + + + + +# Open Source Dependencies + +Several open source dependencies that have aided Projects's development: + +![NodeJS](https://img.shields.io/badge/node.js-6DA55F?style=for-the-badge&logo=node.js&logoColor=white) +![Apache Kafka](https://img.shields.io/badge/Apache%20Kafka-000?style=for-the-badge&logo=apachekafka) +![Redis](https://img.shields.io/badge/redis-%23DD0031.svg?style=for-the-badge&logo=redis&logoColor=white) +![Jest](https://img.shields.io/badge/-jest-%23C21325?style=for-the-badge&logo=jest&logoColor=white) +![Git](https://img.shields.io/badge/git-%23F05033.svg?style=for-the-badge&logo=git&logoColor=white)