channable / hoff

A gatekeeper for your commits
Apache License 2.0
41 stars 3 forks source link

Lots of issues with the install and run process #153

Open ghost opened 2 years ago

ghost commented 2 years ago

i've been trying to install hoff on my own server, but have run into several issues. Hold onto your sock, sandals, shoes or any combination thereof, because this is gonna be a long one, with a lot of logs

but following the instructions here don't seem to work properly for me.

using nix version: nix (Nix) 2.10.3 OS: Archlinux

  1. trying to get into a nix shell:

    $ nix run -c $SHELL
    error: unrecognised flag '-c'
    Try 'nix --help' for more information.

    it does work with nix-shell --run $SHELL

  2. when trying to build the binary, i get this error:

    $ ./build-binary.sh
    ./build-binary.sh: line 10: stack: command not found

    was fixed with nix-env -i stack

  3. once that ran, this is an error that seems to generally haunt me:

    warning: Nix search path entry './nixpkgs-pinned.nix' does not exist, ignoring
  4. when running first time, i got this error:

    
    Warning: haddock-interfaces: /nix/store/bxw7wb0l4zh62kkica0lf53nl9v9hmlb-fail-4.9.0.0/share/doc/x86_64-linux-ghc-8.10.4/fail-4.9.0.0/html/fail.haddock doesn't exist or isn't a file
    Warning: haddock-html: /nix/store/bxw7wb0l4zh62kkica0lf53nl9v9hmlb-fail-4.9.0.0/share/doc/x86_64-linux-ghc-8.10.4/fail-4.9.0.0/html doesn't exist or isn't a directory
    Warning: haddock-interfaces: /nix/store/9jlapk6k95spkijllf5nb99c75vcg7i5-nats-1.1.2/share/doc/x86_64-linux-ghc-8.10.4/nats-1.1.2/html/nats.haddock doesn't exist or isn't a file
    Warning: haddock-html: /nix/store/9jlapk6k95spkijllf5nb99c75vcg7i5-nats-1.1.2/share/doc/x86_64-linux-ghc-8.10.4/nats-1.1.2/html doesn't exist or isn't a directory
    stack will use the GHC on your PATH
    For more information on paths, see 'stack path' and 'stack exec env'
    To use this GHC and packages outside of a project, consider using:
    stack ghc, stack ghci, stack runghc, or stack exec
    warning: Nix search path entry './nixpkgs-pinned.nix' does not exist, ignoring
    Building with --split-objs is enabled. Note that this feature is EXPERIMENTAL, and its behavior may be changed and improved. You will need to clean your workdirs before use. If you want to compile all dependencies with split-objs, you will need to delete the snapshot (and all snapshots that could reference that snapshot).
    [1 of 2] Compiling Main             ( /home/minecraft/.stack/setup-exe-src/setup-mPHDZzAJ.hs, /home/minecraft/.stack/setup-exe-src/setup-mPHDZzAJ.o )
    [2 of 2] Compiling StackSetupShim   ( /home/minecraft/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs, /home/minecraft/.stack/setup-exe-src/setup-shim-mPHDZzAJ.o )
    Linking /home/minecraft/.stack/setup-exe-cache/x86_64-linux-nix/tmp-Cabal-simple_mPHDZzAJ_3.2.1.0_ghc-8.10.4 ...
    Building all executables for `hoff' once. After a successful build of all of them, only specified executables will be rebuilt.
    hoff> configure (lib + exe)
    Configuring hoff-0.26.2...
    hoff> build (lib + exe)
    Preprocessing library for hoff-0.26.2..
    Building library for hoff-0.26.2..

on the commandline: error: [-Werror] ignoring -split-objs

-- While building package hoff-0.26.2 (scroll up to its section to see the error) using: /home/minecraft/.stack/setup-exe-cache/x86_64-linux-nix/Cabal-simple_mPHDZzAJ_3.2.1.0_ghc-8.10.4 --builddir=.stack-work/dist/x86_64-linux-nix/Cabal-3.2.1.0 build lib:hoff exe:hoff --ghc-options " -fdiagnostics-color=always" Process exited with code: ExitFailure 1

i fixed that by removing the `--split-objs` flags present in `package/build-binary.sh`
then it built the binary properly, yay

5. but then when trying to run it with the following config:
```json
{
  "projects": [{
    "owner": "OpenThingies",
    "repository": "OpenMoodServer",
    "branch": "mistress",
    "testBranch": "testing",
    "checkout": "/var/lib/hoff/checkouts/OpenThingies/OpenMoodServer",
    "stateFile": "/var/lib/hoff/state/OpenThingies/OpenMoodServer.json"
  }],
  "secret": "*******************",
  "accessToken": "*********************",
  "port": 1979,
  "tls": null,
  "user": {
    "name": "Operator-9O",
    "email": "hoff@openthingies.com",
    "sshConfigFile": "/etc/hoff/ssh_config"
  },
  "mergeWindowExemption": ["hoffbot"],
  "trigger": {
    "commentPrefix": "@Operator-9O"
  }
}

