Use ngrok with Odoo

How to test locally with public access

Introduction

In a typical development environment and release pipeline, development is done on a local machine and the local Odoo instance is called via http://localhost:8069.

However, in some cases it is necessary that external services can call your local environment for testing purposes. Here are some examples:

  • Odoo interacts with a shipping API that pushes delivery-updates to your database
  • Integration of a new Payment Provider that notifies Odoo whenever a transaction was successful or failed.

To test these scenarios, the external service must be able to connect to your local Odoo database via Webhooks. 

One simple way to do so, is to use ngrok (Link: https://ngrok.com/ a command-line tool that maps your local ports to a public address without any changes necessary to your local firewall.

In the following post, we will explain how to use ngrok with Odoo on a Windows machine.

Setup

Head to the ngrok page and sign-up with their system

Download the latest ngrok version (Link), extract the .exe-File within the Zip-Package and place it at any location on your computer

Open a command-line window, head to the location of your ngrok.exe-File 

Register ngrok with your account by typing 

ngrok authtoken abcd 
(ersetzen Sie abcd durch Ihren Authtoken, den Sie nach der Anmeldung erhalten)

Starten Sie die ngrok-Weiterleitung zu Odoo durch Eingabe von

ngrok http localhost:8069

Ngrok will display the current status:

Use ngrok with Odoo - Current Status

Start your local Odoo-instance.

Now you will be able to access Odoo from external services (or even your webbrowser) through the *https://.ngrok.io-link/ provided within the command-line-window).

Credit: Cover by JOHN TOWNER on Unsplash
Blockchain and logistics – a real-world approach
Why blockchain won't save us, but could still have potential in certain niches