Skip to content
This repository was archived by the owner on Jan 10, 2020. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
158 changes: 98 additions & 60 deletions docs/installation/heroku.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,19 @@ In order to deploy erxes and other related apps, you will need `mLab MongoDB` (M

To add any addon to an app, you will need to register your credit card. So please add your creadit card and verify your account prior to proceeding further.

### One Click deployment
## One Click deployment

In this installation guide, we pretend the following app names will be available on Heroku and they will be used to demonstrate - we expect you to choose any available names on Heroku.

- `erxes` - **erxes** `(https://erxes.herokuapp.com)`
- `erxes API` - **erxes-api** `(https://erxes-api.herokuapp.com)`
- `erxes Widget` - **erxes-widget** `(https://erxes-widget.herokuapp.com)`
- `erxes Widget API` - **erxes-widget-api** `(https://erxes-widget-api.herokuapp.com)`

Try the following 4 steps to install all required apps on Heroku.

**Note** - When setting up config vars (environment vars), do not change the PORT numbers of all apps.
**Note**: When setting up config vars (environment vars), do not change the PORT numbers of all apps.

1.**Install erxes**
### 1. Install erxes

Please try clicking the deploy button below, then set all the config vars and hit the Deploy app button.

Expand All @@ -34,112 +33,151 @@ Please try clicking the deploy button below, then set all the config vars and hi
REACT_APP_API_SUBSCRIPTION_URL = ws://erxes-api.herokuapp.com/subscriptions
REACT_APP_API_URL = https://erxes-api.herokuapp.com
REACT_APP_CDN_HOST = https://erxes-widget.herokuapp.com
REACT_APP_CDN_HOST_API = https://erxes-widget-api.herokuapp.com
```

[![Deploy erxes](https://www.herokucdn.com/deploy/button.svg#heroku "Deploy erxes")](https://heroku.com/deploy?template=https://github.com/erxes/erxes)
[![Deploy erxes](https://www.herokucdn.com/deploy/button.svg#heroku "Deploy erxes")](https://heroku.com/deploy?template=https://github.com/batnasan/erxes/tree/heroku_button)

2.**Install erxes API**
### 2. Install erxes API

Now it's time to install erxes API - click the button below and set the config vars.

**Config vars:**

```sh
AWS_ACCESS_KEY_ID = your_acess_key_id
AWS_BUCKET = bucket_name
AWS_PREFIX = prefix
AWS_REGION = your_bucket_region
AWS_SECRET_ACCESS_KEY = secret_key
AWS_SES_ACCESS_KEY_ID = access_key
AWS_SES_CONFIG_SET = config
AWS_SES_SECRET_ACCESS_KEY = secret_key
COMPANY_EMAIL_FROM = noreply@erxes.io
DEFAULT_EMAIL_SERVICE = sendgrid
DOMAIN = https://erxes-api.herokuapp.com
FILE_SYSTEM_PUBLIC = false
HTTPS = true
INTEGRATIONS_API_DOMAIN = https://ERXESINTEGRATIONSAPINAME.herokuapp.com
MAIL_HOST = your_mail_host
MAIL_PASS = pass
MAIL_PORT = port
MAIL_SERVICE = sendgrid
MAIL_USER = your_user
MAIN_APP_DOMAIN = https://erxes.herokuapp.com
MONGO_URL = mongodb:// # leave it as is, we will update it later on
PORT = 3300
PUBSUB_TYPE = REDIS
RABBITMQ_HOST = RABBITMQ_HOST
REDIS_HOST = REDIS_HOST # we will update it later on
REDIS_PASSWORD = REDIS_PASS # we will update it later on
REDIS_PORT = 28229 # update it later on
UPLOAD_FILE_TYPES = image/png,image/jpeg,image/jpg,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/pdf,
UPLOAD_SERVICE_TYPE = AWS
USE_BRAND_RESTRICTIONS = false
WIDGETS_API_DOMAIN = https://erxes-widget-api.herokuapp.com
WIDGETS_DOMAIN = https://erxes-widget.herokuapp.com
```

[![Deploy erxes API](https://www.herokucdn.com/deploy/button.svg#heroku "Deploy erxes API")](https://heroku.com/deploy?template=https://github.com/erxes/erxes-api)
[![Deploy erxes API](https://www.herokucdn.com/deploy/button.svg#heroku "Deploy erxes API")](https://heroku.com/deploy?template=https://github.com/batnasan/erxes-api/tree/heroku_button)

3.**Install erxes Widgets**
Now go to Heroku dashboard and select the **erxes-api app** from the Apps tab.

Go to Settings tab where you can manage your Config Vars as you need to update config vars of **erxes-api** app.

In the Config Vars section, click a button 'Reveal Config Vars' so that you will be able to see all the config vars.

Copy MONGO_URI's value and paste it into MONGO_URL.

Copy RABBITMQ_URL's value and paste into RABBITMQ_HOST.

Update REDIS_HOST, REDIS_PASSWORD, and REDIS_PORT values using REDIS_URL's value.

Please now go to Resources tab as you will need to start `cronjob` and `worker` processes.
Start `cronjob` and `worker`.

The last step is to insert initial data. To do that you will need to clone `erxes-api` repo and `mongorestore` tool.

Clone the `erxes-api` and run the following commands in the terminal.

`cd erxes-api`

`mongorestore --host=host --port=port -u user -d db initialData`

`mongorestore --host=host --port=port -u user -d db permissionData`

**Note**: extract `host`, `port`, `user`, `db` from the `MONGO_URI` config var.

Now you can log into `https://erxes.herokuapp.com` using the following credentials.

```sh
username: admin@erxes.io
password: erxes
```

### 3. Install erxes Widgets

Now install erxes Widget app by clicking the deploy button below and set config vars.

**Config vars:**

```sh
API_GRAPHQL_URL = https://erxes-widget-api.herokuapp.com/graphql
API_SUBSCRIPTIONS_URL = ws://erxes-api.herokuapp.com/subscriptions
MAIN_API_URL = https://erxes.herokuapp.com
PORT = 3200
ROOT_URL = https://erxes-widget.herokuapp.com
```

[![Deploy Widgets](https://www.herokucdn.com/deploy/button.svg#heroku "Deploy erxes Widgets")](https://heroku.com/deploy?template=https://github.com/erxes/erxes-widgets)
[![Deploy Widgets](https://www.herokucdn.com/deploy/button.svg#heroku "Deploy erxes Widgets")](https://heroku.com/deploy?template=https://github.com/batnasan/erxes-widgets-heroku-button)

Now it's time to grab yourself a cup of coffee and enjoy using **erxes**.

4.**Install erxes Widgets API**
## Extra features

You are doing great! And now it's time to install last app - erxes Widgets API.
There is a several apps available for you to install and make erxes even more powerful.
The steps of installing them are same as above.

### 1. Install erxes engages email sender

**Config vars:**

```sh
MONGO_URL = mongodb://localhost/erxes
PORT = 3100
RABBITMQ_HOST = amqp://localhost # we will update it later on
WIDGET_URL = https://erxes-widget.herokuapp.com # we will update it later on
AWS_SES_CONFIG_SET = erxes
MAIN_API_URL = https://erxes-api.herokuapp.com
MONGO_URL = MONGO_URL # we will update it later on
PORT = 3900
RABBITMQ_HOST = copy and paste from erxes-api RABBITMQ_HOST config var
```

[![Deploy Widgets API](https://www.herokucdn.com/deploy/button.svg#heroku "Deploy erxes Widgets API")](https://heroku.com/deploy?template=https://github.com/erxes/erxes-widgets-api)
[![Deploy Widgets](https://www.herokucdn.com/deploy/button.svg#heroku "Deploy erxes engages email sender")](https://heroku.com/deploy?template=https://github.com/batnasan/erxes-engages-email-sender/tree/heroku_button)

Now go to Heroku dashboard and select the **erxes-api app** from the Apps tab.
Once the app is deployed, go to `Settings` and click `Config Vars` button.
Copy `MONGODB_URI`'s value and paste it into `MONGO_URL`.

Go to Resources tab where you can manage your resources. You need to share MongoDB and RabbitMQ addons with **erxes-widget-api** app so that the **erxes-widget-api** will be able to access these two addons.
### 2. Install erxes logger

To do that, click a button 'Attached as RABBITMQ' in Add-ons section and then click 'Manage Attachments'.
Now click '+ Attach to another app' button and search for 'erxes widget app' name you have chosen and select it.
Repeat the step for MongoDB.
**Config vars:**

If you find it difficult, please go to [Heroku Dev Center](https://devcenter.heroku.com/articles/managing-add-ons#using-the-dashboard-attaching-an-add-on-to-another-app).
```sh
DEBUG_PREFIX = erxes-logs
MONGO_URL = MONGO_URL # we will update it later on
PORT = 3800
```

Finally, you need to update config vars of **erxes-api** and **erxes-widget-api** apps.
[![Deploy Widgets](https://www.herokucdn.com/deploy/button.svg#heroku "Deploy erxes engages email sender")](https://heroku.com/deploy?template=https://github.com/batnasan/erxes-logger/tree/heroku_button)

Please go to **erxes-api** app and select Settings tab.
In the Config Vars section, click a button 'Reveal Config Vars'.
Now you will be able to see all the config vars.
Copy MONGO_URI's value and paste it into MONGO_URL.
Copy RABBITMQ_URL's value and paste into RABBITMQ_HOST.
Update REDIS_HOST, REDIS_PASSWORD, and REDIS_PORT values using REDIS_URL's value.
Once the app is deployed, go to `Settings` and click `Config Vars` button.
Copy `MONGODB_URI`'s value and paste it into `MONGO_URL`.

Now please go to **erxes-widget-api** and update RABBITMQ_HOST and MONGO_URL config vars.
Use CLOUDAMQP_URL and MONGODB_URI config vars values'.
### 3. Install erxes integrations

Now go back to **erxes-api** and click 'More' button in the top right corner, then select 'Run console'.
Run 'yarn initProject' command which will create the following credentials for you to log into `https://erxes.herokuapp.com`.
**Config vars:**

```sh
username: admin@erxes.io
password: erxes
DOMAIN = https://erxes-integration.herokuapp.com
ENCRYPTION_KEY = ENCRYPTION_KEY
FACEBOOK_APP_ID = FACEBOOK_APP_ID
FACEBOOK_APP_SECRET = FACEBOOK_APP_SECRET
FACEBOOK_VERIFY_TOKEN = FACEBOOK_VERIFY_TOKEN
GOOGLE_APPLICATION_CREDENTIALS = GOOGLE_APPLICATION_CREDENTIALS
GOOGLE_CLIENT_ID = GOOGLE_CLIENT_ID
GOOGLE_GMAIL_SUBSCRIPTION_NAME = GOOGLE_GMAIL_SUBSCRIPTION_NAME
GOOGLE_GMAIL_TOPIC = GOOGLE_GMAIL_TOPIC
GOOGLE_PROJECT_ID = GOOGLE_PROJECT_ID
MAIN_API_DOMAIN = MAIN_API_DOMAIN
MAIN_APP_DOMAIN = MAIN_APP_DOMAIN
MICROSOFT_CLIENT_ID = MICROSOFT_CLIENT_ID
MICROSOFT_CLIENT_SECRET = MICROSOFT_CLIENT_SECRET
MONGO_URL = MONGO_URL # we will update it later on
NYLAS_CLIENT_ID = NYLAS_CLIENT_ID
NYLAS_CLIENT_SECRET = NYLAS_CLIENT_SECRET
NYLAS_WEBHOOK_CALLBACK_URL = NYLAS_WEBHOOK_CALLBACK_URL
PORT = 3400
RABBITMQ_HOST = copy and paste from erxes-api RABBITMQ_HOST config var
TWITTER_ACCESS_TOKEN = TWITTER_ACCESS_TOKEN
TWITTER_ACCESS_TOKEN_SECRET = TWITTER_ACCESS_TOKEN_SECRET
TWITTER_CONSUMER_KEY = TWITTER_CONSUMER_KEY
TWITTER_CONSUMER_SECRET = TWITTER_CONSUMER_SECRET
```

Now it's time to grab yourself a cup of coffee and enjoy using **Erxes**.
[![Deploy Widgets](https://www.herokucdn.com/deploy/button.svg#heroku "Deploy erxes engages email sender")](https://heroku.com/deploy?template=https://github.com/batnasan/erxes-integrations/tree/heroku_button)

Once the app is deployed, go to `Settings` and click `Config Vars` button.
Copy `MONGODB_URI`'s value and paste it into `MONGO_URL`.