Abstract
The coffee batch inspection log basically is a web-based application developed to record and managed coffee batch inspection information.The project demonstrates how a simple information-management system can be built by using a Python Backend,a relational database,and containerization in which the main purpose is to provide a structured way to store batch details such as identification of the coffee,origin,processing method,and inspection status.The application also demonstrates cloud-services related concepts including HTTP communication,persistent storage,service configuration,and container health monitoring.
1.Introduction
Coffee production may involves multiple batches that may differ in origin processing method,and it's inspection results.Keeping these details very organized and well mannered is very crucial for traceability and record management.Therefore,a digital log can make it easier to add,view,update,and remove records than maintaining the same information in seperate manual documents.
The coffee Batch inspection Log was selected as a practical example of a data-management application in an Indonesian agricultural context.The project is not an automated coffee-quality detection system.Instead,it provides a web interface for users to record and manage inspection information.
2.Application Architecture
The application uses a three-part structure:a front-end,a backend,and a database.The frontend is a browser-based interface through which users interact with coffee batch records.The backend is written in Python using Flask.It receives the HTTP requests,validates submitted information,performs the request operation as well as communicates with the database.
PostgreSQL version 16 is used as the relational database which stores the batch records so that the information is not limited to the browser session.The backend connects to PostgreSQL using a database connection string supplied through the DATABASE_URL environment variable.The database service is addressed by its Compose service name,db,allowing the application container to communicate with it over the Docker Network.
3.CRUD Operations and Data Validation
The application supports the four basic data-management operations currently known as the CRUD:Create,Read,Update,and delete.Users can create a batch record,retrieve and view existing records,update information when details change,and delete a record when it is no longer required.
The backend validates the incoming data before it is stored and validation helps in preventing incomplete or invalid information from entering the database.For example,a required text fiels should not be empty,and numerical values should be within acceptable limits.The application also provides an API endpoint for retrieving batch records and a /health endpoint for checking application responsiveness.
4.Containerization with Docker
Docker is used to package the application and its runtime environment into a container image.The project Dockerfile uses a multi-stage build.In the first stage,Python as a virtual environment is created and the dependencies listed in requirements.txt are installed.In the second stage,a fresh python slim image is prepared,and the virtual environment and the applications file are copied into it.Gunicorn is used to serve the Flask application on the port 5000.
Seperating dependency installation from the runtime stage keeps the build process organized and avoids carrying the builder stage itself into the final runtime image.
5.Managing Services with Docker COmpose
Docker Compose defines,runs the application's two services:web and db.The web service builds the application image from the Dockerfile and maps host port 5001 to the container port 5000.The db service uses the PostgreSQL 16 image.
A named volume,postgres_data,is mounted to PostgreSQL's data directory to preserve database files when containers are recreated,provided the volume is not removed.The database health check uses pg_isready to test whether PostgreSQL is ready to accept connections.The web service uses service_healthy dependency condition so it waits for the database health check to pass before starting.Thes settings demonstrate service coordination and persistent storage in a multi-container application.
Conclusion
The Coffee Batch Inspection Log demonstrate how the Flask,PostgreSQL,Docker,and Docker Compose can be combined to build a practical web-based record management application which implements always and again the CRUD(Create,Read,Update,Delete) functionality,data validation,database persistence,containerized execution as well as health monitoring.The project provided practical experience with backend development,HTTP APIs,relational databases,Docker images,service dependencies and the persistent volumes.Although it does not automatically assess coffee quality,it establishes a digital foundation for organizing coffee batch inspection records.
References
1.Docker. Docker Compose. https://docs.docker.com/compose/
2.Docker. Docker Compose Quickstart. https://docs.docker.com/compose/gettingstarted/

