# 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: ```bash 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 to `consul.service.dc1.consul`). - `CONSUL_PORT`: The port of your Consul agent (defaults to `8500`). The application can be run in several modes. The default command is `schedule` to run the sync on a schedule. ```bash 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. 1. **Run the container with the `setup` command:** ```bash docker run -it --rm \ -e CONSUL_HOST=your-consul-host \ -e CONSUL_PORT=8500 \ fitbit-garmin-sync setup ``` - `-it` allows you to interact with the container's terminal. - `--rm` will remove the container after it exits. 2. **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: ```bash docker run -it --rm \ -e CONSUL_HOST=your-consul-host \ -e CONSUL_PORT=8500 \ fitbit-garmin-sync sync ``` To check the status: ```bash 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`).