brainupdaters / drlm

Disaster Recovery Linux Manager
http://drlm.org
GNU General Public License v3.0
68 stars 15 forks source link

make rpm: Cannot find main module for drlm-api #185

Closed Rintokz closed 2 years ago

Rintokz commented 2 years ago

Disaster Recovery Linux Manager (DRLM) Issue Template Quick response time is not guaranteed with free support, if you are using DRLM in a production environment and enterprise grade level support services are required, please see: http://www.brainupdaters.net/en/drlm-services. Please fill in the following items before submitting a new issue:

Issue details: Issue type: Bug Impact (Low / High / Critical / Urgent): High How often it happens: Always System: Rocky 8.5 Brief description of the issue: When trying to run 'make rpm' on 2.4.0 it fails with 'cannot find main module'.

Steps to reproduce: Download 2.4.0.tar.gz of DRLM 2.4.0 from https://drlm.org/download (or do git clone method from https://drlm-docs.readthedocs.io/en/develop/Install.html for Centos & RHEL)

[root@]# tar zxvf 2.4.0.tar.gz [root@]# cd drlm-2.4.0 [root@]# make rpm rm -f drlm-2.4.0-git.tar.gz rm -f build-stamp rm -f packaging/docker/src/drlm*.deb rm -f usr/sbin/drlm-api == Validating scripts and configuration ==

Validating BASH Syntax

find etc/ usr/share/drlm/conf/ -name '.conf' ! -path etc/drlm/rsyncd/rsyncd.conf | xargs bash -n bash -n usr/sbin/drlm bash -n usr/sbin/drlm-stord for file in $(find . -name '.sh'); do bash -n $file || exit 1; done

Validating GO Syntax

gofmt usr/share/drlm/www/drlm-api/backup.go usr/share/drlm/www/drlm-api/client.go usr/share/drlm/www/drlm-api/configuration.go usr/share/drlm/www/drlm-api/connection.go usr/share/drlm/www/drlm-api/credentials.go usr/share/drlm/www/drlm-api/drlm-api.go usr/share/drlm/www/drlm-api/jobs.go usr/share/drlm/www/drlm-api/logger.go usr/share/drlm/www/drlm-api/network.go usr/share/drlm/www/drlm-api/session.go usr/share/drlm/www/drlm-api/snaps.go usr/share/drlm/www/drlm-api/users.go usr/share/drlm/www/drlm-api/utilities.go > /dev/null == Building DRLM API == go get github.com/google/uuid go get github.com/mattn/go-sqlite3 go build -o ./usr/sbin/drlm-api ./usr/share/drlm/www/drlm-api/ go: cannot find main module, but found .git/config in /root/drlm to create a module there, run: go mod init make: *** [Makefile:201: drlmapi] Error 1 [root@]#

proura commented 2 years ago

Hello @Rintokz,

It seems that the golang version is not compatible, you can try to install the latest version from this link https://go.dev/doc/install and re-create the package running "make rpm" again.

Thanks,

Rintokz commented 2 years ago

Thank you @proura

I installed go 1.17.6 but got the same error. I found the fix along the way learning to install go: 1.17.6. To fix it inside the drlm directory I ran:

go mod init drlm

and then ran 'make rpm' / dnf installed it and it works great.

For completeness I ran the install on another Rocky8 server and it installed correctly with the epel-release go 1.16 version too and the 'go mod init drlm' step.

Downloading the version from this page: https://drlm.org/download/ which gives https://github.com/brainupdaters/drlm/archive/2.4.0.tar.gz fails though (this is a separate issue I guess) saying the directory is not a git repository. But following the instructions here: https://drlm-docs.readthedocs.io/en/develop/Install.html#drlm-installation with the 'git clone' steps worked perfectly on both servers. Thank you for the quick help

proura commented 2 years ago

Thank you very much @Rintokz,

I have updated the DRLM install documentation of all versions with an specific section for golang. In the next DRLM version we will try to make it automatically with "make deb/rpm".

Regards