diff --git a/README.md b/README.md index e977d5c..aeb9f2c 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,204 @@ -# flask-neo-object-storage +# Flask NEO Object Storage Manager -🚀 Flask web application for managing BiznetGio NEO Object Storage with S3-compatible API. Upload, view, and delete files with ease. Features SSL handling, auto bucket creation, and responsive UI. \ No newline at end of file +🚀 A modern Flask web application for managing [BiznetGio NEO Object Storage](https://www.biznetgio.com/product/neo-object-storage) with S3-compatible API. + +![Python](https://img.shields.io/badge/Python-3.8+-blue.svg) +![Flask](https://img.shields.io/badge/Flask-2.3+-green.svg) +![License](https://img.shields.io/badge/License-MIT-yellow.svg) + +## ✨ Features + +- 📁 **File Upload & Management** - Upload files with drag & drop support +- 🖼️ **Image Preview** - Preview uploaded images directly in browser +- 🗑️ **File Deletion** - Delete files with confirmation +- 🔗 **Direct Links** - Copy direct URLs to clipboard +- 🛡️ **SSL Handling** - Automatic SSL certificate handling for development +- 🪣 **Auto Bucket Creation** - Automatically creates buckets if they don't exist +- 📱 **Responsive UI** - Bootstrap-based responsive interface +- 🔧 **Easy Configuration** - Environment variable based setup + +## 🚀 Quick Start + +### Prerequisites +- Python 3.8+ +- BiznetGio NEO Object Storage account +- Access Key & Secret Key from NEO Portal + +### Installation + +1. **Clone the repository** + ```bash + git clone https://git.classy.id/andri/flask-neo-object-storage.git + cd flask-neo-object-storage + ``` + +2. **Create virtual environment** + ```bash + python -m venv venv + source venv/bin/activate # On Windows: venv\Scripts\activate + ``` + +3. **Install dependencies** + ```bash + pip install -r requirements.txt + ``` + +4. **Configure environment variables** + ```bash + cp .env.example .env + # Edit .env with your NEO credentials + ``` + +5. **Run the application** + ```bash + python app.py + ``` + +6. **Open browser** + ``` + http://localhost:7600 + ``` + +## ⚙️ Configuration + +Create a `.env` file with your NEO Object Storage credentials: + +```env +NEO_ACCESS_KEY=your_access_key_here +NEO_SECRET_KEY=your_secret_key_here +NEO_ENDPOINT=https://nos.wjv-1.neo.id +NEO_BUCKET=my-unique-bucket-name +NEO_USE_SSL=false +``` + +### Getting NEO Credentials + +1. Login to [BiznetGio Portal](https://portal.biznetgio.com/) +2. Navigate to **NEO Object Storage** +3. Create a new bucket or use existing one +4. Copy your **Access Key** and **Secret Key** + +## 📁 Project Structure + +``` +flask-neo-object-storage/ +├── app.py # Main Flask application +├── requirements.txt # Python dependencies +├── .env.example # Environment variables template +├── .env # Your environment variables (gitignored) +├── templates/ # HTML templates +│ ├── base.html +│ ├── index.html +│ ├── upload.html +│ └── files.html +└── README.md +``` + +## 🛠️ API Endpoints + +| Method | Endpoint | Description | +|--------|----------|-------------| +| `GET` | `/` | Home page | +| `GET/POST` | `/upload` | Upload files | +| `GET` | `/files` | View all files | +| `POST` | `/api/upload` | AJAX file upload | +| `POST` | `/api/delete` | Delete file | +| `GET` | `/api/files` | List files JSON | +| `GET` | `/test-connection` | Test NEO connection | +| `GET` | `/setup-bucket` | Create bucket | + +## 🐛 Troubleshooting + +### SSL Certificate Issues +If you encounter SSL certificate errors: +```env +NEO_USE_SSL=false +NEO_ENDPOINT=http://nos.wjv-1.neo.id +``` + +### Bucket Not Found Error +1. Make sure bucket name is unique globally +2. Create bucket manually in NEO Portal +3. Use `/setup-bucket` endpoint to auto-create + +### Access Denied Error +1. Verify your Access Key and Secret Key +2. Check bucket permissions in NEO Portal +3. Ensure bucket policy allows public read + +## 🚀 Deployment + +### Production Deployment + +1. **Use production WSGI server** + ```bash + pip install gunicorn + gunicorn -w 4 -b 0.0.0.0:8000 app:app + ``` + +2. **Enable SSL in production** + ```env + NEO_USE_SSL=true + ``` + +3. **Use reverse proxy (Nginx)** + ```nginx + server { + listen 80; + server_name yourdomain.com; + + location / { + proxy_pass http://127.0.0.1:8000; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + } + } + ``` + +### Docker Deployment + +```dockerfile +FROM python:3.9-slim + +WORKDIR /app +COPY requirements.txt . +RUN pip install -r requirements.txt + +COPY . . +EXPOSE 7600 + +CMD ["python", "app.py"] +``` + +## 🤝 Contributing + +1. Fork the repository +2. Create your feature branch (`git checkout -b feature/AmazingFeature`) +3. Commit your changes (`git commit -m 'Add some AmazingFeature'`) +4. Push to the branch (`git push origin feature/AmazingFeature`) +5. Open a Pull Request + +## 📄 License + +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. + +## 🙏 Acknowledgments + +- [BiznetGio](https://www.biznetgio.com/) for NEO Object Storage service +- [Flask](https://flask.palletsprojects.com/) web framework +- [Bootstrap](https://getbootstrap.com/) for UI components +- [Boto3](https://boto3.amazonaws.com/v1/documentation/api/latest/index.html) for AWS S3 compatible API + +## 📞 Support + +- 📧 Email: your-email@example.com +- 🐛 Issues: [GitHub Issues](https://github.com/yourusername/flask-neo-object-storage/issues) +- 💬 Discussions: [GitHub Discussions](https://github.com/yourusername/flask-neo-object-storage/discussions) + +--- + +**Made with ❤️ in Indonesia** + + +Dengan setup ini, kamu bisa menggunakan Flask app sebagai microservice untuk handle object storage, sementara aplikasi utama tetap menggunakan PHP! +``` \ No newline at end of file