KSP-SpaceDock / SpaceDock-Backend

Old-Experimantal-Backend (not finished, please ignore)
Other
5 stars 6 forks source link

Build instructions reference non-existent file #30

Closed HebaruSan closed 6 years ago

HebaruSan commented 6 years ago

Following the instructions in README.md up to this point:

https://github.com/KSP-SpaceDock/SpaceDock-Backend/blob/43a0c94fc550ac565dc38629b204818eb09caca0/README.md#L55-L59

... I have no build_sdb.go file. This causes the above command to fail.

Should this perhaps be sdb.go instead? It's the only .go file in the project's root folder.

Xinayder commented 6 years ago

Weird. Did you run build/fetch_plugins.sh and the other script in the folder?

On Fri, Feb 16, 2018, 12:42 AM HebaruSan notifications@github.com wrote:

Following the instructions in README.md up to this point:

https://github.com/KSP-SpaceDock/SpaceDock-Backend/blob/43a0c94fc550ac565dc38629b204818eb09caca0/README.md#L55-L59

... I have no build_sdb.go file. This causes the above command to fail.

Should this perhaps be sdb.go instead? It's the only .go file in the project's root folder.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/KSP-SpaceDock/SpaceDock-Backend/issues/30, or mute the thread https://github.com/notifications/unsubscribe-auth/ABMW-9OeIq8vAo9WbQ7-4tIvaQ2oaIouks5tVOsigaJpZM4SH0K0 .

HebaruSan commented 6 years ago

No I did not run build/fetch_plugins.sh, because it was contraindicated by the instructions:

https://github.com/KSP-SpaceDock/SpaceDock-Backend/blob/43a0c94fc550ac565dc38629b204818eb09caca0/README.md#L49-L52

I have no reason to "want" to use plugins at this point (I'd prefer a simple, stable build the first time around), and I know of no goland dependency URLs to enter into that file, since I don't know of any plugins. So I moved on to the next section.

HebaruSan commented 6 years ago

I did run build/install_glide.sh, though. It seemed to work fine, and $GOPATH/bin/glide now exists.

Xinayder commented 6 years ago

Does it work if you compile sdb.go instead? It should work since build_sdb.go is just sdb.go with plugins added to its imports.

On Fri, Feb 16, 2018, 12:50 AM HebaruSan notifications@github.com wrote:

No I did not run build/fetch_plugins.sh, because it was contraindicated by the instructions:

https://github.com/KSP-SpaceDock/SpaceDock-Backend/blob/43a0c94fc550ac565dc38629b204818eb09caca0/README.md#L49-L52

I have no reason to "want" to use plugins at this point (I'd prefer a simple, stable build the first time around), and I know of no goland dependency URLs to enter into that file, since I don't know of any plugins. So I moved on to the next section.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/KSP-SpaceDock/SpaceDock-Backend/issues/30#issuecomment-366130888, or mute the thread https://github.com/notifications/unsubscribe-auth/ABMW-wtFhj9fAv1OTJn_j90bFwR0feUNks5tVO0AgaJpZM4SH0K0 .

HebaruSan commented 6 years ago

Yes, this command seemed to work as expected:

go build -v -o ./sdb ./sdb.go

This gave me a ~20 MB sdb file in the current directory, as well as an exact copy of that file called SpaceDock-Backend.

HebaruSan commented 6 years ago

I get this when I run ./sdb:

2018/02/15 21:06:27 SpaceDock-Backend -- Version: {$VERSION}
2018/02/15 21:06:27 * Loading configuration file: config/config.yml
2018/02/15 21:06:27 * Establishing Database connection
2018/02/15 21:06:27 * Failed to connect to the database: Error 1045: Access denied for user ''@'localhost' (using password: NO)

I assume this is because my SQL environment isn't set up to host a SpaceDock data set. I'll try to figure out how to do that, but a "Database setup" section in README.md would be nice to have.

Xinayder commented 6 years ago

It's pretty easy, just setup the correct connection string in config.yml and then run sdb setup

On Fri, Feb 16, 2018, 1:09 AM HebaruSan notifications@github.com wrote:

I get this when I run ./sdb:

2018/02/15 21:06:27 SpaceDock-Backend -- Version: {$VERSION} 2018/02/15 21:06:27 Loading configuration file: config/config.yml 2018/02/15 21:06:27 Establishing Database connection 2018/02/15 21:06:27 * Failed to connect to the database: Error 1045: Access denied for user ''@'localhost' (using password: NO)

I assume this is because my SQL environment isn't set up to host a SpaceDock data set. I'll try to figure out how to do that, but a "Database setup" section in README.md would be nice to have.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/KSP-SpaceDock/SpaceDock-Backend/issues/30#issuecomment-366133104, or mute the thread https://github.com/notifications/unsubscribe-auth/ABMW-17-Zp5Tq2w8dksX6ZFfFziBhzPNks5tVPFtgaJpZM4SH0K0 .

HebaruSan commented 6 years ago

I tried guessing a string to see what errors came up:

dialect: "mysql"
connection-data: "server=127.0.0.1;uid=root;pwd=test;database=spacedockbackend"

I don't think that password is valid, but the error was about something else:

2018/02/15 21:20:29 * Failed to connect to the database: invalid DSN: missing the slash separating the database name

What is the format of this string supposed to be? None of the examples of connection strings I can find online include slashes.

Xinayder commented 6 years ago

postgresql://username:password@hostname:port/database

HebaruSan commented 6 years ago

The dialect setting defaulted to "mysql". I assume it should be "postgresql" to use those values?

Xinayder commented 6 years ago

Here's the one I use

dialect: "postgres"
connection-data: "postgresql://spacedock:spacedock@127.0.0.1/spacedock?sslmode=disable"

EDIT: after you setup your DB correctly, just run sdb setup and it should update the DB's structure with the required tables and fields.

HebaruSan commented 6 years ago

Thanks! Finally I got the expected failed authentication message. Now to figure out how to administer postgresql on Ubuntu...

Xinayder commented 6 years ago

Check the SpaceDock readme for more instructions on setting up PostgreSQL.

HebaruSan commented 6 years ago

... and a short SQL crash course later, ./sdb setup has finished running, and ./sdb says:

Serving HTTP on 0.0.0.0 port 5000 using httprouter

On to OpenDock!...

HebaruSan commented 6 years ago

Should this work for configuring Apache? It's been a few years and apparently some of the syntax has changed...

Alias "/OpenDock/" "/home/paul/Documents/src/gopath/src/github.com/KSP-SpaceDock/OpenDock/"
<Directory "/home/paul/Documents/src/gopath/src/github.com/KSP-SpaceDock/OpenDock/">
    AllowOverride All
    Require all granted
</Directory>

I get this in error.log:

[Thu Feb 15 22:53:29.198876 2018] [:error] [pid 25569] [client 127.0.0.1:60926] PHP Fatal error: Uncaught BadMethodCallException: Method notFound is not a valid method in /home/paul/Documents/src/gopath/src/github.com/KSP-SpaceDock/OpenDock/vendor/slim/slim/Slim/App.php:126\nStack trace:\n#0 /home/paul/Documents/src/gopath/src/github.com/KSP-SpaceDock/OpenDock/src/anonymus.php(41): Slim\App->__call('notFound', Array)\n#1 /home/paul/Documents/src/gopath/src/github.com/KSP-SpaceDock/OpenDock/index.php(47): require('/home/paul/Docu...')\n#2 {main}\n thrown in /home/paul/Documents/src/gopath/src/github.com/KSP-SpaceDock/OpenDock/vendor/slim/slim/Slim/App.php on line 126

I'm not sure whether notFound is supposed to be defined in OpenDock itself or a library.

StollD commented 6 years ago

Thanks! Finally I got the expected failed authentication message. Now to figure out how to administer postgresql on Ubuntu...

I recommend pgAdmin for that, it's a really nice tool

The README should be changed to specify that running the fetch_plugins script without having plugins defined just generates build_sdb.go without any changes.

However, OpenDock currently needs some of the plugins in SpaceDock-Extras, so here is my plugins.txt for reference: https://gist.github.com/StollD/686a2476b1c48eb899d1f5b3d9557434