Odoo – super simple subdomain filtering with Cloudflare

Small introduction

Cloudflare is a great set of services for its community and their websites. It can provide you with high quality tools that any webmaster could ever wish for. Your sites are much safer with these services, and you can easily grasp what is really happening out there around your little Internet web corner.

You can get your free Cloudflare account in couple of minutes, and with it, you get your brand new name servers. All the benefits of moving your domains to Cloudflare is subject to the completely new post. Here, I just want to show three easy little steps on how to activate subdomain filtering to your odoo server (Ubuntu 14.04).

Subdomain filtering? Well, would you like that web address http://base.yourdomain.com/ automagically opens odoo instance and web site with database named base ? Thats it.

Did I mention that Cloudflare would also create ssl certificates for all your domains? For free? Yes and all your odoo sites will be ssl green and trusted worldwide.

1st step (location: odoo server)

First step is really just following this post -> http://netjunky.net/run-odoo-on-port-80-instead-of-8069/

It will reroute all incoming port 80 traffic to odoo default 8069.

2nd step (location: odoo server)

On our odoo server, we need to modify odoo daemon script. Usually, you want to setup your production odoo server with odoo daemon/service script. Script is more or less standard and usually placed here -> /etc/init.d/odoo-server (odoo-server name is optional).

Here is the part you need to modify:

# Additional options that are passed to the Daemon.
DAEMON_OPTS="-c $CONFIGFILE"

And after the editing, DAEMON_OPTS line should look like this:

# Additional options that are passed to the Daemon.
DAEMON_OPTS="-c $CONFIGFILE --db-filter=^%d$"

Save changes to the script and then restart service:

user@server:~$ sudo service odoo-server restart
3rd step (location: Cloudflare dashboard)

On your cloudflare dashboard select your domain, and then DNS tool for managing your Domain Name System settings.

Add a new A record which points to your odoo server IP address -> example: A    databasename    points to 173.25.53.33

Open your browser with new address -> http://databasename.yourdomain.com/

Create new odoo database with name -> databasename (Note: it must be same as the subdomain name in the A record)

Repeate this step for every new subdomain you want to add.

 

Summary

And do you know what else? It works for all your different Cloudflare domains just as well, one odoo server with multiple domains and subdomains.

Obviously, you don’t want and can’t have two or more databases with the same name. So if you need to have something like  erp.domain1.com and erp.domain2.com on the same server, you will need to use slightly different regular expression for database filtering -> instead of ^%d$ you should use ^%h$ .

If we define domain like this -> hostname.domain.com, then regular expression ^%d$  will filter out string hostname. On the other hand regular expression ^%h$ will filter out string hostname.domain.com.

In short, if you decide to go with regular expression ^%h$ , database name in the 3rd step should be hostname-domain-com (we need to switch dots with dashes).
This is solution when you want to host larger number of databases on one odoo server and you need to have even more flexible domain name choices.

Enjoy your brand new odoo nicely named instances!

Hey what about SSL stuff?

Well ask netjunky, maybe he can write something about that.

 

Mobile Therefore SSL-less

Therefore™ is popular information and document management system from Canon. Actually complete suite of applications that enables you to store, manage and process all kinds of business information efficiently and securely throughout your organization.

More info here -> http://www.therefore.net/

As it goes these days, there is of course Therefore mobile app for iOS, Android and Windows Phone.
However, out of box – default Therefore mobile service requires SSL to run.

Here you can find a quick note how to run SSL-less Therefore mobile service.

First, you need to find TheMobileManager.exe.config configuration file, usually placed in C:\Program Files\Therefore directory:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <appSettings>
    <!--uncomment this line to enable http-->
    <!--<add key="HttpEnabled" value="true" />-->
    
    <!--uncomment these lines in case of multi-tenant system-->
    <!--<add key="CacheCleanUpTime" value="30"/>
    <add key="CacheLocation" value="LocalTempFolder"/>
    <add key="WebServicePort" value="443"/>-->
        
  </appSettings>
</configuration>

 

Second, uncomment line 5 to enable http for the service:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <appSettings>
    <!--uncomment this line to enable http-->
    <add key="HttpEnabled" value="true" />
    
    <!--uncomment these lines in case of multi-tenant system-->
    <!--<add key="CacheCleanUpTime" value="30"/>
    <add key="CacheLocation" value="LocalTempFolder"/>
    <add key="WebServicePort" value="443"/>-->
        
  </appSettings>
</configuration>

Finally, you only need to restart Therefore Mobile service and you are ready to go mobile without SSL.