i get the following error (and it stops running:

Config file: /etc/hoff/config.json
Read-only: False
File '/var/lib/hoff/state/OpenThingies/OpenMoodServer.json' not found, starting with an empty state.
[Info] executing git clone --config transfer.fsckObjects=true --config user.name=Operator-9O --config user.email=hoff@openthingies.com git@github.com:OpenThingies/OpenMoodServer.git /var/lib/hoff/checkouts/OpenThingies/OpenMoodServer
Listening for webhooks on port 1979.
[Warn] git clone failed. Reason: fatal: could not create leading directories of '/var/lib/hoff/checkouts/OpenThingies/OpenMoodServer': Permission denied

[Info] executing git clone --config transfer.fsckObjects=true --config user.name=Operator-9O --config user.email=hoff@openthingies.com git@github.com:OpenThingies/OpenMoodServer.git /var/lib/hoff/checkouts/OpenThingies/OpenMoodServer
[Warn] git clone failed. Reason: fatal: could not create leading directories of '/var/lib/hoff/checkouts/OpenThingies/OpenMoodServer': Permission denied

[Info] executing git clone --config transfer.fsckObjects=true --config user.name=Operator-9O --config user.email=hoff@openthingies.com git@github.com:OpenThingies/OpenMoodServer.git /var/lib/hoff/checkouts/OpenThingies/OpenMoodServer
[Warn] git clone failed. Reason: fatal: could not create leading directories of '/var/lib/hoff/checkouts/OpenThingies/OpenMoodServer': Permission denied

[Info] logic loop received event: Synchronize
[Debug] state before: ProjectState {pullRequests = fromList [], pullRequestApprovalIndex = 0}
[Debug] Getting open pull request in OpenThingies/OpenMoodServer.
[Debug] Got 1 open pull requests in OpenThingies/OpenMoodServer.
[Debug] Getting pull request 3 in OpenThingies/OpenMoodServer.
hoff: /var/lib/hoff/state/OpenThingies/OpenMoodServer.json.new: openBinaryFile: does not exist (No such file or directory)

i wonder how many people outside of @channable had this issue. I've been going up and down in the repo, trying to see where i went wrong (other than using arch on a server), but i cannot find further info, so i thought i'd leave an issue.

ruuda commented 2 years ago
$ nix run -c $SHELL
error: unrecognised flag '-c'
Try 'nix --help' for more information.

This subcommand was present in Nix 2.3, but later versions of Nix made breaking changes to it. You can get the installer for 2.3 here, or if you have any other version of Nix already, you can also

nix-store --realise /nix/store/9hkh1fx8z1frgbz2nawr0mnyvizrb8yk-nix-2.3.15

and then use bin/nix from inside there. (This is the store path for x64 Linux.) Then nix run --command $SHELL should work, and that should solve the issue of Stack not being found.

[Warn] git clone failed. Reason: fatal: could not create leading directories of '/var/lib/hoff/checkouts/OpenThingies/OpenMoodServer': Permission denied
...
hoff: /var/lib/hoff/state/OpenThingies/OpenMoodServer.json.new: openBinaryFile: does not exist (No such file or directory)

Do /var/lib/hoff/checkouts and /var/lib/hoff/state exist, and does the user that you are running Hoff as have write permission in these directories? (I suspect the “no such file or directory” error in the second message is not about the .json.new file, which it tries to create, but about the parent directory.)

ghost commented 2 years ago

to avoid confusion: that @Dragonsight91 up there is my private account here's an overview of /var/lib/hoff this is after fixing the nix issue, that worked, thanks for that

total 8.0K
drwxr-xr-x 3 hoff hoff 4.0K Aug  9 10:42 checkouts
drwxr-xr-x 2 hoff hoff 4.0K Aug  8 17:28 state

both exist and it was able to write the repository to /var/lib/hoff/checkouts

/var/lib/hoff/checkouts:
total 4.0K
drwxr-xr-x 3 hoff hoff 4.0K Aug  9 10:42 OpenThingies

/var/lib/hoff/state:
total 0

oh and i found another issue, when trying to build a package:

$ VERSION=0.0.1 fakeroot ./build-package.sh 
stack: /nix/store/nprym6lf8lzhp1irb42lb4vp8069l5rj-glibc-2.32-54/lib/libc.so.6: version `GLIBC_2.34' not found (required by /usr/lib/libfakeroot/libfakeroot.so)