Using Backend APIs with On-Premise

Since mesibo will NOT have any access to your on-premise setup or database, there are only limited operations (useradd, userset, and usertoken) you can perform with mesibo hosted backend API when using on-premise. For all other operations like group management or sending messages, you will need to use real-time APIs, for example, real-time group management APIs.

Alternatively (highly recommended), you can host entire backend APIs to your own server. This will enable you to access entire backend APIs while using mesibo on-premise. Even if you are not using backend APIs for group management or sending messages, it is highly recommended that you enable and use backend APIs bundled with mesibo docker image as it will update your database instantly and also give you access to additionals ops like usersget, groupsget, etc.

Hosting mesibo backend APIs

You can easily host entire backend APIs to your own servers as it is already bundled with mesibo docker image. You will only need to configure your webserver to access it.

mesibo backend API server is bundled with mesibo docker image as a FastCGI server so that you can configure it with any of your existing web servers. By default, mesibo on-premise will not launch the backend FastCGI server. To launch the backend FastCGI server, you will need to pass -b <port> option when starting mesibo on-premise. For example, the following command will start the mesibo on-premise and will also start the backend FastCGI server on port 5000.

$ sudo docker run -v /certs:/etc/letsencrypt/archive/mesibo.example.com --net=host \
	--ipc=host --name mesibo --rm -d mesibo/mesibo -b 5000 iqmr059ms2yopxhc2sayx05ba2l5cralockbicqjsvv1nsqxs0x1yclfv0qvyg1q 

You should see in logs that the backend API server is started.

Once the mesibo on-premise and the backend server are started, you need to configure a URL on your webserver to access backend APIs. Any API request received on this URL should be forwarded to the mesibo backend FastCGI server at the port specified in the command, port 5000 in above example.

All the web servers (apache, nginx, lighttpd, IIS, etc.) support FastCGI. If you are using PHP or any other backend, you are already using FastCGI on your web server. Refer to your web server documentation to learn how to configure a URL and connect it to a FastCGI server.

Below is an nginx server example which tells server to create a virtual URL https://<your-web-server>/mesiboapi. Any request recieved on this URL will be forwared to a FastCGI server, in this case, mesibo backend API FastCGI server on port 5000.

location /mesiboapi {
	fastcgi_param SCRIPT_FILENAME $request_filename;
	include        fastcgi_params;
	fastcgi_pass   <your docker IP address>:5000;
}

Once configured, restart your webserver and open configured URL on your web browser. If configured successfully, you should see the following output on your web browser.

{"error":"MISSINGOP","result":false}