talex5 / cuekeeper

Browser-based GTD (TODO list) system. No server needed.
http://roscidus.com/blog/blog/2015/04/28/cuekeeper-gitting-things-done-in-the-browser/
GNU Lesser General Public License v2.1
290 stars 23 forks source link

can't make "server" on Mac #27

Closed bcohen44 closed 4 years ago

bcohen44 commented 4 years ago

I followed all instructions in the README, and on the make server step, I get

one-C02VV5SWHTD6:server bcohen$ make server
make: *** No rule to make target `server'.  Stop.
None-C02VV5SWHTD6:server bcohen$ 
talex5 commented 4 years ago

Are you sure you're in the top-level source code directory? There's certainly a server target in the Makefile: https://github.com/talex5/cuekeeper/blob/master/Makefile#L52

Brian2-Cohen-Bose commented 4 years ago

You were correct, I was not at the top level, But now I get the following:

Generating server key...
[ -d server/conf] || mkdir -p server/conf
/bin/sh: line 0: [: missing `]'
openssl genpkey -out server/conf/server.key -outform PEM -algorithm RSA -pkeyopt rsa_keygen_bits:4096
.....++
...++
>>> Generating server X.509 certificate.
>>> Enter the server's full hostname as the 'Common Name' (e.g. cuekeeper.mynet).
>>> Everything else can be left blank.

You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) []:
State or Province Name (full name) []:
Locality Name (eg, city) []:
Organization Name (eg, company) []:
Organizational Unit Name (eg, section) []:
Common Name (eg, fully qualified host name) []:localhost
Email Address []:
rm -rf _build/static
mkdir _build/static
mkdir: _build: No such file or directory
make: *** [server] Error 1
talex5 commented 4 years ago

Could you try changing the mkdir to mkdir -p? I guess -p is the default on Linux, because it works there.

Brian2-Cohen-Bose commented 4 years ago

I continue the fight 😁. My guess is this is macOS specifics, and folks on Linux don't have to do this (otherwise, it would be in the README). I am on the latest Catalina build. Anyway, I was made to install A LOT of opam packages:

Then, I was told to run:

Then I finally tried make server, and now am presented with the following:

None-C02VV5SWHTD6:cuekeeper-master bcohen$ make server
rm -rf _build/static
mkdir -p _build/static
cp -r resources _build/static/
dune build --profile=release ./js/client.bc.js
File "lib/dune", line 15, characters 7-19:
15 |   (run ocaml-crunch init -o ck_init.ml -m plain)))
            ^^^^^^^^^^^^
Error: Program ocaml-crunch not found in the tree or in PATH
 (context: default)
File "lib/ck_utils.ml", line 70, characters 2-30:
70 |   ReactiveData.RList.make_from init changes
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Unbound value ReactiveData.RList.make_from
make: *** [server] Error 1
None-C02VV5SWHTD6:cuekeeper-master bcohen
talex5 commented 4 years ago

Ah, right - you need to follow the instructions for building the client first Building (without Docker). That should get you those dependencies.

Brian2-Cohen-Bose commented 4 years ago

Created the client successfully.

But for the server, I think we are almost there:

make server
rm -rf _build/static
mkdir -p _build/static
cp -r resources _build/static/
dune build --profile=release ./js/client.bc.js
cp _build/default/js/client.bc.js _build/static/resources/js/cuekeeper.js
sed 's!_build/default/js/client.bc.js!resources/js/cuekeeper.js!;s!var ck_use_server=false;!var ck_use_server=true;!' test.html > _build/static/index.html
ocaml-crunch _build/static -e html -e js -e css -e ico -o server/static.ml -m plain
Generating server/static.ml
Skipping generation of .mli
(cd server && mirage configure -t unix && make depend && make)
/bin/sh: mirage: command not found
make: *** [server] Error 127
talex5 commented 4 years ago

