A Flask service for IBM PowerVS technical training labs. This app provides students with temporary access to IBM Cloud and stores their course feedback in IBM Cloudant, a NoSQL database running on IBM Cloud.
- Invites a student to an IBM Cloud account.
- Adds the student to a configured IAM access group.
- Uses the permanent IAM policy already assigned to the configured access group.
- Removes expired users through the cleanup endpoint.
- Stores course feedback in an IBM Cloudant database.
- Protects administrative endpoints with an
X-SITE-TOKENheader. - The student-facing HTML that calls this backend is intentionally excluded from this repository. Reach out to me if you need it.
GET /health- Displays service health and configuration status.GET /diagnostics- Tests IBM Cloud configuration. RequiresX-SITE-TOKEN.POST /invite- Invites a student and creates temporary access. RequiresX-SITE-TOKEN.POST /cleanup- Removes expired student accounts. RequiresX-SITE-TOKEN.POST /feedback- Stores course feedback in Cloudant.
- Python 3.9 or later
- IBM Cloud account and API key with the required IAM permissions
- IBM Cloud access group and target resource group
- IBM Cloudant instance and database
- IBM Code Engine project for deployment
Create a .env file for local testing or configure these values in Code Engine:
IBM_API_KEY=your-ibm-cloud-api-key
ACCOUNT_ID=your-account-id
RESOURCE_GROUP_ID=your-resource-group-id
ACCESS_GROUP_ID=your-access-group-id
ACCESS_GROUP_NAME=QZD35G-student-access
SITE_TOKEN=your-secret-site-token
ALLOWED_ACCESS_DAYS=7
CLOUDANT_URL=https://your-cloudant-instance-url
CLOUDANT_APIKEY=your-cloudant-api-key
CLOUDANT_DB=qzc51g-feedback
PORT=8080ACCESS_GROUP_ID is optional when ACCESS_GROUP_NAME can be used to locate the group.
python -m pip install -r requirements.txt
python app.pyThe service listens on http://localhost:8080 by default.
curl -X POST http://localhost:8080/invite \
-H "Content-Type: application/json" \
-H "X-SITE-TOKEN: your-site-token" \
-d '{"email":"student@example.com"}'