- Fixes an issue where configuration from Consul was not being loaded correctly due to multiple base64 and encoding issues. - Adds robust decoding logic with fallbacks to handle different value formats from Consul. - Adds the Git commit SHA as a version identifier to the Docker image and application logs to improve debuggability.
Fitbit to Garmin Weight Sync - Dockerized
This application syncs weight data from the Fitbit API to Garmin Connect. This README provides instructions on how to run the application using Docker.
Prerequisites
- Docker must be installed on your system.
Building the Docker Image
To build the Docker image for this application, run the following command from the root directory of the project:
docker build -t fitbit-garmin-sync .
Running the Application
The application is configured entirely via Consul. You can specify the Consul agent's location using environment variables.
CONSUL_HOST: The hostname or IP address of your Consul agent (defaults toconsul.service.dc1.consul).CONSUL_PORT: The port of your Consul agent (defaults to8500).
The application can be run in several modes. The default command is schedule to run the sync on a schedule.
docker run -d --name fitbit-sync \
-e CONSUL_HOST=your-consul-host \
-e CONSUL_PORT=8500 \
fitbit-garmin-sync
This will start the container in detached mode (-d) and run the scheduled sync.
Interactive Setup
The first time you run the application, you will need to perform an interactive setup to provide your Fitbit and Garmin credentials. These will be stored securely in Consul.
-
Run the container with the
setupcommand:docker run -it --rm \ -e CONSUL_HOST=your-consul-host \ -e CONSUL_PORT=8500 \ fitbit-garmin-sync setup-itallows you to interact with the container's terminal.--rmwill remove the container after it exits.
-
Follow the on-screen prompts to enter your Fitbit and Garmin credentials. The application will guide you through the OAuth process for Fitbit, which requires you to copy and paste a URL into your browser.
After the setup is complete, the necessary configuration and session data will be saved in Consul.
Other Commands
You can run other commands by specifying them when you run the container. For example, to run a manual sync:
docker run -it --rm \
-e CONSUL_HOST=your-consul-host \
-e CONSUL_PORT=8500 \
fitbit-garmin-sync sync
To check the status:
docker run -it --rm \
-e CONSUL_HOST=your-consul-host \
-e CONSUL_PORT=8500 \
fitbit-garmin-sync status
Configuration in Consul
All application state, including credentials, tokens, and sync status, is stored in Consul under a configurable prefix (default: fitbit-garmin-sync).