qor / qor-example

An example application showcasing the QOR SDK

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problems getting fresh install to work [AssetFS error, translation error, sql error]

thanateros opened this issue · comments

Summary:

Forked qor-example today, edited database.yml, seeded the database, pulled dependencies (go get ./...), performed npm install and got all the node modules, then ran it. Site is missing images, translations not working, admin page won't load.

Details:

Have been working with QOR for a while now and started over multiple times with no problems; however today I forked and did all the setup and website sorta works and admin doesn't work at all.

Startup Errors

  1. On startup, the first error is :
WARNING: AssetFS is used before overwrite it!
goroutine 1 [running, locked to thread]:
runtime/debug.Stack(0xc42000e020, 0xc42031fd08, 0x1)
        /usr/local/go/src/runtime/debug/stack.go:24 +0xa7
runtime/debug.PrintStack()
        /usr/local/go/src/runtime/debug/stack.go:16 +0x22
github.com/qor/assetfs.SetAssetFS(0x7f3db682f0a0, 0x13db040)
        /home/spennington/go/src/github.com/qor/assetfs/assetfs.go:33 +0xb0
github.com/thanateros/qor-example/config/bindatafs.init.0()
        /home/spennington/go/src/github.com/thanateros/qor-example/config/bindatafs/bindatafs.go:26 +0x5d

I'm not all that educated on AssetFS, so I don't know how to troubleshoot this.

I'm guessing this is why it can't find a few templates on the main page.

  1. Second error is:
Failed to create unique index for translations key & locale, got: Error 1170: BLOB/TEXT column 'key' used in key specification without a key length

I have yet to need to use translations, so I'm not very smart on that topic either; I'm guessing this error is why the dotted label name shows up on the main page instead of the actual English text.

  1. Last startup error is:
(Error 1170: BLOB/TEXT column 'key' used in key specification without a key length)

I'm guessing that's the actual SQL error, and number 2 above is the SQL error wrapped in a go error object or some such.

Rendering Errors

The site looks like this:
image

Console shows assets being served up and no errors reported.

The Admin site looks like this:

image

... and the console shows the following error(s):

goroutine 1 [running, locked to thread]:
runtime/debug.Stack(0xc42000e020, 0xc42031fd08, 0x1)
        /home/spennington/go/src/github.com/go-chi/chi/middleware/recoverer.go:25 +0x9c
panic(0xd0f080, 0x13d31f0)
        /usr/local/go/src/runtime/panic.go:502 +0x229
html/template.(*Template).escape(0x0, 0x0, 0x0)
        /usr/local/go/src/html/template/template.go:95 +0x2e
html/template.(*Template).Execute(0x0, 0x7f3db67e4a78, 0xc4215aab00, 0xe30420, 0xc4202d6c40, 0x1, 0xc42024f500)
        /usr/local/go/src/html/template/template.go:119 +0x2f
github.com/qor/admin.(*Context).Execute(0xc4202d6c40, 0xe3e0bd, 0x9, 0x0, 0x0)
        /home/spennington/go/src/github.com/qor/admin/context.go:227 +0x258
github.com/qor/admin.(*Controller).Dashboard(0xc420fffb00, 0xc4202d6c40)
        /home/spennington/go/src/github.com/qor/admin/controller.go:28 +0x48
github.com/qor/admin.(*Controller).Dashboard-fm(0xc4202d6c40)
        /home/spennington/go/src/github.com/qor/admin/route.go:143 +0x34
github.com/qor/admin.(*Admin).NewServeMux.func2(0xc4202d6c40, 0xc420fcef00)
        /home/spennington/go/src/github.com/qor/admin/route.go:176 +0xe0
github.com/qor/admin.Middleware.Next(0xe3f56d, 0xa, 0xc42103a510, 0xc420fcef00, 0xc4202d6c40)
        /home/spennington/go/src/github.com/qor/admin/route.go:37 +0x48
github.com/qor/admin.(*Admin).NewServeMux.func1(0xc4202d6c40, 0xc420fceec0)
        /home/spennington/go/src/github.com/qor/admin/route.go:166 +0xa1
github.com/qor/admin.Middleware.Next(0xe457c4, 0xf, 0xea21c8, 0xc420fceec0, 0xc4202d6c40)
        /home/spennington/go/src/github.com/qor/admin/route.go:37 +0x48
github.com/qor/l10n.(*Locale).ConfigureQorResource.func7(0xc4202d6c40, 0xc420d7d320)
        /home/spennington/go/src/github.com/qor/l10n/l10n.go:248 +0x6e2
github.com/qor/admin.Middleware.Next(0xe557d5, 0x1c, 0xea2030, 0xc420d7d320, 0xc4202d6c40)
        /home/spennington/go/src/github.com/qor/admin/route.go:37 +0x48
github.com/qor/admin.Admin.registerCompositePrimaryKeyCallback.func1(0xc4202d6c40, 0xc4204dac60)
        /home/spennington/go/src/github.com/qor/admin/composite_primary_key_callback.go:27 +0x208
