primal-caching-service icon indicating copy to clipboard operation
primal-caching-service copied to clipboard

Issue while compiling

Open Darecjo opened this issue 1 year ago • 13 comments

I'm having the following error is there any solution for it. I'm not familiar with nix.

~/primal-caching-service# nix --extra-experimental-features 'nix-command flakes' develop -c sh -c '$start_primal_caching_service'
make: *** No targets specified and no makefile found.  Stop.
ERROR: SystemError: opening file "/pkg.jl": No such file or directory
Stacktrace:
  [1] systemerror(p::String, errno::Int32; extrainfo::Nothing)
    @ Base ./error.jl:176
  [2] #systemerror#80
    @ ./error.jl:175 [inlined]
  [3] systemerror
    @ ./error.jl:175 [inlined]
  [4] open(fname::String; lock::Bool, read::Nothing, write::Nothing, create::Nothing, truncate::Nothing, append::Nothing)
    @ Base ./iostream.jl:293
  [5] open
    @ ./iostream.jl:275 [inlined]
  [6] open(f::Base.var"#387#388"{String}, args::String; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Base ./io.jl:382
  [7] open
    @ ./io.jl:381 [inlined]
  [8] read
    @ ./io.jl:462 [inlined]
  [9] _include(mapexpr::Function, mod::Module, _path::String)
    @ Base ./loading.jl:1484
 [10] include
    @ ./Base.jl:419 [inlined]
 [11] exec_options(opts::Base.JLOptions)
    @ Base ./client.jl:283
 [12] _start()
    @ Base ./client.jl:522

Darecjo avatar Dec 19 '23 10:12 Darecjo

does this work for you?

git clone --recurse-submodules https://github.com/PrimalHQ/primal-caching-service
cd primal-caching-service
nix --extra-experimental-features 'nix-command flakes' run github:NixOS/nixpkgs/23.11#nix -- develop -c sh -c '$start_primal_caching_service'

pritk avatar Dec 19 '23 13:12 pritk

nop this is exactly what i tried except for the github:NixOS/nixpkgs/23.11#nix, I will check and let you know, moreover the docker version works fine. I'm trying to run it on an ec2 instance and I'm facing difficulties with it no clue why. Ps: the docker version works fine and caching, however I can't access the instance via wss connection. It would be great if there is a brief guideline for the process, because this service is truly valuable.

Darecjo avatar Dec 19 '23 15:12 Darecjo

its saying the nix-command is disabled even tho the flag is inserted.

root@vultr:~# git clone --recurse-submodules https://github.com/PrimalHQ/primal-caching-service
cd primal-caching-service
nix --extra-experimental-features 'nix-command flakes' run github:NixOS/nixpkgs/23.11#nix -- develop -c sh -c '$start_primal_caching_service'
Cloning into 'primal-caching-service'...
remote: Enumerating objects: 444, done.
remote: Counting objects: 100% (35/35), done.
remote: Compressing objects: 100% (19/19), done.
remote: Total 444 (delta 20), reused 18 (delta 16), pack-reused 409
Receiving objects: 100% (444/444), 143.38 KiB | 3.33 MiB/s, done.
Resolving deltas: 100% (293/293), done.
Submodule 'bech32' (https://github.com/sipa/bech32) registered for path 'bech32'
Submodule 'dev/HTTP.jl' (https://github.com/PrimalHQ/HTTP.jl) registered for path 'dev/HTTP.jl'
Cloning into '/root/primal-caching-service/bech32'...
remote: Enumerating objects: 340, done.        
remote: Counting objects: 100% (72/72), done.        
remote: Compressing objects: 100% (49/49), done.        
remote: Total 340 (delta 25), reused 51 (delta 20), pack-reused 268        
Receiving objects: 100% (340/340), 184.50 KiB | 6.59 MiB/s, done.
Resolving deltas: 100% (158/158), done.
Cloning into '/root/primal-caching-service/dev/HTTP.jl'...
remote: Enumerating objects: 11118, done.        
remote: Counting objects: 100% (11118/11118), done.        
remote: Compressing objects: 100% (3309/3309), done.        
remote: Total 11118 (delta 7459), reused 11019 (delta 7422), pack-reused 0        
Receiving objects: 100% (11118/11118), 3.12 MiB | 3.17 MiB/s, done.
Resolving deltas: 100% (7459/7459), done.
Submodule path 'bech32': checked out '7a7d7ab158db7078a333384e0e918c90dbc42917'
Submodule path 'dev/HTTP.jl': checked out 'a80909424ec7e6ff016df91d6df208cdbcb3a7b2'
error: experimental Nix feature 'nix-command' is disabled; use '--extra-experimental-features nix-command' to override

Darecjo avatar Dec 20 '23 03:12 Darecjo

what about this?

nix --extra-experimental-features 'nix-command flakes' run github:NixOS/nixpkgs/23.11#nix -- --extra-experimental-features 'nix-command flakes' develop -c sh -c '$start_primal_caching_service'

pritk avatar Dec 20 '23 13:12 pritk

Couldn't find flake.nix

/home/ubuntu/primal-caching-service# nix --extra-experimental-features 'nix-command flakes' run github:NixOS/nixpkgs/23.11#nix -- --extra-experimental-features 'nix-command flakes' develop -c sh -c '$start_primal_caching_service'
path '/' does not contain a 'flake.nix', searching up
error: could not find a flake.nix file

removed the 23.11# part now having this

/home/ubuntu/primal-caching-service# nix --extra-experimental-features 'nix-command flakes' run github:NixOS/nixpkgs/ nix -- --extra-experimental-features 'nix-command flakes' develop -c sh -c '$start_primal_caching_service'
error: cannot find flake attribute 'github:NixOS/nixpkgs#defaultApp.x86_64-linux'

it turns out the problem was with the nix itself I managed to get it up and running using this: curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install Ps: The latest command is the one I used.

Darecjo avatar Dec 21 '23 05:12 Darecjo

Is there any proper configuration for nginx for the cache I can find anywhere?

Darecjo avatar Dec 21 '23 05:12 Darecjo

I managed to run properly, however i strongly introduce providing a step-by-step guidance most people are not familiar with the setting up.

Thanks a lot @pritk I appreciate the overall guidance.

Darecjo avatar Dec 21 '23 06:12 Darecjo

Is there any proper configuration for nginx for the cache I can find anywhere?

we are using nixos module for nginx for configuration. if you are on the same distro or are interested in that form i can share here some parts of our system configuration related to nginx.

pritk avatar Dec 21 '23 22:12 pritk

that would be great yeah.

Darecjo avatar Dec 23 '23 05:12 Darecjo

Is there any example on how to import a .jsonl events file directly to the cache using the import_events function?

Darecjo avatar Dec 29 '23 12:12 Darecjo

i am running in a docker container true the following bash script: #!/bin/bash

#full git path /mnt/Containers/Nostr/Primal/primal-web-app/ Path=/mnt/bigpart/Docker_files/Nostr/Primal-Cache

cd $Path/primal-caching-service git pull

docker stop Primal-Cache docker rm Primal-Cache #docker rmi primal

#docker build --no-cache -t primal .

docker run -d -it
--name Primal-Cache
-v $Path/primal-caching-service:pwd
-w pwd
-p 8801:8801
-e PRIMALSERVER_HOST=0.0.0.0
nixos/nix nix --extra-experimental-features 'nix-command flakes' develop -c sh -c '$start_primal_caching_service' \

:/mnt/bigpart/Docker_files/Nostr/Primal-Cache # docker logs Primal-Cache -f warning: updating lock file '/mnt/bigpart/Docker_files/Nostr/Primal-Cache/primal-caching-service/flake.lock': • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/49b373958553f8b7fea8795b7bb4ede86057488c?narHash=sha256-ZvK5gZ9jtF%2BQK5VZokjqQ6y2at3WQjoXWkWQLaPWr2c%3D' (2023-05-10) → 'github:NixOS/nixpkgs/d272ca50d1f7424fbfcd1e6f1c9e01d92f6da167?narHash=sha256-y31s5idk3jMJMAVE4Ud9AdI7HT3CgTAeMTJ0StqKN7Y%3D' (2024-04-08) warning: Git tree '/mnt/bigpart/Docker_files/Nostr/Primal-Cache/primal-caching-service' is dirty gcc -shared -g -fPIC -O2 -o libbech32.so -Ibech32/ref/c bech32.c bech32.c:5:10: fatal error: segwit_addr.c: No such file or directory 5 | #include "segwit_addr.c" | ^~~~~~~~~~~~~~~ compilation terminated. make: *** [Makefile:2: libbech32.so] Error 1 . . . . . Precompiling project... 82 dependencies successfully precompiled in 119 seconds 1 dependency errored. To see a full report either run import Pkg; Pkg.precompile() or load the package 0 dependencies successfully precompiled in 0 seconds. 82 already precompiled.

now i am stuck is it my?

trijenhout avatar Apr 10 '24 16:04 trijenhout

did you clone git submodules too?

pritk avatar Apr 10 '24 20:04 pritk

did you clone git submodules too?

Thanks that did the trick (never heard about submods)

trijenhout avatar Apr 11 '24 17:04 trijenhout