[How-To] Cardigann compiling (Jackett alternative for Sonarr)

Status
Not open for further replies.

vinchi007

Dabbler
Joined
Mar 3, 2016
Messages
11
Building Cardigann which is coded in Go Lang was tricky. Here are the steps you need to follow if you want to setup in your Jail on FreeNAS (FreeBSD). Personally, I have it setup in my Transmission jail.

  1. First, you need to install GO Lang if you dont have it already in your Jail:
    Code:
    pkg install go
    
  2. Verify that GO is installed
    Code:
    go version
    go version go1.7.4 freebsd/amd64
    

  3. Very important! Determine your GO PATH, where you will pull repositories, compile, etc. You can setup your path in any location, but remember all Go packages will go there. I setup mine in /usr/local/etc/cardigann
    Code:
    Create PATH directory
    mkdir -p /usr/local/etc/cardigann
    
    Export this location for your GO to use
    setenv GOPATH /usr/local/etc/cardigann
    
    Export BIN location for your GO where all of the compiled binaries will be stored
    setenv GOBIN /usr/local/etc/cardigann/bin
    

  4. Get all of the packages required by Kardigann
    Code:
    go get github.com/Sirupsen/logrus
    go get github.com/cardigann/cardigann
    go get gopkg.in/alecthomas/kingpin.v2
    go get github.com/equinox-io/equinox
    go get github.com/kardianos/service
    


    Note: All packages downloaded by 'go get <name>' will be stored in 'src' directory in GOPATH location. All these packages you will find in /usr/local/etc/cardigann/src/<location> (example: /usr/local/etc/cardigann/src/github.com/Sirupsen/logrus)
  5. Setup Environments for XDG-GO package () so it compiles correctly.
    Code:
    mkdir -p /var/db/cardigann/data
    mkdir -p /var/db/cardigann/config
    
    setenv XDG_CONFIG_HOME /var/db/cardigann
    setenv XDG_DATA_HOME /var/db/cardigann
    setenv XDG_CACHE_HOME /var/db/cardigann
    setenv XDG_DATA_DIRS /var/db/cardigann/data
    setenv XDG_CONFIG_DIRS /var/db/cardigann/config
    


    [OPTIONAL] Alternatively you can let XDG-GO use a default location (users $HOME path) but XDG-GO does not have "freebsd" logic. You can create it yourself, by copying a linux version
    Code:
    cd /usr/local/etc/cardigann/src/github.com/cardigann/cardigann/vendor/github.com/casimir/xdg-go
    cp -p xdg_linux.go xdg_freebsd.go
    
    Now you should have 'xdg_freebsd.go' file which will be used by xdg.go when identifying your OS (`go env|grep GOOS`  --> "freebsd")
    
    ls
    -rw-r--r--  1 root  wheel  1080 Jan 13 11:04 LICENSE
    -rw-r--r--  1 root  wheel  2703 Jan 13 11:04 README.md
    -rw-r--r--  1 root  wheel   412 Jan 13 11:04 xdg_darwin.go
    -rw-r--r--  1 root  wheel   518 Jan 13 11:04 xdg_linux.go
    -rw-r--r--  1 root  wheel   390 Jan 13 11:04 xdg_windows.go
    -rw-r--r--  1 root  wheel  2491 Jan 13 12:10 xdg.go
    -rw-r--r--  1 root  wheel   518 Jan 13 12:14 xdg_freebsd.go
    

  6. Ready to compile. Very important: navigate to the directory where cardigann source was downloaded by go get command.
    Code:
    cd /usr/local/etc/cardigann/src/github.com/cardigann/cardigann
    make
    make build
    make install
    


    You will find your cardigann binary in your GOBIN location (/usr/local/etc/cardigann/bin)

Good luck!
It took me few hours to figure this out since I do not know GO Lang.

Regards,
vinchi007
 

IronRobi

Explorer
Joined
Apr 15, 2016
Messages
52
Worked like a charm!

Created an rc.d script in /etc/rc.d

Code:
#!/bin/sh
#
# $FreeBSD$
#

. /etc/rc.subr

name="cardigann"
rcvar="cardigann_enable"

command="/usr/local/etc/cardigann/bin/cardigann"
command_args="server"

load_rc_config $name
run_rc_command "$1"


then added

Code:
cardigann_enable="YES"


to rc.conf

Starts up automatically with the server :D
 
Last edited:

noobi3

Dabbler
Joined
May 2, 2014
Messages
24
When i run

Code:
go get github.com/cardigann/cardigann



I get
Code:
# github.com/cardigann/cardigann/vendor/github.com/casimir/xdg-go
etc/cardigann/src/github.com/cardigann/cardigann/vendor/github.com/casimir/xdg-go/xdg.go:25: undefined: DataHome
etc/cardigann/src/github.com/cardigann/cardigann/vendor/github.com/casimir/xdg-go/xdg.go:30: undefined: ConfigHome
etc/cardigann/src/github.com/cardigann/cardigann/vendor/github.com/casimir/xdg-go/xdg.go:35: undefined: CacheHome
etc/cardigann/src/github.com/cardigann/cardigann/vendor/github.com/casimir/xdg-go/xdg.go:55: undefined: DataDirs
etc/cardigann/src/github.com/cardigann/cardigann/vendor/github.com/casimir/xdg-go/xdg.go:60: undefined: ConfigDirs


Can you pls help
 

moosethemucha

Dabbler
Joined
Feb 25, 2017
Messages
33
Im still working through the install but you need to set the XDG stuff before installing the packages. You can see it through out the file


/usr/local/etc/cardigann/
etc/cardigann/src/github.com/cardigann/cardigann/vendor/github.com/casimir/xdg-go/xdg.go