github.com/qor/admin.(*serveMux).ServeHTTP(0xc42000ecc8, 0x7f3db67d91c0, 0xc4215aab00, 0xc420146400)
        /home/spennington/go/src/github.com/qor/admin/route.go:267 +0x575
github.com/go-chi/chi.(*Mux).Mount.func1(0x7f3db67d91c0, 0xc4215aab00, 0xc420146400)
        /home/spennington/go/src/github.com/go-chi/chi/mux.go:291 +0x107
net/http.HandlerFunc.ServeHTTP(0xc420fcef20, 0x7f3db67d91c0, 0xc4215aab00, 0xc420146400)
        /usr/local/go/src/net/http/server.go:1947 +0x44
github.com/go-chi/chi.(*Mux).routeHTTP(0xc4201b6960, 0x7f3db67d91c0, 0xc4215aab00, 0xc420146400)
        /home/spennington/go/src/github.com/go-chi/chi/mux.go:424 +0x289
github.com/go-chi/chi.(*Mux).(github.com/go-chi/chi.routeHTTP)-fm(0x7f3db67d91c0, 0xc4215aab00, 0xc420146400)
        /home/spennington/go/src/github.com/go-chi/chi/mux.go:368 +0x48
net/http.HandlerFunc.ServeHTTP(0xc420876f70, 0x7f3db67d91c0, 0xc4215aab00, 0xc420146400)
        /home/spennington/go/src/github.com/go-chi/chi/mux.go:424 +0x289
github.com/go-chi/chi.(*Mux).(github.com/go-chi/chi.routeHTTP)-fm(0x7f3db67d91c0, 0xc420800140, 0xc4210a6200)
        /home/spennington/go/src/github.com/go-chi/chi/mux.go:368 +0x48
net/http.HandlerFunc.ServeHTTP(0xc420876f70, 0x7f3db67d91c0, 0xc420800140, 0xc4210a6200)
        /usr/local/go/src/net/http/server.go:1947 +0x44
main.main.func2.1(0x7f3db67d91c0, 0xc420800140, 0xc4210a6100)
        /home/spennington/go/src/github.com/thanateros/qor-example/main.go:79 +0x1b5
net/http.HandlerFunc.ServeHTTP(0xc420ce0a00, 0x7f3db67d91c0, 0xc420800140, 0xc4210a6100)
        /usr/local/go/src/net/http/server.go:1947 +0x44
github.com/go-chi/chi/middleware.Recoverer.func1(0x7f3db67d91c0, 0xc420800140, 0xc4210a6100)
        /home/spennington/go/src/github.com/go-chi/chi/middleware/recoverer.go:35 +0x9f
net/http.HandlerFunc.ServeHTTP(0xc420ce0a20, 0x7f3db67d91c0, 0xc420800140, 0xc4210a6100)
        /usr/local/go/src/net/http/server.go:1947 +0x44
github.com/go-chi/chi/middleware.RequestLogger.func1.1(0xf58360, 0xc4202a02a0, 0xc4210a6000)
        /home/spennington/go/src/github.com/go-chi/chi/middleware/logger.go:46 +0x1b6
net/http.HandlerFunc.ServeHTTP(0xc420cb1aa0, 0xf58360, 0xc4202a02a0, 0xc4210a6000)
        /usr/local/go/src/net/http/server.go:1947 +0x44
github.com/go-chi/chi/middleware.RealIP.func1(0xf58360, 0xc4202a02a0, 0xc4210a6000)
        /home/spennington/go/src/github.com/go-chi/chi/middleware/realip.go:34 +0xa1
net/http.HandlerFunc.ServeHTTP(0xc420ce0a40, 0xf58360, 0xc4202a02a0, 0xc4210a6000)
        /usr/local/go/src/net/http/server.go:1947 +0x44
main.main.func1.1(0xf58360, 0xc4202a02a0, 0xc4210a6000)
        /home/spennington/go/src/github.com/thanateros/qor-example/main.go:60 +0xb1
net/http.HandlerFunc.ServeHTTP(0xc420ce0a60, 0xf58360, 0xc4202a02a0, 0xc4210a6000)
        /usr/local/go/src/net/http/server.go:1947 +0x44
github.com/go-chi/chi.(*Mux).ServeHTTP(0xc4201b6960, 0xf58360, 0xc4202a02a0, 0xc421313f00)
        /home/spennington/go/src/github.com/go-chi/chi/mux.go:81 +0x221
github.com/qor/redirect_back.(*RedirectBack).Middleware.func1(0xf58360, 0xc4202a02a0, 0xc421313f00)
        /home/spennington/go/src/github.com/qor/redirect_back/redirect_back.go:139 +0x1fa
net/http.HandlerFunc.ServeHTTP(0xc42131ada0, 0xf58360, 0xc4202a02a0, 0xc421313e00)
        /usr/local/go/src/net/http/server.go:1947 +0x44
github.com/qor/auth/authority.(*Authority).Middleware.func1(0xf58360, 0xc4202a02a0, 0xc421313e00)
        /home/spennington/go/src/github.com/qor/auth/authority/middleware.go:43 +0xb5
net/http.HandlerFunc.ServeHTTP(0xc42131adc0, 0xf58360, 0xc4202a02a0, 0xc421313e00)
        /usr/local/go/src/net/http/server.go:1947 +0x44
github.com/qor/session/gorilla.Gorilla.Middleware.func1(0xf58360, 0xc4202a02a0, 0xc421313b00)
        /home/spennington/go/src/github.com/qor/session/gorilla/gorilla.go:125 +0x123
net/http.HandlerFunc.ServeHTTP(0xc42131ade0, 0xf58360, 0xc4202a02a0, 0xc421313b00)
        /usr/local/go/src/net/http/server.go:1947 +0x44
net/http.serverHandler.ServeHTTP(0xc420e67ba0, 0xf58360, 0xc4202a02a0, 0xc421313b00)
        /usr/local/go/src/net/http/server.go:2694 +0xbc
net/http.(*conn).serve(0xc4212cc000, 0xf58c60, 0xc4215aa000)
        /usr/local/go/src/net/http/server.go:1830 +0x651
created by net/http.(*Server).Serve
        /usr/local/go/src/net/http/server.go:2795 +0x27b
2018/05/25 14:29:49 "GET http://www.EDITED_OUT:7000/admin HTTP/1.1" from EDITED_OUT:56707 - 500 22B in 19.810252ms

[EDITED_OUT is where I removed sensitive information]

I don't know how to untangle that bug splat; it feels tied in with the startup errors.

I'm less concerned about example media not showing up and most concerned about not being able to access admin.

What am I being dumb about?

I've done this numerous times in the past running into occasional minor things I could tweak to get it working but never a show-stopper like this.

Environment

Hosting: Digital Ocean VPS, Ubuntu 17
Golang: version 1.10.2

To minimize the impact from my environment I have Nginx stopped, firewall temporarily disabled, mysql server running, and nothing else (other than OS-necessary stuff).

Addendum

I went back and re-ran seeding the database/pulling media:

go run -v config/db/seeds/main.go config/db/seeds/seeds.go

This was the result:

command-line-arguments
Failed to find configuration config/application.yml, using example file config/application.example.yml
Failed to find configuration config/smtp.yml, using example file config/smtp.example.yml
Failed to create unique index for translations key & locale, got: Error 1170: BLOB/TEXT column 'key' used in key specification without a key length

(Error 1170: BLOB/TEXT column 'key' used in key specification without a key length)
[2018-05-25 15:32:37]
WARNING: AssetFS is used before overwrite it!
goroutine 1 [running, locked to thread]:
runtime/debug.Stack(0xc42000e020, 0xc42069fc60, 0x1)
        /usr/local/go/src/runtime/debug/stack.go:24 +0xa7
runtime/debug.PrintStack()
        /usr/local/go/src/runtime/debug/stack.go:16 +0x22
github.com/qor/assetfs.SetAssetFS(0x7fb2a41dda80, 0x13202a0)
        /home/spennington/go/src/github.com/qor/assetfs/assetfs.go:33 +0xb0
github.com/thanateros/qor-example/config/bindatafs.init.0()
        /home/spennington/go/src/github.com/thanateros/qor-example/config/bindatafs/bindatafs.go:26 +0x5d
Need to have gorm DB in the configuration in order to run migrations
Start create sample data...
--> Created setting.
--> Created seo.
--> Created admin users.
--> Created users.
--> Created addresses.
--> Created categories.
--> Created collections.
--> Created colors.
--> Created sizes.
--> Created material.
--> Created medialibraries.
--> Created products.
--> Created stores.
--> Created orders.
--> Created widgets.
--> Created articles.
--> Created helps.
--> Done!

When I look in public\system I see the several media folders, all with numbered sub-folders, and all of them have what look like default images in them (e.g., file.listing.jpg, file.main.jpg, etc ...).

I'm guessing the above error(s) is/are why no media downloads but the database seems to get properly populated (except maybe translations stuff).

I just installed GVM and am about to start incrementally rolling back my Go version and testing again in case my version is the culprit.

UPDATE

I used GVM to crawl through Go versions and test code.

Originally, I had whatever Go version comes with Ubuntu 17 (1.8? 1.9?) and that wasn't working, so I got 1.10.2 as a tarball from the golang website --now the website would come up, but not the /admin route.

After installing GVM I tried out 1.9.6, 1.10, 1.10.1, and 1.10.2 (all via GVM).

Everything installed via GVM worked just fine, even with all the same startup errors. Maybe there was more to the tarball binary setup that I was aware of -- the GVM-installed 1.10.2 works just fine; all the GVM installed Gos work just fine.

I learned today my dns service had issues over the last several days; who knows?

Not looking a gifthorse in the mouth, I'm going to stick with using GVM for my go installation needs.

Closing this ticket.

(I still want to know why the reference QOR application, qor-example, throws up a bunch of errors -- this can be a bit of a turn-off for someone breezing through looking for a good CMS to replace theirs -- I almost skipped past QOR because of different start-up errors a long time ago and am glad I did not give up on it)