Mirage should have been installed by the opam pin mirage 3.7.3 command just before the make server one (https://github.com/talex5/cuekeeper#running-a-server). Try running that again...

Brian2-Cohen-Bose commented 4 years ago

OK, server is built!

But, I am now getting this when trying to access https://localhost:8443, I am using Chrome.

./server/cuekeeper 
2020-05-04 07:27:37 -04:00: INF [tcpip-stack-socket] Manager: connect
2020-05-04 07:27:37 -04:00: INF [tcpip-stack-socket] Manager: configuring
2020-05-04 07:27:38 -04:00: INF [unikernel] Connection from 127.0.0.1 (client port 57911)
2020-05-04 07:27:38 -04:00: WRN [tcpip-stack-socket] error Mirage_crypto_rng__Boot.Unseeded_generator in callback
2020-05-04 07:27:38 -04:00: INF [unikernel] Connection from 127.0.0.1 (client port 57912)
2020-05-04 07:27:38 -04:00: WRN [tcpip-stack-socket] error Mirage_crypto_rng__Boot.Unseeded_generator in callback
talex5 commented 4 years ago

OK, I think it's fixed now! The new version of tls used a different random number generator, which needed separate initialisation. The latest version should work (you might need to delete the old server/_build directory before make server:

git pull origin master
rm -rf server/_build
make server

Thanks for testing this!

Brian2-Cohen-Bose commented 4 years ago

Yes, server can start!
I went into Mac Keychain Access, added the server.pem, and gave localhost "Always Trust" permissions. And I had used the pwgen and she256 to generate: U9kNFPK2G9OX5p9jCPhiaeNIY5ZEOjtV 774400f3384a6f37cc2bc54b2fd0280193b613a5bc401c0e54fd17fe4ec19572

I added the SHA256 to my devices.ml as instructed.

So when I hit https://localhost:8443, accept the inseure cert, and am prompted for the token, I enterU9kNFPK2G9OX5p9jCPhiaeNIY5ZEOjtV, and the server log says:

TLS failed: CERTIFICATE_UNKNOWN
2020-05-04 10:11:10 -04:00: INF [unikernel] Connection from 127.0.0.1 (client port 65092)
2020-05-04 10:11:10 -04:00: INF [cuekeeper] 1: GET //localhost:8443/resources/js/vendor/FileSaver.min.js
2020-05-04 10:11:10 -04:00: INF [cuekeeper] 2: GET //localhost:8443/resources/css/foundation.css
2020-05-04 10:11:10 -04:00: WRN [unikernel] TLS failed: CERTIFICATE_UNKNOWN
2020-05-04 10:11:10 -04:00: INF [cuekeeper] 1: GET //localhost:8443/resources/js/vendor/pikaday.js
2020-05-04 10:11:10 -04:00: INF [cuekeeper] 3: GET //localhost:8443/resources/js/cuekeeper.js
2020-05-04 10:11:17 -04:00: INF [cuekeeper] 3: GET //localhost:8443/fetch?token=U9kNFPK2G9OX5p9jCPhiaeNIY5ZEOjtV
2020-05-04 10:11:17 -04:00: WRN [unikernel] Invalid access token used (hash = "f347a1efae17e2ad9f918729e4afa2d23d7d00904045f11c8c7cf7b7a803a4db")

For reference:

None-C02VV5SWHTD6:server bcohen$ pwgen -s 32 1
U9kNFPK2G9OX5p9jCPhiaeNIY5ZEOjtV
None-C02VV5SWHTD6:server bcohen$ echo -n dtXZ7fQfX52VsnJNk22J6uKy8JSn6klb | sha256sum
774400f3384a6f37cc2bc54b2fd0280193b613a5bc401c0e54fd17fe4ec19572  -
None-C02VV5SWHTD6:cuekeeper bcohen$ make server
Generating server key...
[ -d server/conf] || mkdir -p server/conf
/bin/sh: line 0: [: missing `]'
openssl genpkey -out server/conf/server.key -outform PEM -algorithm RSA -pkeyopt rsa_keygen_bits:4096
........................................................................................................................................................................................++
....++
>>> Generating server X.509 certificate.
>>> Enter the server's full hostname as the 'Common Name' (e.g. cuekeeper.mynet).
>>> Everything else can be left blank.

You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) []:
State or Province Name (full name) []:
Locality Name (eg, city) []:
Organization Name (eg, company) []:
Organizational Unit Name (eg, section) []:
Common Name (eg, fully qualified host name) []:localhost
Email Address []:
rm -rf _build/static
mkdir -p _build/static
cp -r resources _build/static/
dune build --profile=release ./js/client.bc.js
cp _build/default/js/client.bc.js _build/static/resources/js/cuekeeper.js
sed 's!_build/default/js/client.bc.js!resources/js/cuekeeper.js!;s!var ck_use_server=false;!var ck_use_server=true;!' test.html > _build/static/index.html
ocaml-crunch _build/static -e html -e js -e css -e ico -o server/static.ml -m plain
Generating server/static.ml
Skipping generation of .mli
(cd server && mirage configure -t unix && make depend && make)
opam pin add -k path --no-action --yes mirage-unikernel-cuekeeper-unix . && opam depext --yes --update mirage-unikernel-cuekeeper-unix ; opam pin remove --no-action mirage-unikernel-cuekeeper-unix
Package mirage-unikernel-cuekeeper-unix does not exist, create as a NEW package? [Y/n] y
[mirage-unikernel-cuekeeper-unix.~dev] synchronised from file:///Users/bcohen/dev/cuekeeper/server
[WARNING] Failed checks on mirage-unikernel-cuekeeper-unix package definition from source at file:///Users/bcohen/dev/cuekeeper/server:
  warning 37: Missing field 'dev-repo'
  warning 49: The following URLs don't use version control but look like version control URLs: "https://github.com/talex5/cuekeeper.git#master"
mirage-unikernel-cuekeeper-unix is now pinned to file:///Users/bcohen/dev/cuekeeper/server (version ~dev)
# Detecting depexts using vars: arch=x86_64, os=macos, os-distribution=homebrew, os-family=homebrew
# The following system packages are needed:
gmp
pkg-config
# All required OS packages found.
Ok, mirage-unikernel-cuekeeper-unix is no longer pinned to file:///Users/bcohen/dev/cuekeeper/server (version ~dev)
opam install -y --deps-only .
[WARNING] Failed checks on mirage-unikernel-cuekeeper-unix package definition from source at file:///Users/bcohen/dev/cuekeeper/server:
  warning 37: Missing field 'dev-repo'
  warning 49: The following URLs don't use version control but look like version control URLs: "https://github.com/talex5/cuekeeper.git#master"
Nothing to do.
mirage build
Generating static1.ml
Generating static1.mli
+ ocamlfind ocamlc -c -g -g -bin-annot -safe-string -principal -thread -strict-sequence -w A-4-44-48-3 -package tls -package tcpip.unix -package tcpip.udpv4-socket -package tcpip.tcpv4-socket -package tcpip.stack-socket -package tcpip -package nocrypto.mirage -package nocrypto -package mirage-unix -package mirage-types-lwt -package mirage-types -package mirage-runtime -package mirage-logs -package mirage-kv-mem -package mirage-entropy -package mirage-clock-unix -package mirage-bootvar-unix -package lwt -package irmin-mem -package irmin-git -package irmin -package functoria-runtime -package cohttp-mirage -predicates mirage_unix -w A-4-41-42-44-48 -color always -o key_gen.cmo key_gen.ml
findlib: [WARNING] Interface static.cmi occurs in several directories: ., /Users/bcohen/.opam/4.07.1/lib/cohttp-mirage
+ ocamlfind ocamlc -c -g -g -bin-annot -safe-string -principal -thread -strict-sequence -package tls -package tcpip.unix -package tcpip.udpv4-socket -package tcpip.tcpv4-socket -package tcpip.stack-socket -package tcpip -package nocrypto.mirage -package nocrypto -package mirage-unix -package mirage-types-lwt -package mirage-types -package mirage-runtime -package mirage-logs -package mirage-kv-mem -package mirage-entropy -package mirage-clock-unix -package mirage-bootvar-unix -package lwt -package irmin-mem -package irmin-git -package irmin -package functoria-runtime -package cohttp-mirage -predicates mirage_unix -w A-4-41-42-44-48 -color always -w -32-34 -o static1.cmi static1.mli
findlib: [WARNING] Interface static.cmi occurs in several directories: ., /Users/bcohen/.opam/4.07.1/lib/cohttp-mirage
+ ocamlfind ocamlc -c -g -g -bin-annot -safe-string -principal -thread -strict-sequence -package tls -package tcpip.unix -package tcpip.udpv4-socket -package tcpip.tcpv4-socket -package tcpip.stack-socket -package tcpip -package nocrypto.mirage -package nocrypto -package mirage-unix -package mirage-types-lwt -package mirage-types -package mirage-runtime -package mirage-logs -package mirage-kv-mem -package mirage-entropy -package mirage-clock-unix -package mirage-bootvar-unix -package lwt -package irmin-mem -package irmin-git -package irmin -package functoria-runtime -package cohttp-mirage -predicates mirage_unix -w A-4-41-42-44-48 -color always -o main.cmo main.ml
findlib: [WARNING] Interface static.cmi occurs in several directories: ., /Users/bcohen/.opam/4.07.1/lib/cohttp-mirage
+ ocamlfind ocamlopt -c -g -g -bin-annot -safe-string -principal -thread -strict-sequence -w A-4-44-48-3 -package tls -package tcpip.unix -package tcpip.udpv4-socket -package tcpip.tcpv4-socket -package tcpip.stack-socket -package tcpip -package nocrypto.mirage -package nocrypto -package mirage-unix -package mirage-types-lwt -package mirage-types -package mirage-runtime -package mirage-logs -package mirage-kv-mem -package mirage-entropy -package mirage-clock-unix -package mirage-bootvar-unix -package lwt -package irmin-mem -package irmin-git -package irmin -package functoria-runtime -package cohttp-mirage -predicates mirage_unix -w A-4-41-42-44-48 -color always -w -32-34 -o static.cmx static.ml
findlib: [WARNING] Interface static.cmi occurs in several directories: ., /Users/bcohen/.opam/4.07.1/lib/cohttp-mirage
+ ocamlfind ocamlopt -c -g -g -bin-annot -safe-string -principal -thread -strict-sequence -w A-4-44-48-3 -package tls -package tcpip.unix -package tcpip.udpv4-socket -package tcpip.tcpv4-socket -package tcpip.stack-socket -package tcpip -package nocrypto.mirage -package nocrypto -package mirage-unix -package mirage-types-lwt -package mirage-types -package mirage-runtime -package mirage-logs -package mirage-kv-mem -package mirage-entropy -package mirage-clock-unix -package mirage-bootvar-unix -package lwt -package irmin-mem -package irmin-git -package irmin -package functoria-runtime -package cohttp-mirage -predicates mirage_unix -w A-4-41-42-44-48 -color always -o key_gen.cmx key_gen.ml
findlib: [WARNING] Interface static.cmi occurs in several directories: ., /Users/bcohen/.opam/4.07.1/lib/cohttp-mirage
+ ocamlfind ocamlopt -c -g -g -bin-annot -safe-string -principal -thread -strict-sequence -package tls -package tcpip.unix -package tcpip.udpv4-socket -package tcpip.tcpv4-socket -package tcpip.stack-socket -package tcpip -package nocrypto.mirage -package nocrypto -package mirage-unix -package mirage-types-lwt -package mirage-types -package mirage-runtime -package mirage-logs -package mirage-kv-mem -package mirage-entropy -package mirage-clock-unix -package mirage-bootvar-unix -package lwt -package irmin-mem -package irmin-git -package irmin -package functoria-runtime -package cohttp-mirage -predicates mirage_unix -w A-4-41-42-44-48 -color always -w -32-34 -o static1.cmx static1.ml
findlib: [WARNING] Interface static.cmi occurs in several directories: ., /Users/bcohen/.opam/4.07.1/lib/cohttp-mirage
+ ocamlfind ocamlopt -c -g -g -bin-annot -safe-string -principal -thread -strict-sequence -package tls -package tcpip.unix -package tcpip.udpv4-socket -package tcpip.tcpv4-socket -package tcpip.stack-socket -package tcpip -package nocrypto.mirage -package nocrypto -package mirage-unix -package mirage-types-lwt -package mirage-types -package mirage-runtime -package mirage-logs -package mirage-kv-mem -package mirage-entropy -package mirage-clock-unix -package mirage-bootvar-unix -package lwt -package irmin-mem -package irmin-git -package irmin -package functoria-runtime -package cohttp-mirage -predicates mirage_unix -w A-4-41-42-44-48 -color always -o main.cmx main.ml
findlib: [WARNING] Interface static.cmi occurs in several directories: ., /Users/bcohen/.opam/4.07.1/lib/cohttp-mirage
+ ocamlfind ocamlopt -g -linkpkg -g -thread -package tls -package tcpip.unix -package tcpip.udpv4-socket -package tcpip.tcpv4-socket -package tcpip.stack-socket -package tcpip -package nocrypto.mirage -package nocrypto -package mirage-unix -package mirage-types-lwt -package mirage-types -package mirage-runtime -package mirage-logs -package mirage-kv-mem -package mirage-entropy -package mirage-clock-unix -package mirage-bootvar-unix -package lwt -package irmin-mem -package irmin-git -package irmin -package functoria-runtime -package cohttp-mirage -predicates mirage_unix devices.cmx key_gen.cmx static.cmx server.cmx static1.cmx unikernel.cmx main.cmx -o main.native
findlib: [WARNING] Interface static.cmi occurs in several directories: ., /Users/bcohen/.opam/4.07.1/lib/cohttp-mirage
ld: warning: directory not found for option '-L/opt/local/lib'
None-C02VV5SWHTD6:cuekeeper bcohen$ 
talex5 commented 4 years ago

The thing you put into echo -n should be your password (that you just generated), not the example one in the README.

Brian2-Cohen-Bose commented 4 years ago

Doohhh.... my bad, copy and paste error.

All set, server is up with the "Sync" button.

Thanks for all your assistance.