Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This articles describes how to setup the Maestrano Hub component using the Nex!™ Platform as a Service.Image Added

...


Table of Contents
stylenone


...


1 - Prerequisites

This documentation is tailored to be used with Maestrano Paas Nex!™.

...

Code Block
languagebash
# install nex_client
gem install nex_client


# Set authentication
export NEX_API_KEY= <your nex! api key>
export NEX_ENDPOINT=<URL of your next! application>
application for example https://nex.yourdomain.io>

# Display all available commands
nex-cli --help

...

Code Block
languagebash
titleapplication.mno-hub
###########################
# General Configuration
###########################
RAILS_ENV=production
RAILS_MAX_THREADS=25
RAILS_LOG_TO_STDOUT=true
JRUBY_WEB_OPTS=-J-Xms1536m -J-Xmx1536m -J-server
JRUBY_WORKER_OPTS=-J-Xms1024m -J-Xmx1024m -J-server
DATABASE_URL={{MYSQL2_URL}}

###################################
# Secrets
###################################
# This key is used to encrypt credentials in database. Use "rake secret" to generate it.
encryption_key=<GENERATE ME>

# Rails secret. Use "rake secret" to generate it.
secret_key_base=<GENERATE ME>

# Rails secret. Use "rake secret" to generate it.
secret_token=<GENERATE ME>

###################################
# Platform components endpoints
###################################
# Url of your Impac installation
IMPAC_ENDPOINT=https://api-impac-yourapp.maestranoyourdomain.io

# Url of your MnoHub installation
MNOHUB_ENDPOINT=https://api-hub-yourapp.maestranoyourdomain.io
conf_hub_api_host=api-hub-yourapp.maestranoyourdomain.io
conf_hub_api_protocol=https

# Marketplace name (on Developer Platform)
default_tenant_name=My Environment
DEV_PLATFORM_ENDPOINT=https://developer.maestrano.iocom
DEV_PLATFORM_SHARED_SECRET=<Ask Us>

# Connec Configuration Replace with appropriate values
CONNEC_ENDPOINT=<CHANGEIT for example: https://api-connec-yourapp.maestranoyourdomain.io
connec_authentication_key=
connec_authentication_secret=
io>
conf_connec_host= <CHANGEIT for example: api-connec-yourapp.maestranoyourdomain.ioio>
conf_connec_paths_accounts_summary=/api/reports/:channel/accounts_summary
conf_connec_paths_all_accounts=/api/reports/:org_uid/account_balances
conf_connec_paths_balance_sheet=/api/reports/:channel/balance_sheet
conf_connec_paths_customers_invoices=/api/reports/:channel/customers_invoices
conf_connec_paths_suppliers_invoices=/api/reports/:channel/suppliers_invoices
conf_connec_paths_sync=/v1/:instance_uid/sync
conf_connec_port=443
conf_connec_protocol=https
conf_connec_upload_company=api-connec-yourappyourdomain.maestrano.io/v1/:channel_id/company
conf_connec_upload_items=api-connec-yourappyourdomain.maestrano.io/v1/admin/uploads/items
conf_connec_upload_organizations=api-connec-yourappyourdomain.maestrano.io/v1/admin/uploads/organizations
conf_connec_upload_people=api-connec-yourappyourdomain.maestrano.io/v1/admin/uploads/people
conf_connec_upload_protocol=http

# MCluster configuration
conf_mcluster_apps_domain=<CHANGE ME>
conf_mcluster_autostop_disabled=false
conf_mcluster_fallback_region=ap-southeast-1
conf_mcluster_mnoe_lockdown_region=ap-southeast-1

###################################
# Assets Management
###################################

# The AWS credentials to use to manage the 'assets' bucket (used to upload images, js/css files)
aws_s3_access_key_id=<CHANGE ME>
aws_s3_secret_access_key=<CHANGE ME>

conf_carrierwave_asset_host=<CHANGE ME>
conf_carrierwave_private_bucket=<CHANGE ME>
conf_carrierwave_public_bucket=<CHANGE ME>
conf_carrierwave_region=<CHANGE ME>

###################################
# Application Configuration
###################################
# OPTIONAL: if specified then an initial tenant will be created on first deploy
default_tenant_host=frontend.yourapp.maestrano.local
default_tenant_id=ea6009b0-be7b-0132-7f2c-22000a93862b
default_tenant_key=shxms3BMKt1dw2DYz4QCxg
default_tenant_name=Maestrano UAT
default_tenant_scheme=http
# Enable/Disable sidekiq for Maestrano Hub. Should be set to false
conf_background_job_disable_recurring_jobs=false

# Default support email displayed on pages
conf_contact_support=support@maestrano.com<CHANGE ME example: support@yourdomain.io>

# Used for geolocalisation
conf_geocoder_ip_lookup=geoip2
conf_geocoder_lookup=google
# Used for geolocalisation
conf_google_map_api_key=<<CHANGE ME Retrieved from Google https://developers.google.com/maps/documentation/javascript/get-api-key>

conf_microsoft_partner_id=<CHANGE ME>

# This value is used to generate unique email addresses for application providers
conf_sso_virtual_email_domain=appmail.api-hub.yourapp.maestrano.localyourdomain.io

