This repository provides a PostgreSQL database setup for the OpenWaiterAI project using Docker Compose. It includes initialization scripts to set up your database schema and seed data automatically on first startup.
Releated blog post can be found here.
The project uses the official PostgreSQL Docker image along with a custom Docker Compose configuration. On initial startup, two SQL scripts are executed:
01_schema.sql: Contains the schema definitions (tables, indexes, etc.).02_data.sql: Contains the seed data to populate the tables.
These scripts are mounted into the PostgreSQL container and are executed only when the database is created for the first time.
-
Clone the repository:
git clone https://github.com/CumaOzavci/openwaiterai_db.git cd openwaiterai_db -
Configure Environment Variables:
Set below environment variables:
OPENWAITERAI_DB_HOST=your_host OPENWAITERAI_DB_NAME=your_database_name OPENWAITERAI_DB_USER=your_database_user OPENWAITERAI_DB_PASSWORD=your_database_password OPENWAITERAI_DB_PORT=your_portNote: The
OPENWAITERAI_DB_PORTis used as the host port. PostgreSQL always listens on port5432inside the container. -
Start the Database Container:
Run the following command to start the PostgreSQL container:
docker-compose up -d
-
Verify Initialization:
Check the container logs to verify that the initialization scripts ran correctly:
docker logs openwaiterai_db
Look for messages indicating that
01_schema.sqland02_data.sqlwere executed.
-
One-Time Initialization: The SQL scripts under
/docker-entrypoint-initdb.d/are executed only when the PostgreSQL data directory is empty. If you need to reinitialize the database, remove the Docker volume by running:docker-compose down -v
Then restart the container with
docker-compose up -d. -
Volume Name: The PostgreSQL data is stored in a Docker volume named
openwaiterai_db_datafor persistent storage.
To stop the container, run:
docker-compose downIf you want to remove the associated volume (thus deleting the database data), run:
docker-compose down -vData is scrapped from the official Tavuk Dünyası website with ChatGPT's search tool. It might contain wrong values. Menu items can be found in menu_item_datas.py. Also you can find database filling script at enter_menu_item.py.
This project and data is licensed under the MIT License.