Skip to content

nycanshu/Ceph-RGW-Admin-Server-Express-Js

Repository files navigation

🚀 Ceph RGW Admin Server — The S3 User Tamer 🦸‍♂️

Ever wished you could wrangle Ceph RGW users as easily as herding virtual cats? Meet the Ceph RGW Admin Server — your Express.js-powered superhero for managing S3-style users and secrets with RESTful flair, bulletproof validation, and developer-friendly APIs!


🌟 The Story

Imagine: You’re the admin of a bustling Ceph RGW object storage cluster. Users come and go, secrets fly, and someone has to keep it all in check. Enter this project: A Node.js/Express server that turns Ceph RGW user management into a breezy, REST-powered experience!

Whether you want to create, list, inspect, or delete users (or even bulk clean up test accounts after a hackathon), this repo gives you the powers of a storage wizard, with robust security, validation, and error handling — all in a modern Express.js setup.


🧩 What’s in the Box?

  • Full REST API for Ceph RGW user management (create, list, get info, check existence, delete, and more)
  • Health check endpoint — because everyone wants to know, “Is it up?”
  • S3 client generator for users (so users can connect right away!)
  • Bulletproof validation and clear error messages
  • Modern security: Helmet, CORS, and more
  • Bulk test-user cleanups (for those mass test runs)
  • Ready-to-use project structure for scaling and hacking

📁 Repo Structure

Ceph-RGW-Admin-Server-Express-Js/
├── config/           # Configuration for RGW and environment
│   └── rgw.js        # Ceph RGW config logic
├── middleware/       # Express middleware
│   └── validation.js # Joi-powered request validation
├── routes/           # API routes
│   └── userRoutes.js # All user-related endpoints
├── services/         # Business logic
│   └── userService.js# All the Ceph RGW magic happens here
├── test/             # Test suite
│   └── test-server.js# Server integration tests
├── .env.example      # Sample environment config
├── package.json      # Dependencies and scripts
├── server.js         # The main Express server
└── README.md         # This awesome guide!

🏁 Quick Start

  1. Clone & Install

    git clone https://github.com/nycanshu/Ceph-RGW-Admin-Server-Express-Js.git
    cd Ceph-RGW-Admin-Server-Express-Js
    npm install
  2. Configure

    • Copy .env.example to .env and fill in your Ceph RGW credentials and settings.
  3. Run

    # Dev mode (with auto-reload)
    npm run dev
    
    # Production
    npm start
  4. Test

    npm test

🔌 API Endpoints (The Fun Bits!)

🚦 Health

  • GET /health
    Check that the server is alive and kicking.

👥 User Management

  • GET /api/users
    List all RGW users

  • POST /api/users/create
    Create a new user
    Body:

    {
      "uid": "user123",
      "displayName": "John Doe"
    }
  • GET /api/users/:uid
    Get info about a specific user

  • GET /api/users/:uid/exists
    See if a user exists

  • GET /api/users/:uid/s3-client
    Get ready-to-use S3 client details for a user

  • DELETE /api/users/:uid
    Delete a user

  • DELETE /api/users/bulk/cleanup-test-users
    Bulk cleanup test users (names starting with test-user and containing _ORGtest-org)

🛡️ Error Responses

Every endpoint gives you a clear, consistent error format:

{
  "success": false,
  "message": "What went wrong",
  "error": "Detailed error (development only)"
}

🦺 Security & Best Practices

  • Helmet.js for HTTP headers
  • Joi schema validation for all user input
  • CORS enabled by default
  • No sensitive info in error messages (unless you’re in development mode)

🧪 Environment Variables

.env file is required. Here’s what matters most:

Variable Description Default
NODE_ENV Environment mode development
PORT Server port 3001
AWS_REGION AWS (RGW) region us-east-1
AWS_ACCESS_KEY_ID RGW access key (required)
AWS_SECRET_ACCESS_KEY RGW secret key (required)
AWS_ENDPOINT RGW endpoint URL (required)
AWS_RGW_ENDPOINT RGW hostname (required)
AWS_RGW_PORT RGW port 80
RABBITMQ_URL RabbitMQ URL (optional) (optional)

🏗️ How It Works (A Peek Under the Hood)

  • server.js is the main Express entrypoint. Handles routes, middleware, and error handling.
  • Routes are modular (see routes/userRoutes.js).
  • Validation and input checking via Joi, in middleware/validation.js.
  • Business logic (like talking to Ceph RGW) is in services/userService.js.
  • Config is cleanly separated in config/rgw.js.

🎉 Why Use This?

  • Admin-friendly: Manage Ceph RGW users with a few HTTP calls.
  • Dev-friendly: Modern Node.js, easy to extend, test suite included.
  • Secure & robust: No cowboy code. Validation and error handling first.
  • Fun to hack on: Clear code, well-structured, and ready for your next storage adventure.

📜 License

MIT — use, share, improve, and have fun!


“With great storage comes great responsibility!”
— You, after deploying this server

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published