Files
fitbit_garmin_sync/README.md
2025-10-04 16:08:55 -07:00

81 lines
2.9 KiB
Markdown

# 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 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.
1. **Create a data directory on your host machine:**
```bash
mkdir fitbit_garmin_data
```
2. **Run the Docker container with a mounted volume:**
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 -v "$(pwd)/fitbit_garmin_data":/app/data 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.
1. **Run the container with the `setup` command:**
```bash
docker run -it --rm -v "$(pwd)/fitbit_garmin_data":/app/data 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 files will be saved in your `fitbit_garmin_data` directory.
### 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 -v "$(pwd)/fitbit_garmin_data":/app/data fitbit-garmin-sync sync
```
To check the status:
```bash
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.