Here's the updated README.md
with the new information added:
A CLI application to configure and mount S3 storage using Rclone. This application reads settings from a .env
file, allows you to install rclone
, configure it, and provides commands to mount and unmount your S3 storage. Additionally, it includes a utility to benchmark and optimize the performance of your mounted S3 bucket.
- Python 3.10
- Ubuntu 22.04
- Conda (Anaconda or Miniconda)
git clone https://github.com/yourusername/pyMountS3.git
cd pyMountS3
conda create --name pyMountS3 python=3.10
conda activate pyMountS3
pip install -r requirements.txt
Create a .env file in the root directory of the project and populate it with your settings. You can use the provided .env.example as a template.
.env
# S3 Storage Settings
IPADDR=your_ip
WEB_USER=your_user
PASSWORD=your_password
S3_ACCESS_KEY=your_access_key
S3_SECRET_KEY=your_secret_key
MOUNT_POINT=/mnt/myswarm
S3_ENDPOINT=https://periferystorage01.domain.com
- Ensure
curl
is installed on your system. - Verify that you have the correct credentials (username and password) for accessing the Perifery storage.
To access the Perifery storage node and get a response, use the following curl
command:
curl -k -v -u 'periferyadmin:password' -H "Host: periferystorage01.domain.com" 'https://periferystorage01.domain.com/'
The CLI includes a command to install rclone:
python pyMountS3.py install
Configure rclone with the S3 settings from your .env file:
python pyMountS3.py configure
Mount your S3 bucket to the specified mount point:
python pyMountS3.py mount <bucket_name>
Replace <bucket_name>
with the name of your S3 bucket.
Unmount the S3 bucket:
python pyMountS3.py unmount <bucket_name>
Replace <bucket_name>
with the name of your S3 bucket.
The project includes a utility to benchmark and optimize the performance of your mounted S3 bucket.
Install fio for benchmarking:
sudo apt-get install -y fio
Create a benchmark.fio
file with the following content:
[global]
directory=/mnt/swarm/firstbucket
ioengine=libaio
direct=1
size=1G
bs=4k
[write_test]
rw=write
name=write_test
numjobs=4
group_reporting
[read_test]
rw=read
name=read_test
numjobs=4
Run the autoBenchmark.py script to benchmark and optimize the performance:
python autoBenchmark.py
This script will test various configurations and output the performance metrics.
- Ensure
curl
is installed on your system. - Verify that you have the correct credentials (username and password) for accessing the Perifery storage.
To access the Perifery storage node and get a response, use the following curl
command:
curl -k -v -u 'periferyadmin:password' -H "Host: periferystorage01.domain.com" 'https://periferystorage01.domain.com/'
curl
: Command-line tool for transferring data.-k
: Skip SSL certificate validation.-v
: Verbose mode for detailed output.-u 'username:password!'
: Basic authentication with usernameusername
and passwordpassword
.-H "Host: periferystorage01.domain.com"
: Host header to specify the target.'https://periferystorage01.domain.com/'
: The URL of the Perifery storage node.
If you encounter a RequestTimeTooSkewed
error, ensure the system time on your client machine is synchronized with the server's time. You can use ntpdate
or a similar tool to sync your system time with an NTP server.
sudo ntpdate pool.ntp.org
pyMountS3.py
: The main CLI application script.autoBenchmark.py
: The benchmarking and optimization utility.requirements.txt
: Python dependencies for the project..env.example
: Example environment configuration file..gitignore
: Git ignore file to exclude .env and pyMountS3 conda environment directories.
This project is licensed under the MIT License. See the LICENSE file for details.
- Fork the repository.
- Create a new branch:
git checkout -b feature-name
. - Make your changes and commit them:
git commit -m 'Add feature'
. - Push to the branch:
git push origin feature-name
. - Submit a pull request.
- Rclone - Rclone documentation and tool.
- Click - Python package for creating command-line interfaces.
- Python-dotenv - Python package to read key-value pairs from a .env file and set them as environment variables.
- Fio - Flexible I/O tester for benchmarking and testing.
For issues or questions, please open an issue on GitHub.