This commit is contained in:
parent
24c7ec2b17
commit
dad0657878
7 changed files with 35 additions and 20 deletions
2
Makefile
2
Makefile
|
|
@ -1,4 +1,4 @@
|
|||
# Generated by mirage.v4.10.1
|
||||
# Generated by mirage.v4.10.3
|
||||
|
||||
-include Makefile.user
|
||||
BUILD_DIR = unikernel/
|
||||
|
|
|
|||
11
README.md
11
README.md
|
|
@ -3,14 +3,9 @@
|
|||
|
||||
build steps:
|
||||
|
||||
$ mirage configure -f unikernel/config.ml -t unix
|
||||
$ gen_tls.sh foo
|
||||
$ make
|
||||
gen_tls.sh foo
|
||||
|
||||
mirage configure -f unikernel/config.ml -t unix && make
|
||||
|
||||
run:
|
||||
./unikernel/dist/mte --pg-database taler-exchange --pg-port 5432 --pg-hostname localhost --pg-user mte --pg-password xxx
|
||||
|
||||
todo
|
||||
- make a .opam file
|
||||
- pin pgx to:
|
||||
"git+https://github.com/pgx-ocaml/pgx.git#57c39ad93b712b4a9c1914be0c99172e050bc8e9"
|
||||
|
|
|
|||
|
|
@ -4,4 +4,4 @@
|
|||
|
||||
(implicit_transitive_deps true)
|
||||
|
||||
;; Generated by mirage.v4.10.1
|
||||
;; Generated by mirage.v4.10.3
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@
|
|||
|
||||
(context (default))
|
||||
|
||||
;; Generated by mirage.v4.10.1
|
||||
;; Generated by mirage.v4.10.3
|
||||
|
|
|
|||
|
|
@ -4,12 +4,26 @@ let pgx_setup = runtime_arg ~pos:__POS__ "Unikernel.pgx_setup"
|
|||
|
||||
let packages =
|
||||
[
|
||||
package "digestif"; package ~min:"0.0.9" "mimic-happy-eyeballs";
|
||||
package "hxd" ~sublibs:[ "core"; "string" ]; package "rresult";
|
||||
package ~min:"0.13.0" "h2"; package ~min:"10.0.0" "dns-client";
|
||||
package "pgx"; package "pgx_lwt"; package "pgx_lwt_mirage"; package "logs";
|
||||
package "mirage-logs"; package "conduit"; package "duration";
|
||||
package ~min:"0.0.9" "mimic-happy-eyeballs"; package ~min:"0.13.0" "h2";
|
||||
package "logs"; package "mirage-logs";
|
||||
package "rresult";
|
||||
]
|
||||
(*
|
||||
@ [
|
||||
package "pgx"; package "pgx_lwt"; package "pgx_lwt_mirage";
|
||||
package "conduit";
|
||||
]
|
||||
*)
|
||||
(*
|
||||
@ [ package ~min:"10.0.0" "dns-client"; package "dns-client-mirage" ]
|
||||
*)
|
||||
(*
|
||||
@ [
|
||||
package ~min:"2.2.4" "caqti"; package ~min:"2.2.4" "caqti-tls";
|
||||
package "caqti-driver-pgx"; package "caqti-mirage"; package "caqti-lwt";
|
||||
package "dns-client-mirage";
|
||||
]
|
||||
*)
|
||||
|
||||
let mte =
|
||||
main "Unikernel.Make" ~local_libs:[ "mte" ] ~packages
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
;; Generated by mirage.v4.10.1
|
||||
;; Generated by mirage.v4.10.3
|
||||
|
||||
(include dune.build)
|
||||
|
|
|
|||
|
|
@ -76,8 +76,6 @@ module Make
|
|||
with type stack = STACK.t
|
||||
and type flow = STACK.TCP.flow) =
|
||||
struct
|
||||
module Pgx_mirage = Pgx_lwt_mirage.Make (STACK) (Happy_eyeballs)
|
||||
|
||||
let map_err_to_string pp_err res =
|
||||
Lwt.map (R.reword_error (R.msgf "%a" pp_err)) res
|
||||
|
||||
|
|
@ -276,11 +274,18 @@ struct
|
|||
let (`Initialized th) = Paf.serve http_1_1_service http_server in
|
||||
th
|
||||
|
||||
(*module Pgx_mirage = Pgx_lwt_mirage.Make (STACK) (Happy_eyeballs)*)
|
||||
|
||||
module Dns = Dns_client_mirage.Make (STACK) (Happy_eyeballs)
|
||||
module Caqti_mirage_connect = Caqti_mirage.Make (STACK) (Dns)
|
||||
|
||||
|
||||
let start assets_ro certificate_ro key_ro tcpv4v6 http_server stack
|
||||
happy_eyeballs pgx_setup =
|
||||
happy_eyeballs _pgx_setup =
|
||||
Logs.set_reporter (Logs_fmt.reporter ());
|
||||
Logs.(set_level (Some Info));
|
||||
let open Lwt.Syntax in
|
||||
(*
|
||||
let pgx = Pgx_mirage.connect (stack, happy_eyeballs) in
|
||||
let module Pgx = (val pgx : Pgx_lwt.S) in
|
||||
let { pgx_database; pgx_port; pgx_hostname; pgx_user; pgx_password } =
|
||||
|
|
@ -295,6 +300,7 @@ struct
|
|||
| false -> Fmt.failwith "Pgx connection failure: connection not alive"
|
||||
| true -> Logs.info (fun m -> m "Pgx connection success")
|
||||
in
|
||||
*)
|
||||
let* assets_res = Assets.assets assets_ro in
|
||||
match assets_res with
|
||||
| Error (`Msg m) -> Fmt.failwith "Assets configuration error: %s." m
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue