Skip to content

Linodsync is a Go-based application designed to back up your project directories and databases on a server to Linode Object Storage.

Notifications You must be signed in to change notification settings

sanda0/linodsync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Linodsync

Linodsync is a Go-based application designed to back up your project directories and databases on a server to Linode Object Storage.

Installation

  1. 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
  1. Make the binary executable by setting the executable permissions:
  chmod +x linodsync

Project Configuration

  1. 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.
  1. 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

Server Configuration

  1. 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.
  1. 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.

Running as a Service

  1. 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

  1. Enable and Start the Service

Reload the systemd daemon and start the service:

systemctl daemon-reload
systemctl start linodsync.service
systemctl enable linodsync.service
  1. Verify Service Status

Check the status of the service:

systemctl status linodsync.service

Usage

To view help:

./linodsync -h

About

Linodsync is a Go-based application designed to back up your project directories and databases on a server to Linode Object Storage.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published