Assuming you set the same path, just open it with vi

Check out that file you can see it has heaps of references to those PATH variables. As you can tell Im no Go programmer. Im still having problems building - working through them.

@vinchi007 when you say your transmission jail do you mean your own custom Transmission jail or the plugin Jail. If it is custom how was it set up. Cheers, I've only tried this in a fresh Jail.
 

Musabi

Cadet
Joined
Feb 8, 2017
Messages
7
Im still working through the install but you need to set the XDG stuff before installing the packages. You can see it through out the file


/usr/local/etc/cardigann/
etc/cardigann/src/github.com/cardigann/cardigann/vendor/github.com/casimir/xdg-go/xdg.go


Assuming you set the same path, just open it with vi

Check out that file you can see it has heaps of references to those PATH variables. As you can tell Im no Go programmer. Im still having problems building - working through them.

@vinchi007 when you say your transmission jail do you mean your own custom Transmission jail or the plugin Jail. If it is custom how was it set up. Cheers, I've only tried this in a fresh Jail.

Hi moosethemuncha,

You mentioned in your post to do the XDG stuff before installing the packages, did you just mean this part:

Code:
mkdir -p /var/db/cardigann/data
mkdir -p /var/db/cardigann/config

setenv XDG_CONFIG_HOME /var/db/cardigann
setenv XDG_DATA_HOME /var/db/cardigann
setenv XDG_CACHE_HOME /var/db/cardigann
setenv XDG_DATA_DIRS /var/db/cardigann/data
setenv XDG_CONFIG_DIRS /var/db/cardigann/config


or did you also mean this:

Code:
cd /usr/local/etc/cardigann/src/github.com/cardigann/cardigann/vendor/github.com/casimir/xdg-go
cp -p xdg_linux.go xdg_freebsd.go


I did the first part of the code I copied before I installed the packages and tried it and had the same error as noobi3 did, so I started again and tried to do both the first part of the code I linked and the second part as well but since
Code:
go get github.com/cardigann/cardigann

hasn't been run yet it doesn't have the proper folders created for it.

I even started over with a new jail and followed the readme.md of the Cardigann git to no avail https://github.com/cardigann/cardigann/blob/master/README.md

How did you eventually get it to work?

Thanks :)
 

vinchi007

Dabbler
Joined
Mar 3, 2016
Messages
11
Im still working through the install but you need to set the XDG stuff before installing the packages. You can see it through out the file


/usr/local/etc/cardigann/
etc/cardigann/src/github.com/cardigann/cardigann/vendor/github.com/casimir/xdg-go/xdg.go


Assuming you set the same path, just open it with vi

Check out that file you can see it has heaps of references to those PATH variables. As you can tell Im no Go programmer. Im still having problems building - working through them.

@vinchi007 when you say your transmission jail do you mean your own custom Transmission jail or the plugin Jail. If it is custom how was it set up. Cheers, I've only tried this in a fresh Jail.

I installed Cardigann in Transmission plugin Jail.
 

dracozny

Dabbler
Joined
May 31, 2017
Messages
10
I think I am missing a requirement that is not listed in the ops instructions

Code:
root@rtorrent:/usr/local/etc/cardigann/src/github.com/cardigann/cardigann # make
cd web; npm run build

> cardigann@0.0.1 build /usr/local/etc/cardigann/src/github.com/cardigann/cardigann/web
> react-scripts build

react-scripts: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! cardigann@0.0.1 build: `react-scripts build`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the cardigann@0.0.1 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!	 /root/.npm/_logs/2017-11-07T04_44_42_658Z-debug.log
*** Error code 1

Stop.


Code:
cat /root/.npm/_logs/2017-11-07T05_19_55_770Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'build' ]
2 info using npm@5.4.2
3 info using node@v8.8.1
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle cardigann@0.0.1~prebuild: cardigann@0.0.1
6 info lifecycle cardigann@0.0.1~build: cardigann@0.0.1
7 verbose lifecycle cardigann@0.0.1~build: unsafe-perm in lifecycle true
8 verbose lifecycle cardigann@0.0.1~build: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/usr/local/etc/cardigann/src/github.com/cardigann/cardigann/web/node_modules/.bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/root/bin
9 verbose lifecycle cardigann@0.0.1~build: CWD: /usr/local/etc/cardigann/src/github.com/cardigann/cardigann/web
10 silly lifecycle cardigann@0.0.1~build: Args: [ '-c', 'react-scripts build' ]
11 info lifecycle cardigann@0.0.1~build: Failed to exec build script
12 verbose stack Error: cardigann@0.0.1 build: `react-scripts build`
12 verbose stack spawn ENOENT
12 verbose stack	 at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:48:18)
12 verbose stack	 at emitTwo (events.js:125:13)
12 verbose stack	 at ChildProcess.emit (events.js:213:7)
12 verbose stack	 at maybeClose (internal/child_process.js:927:16)
12 verbose stack	 at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
13 verbose pkgid cardigann@0.0.1
14 verbose cwd /usr/local/etc/cardigann/src/github.com/cardigann/cardigann/web
15 verbose FreeBSD 11.0-STABLE
16 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"
17 verbose node v8.8.1
18 verbose npm  v5.4.2
19 error file sh
20 error code ELIFECYCLE
21 error errno ENOENT
22 error syscall spawn
23 error cardigann@0.0.1 build: `react-scripts build`
23 error spawn ENOENT
24 error Failed at the cardigann@0.0.1 build script.
24 error This is probably not a problem with npm. There is likely additional logging output above.
25 verbose exit [ 1, true ]

 
Status
Not open for further replies.
Top