Files
aitest-reasonml-mon-fbk/bin/init_db.ml
Charles N Wyble e1ff581603 feat: initial commit - complete website monitoring application
Build a comprehensive website monitoring application with ReasonML, OCaml, and server-reason-react.

Features:
- Real-time website monitoring with HTTP status checks
- Email and webhook alerting system
- Beautiful admin dashboard with Tailwind CSS
- Complete REST API for CRUD operations
- Background monitoring scheduler
- Multi-container Docker setup with 1-core CPU constraint
- PostgreSQL database with Caqti
- Full documentation and setup guides

Tech Stack:
- OCaml 5.0+ with ReasonML
- Dream web framework
- server-reason-react for UI
- PostgreSQL 16 database
- Docker & Docker Compose

Files:
- 9 OCaml source files (1961 LOC)
- 6 documentation files (1603 LOC)
- Complete Docker configuration
- Comprehensive API documentation

💘 Generated with Crush
2026-01-13 15:56:42 -05:00

37 lines
803 B
OCaml

(* Database initialization script *)
open Lwt.Infix
let () =
(* Initialize logger *)
Logs.set_reporter (Logs_fmt.reporter ());
Logs.set_level (Some Logs.Debug);
(* Get database URL *)
let db_url =
try Sys.getenv "DATABASE_URL"
with Not_found ->
"postgresql://monitor_user:changeme@localhost:5432/website_monitor"
in
Printf.printf "Database URL: %s\n" db_url;
(* Initialize database connection *)
let pool = Database.pool in
(* Initialize schema *)
Database.init_schema ()
>>= fun () ->
Lwt_io.printl "Database initialized successfully!"
>>= fun () ->
Lwt.return_unit
let () =
Lwt_main.run @@ begin
Database.init_schema ()
>>= fun () ->
Lwt_io.printl "Database schema initialized successfully!"
>>= fun () ->
Lwt.return_unit
end