Skip to Content
Cloud SetupCloud Setup

Cloud Setup

The software’s cloud segment consists of two primary components:

  • Traccar GPS Server
  • EMQX MQTT Broker

The embedded software establishes communication via MQTT-SN with the MQTT-SN Gateway within EMQX MQTT broker. Each time a device transmits a message to the MQTT-SN gateway (over MQTT-SN protocol), a predefined rule is activated. This rule extracts pertinent device information like location coordinates, battery percentage, GPS accuracy etc and subsequently relays the message to the Traccar REST server utilizing the HTTP protocol.




LightImage

You would run the following commands on the host computer you wish to host the FindMyCat cloud services on. Most people would likely use a Cloud Provider (see Cloud providers) but it is also possible to self host.

The cloud repository contains a findmycat.py wrapper around four commands: start, setup, verify and destroy. The script is provided for convinience but if you prefer to install it with Docker or manually, please follow the instruction in the relevant tabs.

Pre-requisites

Clone Cloud repository

git clone https://github.com/FindMyCat/cloud.git cd cloud

Start the stack

Brings up Traccar and EMQX, waits for both containers to come online.

./findmycat.py start --emqx-password 'something-long'

--emqx-password replaces the EMQX dashboard’s default admin/public login.

A successful run looks like the following:

LightImage

Create the Traccar admin account

Traccar does not ship with a default administrator account, to create one, open its web UI on port 8082 and register. The script provides a reachable URL for convinience, you can click to open the Traccar UI.

LightImage

Configure the device and EMQX rule engine

Registers the device id in Traccar, creates the EMQX webhook resource, and creates the rule engine rule. Use Traccar credentials you used to create the admin account in step 3.

./findmycat.py setup \ --mqtt-topic '/your-chosen-topic-string' \ --traccar-email you@example.com \ --traccar-password 'your-password' \ --device-id your-device-id

Both values have to match the outdoor location engine’s prj.conf:

FlagFirmware setting
--device-idCONFIG_DEVICE_ID
--mqtt-topicCONFIG_MQTT_SN_PUBLISH_TOPIC

MQTT-SN has no authentication, so pick a topic nobody can guess, such as [}xRDvRP:kN*:8.

Verify it end to end

Publishes a test position over MQTT-SN and reports which stage it reached, without needing a real device.

./findmycat.py verify \ --mqtt-topic '/your-chosen-topic-string' \ --device-id your-device-id
StageMeaning
gatewayThe message reached the broker on the right topic
rule sqlFields were extracted from the payload
traccarTraccar accepted the position

Run this while the device is disconnected. MQTT-SN allows one live session per client id, so publishing as the device’s id would displace its session.

Succesful run looks like this:

LightImage

Tearing it down

Stops the containers and removes the EMQX volumes, the Traccar database and its logs. It prints what it would remove and does nothing unless you pass --yes.

./findmycat.py destroy --yes

Cloud providers

Any host with Docker works.

DigitalOcean

SettingValue
ImageUbuntu 24.04 LTS
Size512 MB / 1 vCPU

Add 2 GB of swap. EMQX and Traccar do not both fit in 512 MB without it.

fallocate -l 2G /swapfile && chmod 600 /swapfile && mkswap /swapfile && swapon /swapfile echo '/swapfile none swap sw 0 0' >> /etc/fstab

Firewall:

PortAccess
1885/udpPublic. The tracker connects here.
8082, 18083, 1883, 5055Your IP only
Last updated on