sync
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 3m2s
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 3m2s
This commit is contained in:
58
README.md
58
README.md
@@ -16,32 +16,33 @@ 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.
|
||||
The application is configured entirely via Consul. You can specify the Consul agent's location using environment variables.
|
||||
|
||||
1. **Create a data directory on your host machine:**
|
||||
- `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`).
|
||||
|
||||
```bash
|
||||
mkdir fitbit_garmin_data
|
||||
```
|
||||
The application can be run in several modes. The default command is `schedule` to run the sync on a schedule.
|
||||
|
||||
2. **Run the Docker container with a mounted volume:**
|
||||
```bash
|
||||
docker run -d --name fitbit-sync \
|
||||
-e CONSUL_HOST=your-consul-host \
|
||||
-e CONSUL_PORT=8500 \
|
||||
fitbit-garmin-sync
|
||||
```
|
||||
|
||||
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.
|
||||
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.
|
||||
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 -v "$(pwd)/fitbit_garmin_data":/app/data fitbit-garmin-sync setup
|
||||
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.
|
||||
@@ -49,33 +50,28 @@ The first time you run the application, you will need to perform an interactive
|
||||
|
||||
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.
|
||||
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 -v "$(pwd)/fitbit_garmin_data":/app/data fitbit-garmin-sync sync
|
||||
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 -v "$(pwd)/fitbit_garmin_data":/app/data fitbit-garmin-sync status
|
||||
docker run -it --rm \
|
||||
-e CONSUL_HOST=your-consul-host \
|
||||
-e CONSUL_PORT=8500 \
|
||||
fitbit-garmin-sync status
|
||||
```
|
||||
|
||||
## Data Persistence
|
||||
## Configuration in Consul
|
||||
|
||||
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.
|
||||
All application state, including credentials, tokens, and sync status, is stored in Consul under a configurable prefix (default: `fitbit-garmin-sync`).
|
||||
Reference in New Issue
Block a user