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!
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.
- 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
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!
-
Clone & Install
git clone https://github.com/nycanshu/Ceph-RGW-Admin-Server-Express-Js.git cd Ceph-RGW-Admin-Server-Express-Js npm install -
Configure
- Copy
.env.exampleto.envand fill in your Ceph RGW credentials and settings.
- Copy
-
Run
# Dev mode (with auto-reload) npm run dev # Production npm start
-
Test
npm test
GET /health
Check that the server is alive and kicking.
-
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 withtest-userand containing_ORGtest-org)
Every endpoint gives you a clear, consistent error format:
{
"success": false,
"message": "What went wrong",
"error": "Detailed error (development only)"
}- 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
developmentmode)
.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) |
- 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.
- 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.
MIT — use, share, improve, and have fun!
“With great storage comes great responsibility!”
— You, after deploying this server