turbo-sync/README.md
Benjamin Toby 37a314273a Updates
2025-07-11 06:49:06 +01:00

120 lines
2.4 KiB
Markdown

# Turbo Sync
A no-nonsense file/folder synchronization application
## Requirements
Turbo sync requires **node js** and **rsync**
## Installation
To install simply run:
```bash
npm install --registry="https://git.tben.me/api/packages/Moduletrace/npm/" -g turbosync
```
To update run:
```bash
npm update --registry="https://git.tben.me/api/packages/Moduletrace/npm/" -g turbosync
```
## Usage
Turbo Sync requires a `JSON` file with the correct configuration. example:
```bash
turbosync ./project/sync/config.json
```
However if you have a file named `turbosync.config.json` in the working directory simply run:
```bash
turbosync
```
In this case Turbo Sync will automatically look for a file named `turbosync.config.json` in the working directory for config params.
### Config File
The config file is a json file that contains all the information needed to run turbosync. Example:
```json
[
{
"title": "Sync Files",
"files": [
"/home/user/file1.txt",
"/home/user/file2.txt",
{
"path": "/home/user/file3",
"user": "root",
"host": "5.34.75.236",
"ssh_key": "/home/user/.ssh/key"
}
]
},
{
"title": "Sync Folders",
"options": {
"delete": true
},
"folders": [
"/home/user/folder1",
"/home/user/folder2",
{
"path": "/home/user/folder3",
"user": "user",
"host": "5.39.67.76",
"ssh_key": "/home/user/.ssh/key"
}
]
}
]
```
You can also use environment variables in the config file. Example:
```json
[
{
"title": "Sync Folders",
"folders": ["$FOLDER_1", "$FOLDER_2"]
}
]
```
## System Processes
Run Turbosync as a system process to keep it running in the background.
### Systemd Config
Use this template to create a systemd service for turbosync.
```ini
[Unit]
Description=Service Name
After=network.target
[Service]
ExecStart=/home/user/.bun/bin/turbosync
Restart=always
RestartSec=5
Environment="PATH=/usr/bin:/home/user/.bun/bin:/home/user/.nvm/versions/node/v20.18.1/bin:${PATH}"
User=user
WorkingDirectory=/home/user/services/turbosync/service-name
[Install]
WantedBy=multi-user.target
```
After this you can run:
```bash
sudo systemctl daemon-reload
sudo systemctl enable turbosync-service-name
sudo systemctl start turbosync-service-name
```