The Survey building block enables creation, consumption of Survey,Observation and report capabilities.
- Ubuntu (Recommended: Version 20 and above)
- Windows (Recommended: Version 11 and above)
- macOs (Recommended: Version 12 and above)
Survey service can be setup in 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
Expectation: By diligently following the outlined steps, you will successfully establish a fully operational Survey application setup, including both the portal and backend services.
To set up the Survey 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. For Windows and MacOS users, you can refer to the Docker documentation for installation instructions: Docker Compose Installation Guide. Once these prerequisites are in place, you're all set to get started with setting up the Survey application.
Create survey Directory: Create a directory named survey.
Example Command:
mkdir survey && cd survey/
Note: All commands are run from the survey directory.
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 teminal to check this
for port in 3000 3001 3002 5001 4000 4301 5500 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
-
Download and execute main setup script: Execute the following command in your terminal from the survey directory.
curl -OJL https://github.com/ELEVATE-Project/samiksha-service/raw/main/documentation/1.0.0/dockerized/scripts/mac-linux/setup_survey.sh && chmod +x setup_survey.sh && ./setup_survey.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 :
-
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.
-
All docker containers can be stopped and removed by using below command.
./docker-compose-down.sh
-
All services and dependencies can be started using below command.
./docker-compose-up.sh
-
Keep the current terminal session active, and kindly open a new terminal window within the survey directory.
After successfully completing this, please move to the next section: Enable Citus Extension
-
Download Docker Compose File: Retrieve the docker-compose.yml file from the Survey service repository and save it to the survey directory.
curl -OJL https://github.com/ELEVATE-Project/samiksha-service/raw/main/documentation/1.0.0/dockerized/docker-compose.yml
Note: All commands are run from the survey directory.
-
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/samiksha-service/raw/main/documentation/1.0.0/dockerized/envs/interface_env curl -L -O https://github.com/ELEVATE-Project/samiksha-service/raw/main/documentation/1.0.0/dockerized/envs/entity_management_env curl -L -O https://github.com/ELEVATE-Project/samiksha-service/raw/main/documentation/1.0.0/dockerized/envs/samiksha_env curl -L -O https://github.com/ELEVATE-Project/samiksha-service/raw/main/documentation/1.0.0/dockerized/envs/notification_env curl -L -O https://github.com/ELEVATE-Project/samiksha-service/raw/main/documentation/1.0.0/dockerized/envs/scheduler_env curl -L -O https://github.com/ELEVATE-Project/samiksha-service/raw/main/documentation/1.0.0/dockerized/envs/user_env curl -L -O https://github.com/ELEVATE-Project/samiksha-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 Survey, User, Notification, Scheduler, Interface and Entity-management 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.
-
Download
replace_volume_path
Script File- Windows
curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/samiksha-service/refs/heads/main/documentation/1.0.0/dockerized/scripts/windows/replace_volume_path.bat
- Windows
-
Run
replace_volume_path
Script File- Windows
Run the script file using the following command.
replace_volume_path.bat
- Windows
Run the script file using the following command.
-
Download
docker-compose-up
&docker-compose-down
Script Files- Windows
curl -OJL https://github.com/ELEVATE-Project/samiksha-service/raw/features_dockerSetup/documentation/1.0.0/dockerized/scripts/windows/docker-compose-up.bat
curl -OJL https://github.com/ELEVATE-Project/samiksha-service/raw/main/documentation/1.0.0/dockerized/scripts/windows/docker-compose-down.bat
- Windows
-
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.
-
-
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.yml
file, using thedown
command will lead to data loss since the database container does not persist data. To persist data acrossdown
commands and subsequent container removals, refer to the "Persistence of Database Data in Docker Containers" section of this documentation.
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.
To enable the Citus extension for mentoring and user services, follow these steps.
-
Create a sub-directory named
user
and downloaddistributionColumns.sql
into it. (Skip for linux/mac setup)mkdir user && curl -o ./user/distributionColumns.sql -JL https://github.com/ELEVATE-Project/samiksha-service/raw/main/documentation/1.0.0/distribution-columns/user/distributionColumns.sql
-
Set up the citus_setup file by following the steps given below.
-
Ubuntu/Linux/Mac
-
Enable Citus and set distribution columns for
user
database by running thecitus_setup.sh
with the following arguments../citus_setup.sh user postgres://postgres:postgres@citus_master:5432/user
-
-
Windows
-
Download the
citus_setup.bat
file.curl -OJL https://github.com/ELEVATE-Project/samiksha-service/raw/main/documentation/1.0.0/dockerized/scripts/windows/citus_setup.bat
-
Enable Citus and set distribution columns for
user
database by running thecitus_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. -
To ensure the persistence of database data when running docker compose down
, it is necessary to modify the docker-compose.yml
file according to the steps given below:
- Modification Of The
docker-compose.yml
File:
Begin by opening the docker-compose.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:
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
- 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:
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.
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 Survey 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
./insert_sample_data.sh user postgres://postgres:postgres@citus_master:5432/user
-
Windows
- Download The
sampleData.sql
Files:
mkdir sample-data\user 2>nul & ^curl -L https://raw.githubusercontent.com/ELEVATE-Project/samiksha-service/main/documentation/1.0.0/sample-data/windows/user/sampleData.sql -o sample-data/user/sampleData.sql
- Download The
insert_sample_data
Script File:
-
Windows
curl -L -o insert_sample_data.bat https://github.com/ELEVATE-Project/samiksha-service/raw/main/documentation/1.0.0/dockerized/scripts/windows/insert_sample_data.bat
- Run The
insert_sample_data
Script File:
-
Windows
insert_sample_data.bat user postgres://postgres:postgres@citus_master:5432/user
- Download The
After successfully running the script mentioned above, the following user accounts will be created and available for login:
Email ID | Password | Role |
---|---|---|
[email protected] | Password1@ | State Education Officer |
[email protected] | Password1@ | State Education Officer |
[email protected] | Password1@ | State Education Officer |
This step will guide us in implementing a sample survey and observation solutions following the initial setup of the survey service.
-
Ubuntu/Linux && Windows
docker exec -it samiksha sh -c "node documentation/1.0.0/dockerized/scripts/mac-linux/insert_sample_solutions.js"
-
Ubuntu/Linux/Mac:
curl -OJL https://github.com/ELEVATE-Project/samiksha-service/raw/main/documentation/1.0.0/dockerized/scripts/mac-linux/import_forms_mongo.sh && chmod +x import_forms_mongo.sh && ./import_forms_mongo.sh mongodb://mongo:27017/elevate-samiksha && \ curl -OJL https://github.com/ELEVATE-Project/samiksha-service/raw/main/documentation/1.0.0/dockerized/scripts/mac-linux/add_profile_configuation.sh && chmod +x add_profile_configuation.sh && ./add_profile_configuation.sh
-
Windows:
- Download The
import_forms_mongo.bat
Files & Run Theimport_forms_mongo.bat
Script File:
curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/samiksha-service/refs/heads/main/documentation/1.0.0/dockerized/scripts/windows/import_forms_mongo.bat && curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/samiksha-service/refs/heads/main/documentation/1.0.0/dockerized/scripts/windows/modifyform.js && import_forms_mongo.bat mongodb://localhost:27017/elevate-samiksha
- Download The
Once the services are up and the front-end app bundle is built successfully, navigate to localhost:7007 to access the survey app.
Note: In this setup, features such as Sign-Up,file uploads will not be available because cloud storage credentials have been masked in the environment files for security reasons.
Natively Installed Services & Dependencies
Expectation: Upon following the prescribed steps, you will achieve a fully operational Survey application setup. Both the portal and backend services are managed using PM2, with all dependencies installed natively on the host system.
Before setting up the following Survey 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
-
Download dependency management scripts:
curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/samiksha-service/refs/heads/main/documentation/1.0.0/scripts/linux/check-dependencies.sh && \ curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/samiksha-service/refs/heads/main/documentation/1.0.0/scripts/linux/install-dependencies.sh && \ curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/samiksha-service/refs/heads/main/documentation/1.0.0/scripts/linux/uninstall-dependencies.sh && \ chmod +x check-dependencies.sh && \ chmod +x install-dependencies.sh && \ chmod +x uninstall-dependencies.sh
-
Verify installed dependencies by running
check-dependencies.sh
:./check-dependencies.sh
Note: Keep note of any missing dependencies.
-
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.
-
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
-
Install Node.js 20:
brew install node@20
brew link --overwrite node@20
-
Install Kafka:
brew install kafka
-
Install PostgreSQL 16:
brew install postgresql@16
-
Install PM2:
sudo npm install pm2@latest -g
-
Install Redis:
brew install redis
-
Install Mongo:
brew install [email protected]
-
Download
check-dependencies.sh
file:curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/samiksha- service/refs/heads/feature/sample_data_scripts/documentation/1.0.0/scripts/macos/check-dependencies.sh && \ chmod +x check-dependencies.sh
-
Verify installed dependencies by running
check-dependencies.sh
:./check-dependencies.sh
-
Windows
-
Install Node.js 20:
Download and install Node.js v20 for Windows platform (x64) from official Node.js download page.
-
Install Kafka 3.5.0:
-
Adapt the instructions given in the following "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 Survey services.
Note: Multiple WSL terminals can be opened by launching
Ubuntu
from start menu. -
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: <BROADCAST,MULTICAST,UP,LOWER_UP> 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. -
In the same WSL terminal, navigate to
config
directory of Kafka from step 1 and make the following changes toserver.properties
file.-
Uncomment
listeners=PLAINTEXT://:9092
line and change it tolisteners=PLAINTEXT://0.0.0.0:9092
to allow connections from any IP. -
Uncomment
advertised.listeners
line and set it toadvertised.listeners=PLAINTEXT://172.12.46.150:9092
. Replace172.12.46.150
with the actual IP address of your WSL instance.
-
-
Restart the Zookeeper and Kafka Server from their own WSL terminals from step 1.
-
-
Install Redis:
-
Follow the instructions given in the official Redis Documentation to install Redis using WSL.
-
Using the WSL terminal, open the Redis configuration file in a text editor, such as nano:
sudo nano /etc/redis/redis.conf
-
Find the line containing
bind 127.0.0.1 ::1
and change it tobind 0.0.0.0 ::.
. This change allows Redis to accept connections from any IP address. Then save and exit the file. -
Restart Redis to apply the changes:
sudo service redis-server restart
-
-
Install PM2:
npm install pm2@latest -g
-
Install MongoDB:
- Adapt the instructions given in the following "MongoDB Download Center." Choose the latest version or the version you need.
-
Install PostgreSQL 16:
-
Download and install PostgreSQL 16 from EnterpriseDB PostgreSQL download page.
Note: Set username and password for the default database to be 'postgres' during installation.
-
Once installed, Add
C:\Program Files\PostgreSQL\16\bin
to windows environment variables. Refer here or here for more information regarding how to set it.
-
-
- Create Elevate-survey Directory: Create a directory named elevate-survey.
Example Command:
mkdir elevate-survey && cd elevate-survey/
-
Git Clone Services And Portal Repositories
-
Ubuntu/Linux/MacOS
git clone -b main https://github.com/ELEVATE-Project/samiksha-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.git
-
Windows
git clone -b main https://github.com/ELEVATE-Project/samiksha-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.git
-
-
Install NPM Packages
-
Ubuntu/Linux/MacOS
cd samiksha-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 samiksha-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.
-
-
Download Environment Files
-
Ubuntu/Linux
curl -L -o samiksha-service/.env https://raw.githubusercontent.com/ELEVATE-Project/samiksha-service/refs/heads/main/documentation/1.0.0/native/envs/survey_service_env && \ curl -L -o entity-management/src/.env https://raw.githubusercontent.com/ELEVATE-Project/samiksha-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/samiksha-service/refs/heads/main/documentation/1.0.0/native/envs/user_env && \ curl -L -o notification/src/.env https://raw.githubusercontent.com/ELEVATE-Project/samiksha-service/refs/heads/main/documentation/1.0.0/native/envs/notification_env && \ curl -L -o interface-service/src/.env https://raw.githubusercontent.com/ELEVATE-Project/samiksha-service/refs/heads/main/documentation/1.0.0/native/envs/interface_env && \ curl -L -o scheduler/src/.env https://raw.githubusercontent.com/ELEVATE-Project/samiksha-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/samiksha-service/refs/heads/main/documentation/1.0.0/native/envs/environment.ts
-
MacOS
curl -L -o samiksha-service/.env https://raw.githubusercontent.com/ELEVATE-Project/samiksha-service/refs/heads/feature/sample_data_scripts/documentation/1.0.0/native/envs/survey_service_env && \ curl -L -o user/src/.env https://raw.githubusercontent.com/ELEVATE-Project/samiksha-service/refs/heads/feature/sample_data_scripts/documentation/1.0.0/native/envs/user_env && \ curl -L -o notification/src/.env https://raw.githubusercontent.com/ELEVATE-Project/samiksha-service/refs/heads/feature/sample_data_scripts/documentation/1.0.0/native/envs/notification_env && \ curl -L -o interface-service/src/.env https://raw.githubusercontent.com/ELEVATE-Project/samiksha-service/refs/heads/feature/sample_data_scripts/documentation/1.0.0/native/envs/interface_env && \ curl -L -o scheduler/src/.env https://raw.githubusercontent.com/ELEVATE-Project/samiksha-service/refs/heads/feature/sample_data_scripts/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/samiksha-service/refs/heads/feature/sample_data_scripts/documentation/1.0.0/native/envs/environment.ts
-
Windows
curl -L -o samiksha-service\.env https://github.com/ELEVATE-Project/samiksha-service/blob/main/documentation/1.0.0/native/envs/survey_service_env & ^ curl -L -o entity-management\src\.env https://github.com/ELEVATE-Project/samiksha-service/blob/main/documentation/1.0.0/native/envs/entity_management_env & ^ curl -L -o user\src\.env https://github.com/ELEVATE-Project/samiksha-service/blob/main/documentation/1.0.0/native/envs/user_env & ^ curl -L -o notification\src\.env https://github.com/ELEVATE-Project/samiksha-service/blob/main/documentation/1.0.0/native/envs/notification_env & ^ curl -L -o interface-service\src\.env https://github.com/ELEVATE-Project/samiksha-service/blob/main/documentation/1.0.0/native/envs/interface_env & ^ curl -L -o scheduler\src\.env https://github.com/ELEVATE-Project/samiksha-service/blob/main/documentation/1.0.0/native/envs/scheduler_env & ^ curl -L -o observation-survey-projects-pwa\src\environments\environment.ts https://github.com/ELEVATE-Project/samiksha-service/blob/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 Survey, User, Notification, Scheduler, and Interface repositories for reference.
Caution: While the default values in the downloaded environment files enable the Survey 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.
-
-
Create Databases
-
Ubuntu/Linux
-
Download
create-databases.sh
Script File:curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/samiksha-service/refs/heads/main/documentation/1.0.0/native/scripts/linux/create-databases.sh
-
Make the executable by running the following command:
chmod +x create-databases.sh
-
Run the script file:
./create-databases.sh
-
-
MacOS
-
Download
create-databases.sh
Script File:curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/samiksha- service/refs/heads/feature/sample_data_scripts/documentation/1.0.0/native/scripts/macos/create-databases.sh
-
Make the executable by running the following command:
chmod +x create-databases.sh
-
Run the script file:
./create-databases.sh
-
-
Windows
-
Download
create-databases.bat
Script File:curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/samiksha- service/refs/heads/feature/sample_data_scripts/documentation/1.0.0/native/scripts/windows/create-databases.bat
-
Run the script file:
create-databases.bat
-
-
-
Run Migrations To Create Tables
-
Ubuntu/Linux/MacOS
-
Install Sequelize-cli globally:
sudo npm i sequelize-cli -g
-
Run Migrations:
cd user/src && npx sequelize-cli db:migrate && cd ../.. && \ cd notification/src && npx sequelize-cli db:migrate && cd ../..
-
-
Windows
-
Run Migrations:
cd user\src && npx sequelize-cli db:migrate && cd ..\.. && cd notification\src && npx sequelize-cli db:migrate && cd ..\..
-
-
-
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.
-
Download user
distributionColumns.sql
file.- Linux/Ubuntu/MacOS
curl -o ./user/distributionColumns.sql -JL https://raw.githubusercontent.com/ELEVATE-Project/samiksha-service/refs/heads/main/documentation/1.0.0/user/distributionColumns.sql
- Linux/Ubuntu/MacOS
-
Set up the
citus_setup
file by following the steps given below.-
Ubuntu/Linux
-
Download the
citus_setup.sh
file:curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/samiksha-service/refs/heads/main/documentation/1.0.0/native/scripts/linux/citus_setup.sh
-
Make the setup file executable by running the following command:
chmod +x citus_setup.sh
-
Enable Citus and set distribution columns for
user
database by running thecitus_setup.sh
with the following arguments../citus_setup.sh user postgres://postgres:postgres@localhost:9700/users
-
-
-
-
Insert Initial Data
-
Ubuntu/Linux/Mac/Windows
-
Download
insert_sample_solutions.js
Script File:curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/samiksha-service/refs/heads/main/documentation/1.0.0/native/scripts/linux/insert_sample_solutions.js && \ curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/samiksha-service/refs/heads/main/documentation/1.0.0/native/scripts/linux/common.js && \ curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/samiksha-service/refs/heads/main/documentation/1.0.0/native/scripts/linux/entity_sampleData.js&& \ curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/samiksha-service/refs/heads/main/documentation/1.0.0/native/scripts/linux/observation_sampleData.js && \ curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/samiksha-service/refs/heads/main/documentation/1.0.0/native/scripts/linux/survey_sampleData.js
-
Make the setup file executable by running the following command.
node insert_sample_solutions.js
-
-
Ubuntu/Linux/Mac
- Use Survey in-build seeders to insert the initial data.
cd user/src && npm run db:seed:all && cd ../..
- Use Survey in-build seeders to insert the initial data.
-
Windows
- Use Survey in-build seeders to insert the initial data:
cd user\src && npm run db:seed:all && cd ..\..
- Use Survey in-build seeders to insert the initial data:
-
-
Insert Forms Data into Database
-
Ubuntu/Linux/MacOS/Windows
-
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/samiksha-service/refs/heads/main/documentation/1.0.0/native/scripts/linux/import_forms.js | node
-
-
-
Start The Services
Following the steps given below, 2 instances of each Survey backend service will be deployed and be managed by PM2 process manager.
-
Ubuntu/Linux
cd samiksha-service && pm2 start app.js --name survey-service && cd ../ && cd entity-management/src && pm2 start app.js --name survey-entity-management && cd ../.. && cd user/src && pm2 start app.js --name survey-user && cd ../.. && cd notification/src && pm2 start app.js --name survey-notification && cd ../.. && cd interface-service/src && pm2 start app.js --name survey-interface && cd ../.. && cd scheduler/src && pm2 start app.js --name survey-scheduler && cd ../..
-
MacOS
cd samiksha-service && npx pm2 start app.js -i 2 --name survey-service && cd ../ && \ cd user/src && npx pm2 start app.js -i 2 --name survey-user && cd ../.. && \ cd notification/src && npx pm2 start app.js -i 2 --name survey-notification && cd ../.. && \ cd interface-service/src && npx pm2 start app.js -i 2 --name survey-interface && cd ../.. && \ cd scheduler/src && npx pm2 start app.js -i 2 --name survey-scheduler && cd ../..
-
Windows
cd samiksha-service && pm2 start app.js --name survey-service && cd ../ && ^ cd entity-management/src && pm2 start app.js --name survey-entity-management && cd ../.. && ^ cd user/src && pm2 start app.js --name survey-user && cd ../.. && ^ cd notification/src && pm2 start app.js --name survey-notification && cd ../.. && ^ cd interface-service/src && pm2 start app.js --name survey-interface && cd ../.. && ^ cd scheduler/src && pm2 start app.js --name survey-scheduler && cd ../..
-
-
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 ..\..\..
-
Start The Portal
Survey portal utilizes Ionic and Angular CLI for building the browser bundle, follow the steps given below to install them and start the portal.
-
Ubuntu/Linux
-
Install Ionic CLI globally:
sudo npm install -g @ionic/cli
-
Install Angular CLI globally:
sudo npm install -g @angular/cli
-
Navigate to
observation-survey-projects-pwa
directory:cd observation-survey-projects-pwa
-
Build the portal
ionic build
-
Start the portal:
ionic serve
-
-
MacOS
-
Install Ionic CLI globally:
sudo npm install -g @ionic/cli
-
Install Angular CLI globally:
sudo npm install -g @angular/cli
-
Navigate to
observation-survey-projects-pwa
directory:cd observation-survey-projects-pwa
-
Build the portal:
npx ionic build
-
Start the portal:
npx ionix serve
-
-
Windows
-
Install Ionic CLI globally:
npm install -g @ionic/cli
-
Install Angular CLI globally:
npm install -g @angular/cli
-
Navigate to
observation-survey-projects-pwa
directory:cd observation-survey-projects-pwa
-
Build the portal
ionic build
-
Start the portal:
ionic serve
-
-
During the initial setup of Survey services with the default configuration, you may encounter issues creating new accounts through the regular SignUp flow on the Survey 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 Survey 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/samiksha-service/refs/heads/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/samiksha-service/refs/heads/feature/sample_data_scripts/documentation/1.0.0/scripts/macos/insert_sample_data.sh && \ chmod +x insert_sample_data.sh && \ ./insert_sample_data.sh
-
Windows
curl -OJL https://raw.githubusercontent.com/ELEVATE-Project/samiksha-service/refs/heads/feature/sample_data_scripts/documentation/1.0.0/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 |
---|---|---|
[email protected] | Password1@ | state_educational_officer |
[email protected] | Password1@ | state_educational_officer |
[email protected] | Password1@ | state_educational_officer |
Once the services are up and the front-end app bundle is built successfully, navigate to localhost:8100 to access the survey app.
Note: In this setup, features such as Sign-Up,file uploads will not be available because cloud storage credentials have been masked in the environment files for security reasons.
With implementation scripts, you can seamlessly add new projects to the system. Once a survey or observations are 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.
Several open source dependencies that have aided Survey servie's development: