diff --git a/backend/.env b/backend/.env index 329cc0ba7c..75461598c4 100755 --- a/backend/.env +++ b/backend/.env @@ -11,4 +11,4 @@ REDIS_HOST=localhost CLUSTER_KEY=f414c23b4cdf4e84a6a66ecfd528eff2 TEST_TWILIO_NUMBER=+919910568840 # IS_SAAS_SERVICE=true -# ENCRYPTION_KEY=01234567890123456789012345678901 \ No newline at end of file +ENCRYPTION_KEY=01234567890123456789012345678901 \ No newline at end of file diff --git a/backend/backend/api/smsSmtp.js b/backend/backend/api/smsSmtp.js index f112420206..45ff02159a 100755 --- a/backend/backend/api/smsSmtp.js +++ b/backend/backend/api/smsSmtp.js @@ -46,7 +46,7 @@ router.get('/:projectId', getUser, isAuthorized, async function(req, res) { try { const projectId = req.params.projectId; const smsSmtp = await SmsSmtpService.findOneBy({ projectId }); - return sendItemResponse(req, res, smsSmtp); + return sendItemResponse(req, res, smsSmtp || {}); } catch (error) { return sendErrorResponse(req, res, error); } diff --git a/backend/backend/models/twilio.js b/backend/backend/models/twilio.js index 4061caca28..88f48d0da9 100755 --- a/backend/backend/models/twilio.js +++ b/backend/backend/models/twilio.js @@ -7,7 +7,7 @@ const twilioSchema = new Schema({ authToken: String, phoneNumber: String, iv: Schema.Types.Buffer, - enabled: { type: Boolean, default: true }, + enabled: { type: Boolean, default: false }, createdAt: { type: Date, default: Date.now, diff --git a/backend/backend/services/smsSmtpService.js b/backend/backend/services/smsSmtpService.js index 4a4c3469c7..7f8b8b57fe 100755 --- a/backend/backend/services/smsSmtpService.js +++ b/backend/backend/services/smsSmtpService.js @@ -165,7 +165,7 @@ module.exports = { } query.deleted = false; - let twilio = await TwilioModel.findOne(query) + const twilio = await TwilioModel.findOne(query) .sort([['createdAt', -1]]) .populate('projectId', 'name') .lean(); @@ -176,9 +176,6 @@ module.exports = { ); delete twilio.iv; } - if (!twilio) { - twilio = {}; - } return twilio; } catch (error) { diff --git a/backend/backend/services/twilioService.js b/backend/backend/services/twilioService.js index 1a9c4c2fb8..ee71b48bb8 100755 --- a/backend/backend/services/twilioService.js +++ b/backend/backend/services/twilioService.js @@ -35,7 +35,7 @@ const _this = { error.code = 400; return error; } - return new twilio(accountSid, authToken); + return twilio(accountSid, authToken); }, getSettings: async () => { @@ -173,7 +173,9 @@ const _this = { customTwilioSettings.accountSid, customTwilioSettings.authToken ); + const message = await twilioClient.messages.create(options); + return message; } else { const creds = await _this.getSettings(); diff --git a/docs/run.md b/docs/run.md index 25ce754156..cf35e759e3 100644 --- a/docs/run.md +++ b/docs/run.md @@ -1,10 +1,18 @@ # Running Fyipe -## Running this project in local environment. -- Run MongoDB and Redis manually on port 27017 and 6379 respectively. (You can do this with docker) -- If Docker and Docker compose is not your thing, you can run `npm install` and `npm run dev` on projects you want to work on. Ideally you would need to run those commands in `accounts`, `backend`, `probe`, `dashboard`, and `status-page` in seperate terminal instances to run the basic app. +## Running this project in local environment (without docker compose, recommended if you're doing active development). -## Running with docker compose +- Run MongoDB and Redis manually on port 27017 and 6379 respectively. You can do this with docker below: + +``` +mkdir ~/mongodata # This is where all of your Fyipe MongoDB data will be stored. +docker run -d -p 27017:27017 -v ~/mongodata:/data/db mongo:latest +docker run -d -p 6379:6379 redis:latest +``` + +- You can run `npm install` and `npm run dev` on projects you want to work on. Ideally you would need to run those commands in `accounts`, `backend`, `probe`, `dashboard`, and `status-page` in seperate terminal instances to run the basic app. + +## Running with docker compose (with docker-compose, recommended if you're actively testing the app) - Before you run this project locally, please make sure you're on Ubuntu or on a Mac machine. - Install Docker and Docker Compose. diff --git a/helm-chart/public/fyipe-update-cron.sh b/helm-chart/public/fyipe-update-cron.sh index d256ae3d51..b51925600d 100644 --- a/helm-chart/public/fyipe-update-cron.sh +++ b/helm-chart/public/fyipe-update-cron.sh @@ -1,3 +1,9 @@ +# This document is for launching Fyipe VM's on Azure, GCP and AWS. +# Follow the installation steps below. +# Azure: https://docs.microsoft.com/en-us/azure/marketplace/partner-center-portal/azure-vm-create-offer#technical-configuration + + + # Add these lines to: sudo crontab -e # Run this on Reboot. diff --git a/helm-chart/public/install.sh b/helm-chart/public/install.sh index 0d8d9f0dda..b731be075c 100755 --- a/helm-chart/public/install.sh +++ b/helm-chart/public/install.sh @@ -3,10 +3,8 @@ # This is used to install Fyipe on a standalone VM # This is usally used for CI/CD testing, and to update VM's on GCP, Azure and AWS. -# Flush all repos # If this is the first install, then helm wont be found. - if [[ ! $(which helm) ]] then echo "RUNNING COMMAND: sudo rm /etc/apt/sources.list || echo 'File not found'"