# This service is used to convert monetary values. Put your OpenExchangeRate.org API key
OPENEXCHANGERATES_APP_ID=<OpenExchangeRate<CHANGE ME OpenExchangeRate.org API key>

# OPTIONAL: New Relic app name and enablement flag.
newrelic_app_name=<CHANGE ME>
newrelic_license_key=<CHANGE ME>

#############################################################################################
# Applications Hosting
# OPTIONAL: only required if hosted apps are enabled. Please contact us.
#############################################################################################
# Nex! configuration - only required if hosted apps or webstores must be enabled
NEX_API_KEY=<CHANGE ME>
NEX_ENDPOINT=<CHANGE ME>

# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
FORCE_SSL=true
conf_mcluster_apps_domain=apps.yourapp.maestrano.io
conf_mcluster_autostop_disabled=false
conf_mcluster_fallback_region=ap-southeast-1
conf_mcluster_mnoe_lockdown_region=ap-southeast-1

#############################################################################################
# Payment Gateways
# OPTIONAL
#############################################################################################
# Braintree credentials.
braintree_merchant_id=<OPTIONAL CHANGE ME>
braintree_private_key=<OPTIONALCHANGE ME>
braintree_public_key=<CHANGE ME>

# eWay credentials.
eway_login=87654321<OPTIONAL CHANGE ME>
eway_password=test123<OPTIONAL CHANGE ME>
eway_username=test@eway.com.au<OPTIONAL CHANGE ME>

3 - Nex!™ - Deploying the app

...

Code Block
languagebash
titleCreate the App
# Create the app, with the correct environment variable
# Adjust the tags and description based on the environment you are deploying to
nex-cli apps:create maestrano/web-jruby --env-file <path/to/application.mno-hub>  --size 1620 --tags "jruby,core,mnohub,production" --desc "MnoHub Production"
 
# Save the app name to a var to make your life easier
export app=clueless-turkey-1

# Transfer app ownership to your parent organization (e.g. maestrano)
nex-cli apps:transfer $app maestrano

# Link it to the repository the application to the code package
# NOTE: the S3 credentials must have been provided to you by the Maestrano team
nex-cli apps:scm $app --link github:maestrano/maestrano-hub:1.0.26s3:mnoe-packages/mnohub/releases:v1.0.31.tar.gz --credentials somelogin:somepassword

# Add the mysql and redis add-ons
nex-cli addons:create mysql $app
nex-cli addons:create redis $app


# Review # Start itApp and wait for addons to be up (MySQL and Redis env vars should be populated)
nex-cli apps:info $app


# Setup one-time option to load the database schema
nex-cli apps:vars $app --add RAILS_LOAD_SCHEMA=true
 
# Launch application
nex-cli apps:up $app
 
# Wait for containers to be up
nex-cli cubes --app $app --all
 
# Remove one-time option to load schema
nex-cli apps:vars $app
  -d RAILS_LOAD_SCHEMA
 
# Restart your application to ensure the above change
# is taken into account
nex-cli apps:restart $app

# Check the logs
nex-cli apps:logs $app


# Create the Active Admin Tenant and Active Admin User
nex-cli apps:ssh $app
cd /app
rails c $RAILS_ENV


t = Mnoe::Tenant.create!(name: 'Maestrano', domain: 'activeadmin.com', address: 'Active Admin', email:'active-admin@yourdomain.com', country: 'AU')
t.users.create!(name: 'Admin', surname: 'Active Admin', password: '<GENERATEME>', email: '<CHANGEME, will be used for login>', admin: true)

# Restart the app one last time to have the ActiveAdminTenant activated
nex-cli apps:restart $app


You can now go to the Nex!™ generated URL (e.g. https https://clueless-turkey-1.yourapp.maestrano.io/my-nex-domain.com) and check that everything is working properly.

2.2 - Register Log Drain on SumoLogic

Info

You first need to register a Hosted SumoLogic Collector and use the generated collector URL

  1. Go to Manage > Collection > Add Collector
  2. Select "Hosted Collector" (the collector will be hosted by SumoLogic)
    1. For the name you should use the same name as the component E.g.: core-mnohub-uat or core-mnohub-prd
    2. SumoLogic then ask the type of collector you want. Select "HTTP"
    3. Use the same name as the collector for the name of the HTTP endpoint (e.g. core-mnohub-uat or core-mnohub-prd)
    4. Select "UTC/Etc" for the timezone
  3. Once created SumoLogic will display a popup showing the log drain URL. Just copy that and use it for the next step


# Make sure to use the SumoLogic collector URL
nex-cli apps:update $app --http-log-drain https://collectors.au.sumologic.com/MY_RANDOM-LOG_DRAIN-TOKEN

2.3 - Setting up a custom domain

First create a CNAME to your app using your DNS manager (e.g. AWS Route53, GoDaddy, etc.):

...

Code Block
host api-hub.

...

mydomain.com
# => api-hub.

...

mydomain.

...

com is an alias (CNAME)

...

 for

...

 enhanced-tuna-1.

...

my-nex-domain.com


Code Block
# Create a domain

...


nex-cli domains:create api-hub.

...

mydomain.

...

com $app
  
# Add the SSL certs
nex-cli certs:create

...

 api-hub.mydomain.com $app --cert path-to-the-cert.crt --bundle path-to-the-bundle.crt --privkey .path-to-the-private.key.pem