Table of Contents |
---|
This describe the needed stop article describes how to deploy a rails maestrano connector, developed with our connector framework: Ruby on Rails application based on the Maestrano connector framework https://github.com/maestrano/maestrano-connector-rails
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.
1 - Prerequisite
Make sure these software are already installed
...
Create a user and a database dedicated to the connector.
For exampleExecute the following commands using the MySQL root account:
Code Block | ||
---|---|---|
| ||
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`; |
...
In order to start the connector, you will need to retrieve and generate configure a set of environment variables.
1 - Developer platform integration
The configuration of the marketplaces the connector is listed on is dynamically retrieved from the developer platform.
Related to:
- MNO_DEVPL_ENV_KEY
- MNO_DEVPL_ENV_SECRET
...
Code Block | ||||
---|---|---|---|---|
| ||||
# 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 |
4 - Setup the Connector
...
Application
1 - Check out the code of the connector, bundle install and install foreman
...
Code Block | ||
---|---|---|
| ||
rake assets:precompile |
3 - Start the Connector
- Make sure the mysql and redis are running
- Start the connector with:
Code Block | ||
---|---|---|
| ||
foreman start |
Verify the connector is up and running by opening the URL http://hostname:3000
Info |
---|
It is recommended to not access the Rails server directly but to use a Web Server such as Nginx to process client requests. |
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.
...