Install Bouquet from scratch

 

This page shows how to install and run Bouquet from scratch and describes the Bouquet install procedure on Linux Ubuntu 14.04 (trusty) and RHEL/CentOS 6 and 7. We recommend this installation if you require an entreprise-level, production ready Bouquet deployment.

Bouquet is composed of two main components:

  • Bouquet Server: a Java application that exposes a RESTful API; fork it here!
  • Bouquet Explorer: a web application that interact with the Bouquet server API; fork it here!

Bouquet Server requires the following dependencies to run properly:

  • MongoDB: To store the data model
  • Redis: To cache large volume of data
  • Tomcat & Apache2: To run Bouquet Server application and expose the API
  • Elasticsearch: To provide indexing and search. If you don't have a running elasticsearch node, don't worry, Bouquet will launch an internal one for you. If you do, please follow this doc after the installation.

In this documentation you will install the stack described above and be able to access Bouquet Server, connect your datasource and explore your data.

This guide is composed of four steps:

  1. Install Bouquet dependencies
  2. Configure Bouquet Server
  3. Install Bouquet Server
  4. Install Bouquet database plugins
  5. Create your first Bouquet Customer

Install Bouquet dependencies

To install Bouquet dependencies run the following command in a terminal:

Ubuntu: 

apt-get update
apt-get upgrade
apt-get install mongodb redis-server redis-tools tomcat7 apache2-mpm-worker

CentOS: 

yum update
yum install mongodb redis tomcat httpd java-1.7.0-openjdk
apt-get install mongodb redis-server redis-tools tomcat7 apache2-mpm-worker
# On CentOS 7
systemctl start mongod.service
systemctl start redis.service

# On CentOS 6
/etc/init.d/redis start
/etc/init.d/mongod start

Configure Bouquet Server

First, we need to create some directories to get Bouquet run perfectly. In a terminal execute the following command:

Ubuntu:

mkdir -p /opt/squid/bouquet/etc /opt/squid/bouquet/plugins
install -d /var/cache/bouquet -o tomcat7 -g tomcat7
ln -s /var/cache/bouquet /var/lib/tomcat7/caches
ln -s /var/cache/bouquet /usr/share/tomcat7/caches

CentOS:

mkdir -p /opt/squid/bouquet/etc /opt/squid/bouquet/plugins
install -d /var/cache/bouquet -o tomcat -g tomcat
ln -s /var/cache/bouquet /var/lib/tomcat/caches
ln -s /var/cache/bouquet /usr/share/tomcat/caches

At this point we created the directories that will contain Bouquet data and configuration files. We must now add the Bouquet configuration files.

Create the file bouquet.json using this sample in /opt/squid/bouquet/etc/ directory. This file specifies the Bouquet Server configuration. Some configuration entries must be correctly set:

  • default.client.url should contain a list of comma-separated domain names hosting the apps that can use the API. For example add "openbouquet.io" if you want to use our online Bouquet Explorer, or add "swagger.squidsolutions.com" if you want to access your API with swagger,
  • kraken.oauth.endpoint must be either empty or the URL to your authentication webapp,
  • mail.* are used by the "lost password" mechanism. It's not necessary though. But if you need it, make sure you use a working SMTP server.

See this documentation for an exhaustive configuration explanation.

Create the file auth-webapp.xml using this sample in /opt/squid/bouquet/etc directory . This file contains the authentication webapp's configuration. Some configuration entries must be correctly set:

  • kraken.rest.port: 8080
  • kraken.rest.version: /bouquet
  • signin.url: http://IP_ADDRESS/release/auth/oauth
  • public.url: http://IP_ADDRESS/release/auth

Important: Replace IP_ADDRESS with your system IP address. The IP address must be accessible in HTTP via the port 80.

Next, we need to create a new mongo user for the kraken_test database. In a terminal run the following command:

echo 'db.addUser({user:"test",pwd:"test",roles:["readWrite", "dbAdmin"]})' | mongo kraken_test

It should output something similar to:

MongoDB shell version: 2.4.14
connecting to: kraken_test
{
	"user" : "test",
	"pwd" : "a6de521abefc2fed4f5876855a3484f5",
	"roles" : [
		"readWrite",
		"dbAdmin"
	],
	"_id" : ObjectId("560bad2d203686e7a0f99375")
}
bye

Edit the tomcat environment variables by adding this line at the end of the file:

  • /etc/default/tomcat7 on Ubuntu
