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
|
-include Makefile.user
|
||||||
BUILD_DIR = unikernel/
|
BUILD_DIR = unikernel/
|
||||||
|
|
|
||||||
11
README.md
11
README.md
|
|
@ -3,14 +3,9 @@
|
||||||
|
|
||||||
build steps:
|
build steps:
|
||||||
|
|
||||||
$ mirage configure -f unikernel/config.ml -t unix
|
gen_tls.sh foo
|
||||||
$ gen_tls.sh foo
|
|
||||||
$ make
|
mirage configure -f unikernel/config.ml -t unix && make
|
||||||
|
|
||||||
run:
|
run:
|
||||||
./unikernel/dist/mte --pg-database taler-exchange --pg-port 5432 --pg-hostname localhost --pg-user mte --pg-password xxx
|
./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)
|
(implicit_transitive_deps true)
|
||||||
|
|
||||||
;; Generated by mirage.v4.10.1
|
;; Generated by mirage.v4.10.3
|
||||||
|
|
|
||||||
|
|
@ -2,4 +2,4 @@
|
||||||
|
|
||||||
(context (default))
|
(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 =
|
let packages =
|
||||||
[
|
[
|
||||||
package "digestif"; package ~min:"0.0.9" "mimic-happy-eyeballs";
|
package ~min:"0.0.9" "mimic-happy-eyeballs"; package ~min:"0.13.0" "h2";
|
||||||
package "hxd" ~sublibs:[ "core"; "string" ]; package "rresult";
|
package "logs"; package "mirage-logs";
|
||||||
package ~min:"0.13.0" "h2"; package ~min:"10.0.0" "dns-client";
|
package "rresult";
|
||||||
package "pgx"; package "pgx_lwt"; package "pgx_lwt_mirage"; package "logs";
|
|
||||||
package "mirage-logs"; package "conduit"; package "duration";
|
|
||||||
]
|
]
|
||||||
|
(*
|
||||||
|
@ [
|
||||||
|
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 =
|
let mte =
|
||||||
main "Unikernel.Make" ~local_libs:[ "mte" ] ~packages
|
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)
|
(include dune.build)
|
||||||
|
|
|
||||||
|
|
@ -76,8 +76,6 @@ module Make
|
||||||
with type stack = STACK.t
|
with type stack = STACK.t
|
||||||
and type flow = STACK.TCP.flow) =
|
and type flow = STACK.TCP.flow) =
|
||||||
struct
|
struct
|
||||||
module Pgx_mirage = Pgx_lwt_mirage.Make (STACK) (Happy_eyeballs)
|
|
||||||
|
|
||||||
let map_err_to_string pp_err res =
|
let map_err_to_string pp_err res =
|
||||||
Lwt.map (R.reword_error (R.msgf "%a" 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
|
let (`Initialized th) = Paf.serve http_1_1_service http_server in
|
||||||
th
|
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
|
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_reporter (Logs_fmt.reporter ());
|
||||||
Logs.(set_level (Some Info));
|
Logs.(set_level (Some Info));
|
||||||
let open Lwt.Syntax in
|
let open Lwt.Syntax in
|
||||||
|
(*
|
||||||
let pgx = Pgx_mirage.connect (stack, happy_eyeballs) in
|
let pgx = Pgx_mirage.connect (stack, happy_eyeballs) in
|
||||||
let module Pgx = (val pgx : Pgx_lwt.S) in
|
let module Pgx = (val pgx : Pgx_lwt.S) in
|
||||||
let { pgx_database; pgx_port; pgx_hostname; pgx_user; pgx_password } =
|
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"
|
| false -> Fmt.failwith "Pgx connection failure: connection not alive"
|
||||||
| true -> Logs.info (fun m -> m "Pgx connection success")
|
| true -> Logs.info (fun m -> m "Pgx connection success")
|
||||||
in
|
in
|
||||||
|
*)
|
||||||
let* assets_res = Assets.assets assets_ro in
|
let* assets_res = Assets.assets assets_ro in
|
||||||
match assets_res with
|
match assets_res with
|
||||||
| Error (`Msg m) -> Fmt.failwith "Assets configuration error: %s." m
|
| Error (`Msg m) -> Fmt.failwith "Assets configuration error: %s." m
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue