dimonomid / geekmarks

API-Driven, Geeky Bookmarking Service
BSD 2-Clause "Simplified" License
577 stars 39 forks source link

Issue using make -C server/envs/dev on Ubuntu Server 16.04 #16

Open IronTooch opened 6 years ago

IronTooch commented 6 years ago

Good evening! I'm really looking forward to using geekmarks, but I seem to be having some difficulty building it.

This is the error message that appears when running make -C server/envs/dev in /home/USER_REDACTED/go/src/dmitryfrank.com/geekmarks

make: Entering directory '/home/USER_REDACTED/go/src/dmitryfrank.com/geekmarks/server/envs/dev'
make -C ../..
make[1]: Entering directory '/home/USER_REDACTED/go/src/dmitryfrank.com/geekmarks/server'
go generate dmitryfrank.com/geekmarks/...
warning: ignoring symlink /home/USER_REDACTED/go/src/dmitryfrank.com/geekmarks/client/chrome-ext/common
server/server.go:4: running "go-bindata-assetfs": exec: "go-bindata-assetfs": executable file not found in $PATH
Makefile:9: recipe for target 'docker-build' failed
make[1]: *** [docker-build] Error 1
make[1]: Leaving directory '/home/USER_REDACTED/go/src/dmitryfrank.com/geekmarks/server'
Makefile:9: recipe for target 'up' failed
make: *** [up] Error 2
make: Leaving directory '/home/USER_REDACTED/go/src/dmitryfrank.com/geekmarks/server/envs/dev'

Go version is 1.10 linux/amd64 Docker version is 18.03.0-ce, build 0520e24 Docker Compose version is 1.19.0, build 9e633ef PATH environment variable: /home/USER_REDACTED/bin:/home/USER_REDACTED/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/go/bin:/home/USER_REDACTED/go:/home/USER_REDACTED/go/bin

Output of "go env"

GOARCH="amd64"
GOBIN="/usr/local/go/bin"
GOCACHE="/home/USER_REDACTED/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/USER_REDACTED/go"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build224985629=/tmp/go-build -gno-record-gcc-switches"

Of course, I'm happy to provide any other outputs or inputs as needed to troubleshoot.

Additionally, just as an enhancement feature, it would be awesome to be able to use a MariaDb database as opposed to Postgres, as I have a separate DB server, and it would help for portability. I would also second the request for some kind of basic auth. Thanks!

dimonomid commented 6 years ago

Hi! Yeah apparently the readme on building is incomplete, I'll have to amend it a bit. Sorry about that!

You need to install this https://github.com/elazarl/go-bindata-assetfs , just as follows:

$ go get github.com/jteeuwen/go-bindata/...
$ go get github.com/elazarl/go-bindata-assetfs/...

As to MariaDb, honestly I have totally no plans supporting it. And given that I have a ton of pending improvements to Geekmarks already, which I'm unable to implement due to lack of time, it's highly unlikely I'll be able to implement it. I could review PRs though.

And yes, some basic authn is one of the improvements I'd like to see here, sooner or later.

IronTooch commented 6 years ago

How dare this free project you've dedicated personal time to, not meet my every wish and desire? I call shenanigans!

Sounds great, I'll give this a test on fresh box, and if it works correctly, I can submit a pull/merge request to update the readme. I'd offer to help with the rest, but I need to get a bit better at Go first. I appreciate you making the app in the first place, and being so responsive on the Issue.

dimonomid commented 6 years ago

How dare this free project you've dedicated personal time to, not meet my every wish and desire? I call shenanigans!

Haha :)

I'll give this a test on fresh box, and if it works correctly, I can submit a pull/merge request to update the readme.

Great, thank you!

IronTooch commented 6 years ago

Okay, so, originally the issue reoccurred, but I realized that in addition to doing these

$ go get github.com/jteeuwen/go-bindata/...
$ go get github.com/elazarl/go-bindata-assetfs/...

I need to also ensure that $PATH included ~/go/bin, in addition to /usr/local/go/bin. That's the good news. Now it at least tries to make. once I run make-C server/envs/dev though....

make: Entering directory '/home/USER_REDACTED/go/src/dmitryfrank.com/geekmarks/server/envs/dev'
make -C ../..
make[1]: Entering directory '/home/USER_REDACTED/go/src/dmitryfrank.com/geekmarks/server'
go generate dmitryfrank.com/geekmarks/...
warning: ignoring symlink /home/USER_REDACTED/go/src/dmitryfrank.com/geekmarks/client/chrome-ext/common
go build --race -i dmitryfrank.com/geekmarks/server/cmd/geekmarks-server
# dmitryfrank.com/geekmarks/server/server
server/bindata_assetfs.go:29:6: asset redeclared in this block
previous declaration at server/bindata.go:29:6
server/bindata_assetfs.go:34:6: bindataFileInfo redeclared in this block
previous declaration at server/bindata.go:34:6
server/bindata_assetfs.go:60:5: _webrootFaviconIco redeclared in this block
previous declaration at server/bindata.go:60:5
server/bindata_assetfs.go:62:40: webrootFaviconIcoBytes redeclared in this block
previous declaration at server/bindata.go:62:40
server/bindata_assetfs.go:66:35: webrootFaviconIco redeclared in this block
previous declaration at server/bindata.go:66:35
server/bindata_assetfs.go:77:5: _webrootGeekmarksCrx redeclared in this block
previous declaration at server/bindata.go:77:5
server/bindata_assetfs.go:79:42: webrootGeekmarksCrxBytes redeclared in this block
previous declaration at server/bindata.go:79:42
server/bindata_assetfs.go:83:37: webrootGeekmarksCrx redeclared in this block
previous declaration at server/bindata.go:83:37
server/bindata_assetfs.go:94:5: _webrootImages01_something_about_pythonGif redeclared in this block
previous declaration at server/bindata.go:94:5
server/bindata_assetfs.go:96:64: webrootImages01_something_about_pythonGifBytes redeclared in this block
previous declaration at server/bindata.go:96:64
server/bindata_assetfs.go:96:64: too many errors
Makefile:9: recipe for target 'docker-build' failed
make[1]: *** [docker-build] Error 2
make[1]: Leaving directory '/home/USER_REDACTED/go/src/dmitryfrank.com/geekmarks/server'
Makefile:9: recipe for target 'up' failed
make: *** [up] Error 2
make: Leaving directory '/home/USER_REDACTED/go/src/dmitryfrank.com/geekmarks/server/envs/dev'

This is a bit weird to me... bindata.go isn't present when you initially clone the repo, and a rudimentary search on Github doesn't appear to compile such a file, but it's present after running the Make. It's the only change in the server/server/ directory. Thoughts?

IronTooch commented 6 years ago

This may also be related to Feature Request: be able to use both go-bindata and go-bindata-assetfs at the same time #20 in the go-bindata-assetfs package. I'm going to see if I can make enough sense of things (without knowing Go) to get closer to the problem.

IronTooch commented 6 years ago

For debugging, it looks like server/bindata.go is built at Line 8 of server Makefile.

go generate dmitryfrank.com/geekmarks/...

That command, run separately, works fine. It tanks at the go build command, specifically building the server/server section.

I also (just for giggles) removed GoLang 1.10, and installed GoLan 1.8.1 to determine if it was a Golang incompatibility, but the same behavior occurs.

Still continuing to investigate, but trying to add data as it's available.

IronTooch commented 6 years ago

Okay. Cheese and crackers. I think I have a solution, or at least, a potential one. Literally adding one compiler flag to say "ignore the errors" seems to make the thing compile and run. I can at least get something to appear on the hosted sever at port 4000. I will test to confirm it functions in general, and if so, I will re-roll on a fresh box and test it. If that fixes it, I'll put in a PR.

dimonomid commented 6 years ago

@IronTooch thanks for the time you're investing here; sorry I'm so busy these days so I can't even try to reproduce it. Probably will manage to do that at weekend.

issmirnov commented 6 years ago

Man, I should really check the issues tab before I dive in. Fell into the same hole - sent out #17 and after the page reloaded saw this PR.

Looking forward to the fix about the compilation. I tried editing /server/Makefile and removing the --race option, but that didn't solve it.

IronTooch commented 6 years ago

@dimonomid Of course! I don't know if it's actually helping, but it's also helping me work on my containerized-go diagnostics and knocking the rust of some old skills, so I'm on board.

So spun up new server, made the change to the makefile (plus added a little more chatter to see what was going on), and kicked it off. Currently, make still fails. I think it's because go build is passing back out an error code, even though it's still doing the builds due to the '-e' flag, so make assumes that stage fails and stops the build. So I added '-' to the command, to say continue executing in spite of errors. Changes reflected here.

That gets us all the way to the server/Dockerfile., where it bombs out at ADD geekmarks-server /

Full output below

dmitryfrank.com/geekmarks/server/server
# dmitryfrank.com/geekmarks/server/server
server/bindata_assetfs.go:29: asset redeclared in this block
previous declaration at server/bindata.go:29
server/bindata_assetfs.go:34: bindataFileInfo redeclared in this block
previous declaration at server/bindata.go:34
server/bindata_assetfs.go:41: bindataFileInfo.Name redeclared in this block
previous declaration at server/bindata.go:41
server/bindata_assetfs.go:44: bindataFileInfo.Size redeclared in this block
previous declaration at server/bindata.go:44
server/bindata_assetfs.go:47: bindataFileInfo.Mode redeclared in this block
previous declaration at server/bindata.go:47
server/bindata_assetfs.go:50: bindataFileInfo.ModTime redeclared in this block
previous declaration at server/bindata.go:50
server/bindata_assetfs.go:53: bindataFileInfo.IsDir redeclared in this block
previous declaration at server/bindata.go:53
server/bindata_assetfs.go:56: bindataFileInfo.Sys redeclared in this block
previous declaration at server/bindata.go:56
server/bindata_assetfs.go:60: _webrootFaviconIco redeclared in this block
previous declaration at server/bindata.go:60
server/bindata_assetfs.go:62: webrootFaviconIcoBytes redeclared in this block
previous declaration at server/bindata.go:62
server/bindata_assetfs.go:66: webrootFaviconIco redeclared in this block
previous declaration at server/bindata.go:66
server/bindata_assetfs.go:77: _webrootGeekmarksCrx redeclared in this block
previous declaration at server/bindata.go:77
server/bindata_assetfs.go:79: webrootGeekmarksCrxBytes redeclared in this block
previous declaration at server/bindata.go:79
server/bindata_assetfs.go:83: webrootGeekmarksCrx redeclared in this block
previous declaration at server/bindata.go:83
server/bindata_assetfs.go:94: _webrootImages01_something_about_pythonGif redeclared in this block
previous declaration at server/bindata.go:94
server/bindata_assetfs.go:96: webrootImages01_something_about_pythonGifBytes redeclared in this block
previous declaration at server/bindata.go:96
server/bindata_assetfs.go:100: webrootImages01_something_about_pythonGif redeclared in this block
previous declaration at server/bindata.go:100
server/bindata_assetfs.go:111: _webrootImages01_something_about_python_smallGif redeclared in this block
previous declaration at server/bindata.go:111
server/bindata_assetfs.go:113: webrootImages01_something_about_python_smallGifBytes redeclared in this block
previous declaration at server/bindata.go:113
server/bindata_assetfs.go:117: webrootImages01_something_about_python_smallGif redeclared in this block
previous declaration at server/bindata.go:117
server/bindata_assetfs.go:128: _webrootImages02_python_replGif redeclared in this block
previous declaration at server/bindata.go:128
server/bindata_assetfs.go:130: webrootImages02_python_replGifBytes redeclared in this block
previous declaration at server/bindata.go:130
server/bindata_assetfs.go:134: webrootImages02_python_replGif redeclared in this block
previous declaration at server/bindata.go:134
server/bindata_assetfs.go:145: _webrootImages02_python_repl_smallGif redeclared in this block
previous declaration at server/bindata.go:145
server/bindata_assetfs.go:147: webrootImages02_python_repl_smallGifBytes redeclared in this block
previous declaration at server/bindata.go:147
server/bindata_assetfs.go:151: webrootImages02_python_repl_smallGif redeclared in this block
previous declaration at server/bindata.go:151
server/bindata_assetfs.go:162: _webrootImages03_findGif redeclared in this block
previous declaration at server/bindata.go:162
server/bindata_assetfs.go:164: webrootImages03_findGifBytes redeclared in this block
previous declaration at server/bindata.go:164
server/bindata_assetfs.go:168: webrootImages03_findGif redeclared in this block
previous declaration at server/bindata.go:168
server/bindata_assetfs.go:179: _webrootImagesGm_menu_loggedPng redeclared in this block
previous declaration at server/bindata.go:179
server/bindata_assetfs.go:181: webrootImagesGm_menu_loggedPngBytes redeclared in this block
previous declaration at server/bindata.go:181
server/bindata_assetfs.go:185: webrootImagesGm_menu_loggedPng redeclared in this block
previous declaration at server/bindata.go:185
server/bindata_assetfs.go:196: _webrootImagesGm_menu_not_loggedPng redeclared in this block
previous declaration at server/bindata.go:196
server/bindata_assetfs.go:198: webrootImagesGm_menu_not_loggedPngBytes redeclared in this block
previous declaration at server/bindata.go:198
server/bindata_assetfs.go:202: webrootImagesGm_menu_not_loggedPng redeclared in this block
previous declaration at server/bindata.go:202
server/bindata_assetfs.go:393: _webrootIndexHtml redeclared in this block
previous declaration at server/bindata.go:393
server/bindata_assetfs.go:395: webrootIndexHtmlBytes redeclared in this block
previous declaration at server/bindata.go:395
server/bindata_assetfs.go:399: webrootIndexHtml redeclared in this block
previous declaration at server/bindata.go:399
server/bindata_assetfs.go:420: _webrootIndexJs redeclared in this block
previous declaration at server/bindata.go:420
server/bindata_assetfs.go:422: webrootIndexJsBytes redeclared in this block
previous declaration at server/bindata.go:422
server/bindata_assetfs.go:426: webrootIndexJs redeclared in this block
previous declaration at server/bindata.go:426
server/bindata_assetfs.go:464: _webrootLogoJs redeclared in this block
previous declaration at server/bindata.go:464
server/bindata_assetfs.go:466: webrootLogoJsBytes redeclared in this block
previous declaration at server/bindata.go:466
server/bindata_assetfs.go:470: webrootLogoJs redeclared in this block
previous declaration at server/bindata.go:470
server/bindata_assetfs.go:558: _webrootStylesCss redeclared in this block
previous declaration at server/bindata.go:558
server/bindata_assetfs.go:560: webrootStylesCssBytes redeclared in this block
previous declaration at server/bindata.go:560
server/bindata_assetfs.go:564: webrootStylesCss redeclared in this block
previous declaration at server/bindata.go:564
server/bindata_assetfs.go:578: Asset redeclared in this block
previous declaration at server/bindata.go:578
server/bindata_assetfs.go:592: MustAsset redeclared in this block
previous declaration at server/bindata.go:592
server/bindata_assetfs.go:604: AssetInfo redeclared in this block
previous declaration at server/bindata.go:604
server/bindata_assetfs.go:617: AssetNames redeclared in this block
previous declaration at server/bindata.go:617
server/bindata_assetfs.go:640: _bindata redeclared in this block
previous declaration at server/bindata.go:640
server/bindata_assetfs.go:655: AssetDir redeclared in this block
previous declaration at server/bindata.go:655
server/bindata_assetfs.go:677: bintree redeclared in this block
previous declaration at server/bindata.go:677
server/bindata_assetfs.go:699: _bintree redeclared in this block
previous declaration at server/bindata.go:699
server/bindata_assetfs.go:702: RestoreAsset redeclared in this block
previous declaration at server/bindata.go:702
server/bindata_assetfs.go:727: RestoreAssets redeclared in this block
previous declaration at server/bindata.go:727
server/bindata_assetfs.go:743: _filePath redeclared in this block
previous declaration at server/bindata.go:743
server/bindata_assetfs.go:749: assetFS redeclared in this block
previous declaration at server/bindata.go:749
server/bindata_assetfs.go:750: assetFS.func1 redeclared in this block
previous declaration at server/bindata.go:750
Makefile:9: recipe for target 'docker-build' failed
make[1]: [docker-build] Error 2 (ignored)
Make - server/Makefile - Running docker build
docker build -t docker.io/dimonomid/geekmarks-server .
Sending build context to Docker daemon   7.49MB
Step 1/3 : FROM golang:1.8.1
 ---> fcef75ee6be1
Step 2/3 : ADD geekmarks-server /
ADD failed: stat /var/lib/docker/tmp/docker-builder922600334/geekmarks-server: no such file or directory
Makefile:9: recipe for target 'docker-build' failed
make[1]: *** [docker-build] Error 1
make[1]: Leaving directory '/home/USER/go/src/dmitryfrank.com/geekmarks/server'
Makefile:9: recipe for target 'up' failed
make: *** [up] Error 2
make: Leaving directory '/home/USER/go/src/dmitryfrank.com/geekmarks/server/envs/dev'
issmirnov commented 6 years ago

@IronTooch can you push your branch to your fork? I'd love to play around with this as well, if you're open to that.

IronTooch commented 6 years ago

Changes are reflected in the fork, let me know if you don't see them?

issmirnov commented 6 years ago

Found them! Will try to get some time in the next few days to play with it.

leematos commented 5 years ago

I'm a little late to the party but the problem appears to be:

https://github.com/dimonomid/geekmarks/blob/28e8cb03b9d9f508f2c8b95c91b665a54cff7338/server/server/server.go#L4

This will run bindata "again" (one already exists in the repo currently). I found this via stracing the make process and searching for bindata:

20011 01:14:24.043891 fcntl(2</dev/pts/0<char 136:0>>, F_SETFD, 0) = 0 <0.000037>
20011 01:14:24.043981 execve("/home/vagrant/.go/bin/go-bindata-assetfs", ["go-bindata-assetfs", "-pkg", "server", "-nocompress", "-modtime", "1", "-mode", "420", "webroot/..."], 0xc00044a000 /* 32 vars */ <unfinished ...>
20005 01:14:24.044141 <... clone resumed>) = 20011 <0.006652>
20011 01:14:24.044164 <... execve resumed>) = 0 <0.000163>

I'm unfamiliar with go, so I wasn't aware that the comments would get parsed: https://blog.carlmjohnson.net/post/2016-11-27-how-to-use-go-generate/

Basically, I commented that out, and I was able to get passed that error. Still no clean build, but working on it.

I think a longer term fix would be to remove the bindata-assetfs.go file that's generated in the repo, and let it get generated on build?

leematos commented 5 years ago

Clean build:
image

I had some docker permission problems (user needed to be in the docker group) and being lazy and doing sudo make meant that it wasn't finding the project in the $GOPATH of the root user...

So for anyone following along, you can change https://github.com/dimonomid/geekmarks/blob/28e8cb03b9d9f508f2c8b95c91b665a54cff7338/server/server/server.go#L4

to something like go-dont-generate <blah> AND remove the bindata.go file that was generated from the server directory and you should be able to build cleanly.