Officer is a backend service written in Rust, designed to perform daily operations for your infrastructure. It provides a set of API endpoints to interact with your Kubernetes cluster and database, automating common tasks such as retrieving pod details, restarting deployments, and seeding databases.
- Get Pods and Image Versions: Retrieve a list of running pods along with their associated image versions.
- Restart Deployment: Restart a Kubernetes deployment to apply new changes.
- Seed Database: Populate the database with initial data for application setup.
- Health Check: Check the status of the service to ensure it is running properly.
The API is automatically generated using the Paperclip library. You can access the OpenAPI documentation at:
GET /api/docs
This provides an interactive interface to explore and test the available endpoints.
- Clone the repository:
git clone https://github.com/your-repo/officer.git cd officer - Install dependencies:
cargo build
- Configure environment variables in
.envfile:RUST_LOG=info RUST_BACKTRACE=1 API_KEY="" OFFICER_SECRET_KEY="" OAUTH2_CLIENT_ID="" OAUTH2_CLIENT_SECRET="" OAUTH2_URL="https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0" OAUTH2_USER_INFO_ENDPOINT="https://graph.microsoft.com/oidc/userinfo" OAUTH2_JWKS_URL="https://login.microsoftonline.com/<tenant-id>/discovery/v2.0/keys" OAUTH2_REDIRECT_URL="http://localhost:8000/auth/oidc/callback" USERS="dodiprasetyo@mail.com,dzaka.eryan@mail.com"
- Start the service:
With auto reload:
cargo run
cargo watch -x run
- Docker:
docker build -t officer . docker run -p 8000:8000 officer
MIT License
Feel free to submit issues or pull requests to improve the service!