Linodsync is a Go-based application designed to back up your project directories and databases on a server to Linode Object Storage.
- Create a directory for linodsync and download the pre-compiled binary into the server:
mkdir linodsync && cd linodsync
wget https://github.com/sanda0/linodsync/releases/download/v1.0.1/linodsync
- Make the binary executable by setting the executable permissions:
chmod +x linodsync
- Create
linodsync.json
.
In the project folder you want to back up, create a file named linodsync.json
with the following structure:
{
"env_file": ".env",
"zip_file_name": "project_backup",
"database": {
"connection": "DB_CONNECTION",
"host": "DB_HOST",
"port": "DB_PORT",
"username": "DB_USERNAME",
"password": "DB_PASSWORD",
"database_name": "DB_DATABASE"
},
"dir": [
"storage/app",
"database/companies"
]
}
env_file
: Name of the .env file containing database credentials.zip_file_name
: Name of the backup zip file.database
: Database connection details, which will be extracted from the .env file.dir
: List of directories to include in the backup.
- Push the
linodsync.json
file to the server.
If you created the linodsync.json
file on your local machine, push it to the project folder on the server.
git add linodsync.json
git commit -m "Add linodsync configuration"
git push
- Generate
linodsync.config.json
Run the following command to create the server configuration:
./linodsync -cc
This will generate a linodsync.config.json
file with the following fields:
{
"access_key": "",
"secret_key": "",
"bucket": "",
"region": "",
"endpoint": "",
"retention_days": 30
}
access_key
: Your Linode Object Storage access key.secret_key
: Your Linode Object Storage secret key.bucket
: Name of the bucket where backups will be stored.region
: Region of the Linode bucket.endpoint
: Linode Object Storage endpoint.retention_days
: Number of days to retain backups.
- Add Project to Backup
Navigate to the project folder on the server and run:
<path_to_linodsync_folder_that_you_created>/linodsync --add
A success message will confirm the addition, and a backup_config.json
file will be generated, listing all projects added for backup.
- Generate Service File
Run the following command to create the linodsync.service
file:
./linodsync -cs
The file will be saved at /etc/systemd/system/linodsync.service
- Enable and Start the Service
Reload the systemd daemon and start the service:
systemctl daemon-reload
systemctl start linodsync.service
systemctl enable linodsync.service
- Verify Service Status
Check the status of the service:
systemctl status linodsync.service
To view help:
./linodsync -h