luarocks / luarocks-site

LuaRocks website and module host
http://luarocks.org
175 stars 36 forks source link

Missing seed data, fails to start with empty database #74

Closed jirutka closed 7 years ago

jirutka commented 8 years ago

I can’t find any seed data in this repository (only schema) and when I start luarocks-site with empty database and open http://localhost:8080/:

Error
models/Manifests.lua:229: Missing root manifest

Traceback
stack traceback:
    [C]: in function 'assert'
    models/Manifests.lua:229: in function 'root'
    app.lua:58: in function 'handler'
    .moonbox/share/lua/5.1/lapis/application.lua:399: in function 'resolve'
    .moonbox/share/lua/5.1/lapis/application.lua:408: in function <.moonbox/share/lua/5.1/lapis/application.lua:406>
    [C]: in function 'xpcall'
    .moonbox/share/lua/5.1/lapis/application.lua:406: in function 'dispatch'
    .moonbox/share/lua/5.1/lapis/nginx.lua:205: in function <.moonbox/share/lua/5.1/lapis/nginx.lua:203>

nginx log:

2015/12/12 15:27:03 [notice] 93671#0: *1 [lua] postgres.lua:62: select(): SQL: SELECT * from "manifests" where "name" = 'root' limit 1, client: 127.0.0.1, server: , request: "GET / HTTP/1.1", host: "localhost:8080"
2015/12/12 15:27:03 [notice] 93671#0: *1 [lua] application.lua:475: old_error_handler(): [500] GET / - {}, client: 127.0.0.1, server: , request: "GET / HTTP/1.1", host: "localhost:8080"
2015/12/12 15:27:03 [notice] 93671#0: *1 [lua] postgres.lua:62: select(): SQL: SELECT * from "exception_types" where "label" = 'models/Manifests.lua:229: Missing root manifest' limit 1, client: 127.0.0.1, server: , request: "GET / HTTP/1.1", host: "localhost:8080"
2015/12/12 15:27:03 [notice] 93671#0: *1 [lua] postgres.lua:62: insert(): SQL: INSERT INTO "exception_types" ("updated_at", "label", "created_at") VALUES ('2015-12-12 14:27:03', 'models/Manifests.lua:229: Missing root manifest', '2015-12-12 14:27:03') RETURNING "id", client: 127.0.0.1, server: , request: "GET / HTTP/1.1", host: "localhost:8080"
2015/12/12 15:27:03 [notice] 93671#0: *1 [lua] postgres.lua:62: update(): SQL: UPDATE "exception_types" SET "updated_at" = '2015-12-12 14:27:03', "count" = count + 1 WHERE "id" = 1 RETURNING "count", client: 127.0.0.1, server: , request: "GET / HTTP/1.1", host: "localhost:8080"
2015/12/12 15:27:03 [notice] 93671#0: *1 [lua] postgres.lua:62: insert(): SQL: INSERT INTO "exception_requests" ("exception_type_id", "updated_at", "created_at", "path", "method", "ip", "trace", "msg", "data") VALUES (1, '2015-12-12 14:27:03', '2015-12-12 14:27:03', '/', 'GET', '127.0.0.1', '
stack traceback:
    [C]: in function ''assert''
    models/Manifests.lua:229: in function ''root''
    app.lua:58: in function ''handler''
    .moonbox/share/lua/5.1/lapis/application.lua:399: in function ''resolve''
    .moonbox/share/lua/5.1/lapis/application.lua:408: in function <.moonbox/share/lua/5.1/lapis/application.lua:406>
    [C]: in function ''xpcall''
    .moonbox/share/lua/5.1/lapis/application.lua:406: in function ''dispatch''
    .moonbox/share/lua/5.1/lapis/nginx.lua:205: in function <.moonbox/share/lua/5.1/lapis/nginx.lua:203>', 'models/Manifests.lua:229: Missing root manifest', '{"params":{},"cmd_url":"\/","headers":{"host":"localhost:8080","accept-language":"en-GB,en;q=0.7,cs;q=0.3","user-agent":"Mozilla\/5.0 (Macintosh; Intel Mac OS X 10.9; rv:42.0) Gecko\/20100101 Firefox\/42.0","connection":"keep-alive","accept":"text\/html,application\/xhtml+xml,application\/xml;q=0.9,*\/*;q=0.8","cache-control":"max-age=0","dnt":"1","accept-encoding":"gzip, deflate"},"session":{}}') RETURNING "id", client: 127.0.0.1, server: , request: "GET / HTTP/1.1", host: "localhost:8080"
leafo commented 8 years ago

in the meantime you can run lua -e 'require("models").Manifests:create("root", true)

jirutka commented 8 years ago

Thanks, this helped me to start. Now I need to populate DB with some dummy modules and versions. Is there any easy way how to do that?

leafo commented 8 years ago

no easy way, your best option is download some rockspecs from the site an upload them.

leafo commented 7 years ago

Root manifest is now created if it doesn't exist