# Installation

Last updated: August 30th, 2024

## Introduction

The installation of JupiterMeet Pro is very easy and straightforward. This guide will help you run the bash script which will install and configure all the dependencies required to run the project properly on a clean Ubuntu 22.04 or CentOS 7 server. A basic knowledge of terminal is required.

Please follow all the steps very carefully. Once you have the dependencies installed, you can use the web installer to install the application from the browser itself.

## VPS

Ubuntu 22.04 or CentOS 7 with minimum of 6 GB RAM is a recommended VPS.

Check out this link to get a cheap VPS hosting.

## Automatic installation

Make sure the server is empty, otherwise it may create issues. Click here if you prefer the manual way.

1. Upload the bash script (jupitermeet-installation.sh) and the application (jupitermeet.zip) to your server

   Note: Place the zip and the script in same directory

2. Set execute permission on script

   `chmod 700 jupitermeetpro-installation.sh`

3. Execute the script

   `./jupitermeetpro-installation.sh`

Once the installation is finished, note down all the details it returns.

## Application setup

- Open yourdomain.in/install in the browser
- .env section: Follow all the steps very carefully and udpate the values as below
  Application
  - APP_ENV: local or live. Based upon where you want to setup
  - APP_KEY: No need to change
  - APP_DEBUG: true or false. Generally, true in local server and false on live
  - APP_LOG_LEVEL: No need to change
  - APP_URL: Your application URL
  Database
  - DB_CONNECTION: No need to change
  - DB_HOST: No need to change
  - DB_PORT: No need to change
  - DB_DATABASE: Database name that you created in the above step
  - DB_USERNAME: Database username
  - DB_PASSWORD: Database password
  Email
  - MAIL_DRIVER: Email driver
  - MAIL_HOST: Email host
  - MAIL_PORT: Email port
  - MAIL_USERNAME: Email username
  - MAIL_PASSWORD: Email password
  - MAIL_ENCRYPTION: Email encryption
  - MAIL_FROM_NAME: Your application name
  - MAIL_FROM_ADDRESS: Your email address
- Please add qoutes if env variables have space in it
- Click save and Install (Make sure you click 'Save .env' before clicking on Install)

### Turn on 'less secure apps' from your Google account to allow the application to send emails

1. Go to your (Google Account).
2. On the left navigation panel, click Security.
3. On the bottom of the page, in the Less secure app access panel, click Turn on access.
4. Click the Save button.

### Note: The application will send emails in the following cases,

- Reset password
- Meeting invitation

## Signaling

Navigate to the /server directory from terminal.

`cd /var/www/html/jupitermeet_pro/server`

Update .env file to match your requirements

- KEY_PATH: Path to your SSL key
- CERT_PATH: Path to your SSL certificate
- DOMAIN: Your domain with https
- PORT: Port to run NodeJS on
- MAX_FILESIZE: In MB
- IP: Server's IP address
- ANNOUNCED_IP: Useful when running application behind NAT with private IP
- RTC_MIN_PORT: Minimun RTC port
- RTC_MAX_PORT: Maximum RTC port
- OPENAI_API_KEY: Your secret OpenAI API key
- CHATGPT_API_URL: No need to change
- CHATGPT_MODEL: ChatGPT model
- CHATGPT_SECONDS: The number of seconds a user must wait before sending another message
- CHATGPT_MESSAGE_LIMIT: The maximum number of messages a user can send during a meeting
- CHATGPT_MAX_CONVERSATION_LENGTH: The maximum number of recent messages sent to ChatGPT

Note: These last three settings are designed to prevent the misuse of ChatGPT.

Run on live

`npm run live`

Run on local server

`npm run local`

## Configuration

### Storage link (optional)

If you see a broken logo, that means the storage link has not been created, use this command (from root project directory)

`php artisan storage:link`

### Global Configuration

- Login and navigate to the Admin > Global Configuration module
- Here you can update application name, logo, theme color etc
- Update the Signaling URL with your domain and port

## Payment Configuration

- Enable payment mode from Admin > Global Configuration
- Extended License is required to enable the payment mode. Updrade to the Extended License
- Login and navigate to the Admin > Manage Payment > Payment Gateways
- Here you can enable payments and set payment credentials

### Stripe

- Login into your Stripe account
- Go to the Developers section of the Stripe dashboard and click on API Keys
- Copy the Publishable key and Secret key in Admin > Manage Payment > Payment Gateways > Stripe
- From the sidebar, go to the Developers section of the Stripe dashboard and click on Webhooks. and Click on Add a new endpoint
- On the `Endpoint URL` field paste your webhook URL, this can be found on Admin > Manage Payment > Payment Gateways > Stripe.
- On the Events to send field, click on receive all events, and click the Add endpoint button.
- Copy the `Signing secret` in Admin > Manage Payment > Payment Gateways > Stripe.

### Paystack

- Login into your Paystack account
- Go to the Setting section of the Paystack dashboard and click on API Keys
- Copy the `Secret key` in Admin > Manage Payment > Payment Gateways > Paystack
- On the `Webhook URL` field paste your webhook URL, this can be found on Admin > Manage Payment > Payment Gateways > Paystack.
- On the `Callback URL` field paste your Callback URL, this can be found on Admin > Manage Payment > Payment Gateways > Paystack.

### Mollie

- Login into your Mollie account
- From the top menu click on More and then click on Developers
- Copy the `Live API key` in Admin > Manage Payment > Payment Gateways > Mollie.

### Razorpay

- Login into your Razorpay account
- Click on Account & Settings in the sidebar, the Choose API Keys Menu Option and click Generate Key button
- Copy the `Key Id` and `Key Secret` in Admin > Manage Payment > Payment Gateways > Razorpay.
- Click on Account & Settings in the sidebar, the Choose Webhooks Option and click Add New Webhook
- On the `Webhook URL` field paste your webhook URL, this can be found on Admin > Manage Payment > Payment Gateways > Razorpay.
- On Active Events field checked Subscription Events and then save

### PayPal

- Login into your Paypal account
- Go to the My apps & credentials section, click on Live button and then on the Create app button.
- Copy the `Client ID` and `Secret` in Admin > Manage Payment > Payment Gateways > PayPal.
- Go to the My apps & credentials section, click on Live button and then select your app.
- Scroll down to LIVE WEBHOOKS and click on the Add webhook button.
- On the `Webhook URL` field paste your webhook URL. This can be found on Admin > Manage Payment > Payment Gateways > PayPal.
- Under the Events types select All events and save your changes.
- Copy the Webhook ID in Admin > Manage Payment > Payment Gateways > PayPal.

## Localization

To add a new language, Download the Sample English File from the Languages section in the Admin panel. After editing to your language, click on the Create button and add that edited file.

When an update is made and more texts are added to the English file, download the sample as well as your language file, translate the difference and save it.

## Configure Firewall (optional)

If Firewall is active, please open the below ports for signaling server.

- 443 TCP
- 9007 TCP
- From RTC_MIN_PORT to RTC_MAX_PORT UDP

## Manage Processes

Manage processes with PM2

### Manage NodeJS

View running processes

`pm2 list`

Restart NodeJS server

`pm2 restart JupiterMeetPro`

## Renew SSL

Let's Encryt will renew certificates automatically but if you need to do it manually, use the below command.

`certbot renew`

## Troubleshooting

- Make sure NodeJS server is up and running
- Make sure frontend is pointing to the NodeJS server with your signaling port (9007)
- If firewall is active, make sure the ports are allowed
- If the application is running behind NAT with private IP, add ANNOUNCED_IP in /server/.env
- Make sure the app is running on https
- Make sure the SSL certificates are valid
- Make sure no antivirus softwares are blocking the media device access
- To reflect the changes, please clear browser cache or hard reload the page

## Webhooks

### Create Meeting

`https://yourdomain.in/webhooks/meeting`

Query Params: api_token, title, description, password, date, time, timezone

Method: post

Returns: meeting details

Note: api_token can be taken from the user profile

### Create User

`https://yourdomain.in/webhooks/user`

Query Params: api_token, username, email, password

Method: post

Returns: user details

Note: api_token can be taken from the admin panel

## Google reCAPTCHA

This feature adds an extra layer of security on the checkout page. Follow the steps below to setup Google reCAPTCHA.

- Go to this link https://www.google.com/recaptcha/admin/create and register a new site.
- Once done, copy and paste the Key and Secret in the Admin panel > Global Configuration > Google reCAPTCHA section.

## Email Jobs

The application uses Laravel's Queue feature to send out meeting invite emails.

Navigate to the project directory (/) from terminal.

`cd /var/www/html/jupitermeet_pro`

Run jobs

`pm2 start jobs`

Save the processes

`pm2 save`

## Social Logins

### Google

Navigate to the below link and create new project.

https://console.cloud.google.com/projectcreate

Then click on OAuth client ID as shown below.

https://console.cloud.google.com/apis/credentials

Then click on "Configure consent screen", then click on "External". Fill up all the information.

At last, go to the Global config section and copy Callback URL. Place it at the place of Authorised redirect URI, and click "Save".

### Facebook

Navigate to the below link and click on Create App.

https://developers.facebook.com/apps

Then follow the below steps,

Fill out the below form and click on Create app button.

Copy App ID and secret from the Basic section and paste it in the global config section.

Copy Callback URL from the global config section, paste it below, and click on Save changes.

### LinkedIn

Navigate to the below link and click on Create App.

https://www.linkedin.com/developers/apps

Then fill out all the information,

Then choose Sign in with LinkedIn

Click on the Auth section, copy client Id and secret and paste in the global config section. Finally, copy add redirect URL and paste it as shown below.

### Twitter

Navigate to the below link and click on Add project.

https://developer.twitter.com/en/portal/projects-and-apps

Then fill out all the information,

Copy and paste the API key and secret to the global config section.

Once done, click on the Set up button.

In the next screen, set App permissions to Read. Set Type of App to Web app. Copy Callback URL and paste it to the App info section.

Finally, copy the Client ID and secret and paste into the global config section.

## ChatGPT

This feature allows users to use ChatGPT during the meeting. Follow the steps below to setup ChatGPT.

- Go to this link https://platform.openai.com/api-keys and create new secret key as shown below.
- Once done, copy and paste the Secret key in the /server/.env file. For detailed clarification of each configuration, please check the Signaling section above.

Note: To disable this feature, navigate to Admin > Plans > Edit Default Plan, then turn off ChatGPT in the Features section.