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 requires persistent storage for configuration, database, logs, and session data. You should create a local directory to store this data and mount it as a volume when running the container.
-
Create a data directory on your host machine:
mkdir fitbit_garmin_data -
Run the Docker container with a mounted volume:
The application can be run in several modes. The default command is
scheduleto run the sync on a schedule.docker run -d --name fitbit-sync -v "$(pwd)/fitbit_garmin_data":/app/data fitbit-garmin-syncThis 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.
-
Run the container with the
setupcommand:docker run -it --rm -v "$(pwd)/fitbit_garmin_data":/app/data 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 files will be saved in your
fitbit_garmin_datadirectory.
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 -v "$(pwd)/fitbit_garmin_data":/app/data fitbit-garmin-sync sync
To check the status:
docker run -it --rm -v "$(pwd)/fitbit_garmin_data":/app/data fitbit-garmin-sync status
Data Persistence
The following files will be stored in the mounted data volume (fitbit_garmin_data):
config.json: Application configuration, including API keys.weight_sync.db: SQLite database for storing sync state.weight_sync.log: Log file.garmin_session.json: Garmin session data.
By using a volume, this data will persist even if the container is stopped or removed.
Managing Credentials
Your Fitbit and Garmin credentials are an essential part of the config.json file, which is stored in the data volume. Be sure to treat this data as sensitive. It is recommended to restrict permissions on the fitbit_garmin_data directory.