JAVA_OPTS="${JAVA_OPTS} -Des.path.data=/var/lib/tomcat7/caches \
-Des.network.bind_host=127.0.0.1 -DDEBUG.MONGO=true -DDB.TRACE=true \
-Dlogback.configurationFile=logback.xml -Duser.timezone=UTC \
-Dkraken.facet=front,keyserver,queries,queryworker \
-Dbouquet.config.file=/opt/squid/bouquet/etc/bouquet.json \
-Dkraken.plugin.dir=/opt/squid/bouquet/plugins \
-Dconfig.file=/opt/squid/bouquet/etc/auth-webapp.xml"
  • /etc/tomcat/tomcat.conf on CentOS
JAVA_OPTS="-Des.path.data=/var/lib/tomcat7/caches \
-Des.network.bind_host=127.0.0.1 -DDEBUG.MONGO=true -DDB.TRACE=true \
-Dlogback.configurationFile=logback.xml -Duser.timezone=UTC \
-Dkraken.facet=front,keyserver,queries,queryworker \
-Dbouquet.config.file=/opt/squid/bouquet/etc/bouquet.json \
-Dkraken.plugin.dir=/opt/squid/bouquet/plugins \
-Dconfig.file=/opt/squid/bouquet/etc/auth-webapp.xml"

Then, we must configure Apache. On Ubuntu enable the proxy_http, rewrite and headers modules running the following command in a terminal

a2enmod proxy_http rewrite headers

On CentOS, these modules are already loaded by default.

Paste the following connfiguration inside the default VirtualHost file:

  • /etc/apache2/sites-enabled/000-default.conf on Ubuntu
  • /etc/httpd/conf.d/squid.conf on CentOS
# Swagger.json must be usable from all domains
SetEnvIf Request_URI release/v4.2/swagger.json  STATIC
Header set Access-Control-Allow-Origin "*" env=STATIC

# Ease access to some URLs
RewriteEngine On

RewriteRule ^/sign-in(.*) /release/auth/oauth$1 [NE,R,L]
RewriteRule ^/release/api/oauth(.*)$ /release/auth/oauth$1 [R,NE,L]
RewriteRule ^/release/admin/auth/oauth(.*)$ /release/auth/oauth$1 [R,NE,L]


# Oauth module
ProxyPass /release/auth http://127.0.0.1:8080/auth

# v4.2 Restfull API
ProxyPass /release/v4.2/rs http://127.0.0.1:8080/bouquet/rs
# Swagger json - describe our API
ProxyPass /release/v4.2/swagger.json http://127.0.0.1:8080/bouquet/swagger.json

Install Bouquet Server

Finally, you have to install the Bouquet and Auth webapps. Download the Bouquet and Auth war files in the download page.

Move the war files previously downloaded to the following directory:

  • /var/lib/tomcat7/webapps on Ubuntu
  • /var/lib/tomcat/webapps on CentOS

Set the correct permissions to the war files by executing the following command:

sudo chmod 644 /var/lib/tomcat?/webapps/*

 

Install Bouquet database plugins

From this step, you have installed and configured Bouquet, Bouquet server and all the dependencies. The next step is to install the database plugin that will be used to connect your datasource.

Download the plugin you want to use and move it to /opt/squid/bouquet/plugins. Set the correct permissions to the plugin file by executing the following command:

chmod 644 /opt/squid/bouquet/plugins/*

To finish, restart apache and tomcat services as running these commands in a terminal:

  • On Ubuntu
service apache2 restart
service tomcat7 restart
  • On Centos 6
/etc/init.d/httpd start
/etc/init.d/tomcat start
  • On Centos 7
systemctl start httpd
systemctl start tomcat

Well done, Bouquet is installed! You can now access Bouquet, connect your datasource and explore your data.

Create your first Customer

Your Bouquet server is empty for now. You need to access the admin REST API that allows you to create the first bricks of the data model:

  • A Customer,
  • Two Clients (or applications),
  • A super-user.

Just run this one-liner, and Bouquet server will create them:

wget -O - --post-data='customerName=CUSTOMER_NAME&login=LOGIN&password=PASS' http://127.0.0.1:8080/bouquet/admin/create-customer
  • CUSTOMER_NAME is the fancy name of your Customer
  • LOGIN is the login of the super-user. You can choose for example "admin", "super", "Administrator", as you like.
  • PASS is the super-user's password. Make it strong.
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.