From d59ee0e0185cf845c8dc38e52a815c1156ee0691 Mon Sep 17 00:00:00 2001 From: Rahul K R Date: Mon, 5 Feb 2024 09:34:53 +0530 Subject: [PATCH 1/8] README 2.5.0 --- README.md | 245 +++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 198 insertions(+), 47 deletions(-) diff --git a/README.md b/README.md index 587d766c8..c2ef52cb4 100644 --- a/README.md +++ b/README.md @@ -2,19 +2,23 @@ CONTENTS OF THIS FILE --------------------- * Dependencies - * Ionic-Android build Setup - * Cli setup + * Command-line setup * Project setup - * Build apk - * Debug apk + * Build MentorED + * Debug MentorED + * Hashicorp Vault Setup + * Jenkins Pipeline + * Ansible Deployment Script + * Env Files, Server.js And Pm2 Config Files DEPENDENCIES ---------------------- +------------ + * Ionic: - Ionic CLI : 6.19.1 (/usr/local/lib/node_modules/@ionic/cli) - Ionic Framework : @ionic/angular 6.1.7 + Ionic CLI : 7.1.1 (/usr/local/lib/node_modules/@ionic/cli) + Ionic Framework : @ionic/angular 6.7.5 @angular-devkit/build-angular : 13.2.6 @angular-devkit/schematics : 13.2.6 @angular/cli : 13.2.6 @@ -22,10 +26,10 @@ DEPENDENCIES * Capacitor: - Capacitor CLI : 3.5.1 - @capacitor/android : 3.5.0 - @capacitor/core : 3.5.1 - @capacitor/ios : 3.5.0 + Capacitor CLI : 5.5.1 + @capacitor/android : 5.5.1 + @capacitor/core : 5.5.1 + @capacitor/ios : 5.5.1 * Cordova: @@ -36,61 +40,208 @@ DEPENDENCIES * Utility: cordova-res : 0.15.4 - native-run : 1.6.0 + native-run : 1.7.4 * System: - Android SDK Tools : 26.1.1 (/home/afnan/Android/Sdk) - NodeJS : v14.19.0 (/usr/local/bin/node) - npm : 6.14.16 + Android SDK Tools : 26.1.1 + NodeJS : v18.18.2 (you can download from https://nodejs.org/) + npm : 10.2.0 OS : Linux 5.13 -IONIC-ANDROID BUILD SETUP ---------------------- - -- [Install java] (https://www.oracle.com/java/technologies/downloads/#java8) -- [Install Gradle] (https://gradle.org/install/) -- [Install Android Studio] (https://developer.android.com/studio) - -- After Android studio installation, install SDK -- Open Android studio and goto settings/appearance and behavior/system settings/Android SDK -- Install appropriate Android sdk platform package. -- Add environment variables in ~/.bashrc or ~/.bash_profile as follows - export ANDROID_SDK_ROOT=path_to_sdk - export PATH=$PATH:$ANDROID_SDK_ROOT/tools/bin - export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools -- Reference: https://ionicframework.com/docs/installation/android - - CLI SETUP ---------------------- +--------- -- `npm install -g ionic` -- `npm install @capacitor/core` -- `npm install @capacitor/cli --save-dev` -- `npx cap init` +- npm install -g ionic +- npm install -g @ionic/cli +- npm install @capacitor/core +- npm install @capacitor/cli --save-dev PROJECT SETUP ---------------------- +------------- - git clone the repo (https://github.com/ELEVATE-Prjoect/mentoring-mobile-app.git) +- Checkout to latest branch.(currently release-2.5.0) - Add environment files inside src/environments - Go to project folder and run npm i -BUILD APK ---------------------- -- To check attached devices do adb devices -- Run ionic build (Make sure you have attached device) +BUILD MENTORED +-------------- + +- Run npx cap sync +- Run ionic build - Run ionic cap sync -- Run ionic capacitor run android --prod -- Apk location project_folder/platforms/android/app/build/outputs/apk/debug/apk_name.apk +- Run ionic serve to serve the project in local -DEBUG APK +DEBUG MENTORED +-------------- + +- Open the running app in browser +- Start inspecting using chrome dev tools or any alternatives + +HASHICORP VAULT SETUP --------------------- -- Open chrome and enter chrome://inspect -- Select app \ No newline at end of file + +JENKINS PIPELINE +---------------- + +For automating your app deployment, you can use Jenkins. You can create a Jenkins job and run that job each time you want a deployment. +For that you can create a Jenkins job and add a pipeline script for the job inside the job’s ‘Configure’ section. For example, see below. + + pipeline { agent any + options { + disableConcurrentBuilds() + } + stages { + stage("git"){ + steps{ + + git branch: '', url: '' + } + + } + stage("ansible run"){ + steps{ + + ansiblePlaybook becomeUser: 'jenkins', + credentialsId:’your-cred-id’, + extras: "-e vaultAddress= -e gitBranch=", + installation: 'ansible', + inventory: '', + playbook: '' + } + + } + } + } + +This pipeline will help to fetch the latest code from the given branch in repo and run the ansible script which we are about to create for building and deploying our application. + +ANSIBLE DEPLOYMENT SCRIPT +------------------------- + +Add an ansible script inside the ‘deployment’ folder in the root folder of your project. And add that path in your jenkins pipeline. When you run the job in jenkins, this script will get executed step by step till the end. Please update all the necessary details in the below example. + +Eg : + + - hosts: “” + vars: + project_path: + root_path: + //Add variables here if needed. (Remove this line in your code) + tasks: + - name: Get the token for Hashicorp vault + slurp: + src: "" + register: slurpfile + - name: Run vault credentials and get the environment related secrets stored in hashicorp vault + shell: "curl --location --request GET '{{ vaultAddress }}' --header 'X-Vault-Token: {{ slurpfile['content'] | b64decode }}' | jq '.data' > '{{root_path}}/data2.json'" + register: vaultCurl + - name: Change directory + shell: cd {{project_path}} + - name: Fetch the latest code + git: + repo: git-url + dest: "{{project_path}}" + version: "{{gitBranch}}" + force: yes + - name: Update npm + shell: cd {{project_path}} && npm i --force + - name: Set permission + shell: chmod 744 {{ project_path }}/src/scripts/json2env.sh + - name: Generate .env and store it in environment folder + shell: cat {{root_path}}/data2.json | jq '.data' > {{ project_path }}/src/environments/environment.ts && sed -i '1s/^/export const environment = \n/' {{ project_path }}/src/environments/environment.ts + register: envConfig + - debug: msg=" cred {{ envConfig }} " + - name: Change directory + shell: chdir {{project_path}} + - name: Fetch pm2 config file from Hashicorp vault + shell: "curl --location --request GET '{{ vaultAddress }}' --header 'X-Vault-Token: {{ slurpfile['content'] | b64decode }}' | jq '.data.data' > '{{ project_path }}/pm2.config.json'" + register: pm2 + - name: Change directory + shell: cd {{project_path}} + - name: Remove www folder + shell: rm -rf www + - name: Build pwa app to deploy + shell: cd {{project_path}} && ionic build --prod + - name: Start pm2 with pm2 config file and finish deployment + shell: cd {{project_path}} && pm2 start pm2.config.json + + +Please remove all the unwanted lines. + +You also have to add a script inside /src/scripts/json2env.sh + + + #!/bin/sh + + tr -d '\n' | + grep -o '"[A-Za-z\_][A-Za-z_0-9]\+"\s*:\s*\("[^"]\+"\|[0-9\.]\+\|true\|false\|null\)' | + sed 's/"\(._\)"\s_:\s\*"\?\([^"]\+\)"\?/\1= "\2"/' + +This script will convert the fetched data from hashicorp to env files. + + + +ENV FILES, SERVER.JS AND PM2 CONFIG FILES +----------------------------------------- + +For deploying your application, you need an Environment file, Server.js, and a pm2.config.json file. Adding structure of those below for reference. + + export const environment = { + production: true / false, + name: "", + staging: true / false, + dev: true / false, + baseUrl: "", + sqliteDBName: " (if you have)", + deepLinkUrl: "", + privacyPolicyUrl: "", + termsOfServiceUrl: "", + }; + +* pm2.config.json file structure : + + { + "apps": [ + { + "name": "", + "script": "server.js", + "args": [], + "instances": "1", + "exec_mode": "cluster", + "watch": false, + "merge_logs": true, + "env": { + "NODE_ENV": "production", + "PORT": + } + } + ] + } + + +* Server.js file structure: + + const express = require('express'); + const path = require('path'); + const app = express(); + const port = process.env.PORT || 7601; + + + app.use(express.static(path.join(__dirname, 'www'))); + + + app.get('*', (req, res) => { + res.sendFile(path.join(__dirname, 'www', 'index.html')); + }); + + + app.listen(port, () => { + console.log(`Server is running on port ${port}`); + }); From 57021db2ff4d8c2e289161acd51c25e209dc4658 Mon Sep 17 00:00:00 2001 From: Nanditha K <106753017+nanditha938@users.noreply.github.com> Date: Tue, 13 Feb 2024 14:10:09 +0530 Subject: [PATCH 2/8] Edits to product names, dependencies, and project setup - Changed MentorED to Mentor. - Corrected capitalization in product names such as HashiCorp and Node.js. - Added title case for headings. - Tabulated the dependencies. - Corrections to URL and instructions in Project Setup. --- README.md | 86 ++++++++++++++++++++----------------------------------- 1 file changed, 31 insertions(+), 55 deletions(-) diff --git a/README.md b/README.md index c2ef52cb4..24062f48d 100644 --- a/README.md +++ b/README.md @@ -1,56 +1,32 @@ -CONTENTS OF THIS FILE +# Customizing the PWA + +Contents --------------------- * Dependencies * Command-line setup * Project setup - * Build MentorED - * Debug MentorED - * Hashicorp Vault Setup + * Build Mentor + * Debug Mentor + * HashiCorp Vault setup * Jenkins Pipeline * Ansible Deployment Script - * Env Files, Server.js And Pm2 Config Files + * Environment files, Server.js, and pm2.config.json -DEPENDENCIES +Dependencies ------------ -* Ionic: - - Ionic CLI : 7.1.1 (/usr/local/lib/node_modules/@ionic/cli) - Ionic Framework : @ionic/angular 6.7.5 - @angular-devkit/build-angular : 13.2.6 - @angular-devkit/schematics : 13.2.6 - @angular/cli : 13.2.6 - @ionic/angular-toolkit : 6.1.0 - -* Capacitor: - - Capacitor CLI : 5.5.1 - @capacitor/android : 5.5.1 - @capacitor/core : 5.5.1 - @capacitor/ios : 5.5.1 - -* Cordova: - - Cordova CLI : 11.0.0 - Cordova Platforms : none - Cordova Plugins : no whitelisted plugins (0 plugins total) - -* Utility: - - cordova-res : 0.15.4 - native-run : 1.7.4 - -* System: - - Android SDK Tools : 26.1.1 - NodeJS : v18.18.2 (you can download from https://nodejs.org/) - npm : 10.2.0 - OS : Linux 5.13 - +| Requirement | Description | +|--------------|-----------| +| Ionic CLI|Version 7.1.1 (/usr/local/lib/node_modules/@ionic/cli)| +| Ionic Framework |
  • @ionic/angular 6.7.5
  • @angular-devkit/build-angular : 13.2.6
  • @angular-devkit/schematics : 13.2.6
  • @angular/cli : 13.2.6
  • @ionic/angular-toolkit : 6.1.0
| +| Capacitor |
  • Capacitor CLI : 5.5.1
  • @capacitor/android : 5.5.1
  • @capacitor/core : 5.5.1
  • @capacitor/ios : 5.5.1
| +| Cordova |
  • Cordova CLI : 11.0.0
  • Cordova Platforms : none
  • Cordova Plugins : no whitelisted plugins (0 plugins total)
| +| Utility |
  • cordova-res : 0.15.4
  • native-run : 1.7.4
+| System |
  • Android SDK Tools : 26.1.1
  • Node.js®: v18.18.2
  • npm: 10.2.0
  • OS : Linux 5.13
| -CLI SETUP +CLI Setup --------- - npm install -g ionic @@ -59,16 +35,16 @@ CLI SETUP - npm install @capacitor/cli --save-dev -PROJECT SETUP +Project Setup ------------- -- git clone the repo (https://github.com/ELEVATE-Prjoect/mentoring-mobile-app.git) -- Checkout to latest branch.(currently release-2.5.0) -- Add environment files inside src/environments -- Go to project folder and run npm i +1. Clone the [repository](https://github.com/ELEVATE-Project/mentoring-mobile-app.git). +2. Change to the latest GitHub branch (**release-2.5.0**). +3. Add environment files into the src/environments folder. +4. Go to the project folder and run `npm i`. -BUILD MENTORED +Build Mentor -------------- - Run npx cap sync @@ -77,17 +53,17 @@ BUILD MENTORED - Run ionic serve to serve the project in local -DEBUG MENTORED +Debug Mentor -------------- -- Open the running app in browser -- Start inspecting using chrome dev tools or any alternatives +- Open the running app in the browser. +- Start inspecting using Chrome dev tools or any alternatives. -HASHICORP VAULT SETUP +HashiCorp Vault Setup --------------------- -JENKINS PIPELINE +Jenkins Pipeline ---------------- For automating your app deployment, you can use Jenkins. You can create a Jenkins job and run that job each time you want a deployment. @@ -122,7 +98,7 @@ For that you can create a Jenkins job and add a pipeline script for the job insi This pipeline will help to fetch the latest code from the given branch in repo and run the ansible script which we are about to create for building and deploying our application. -ANSIBLE DEPLOYMENT SCRIPT +Ansible Deployment Script ------------------------- Add an ansible script inside the ‘deployment’ folder in the root folder of your project. And add that path in your jenkins pipeline. When you run the job in jenkins, this script will get executed step by step till the end. Please update all the necessary details in the below example. @@ -188,8 +164,8 @@ This script will convert the fetched data from hashicorp to env files. -ENV FILES, SERVER.JS AND PM2 CONFIG FILES ------------------------------------------ +Structure of Environment file, Server.js, and pm2.config.json +------------------------------------------------------------- For deploying your application, you need an Environment file, Server.js, and a pm2.config.json file. Adding structure of those below for reference. From 4ca2c74bc9d4422d59cea5463650a4355f5db321 Mon Sep 17 00:00:00 2001 From: Nanditha K <106753017+nanditha938@users.noreply.github.com> Date: Fri, 23 Feb 2024 17:11:50 +0530 Subject: [PATCH 3/8] Added instructions in CLI Setup and Build Mentor sections. Added code blocks to the file structures. --- README.md | 79 +++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 62 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 24062f48d..65f0c67ef 100644 --- a/README.md +++ b/README.md @@ -29,11 +29,29 @@ Dependencies CLI Setup --------- -- npm install -g ionic -- npm install -g @ionic/cli -- npm install @capacitor/core -- npm install @capacitor/cli --save-dev +1. Install the Ionic framework. + ``` + npm install -g ionic + ``` + +2. Install the Ionic client. + + ``` + npm install -g @ionic/cli + ``` + +3. Install the Capacitor Core. + + ``` + npm install @capacitor/core + ``` + +4. Install the Capacitor runtime Client. + + ``` + npm install @capacitor/cli --save-dev + ``` Project Setup ------------- @@ -47,17 +65,39 @@ Project Setup Build Mentor -------------- -- Run npx cap sync -- Run ionic build -- Run ionic cap sync -- Run ionic serve to serve the project in local +1. To add the Capacitor plugin, run the following command: + + ``` + npx cap sync + + ``` + +2. To run a development build, run the following command: + + ``` + ionic build + ``` + +3. To perform an Ionic build and update any Capacitor plugins or dependencies, run the capacitor sync command. + + ``` + ionic cap sync + + ``` + +4. Run the project on your local system using the following command: + + ``` + ionic serve + + ``` Debug Mentor -------------- -- Open the running app in the browser. -- Start inspecting using Chrome dev tools or any alternatives. +1. Open the running app in the browser. +2. Start inspecting using Chrome dev tools or any alternatives. HashiCorp Vault Setup --------------------- @@ -101,9 +141,7 @@ This pipeline will help to fetch the latest code from the given branch in repo a Ansible Deployment Script ------------------------- -Add an ansible script inside the ‘deployment’ folder in the root folder of your project. And add that path in your jenkins pipeline. When you run the job in jenkins, this script will get executed step by step till the end. Please update all the necessary details in the below example. - -Eg : +Add an ansible script inside the ‘deployment’ folder in the root folder of your project. And add that path in your jenkins pipeline. When you run the job in jenkins, this script will get executed step by step till the end. Please update all the necessary details in the following example: - hosts: “” vars: @@ -167,8 +205,11 @@ This script will convert the fetched data from hashicorp to env files. Structure of Environment file, Server.js, and pm2.config.json ------------------------------------------------------------- -For deploying your application, you need an Environment file, Server.js, and a pm2.config.json file. Adding structure of those below for reference. +For deploying your application, you need an Environment file, Server.js, and a pm2.config.json file. +### Structure of environment.ts File + + ```jsx export const environment = { production: true / false, name: "", @@ -180,9 +221,11 @@ For deploying your application, you need an Environment file, Server.js, and a p privacyPolicyUrl: "", termsOfServiceUrl: "", }; +``` -* pm2.config.json file structure : +### Structure of pm2.config.json File +```json { "apps": [ { @@ -200,10 +243,11 @@ For deploying your application, you need an Environment file, Server.js, and a p } ] } +``` +### Structure of Server.js File -* Server.js file structure: - +```jsx const express = require('express'); const path = require('path'); const app = express(); @@ -221,3 +265,4 @@ For deploying your application, you need an Environment file, Server.js, and a p app.listen(port, () => { console.log(`Server is running on port ${port}`); }); +``` From 6a14be00d47074d5444103cc165814f310dd4acb Mon Sep 17 00:00:00 2001 From: Nanditha K <106753017+nanditha938@users.noreply.github.com> Date: Fri, 15 Mar 2024 18:27:39 +0530 Subject: [PATCH 4/8] Added the updated Ansible script received from the team. Editorial changes to HashiCorp setup, Jenkins, and Ansible script sections. --- README.md | 217 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 112 insertions(+), 105 deletions(-) diff --git a/README.md b/README.md index 65f0c67ef..85db7a4ac 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Customizing the PWA +The Mentor PWA is developed using the Ionic framework. This document provides instructions on setting up the development environment. + Contents --------------------- @@ -26,8 +28,8 @@ Dependencies | Utility |
  • cordova-res : 0.15.4
  • native-run : 1.7.4
| System |
  • Android SDK Tools : 26.1.1
  • Node.js®: v18.18.2
  • npm: 10.2.0
  • OS : Linux 5.13
| -CLI Setup ---------- +Setting up the CLI +------------------ 1. Install the Ionic framework. @@ -53,8 +55,8 @@ CLI Setup npm install @capacitor/cli --save-dev ``` -Project Setup -------------- +Setting up the Project +---------------------- 1. Clone the [repository](https://github.com/ELEVATE-Project/mentoring-mobile-app.git). 2. Change to the latest GitHub branch (**release-2.5.0**). @@ -62,8 +64,8 @@ Project Setup 4. Go to the project folder and run `npm i`. -Build Mentor --------------- +Building the Mentor App +----------------------- 1. To add the Capacitor plugin, run the following command: @@ -93,114 +95,119 @@ Build Mentor ``` -Debug Mentor --------------- +Debugging the Mentor App +------------------------ 1. Open the running app in the browser. 2. Start inspecting using Chrome dev tools or any alternatives. -HashiCorp Vault Setup ---------------------- +Setting up the HashiCorp Vault +------------------------------ +After setting up the HashiCorp Vault, you must add the Vault address to the Jenkins® Pipeline script and Ansible® deployment script. -Jenkins Pipeline ----------------- - -For automating your app deployment, you can use Jenkins. You can create a Jenkins job and run that job each time you want a deployment. -For that you can create a Jenkins job and add a pipeline script for the job inside the job’s ‘Configure’ section. For example, see below. - - pipeline { agent any - options { - disableConcurrentBuilds() - } - stages { - stage("git"){ - steps{ - - git branch: '', url: '' - } - - } - stage("ansible run"){ - steps{ - - ansiblePlaybook becomeUser: 'jenkins', - credentialsId:’your-cred-id’, - extras: "-e vaultAddress= -e gitBranch=", - installation: 'ansible', - inventory: '', - playbook: '' - } - - } - } - } +Creating a Jenkins Job +---------------------- +To automate your app deployment using Jenkins, do as follows: + +1. Create a Jenkins job each time you want a deployment. + +2. Add the pipeline script for the job inside the job’s **Configure** section. This pipeline will fetch the latest code from the given branch in the repository and run the [Ansible script](#deploying-the-application-using-an-ansible-script). + + ``` + pipeline { agent any + options { + disableConcurrentBuilds() + } + stages { + stage("git"){ + steps{ + + git branch: '', url: '' + } + + } + stage("ansible run"){ + steps{ + + ansiblePlaybook becomeUser: 'jenkins', + credentialsId:’your-cred-id’, + extras: "-e vaultAddress= -e gitBranch=", + installation: 'ansible', + inventory: '', + playbook: '' + } + + } + } + } + ``` -This pipeline will help to fetch the latest code from the given branch in repo and run the ansible script which we are about to create for building and deploying our application. - -Ansible Deployment Script -------------------------- - -Add an ansible script inside the ‘deployment’ folder in the root folder of your project. And add that path in your jenkins pipeline. When you run the job in jenkins, this script will get executed step by step till the end. Please update all the necessary details in the following example: - - - hosts: “” - vars: - project_path: - root_path: - //Add variables here if needed. (Remove this line in your code) - tasks: - - name: Get the token for Hashicorp vault - slurp: - src: "" - register: slurpfile - - name: Run vault credentials and get the environment related secrets stored in hashicorp vault - shell: "curl --location --request GET '{{ vaultAddress }}' --header 'X-Vault-Token: {{ slurpfile['content'] | b64decode }}' | jq '.data' > '{{root_path}}/data2.json'" - register: vaultCurl - - name: Change directory - shell: cd {{project_path}} - - name: Fetch the latest code - git: - repo: git-url - dest: "{{project_path}}" - version: "{{gitBranch}}" - force: yes - - name: Update npm - shell: cd {{project_path}} && npm i --force - - name: Set permission - shell: chmod 744 {{ project_path }}/src/scripts/json2env.sh - - name: Generate .env and store it in environment folder - shell: cat {{root_path}}/data2.json | jq '.data' > {{ project_path }}/src/environments/environment.ts && sed -i '1s/^/export const environment = \n/' {{ project_path }}/src/environments/environment.ts - register: envConfig - - debug: msg=" cred {{ envConfig }} " - - name: Change directory - shell: chdir {{project_path}} - - name: Fetch pm2 config file from Hashicorp vault - shell: "curl --location --request GET '{{ vaultAddress }}' --header 'X-Vault-Token: {{ slurpfile['content'] | b64decode }}' | jq '.data.data' > '{{ project_path }}/pm2.config.json'" - register: pm2 - - name: Change directory - shell: cd {{project_path}} - - name: Remove www folder - shell: rm -rf www - - name: Build pwa app to deploy - shell: cd {{project_path}} && ionic build --prod - - name: Start pm2 with pm2 config file and finish deployment - shell: cd {{project_path}} && pm2 start pm2.config.json - - -Please remove all the unwanted lines. - -You also have to add a script inside /src/scripts/json2env.sh - - - #!/bin/sh - - tr -d '\n' | - grep -o '"[A-Za-z\_][A-Za-z_0-9]\+"\s*:\s*\("[^"]\+"\|[0-9\.]\+\|true\|false\|null\)' | - sed 's/"\(._\)"\s_:\s\*"\?\([^"]\+\)"\?/\1= "\2"/' - -This script will convert the fetched data from hashicorp to env files. +Deploying the Application Using an Ansible Script +------------------------------------------------- +To build and deploy the application using an Ansible script, do as follows: +1. Add an Ansible script to the **deployment** folder in the root folder of your project. + + >**Note**: Update the script with details (such as paths) that are specific to your project. + + ``` + - hosts: + vars: + project_path: + root_path: + //Add variables here if needed. (Remove this line in your code) + tasks: + - name: Slurp host file + slurp: + src: "" + register: slurpfile + - name: Run the HashiCorp Vault credentials + shell: "curl --location --request GET '{{ vaultAddress }}mentored-portal' --header 'X-Vault-Token: {{ slurpfile['content'] | b64decode }}' | jq '.data' > '{{root_path}}/data2.json'" + register: vaultCurl + - name: Change directory + shell: cd {{project_path}} + - name: Fetch the latest code + git: + repo: https://github.com/ELEVATE-Project/mentoring-mobile-app + dest: "{{project_path}}" + version: "{{gitBranch}}" + force: yes + - name: Update npm + shell: cd {{project_path}} && npm i --force + - name: Set permission + shell: chmod 744 {{ project_path }}/src/scripts/json2env.sh + - name: Generate .env + shell: cat {{root_path}}/data2.json | jq '.data' > {{ project_path }}/src/environments/environment.ts && sed -i '1s/^/export const environment = \n/' {{ project_path }}/src/environments/environment.ts + register: envConfig + - debug: msg=" cred {{ envConfig }} " + - name: Change directory + shell: chdir {{project_path}} + - name: Fetch pm2 config file + shell: "curl --location --request GET '{{ vaultAddress }}portalPm2Config' --header 'X-Vault-Token: {{ slurpfile['content'] | b64decode }}' | jq '.data.data' > '{{ project_path }}/pm2.config.json'" + register: pm2 + - name: Change directory + shell: cd {{project_path}} + - name: Remove www folder + shell: rm -rf www + - name: Build pwa app + shell: cd {{project_path}} && ionic build --prod + - name: Start pm2 + shell: cd {{project_path}} && pm2 start pm2.config.json + ``` + +3. Add the script's path to the [Jenkins Pipeline script](#creating-a-jenkins-job). When you run the Jenkins job, the script is executed. + +4. To convert the JSON file that was fetched from the HashiCorp Vault to an env format, add the following script to ```/src/scripts/json2env.sh.```: + + ``` + #!/bin/sh + + tr -d '\n' | + grep -o '"[A-Za-z\_][A-Za-z_0-9]\+"\s*:\s*\("[^"]\+"\|[0-9\.]\+\|true\|false\|null\)' | + sed 's/"\(._\)"\s_:\s\*"\?\([^"]\+\)"\?/\1= "\2"/' + ``` Structure of Environment file, Server.js, and pm2.config.json ------------------------------------------------------------- From 7d5050bdf6180a82ec23ea06a59715d2aaa4650f Mon Sep 17 00:00:00 2001 From: Nanditha K <106753017+nanditha938@users.noreply.github.com> Date: Thu, 21 Mar 2024 13:18:17 +0530 Subject: [PATCH 5/8] Edits to 'Contents' Included links to the specific sections in Contents. --- README.md | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 85db7a4ac..72d8b3a4f 100644 --- a/README.md +++ b/README.md @@ -5,16 +5,15 @@ The Mentor PWA is developed using the Ionic framework. This document provides in Contents --------------------- - * Dependencies - * Command-line setup - * Project setup - * Build Mentor - * Debug Mentor - * HashiCorp Vault setup - * Jenkins Pipeline - * Ansible Deployment Script - * Environment files, Server.js, and pm2.config.json - + * [Dependencies](#dependencies) + * [Setting up the CLI](#setting-up-the-cli) + * [Setting up the Project](#setting-up-the-project) + * [Building the Application](#building-the-application) + * [Debugging the Application](#debugging-the-application) + * [Setting up the HashiCorp® Vault](#setting-up-the-hashicorp-vault) + * [Creating a Jenkins® Job](#creating-a-jenkins-job) + * [Deploying the Application Using an Ansible® Script](#deploying-the-application-using-an-ansible-script) + * [Structure of Environment file, Server.js, and pm2.config.json](#structure-of-environment-file-serverjs-and-pm2configjson) Dependencies ------------ @@ -64,8 +63,8 @@ Setting up the Project 4. Go to the project folder and run `npm i`. -Building the Mentor App ------------------------ +Building the Application +------------------------ 1. To add the Capacitor plugin, run the following command: @@ -95,8 +94,8 @@ Building the Mentor App ``` -Debugging the Mentor App ------------------------- +Debugging the Application +------------------------- 1. Open the running app in the browser. 2. Start inspecting using Chrome dev tools or any alternatives. @@ -104,7 +103,7 @@ Debugging the Mentor App Setting up the HashiCorp Vault ------------------------------ -After setting up the HashiCorp Vault, you must add the Vault address to the Jenkins® Pipeline script and Ansible® deployment script. +After setting up the HashiCorp Vault, you must add the Vault address to the Jenkins Pipeline script and Ansible deployment script. Creating a Jenkins Job ---------------------- From 5f569566ec7daa565e0f92419db48cbb6365e1c0 Mon Sep 17 00:00:00 2001 From: Rahul K R Date: Wed, 17 Apr 2024 12:23:09 +0530 Subject: [PATCH 6/8] session detail page invited session bug fix --- .../session-detail/session-detail.page.html | 7 +++++-- .../session-detail/session-detail.page.scss | 20 +++++++++++++------ .../dynamic-form/dynamic-form.component.ts | 2 -- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/app/pages/session-detail/session-detail.page.html b/src/app/pages/session-detail/session-detail.page.html index 46368bca2..ec9ef6255 100644 --- a/src/app/pages/session-detail/session-detail.page.html +++ b/src/app/pages/session-detail/session-detail.page.html @@ -22,8 +22,11 @@
{{detailData?.data?.title}}
{{"COMPLETED_ON"|translate}} {{endDate|date:'dd/MM/yyyy'}} {{"AT"|translate}} {{endDate|date:'shortTime'}}
- -

{{ sessionManagerText | translate}} {{detailData.data.manager_name}}

+
+ + {{ sessionManagerText | translate}} + {{detailData.data.manager_name}} +
diff --git a/src/app/pages/session-detail/session-detail.page.scss b/src/app/pages/session-detail/session-detail.page.scss index 97067384b..5f951405b 100644 --- a/src/app/pages/session-detail/session-detail.page.scss +++ b/src/app/pages/session-detail/session-detail.page.scss @@ -55,11 +55,7 @@ ion-item { height: 200px; } .person-container{ - font-size: 20px; - display: flex; - justify-content: center; - align-items: center; - padding-right: 10px; + font-size: 26px; } .manager-text-container{ @@ -70,5 +66,17 @@ ion-item { font-size: 16px; color: rgb(0, 0, 0); margin-left: 6px; - margin-bottom: 4px; + width: max-content; +} +.invite-container{ + display: flex; + align-items: center; + justify-content: center; +} +.label{ + width: 200px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + padding-left: 5px; } \ No newline at end of file diff --git a/src/app/shared/components/dynamic-form/dynamic-form.component.ts b/src/app/shared/components/dynamic-form/dynamic-form.component.ts index bad65ce4c..db761332b 100644 --- a/src/app/shared/components/dynamic-form/dynamic-form.component.ts +++ b/src/app/shared/components/dynamic-form/dynamic-form.component.ts @@ -209,8 +209,6 @@ export class DynamicFormComponent implements OnInit { return JSON.stringify(a) == JSON.stringify(b); } onSubmit() { - console.log('Form valid: ', this.myForm.valid); - console.log('Form values: ', this.myForm.value); this.isFormValid(); } reset() { From 2659f2b3cd5235daa013c88005623133d18fec72 Mon Sep 17 00:00:00 2001 From: Cafnanc Date: Fri, 10 May 2024 12:47:35 +0530 Subject: [PATCH 7/8] readme changes --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 72d8b3a4f..f9c2e941e 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ Setting up the Project ---------------------- 1. Clone the [repository](https://github.com/ELEVATE-Project/mentoring-mobile-app.git). -2. Change to the latest GitHub branch (**release-2.5.0**). +2. Change to the latest GitHub branch (**release-2.6.1**). 3. Add environment files into the src/environments folder. 4. Go to the project folder and run `npm i`. From 072d6a004968d929241d12a5cfdc7fc278cc9729 Mon Sep 17 00:00:00 2001 From: Rahul K R Date: Thu, 23 May 2024 16:35:07 +0530 Subject: [PATCH 8/8] resend otp PR --- src/app/pages/auth/otp/otp.page.html | 2 +- src/app/pages/auth/otp/otp.page.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/app/pages/auth/otp/otp.page.html b/src/app/pages/auth/otp/otp.page.html index f28b4e4e1..77de6107e 100644 --- a/src/app/pages/auth/otp/otp.page.html +++ b/src/app/pages/auth/otp/otp.page.html @@ -15,7 +15,7 @@
- {{'GENERATE_OTP'|translate}} diff --git a/src/app/pages/auth/otp/otp.page.ts b/src/app/pages/auth/otp/otp.page.ts index 17a73417e..c0114df6f 100644 --- a/src/app/pages/auth/otp/otp.page.ts +++ b/src/app/pages/auth/otp/otp.page.ts @@ -49,6 +49,7 @@ export class OtpPage implements OnInit { captchaToken:any=""; recaptchaResolved: boolean = this.siteKey ? false : true; showOtp:any = false; + enableGeneratetOtp: boolean = false; constructor(private router: Router, private profileService: ProfileService,private location: Location, private activatedRoute: ActivatedRoute, private localStorage: LocalStorageService, private translateService: TranslateService, private authService: AuthService, private toast: ToastService, private menuCtrl: MenuController, private nav: NavController) { @@ -119,7 +120,8 @@ export class OtpPage implements OnInit { async resendOtp() { this.enableResendOtp = false; this.showOtp = false; - this.recaptchaResolved = false + this.recaptchaResolved = false; + this.enableGeneratetOtp = this.siteKey ? false : true; } async onSubmitGenerateOtp(){