Versions Compared

Key

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

...

The installation steps target a Linux system. If you are familiar with Docker containers, you can use the images provided by Maestrano to easily deploy the application and its dependencies.



...

Table of Contents
stylenone

...

1 - Prerequisite

Make sure these software are already installed

2 - Setup

2.1 - Database

Create a user and a database dedicated to the connector.

...

Code Block
languagesql
CREATE USER 'connector-user'@'localhost' IDENTIFIED BY 'connector-pwd';
GRANT ALL PRIVILEGES ON `connector-db`.* TO 'connector-user'@'localhost' WITH GRANT OPTION;
CREATE DATABASE `connector-db`;

2.2 - Redis

Follow https://redis.io/topics/quickstart

2.3 - Environment variables

In order to start the connector, you will need to configure a set of environment variables.

2.3.1 - Developer platform integration

The configuration of the marketplaces the connector is listed on is dynamically retrieved from the developer platform.

...

More info: Introduction to the developer platform 

2.3.2 - Passwords

Related to:

  • encryption_key1
  • encryption_key2
  • SECRET_KEY_BASE
  • SIDEKIQ_PASSWORD

...

  • Go to http://randomkeygen.com/ and generate 2 256-bit WEP Keys for encryption_key1 and encryption_key2 environment variables
  • Pick a Strong password for SIDEKIQ_PASSWORD
  • Generate SECRET_KEY_BASE by calling:

    Code Block
    languagebash
    rake secret


2.3.3 - Connector specific environment variable

The connector may have specific environment variable, they are in general defined in the application.sample.yml file in the github repository.

2.3.4 - Database

Related to DATABASE_URL

The database url is supposed to have this format

...

Code Block
languagebash
DATABASE_URL=mysql://connector-user:connector-pwd@localhost:3306/connector-db?reconnect=true

2.3.5 - Redis

If you want a local installation: set

...

  • REDIS_URL=redis://[USER]:[PASSWORD]@[REDIS_URL]:[REDIS_PORT]

2.3.6 - Summary

The rail application will need all the listed environment variable to run.

...

Code Block
languagebash
titleset-env.sh
# Database
# DATABASE_URL=mysql2://[USER_NAME]:[USER_PASSWORD]@[MY_SQL_URL]:[MY_SQL_PORT]/[MY_SQL_DATABASE_NAME]?reconnect=true
export DATABASE_URL=mysql2://[USER_NAME]:[USER_PASSWORD]@[MY_SQL_URL]:[MY_SQL_PORT]/[MY_SQL_DATABASE_NAME]?reconnect=true

# Connector specific environment variable
# For example
# export partner_key=[ASK_APP_PROVIDER]
# export system_base_url=[ASK_APP_PROVIDER]
# export system_url=[ASK_APP_PROVIDER]
# export wsdl_url=[ASK_APP_PROVIDER]
# export CONNECTOR_SHARED_SECRET=[ASK_APP_PROVIDER]

# 256-bit WEP Keys
# Generate using http://randomkeygen.com/
export encryption_key1=[GENERATE_ME]
export encryption_key2=[GENERATE_ME]

# generate by calling RAILS_ENV=production rake secret
export SECRET_KEY_BASE=[GENERATE_ME]

# Sidekiq Admin management
# Generate using http://randomkeygen.com/
export SIDEKIQ_PASSWORD=[GENERATE_ME]
export SIDEKIQ_USERNAME=admin

# Maestreano connector. MNO_DEVPL_ENV_KEY and MNO_DEVPL_ENV_SECRET are retrieved from the developer platform

export MNO_DEVPL_HOST=https://developer.maestrano.com
export MNO_DEVPL_API_PATH=/api/config/v1/marketplaces
export MNO_DEVPL_ENV_NAME=Production
export MNO_DEVPL_ENV_KEY=[GENERATE_ME]
export MNO_DEVPL_ENV_SECRET=[GENERATE_ME]

export RACK_ENV=production
export RAILS_ENV=production
# the port you want to expose the web application
export PORT=1234

2.4 - Setup the Connector Application

2.4.1 - Check out the code of the connector, bundle install and install foreman

Code Block
languagebash
titleinstalling the connector
git clone git@github.com:maestrano/connector-[name-of-the-connector].git
cd connector-[name-of-the-connector]
bundle install
gem install foreman

2.4.2 - Migrating Database

Set environment variable, for example

...

Code Block
languagebash
rake db:migrate

2.4.3 - Asset Precompile

Code Block
languagebash
rake assets:precompile

3 - Start the Connector

  1. Make sure the mysql and redis are running
  2. Start the connector with:

...

Info

It is recommended to not access the Rails server directly but to use a Web Server such as Nginx to process client requests.
The Maestrano default Nginx configuration can be found here: https://github.com/maestrano/docker-web-ruby/blob/master/2.3/app.conf

4 - Docker Installation

You may use docker to launch the connector web applications, the mysql database and the redis cache. You will need to setup the environment variables accordingly.

...