Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error bootstrapping a database #24

Closed
eyedeekay opened this issue Aug 28, 2019 · 7 comments
Closed

Error bootstrapping a database #24

eyedeekay opened this issue Aug 28, 2019 · 7 comments

Comments

@eyedeekay
Copy link

eyedeekay commented Aug 28, 2019

I am trying to set up an instance of littr.go, but unfortunately I'm quite bad at debugging SQL-related issues. When I attempt to bootstrap the database, I get the following error:

    time="2019-08-27T23:00:51-04:00" level=error msg="query: create table items (
    id serial constraint items_pk primary key,
    key char(32) unique,
    mime_type varchar default NULL,
    title varchar default NULL,
    data text default NULL,
    score bigint default 0,
    path ltree default NULL,
    submitted_by int references accounts(id),
    submitted_at timestamp default current_timestamp,
    updated_at timestamp default current_timestamp,
    metadata jsonb default '{}',
    flags bit(8) default 0::bit(8)
    );" file=/home/dev/go/src/github.com/mariusor/littr.go/app/cmd/bootstrap.go line=373 trace="goroutine 1 [running]:
    runtime/debug.Stack(0x9eca36, 0x9, 0xc00025bc28)
        /snap/go/4301/src/runtime/debug/stack.go:24 +0x9d
    github.com/mariusor/littr.go/internal/errors.Annotatef(0xaab100, 0xc0000c1c20, 0x9eca36, 0x9, 0xc00025bc28, 0x1, 0x1, 0x0, 0x0)
        /home/dev/go/src/github.com/mariusor/littr.go/internal/errors/errors.go:91 +0xad
    github.com/mariusor/littr.go/app/cmd.BootstrapDB(0xc0000a61c0, 0x0, 0x0)
        /home/dev/go/src/github.com/mariusor/littr.go/app/cmd/bootstrap.go:373 +0xa6e
    main.main()
        /home/dev/go/src/github.com/mariusor/littr.go/cli/bootstrap/main.go:77 +0x54b
    "

Is this a bug, or am I missing something?

@mariusor
Copy link
Owner

mariusor commented Aug 28, 2019

Hi, thank you for trying my project, but for the moment the codebase is in relative flux as I'm trying to migrate to a different ActivityPub backend.

I'll take a look as soon as possible to see what the problem is, but on a first look it might not be an error, just a debug message. Have you tried checking if bootstrap has actually created the tables ?

@eyedeekay
Copy link
Author

Looks like it stops immediately after it creates the accounts table, none of the others are created.

@mariusor
Copy link
Owner

OK, thanx for double checking. Currently I'm busy with some work in another part of the project but keep an eye on this ticket, I'll have some updates soon (hopefully the weekend).

@mariusor
Copy link
Owner

Hi, so I've tested with latest master version and for me everything works fine out of the box:

$ ./bin/bootstrap -overwrite -testing -seed
DEBU[0000] Connecting to postgres@localhost:5432//postgres 
DEBU[0000] Connecting to postgres@localhost:5432//littr-test 
DEBU[0000] Connecting to littr-test@localhost:5432//littr-test 
DEBU[0000] Connecting to littr-test@localhost:5432//littr-test 
DEBU[0000] Connecting to littr-test@localhost:5432//littr-test 
DEBU[0000] Connecting to littr-test@localhost:5432//littr-test 

Can you dump your .env file here, please?

Also, which postgresql version are you using ?

@eyedeekay
Copy link
Author

It's not altered much, I tried to remove potentially sensitive information, hopefully it is still helpful.


HOSTNAME=localhost
LISTEN=:3000
ENV=dev
DB_HOST=db
DB_NAME=littr
DB_USER=postgres
DB_PASSWORD=postgrespassword
POSTGRESS_PASSWORD=postgrespassword
SESS_AUTH_KEY=16_chars_enc_key=
SESS_ENC_KEY=16_chars_enc_key+
SESS_BACKEND=cookie
DISABLE_SESSIONS=false
DISABLE_DOWNVOTING=false
DISABLE_VOTING=false

postgresql version is version 10.9-0ubuntu0-18.10.1

@mariusor
Copy link
Owner

mariusor commented Sep 1, 2019

Nothing looks weird and postgresql 10 is fine.

I'm not sure what the problem is, so I added a bit more debugging messages (in a8508c1) to the bootstrap command. Please try again and paste the output of the error. It should now include a "wrapped" field with the message of the underlying db problem.

@mariusor
Copy link
Owner

mariusor commented Sep 6, 2019

@eyedeekay I'm going to close this ticket as my ongoing effort is to move away from using a local database backend for littr.go in favour of using a generic ActivityPub service. This will make the bootstrapping command obsolete, or at least, heavily modify its functionality.

You can track the progress for this task in PR #25.

Sorry for this abrupt end :)

@mariusor mariusor closed this as completed Sep 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants