FlareSync is a lightweight Rust application that automatically updates your Cloudflare DNS records with your current public IP address. It's designed to run as a background service, periodically checking for IP changes and updating the specified DNS records accordingly.
status/flaresync-status.json and can be changed with STATUS_FILE_PATH.SIGINT and SIGTERM, including during IP discovery, Cloudflare updates, and interval waits, then writes a final status update before exiting../status:/app/status and document host directory ownership requirements for rootless containers.2.2.0..env file, list them as a comma-separated string for the DOMAIN_NAME variable (e.g., DOMAIN_NAME=example.com,sub.example.com).docker logs.This application was developed using AI. Please note that while AI tools help accelerate development, it is important to review and test the code thoroughly for your specific use cases.
tokio for efficiency.log4rs.SIGINT and SIGTERM.The recommended way to run FlareSync is using Docker or Docker Compose.
Clone the repository:
bash
git clone https://github.com/BattermanZ/FlareSync.git
cd FlareSync
Set up your environment:
Create a .env file by copying the example file:
bash
cp .env.example .env
Edit the .env file and fill in your details. See the Configuration section for more details on the environment variables.
Create the mounted directories before starting the container and make them writable by the container user:
mkdir -p backups status
chown -R 1000:1000 backups status
docker run -d \
--name flaresync \
--env-file .env \
-v $(pwd)/logs:/app/logs \
-v $(pwd)/backups:/app/backups \
-v $(pwd)/status:/app/status \
--restart unless-stopped \
battermanz/flaresync:latest
This is the recommended method for deployment.
docker-compose up -d
The docker-compose.yml file is already included in the repository. For reference, it contains:
services:
flaresync:
image: battermanz/flaresync:latest
container_name: flaresync
env_file:
- .env
volumes:
- ./backups:/app/backups
- ./status:/app/status
restart: unless-stopped
If you prefer to build from source:
1. Make sure you have Rust installed (min. version 1.70).
2. Set up your .env file as described above. The application will load it automatically.
3. Build and run the application:
bash
cargo run --release
This project uses environment variables for configuration. Create a .env file in the project root by copying the .env.example file.
| Variable | Description | Default |
|---|---|---|
CLOUDFLARE_API_TOKEN |
Your Cloudflare API token. | (required) |
CLOUDFLARE_ZONE_ID |
The Zone ID of your domain. | (required) |
DOMAIN_NAME |
A single domain or multiple domains separated by commas (e.g., domain1.com,domain2.com). |
(required) |
UPDATE_INTERVAL |
The update interval in minutes. | 5 |
STATUS_FILE_PATH |
Path to the runtime status JSON file. | status/flaresync-status.json |
TZ |
The timezone for the container. | Etc/UTC |
PUID |
The user ID for file permissions. | 1000 |
PGID |
The group ID for file permissions. | 1000 |
Make sure your .env file is in the same directory as the docker-compose.yml file.
DNS record backups are stored in the backups directory. A new backup is created each time a DNS record is updated.
FlareSync writes a JSON status file to status/flaresync-status.json by default. The file includes startup time, last successful public IP check, per-domain status, recent errors, and shutdown state. In Docker deployments, mount /app/status to persist this file on the host and ensure the mounted directory is writable by UID/GID 1000:1000.
FlareSync handles SIGINT and SIGTERM and exits cleanly after writing a final status update. This allows Docker and systemd to stop the service without waiting for the full update interval sleep to finish.
Keep your .env file secure and avoid sharing it publicly. It contains sensitive information like your Cloudflare API token.
The following diagram shows the overall system architecture of FlareSync:
+-------------------+ +------------------+ +-------------------+
| Public IP API | <---> | FlareSync | <---> | Cloudflare API |
+-------------------+ +------------------+ +-------------------+
| | |
| | |
[Check IP] [Update DNS Record] [Update Confirmed]
This diagram helps illustrate how FlareSync interacts with public IP services and Cloudflare to maintain updated DNS records.
This project is licensed under the GNU General Public License v3.0 (GPL-3.0). See the LICENSE file for details.
Contributions are welcome! Please open an issue or submit a pull request.
tokio, reqwest, and log4rs.For any questions or issues, feel free to open an issue on this repository.
$ claude mcp add FlareSync \
-- python -m otcore.mcp_server <graph>