commercialhaskell/stackage-server

List issue tracker website link on package page

Opened this issue · 13 comments

Also would be nice: detect if a package has a Github repo, and include an explicit Github link

We are trying to contribute to this. After adding necessary changes, we tried to build a server locally, and being stuck with this error:

SqlError {sqlState = "42P01", sqlExecStatus = FatalError, sqlErrorMsg = "relation \"snapshot\" does not exist", sqlErrorDetail = "", sqlErrorHint = ""}

What we did is:

  • installed PostgreSQL on local
  • Created a user stackage with same password as user's name
  • Created a Stackage DB

Can you help us resolve this error? Thank you.

Sorry about that, the docs are out of date. You'll need to run the cron job to create and populate the database. Can you try stack exec stackage-server-cron? You'll need to export PGSTRING=... first.

We tried stack exec stackage-server-cron, but it requires credential...

You'd have to give it the credentials for your local server.

@snoyberg Hmm... then, can you think of anything about this error?

$ stack exec stackage-server-cron
stackage-server-cron: MissingFileError "/home/bm12/.aws/credentials"

@pythonissam This is how amazonka normally works: AWS credentials are extracted form the environment in a similar way that aws-cli does it: you can either place them in
$HOME/.aws/credentials in format:

[default]
aws_secret_access_key=...
aws_access_key_id=...

or set them as environment variables
AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY

psibi commented

@lehins I think @pythonissam is trying to setup stackage server locally. Is that possible ?

@psibi I am not really sure, as I never dealt with stackage insides before, but by taking a quick look at the script: https://github.com/fpco/stackage-server/blob/master/src/Stackage/Database/Cron.hs#L78, one of the things it's trying to do is upload a snapshot.json file and hoogledb onto an S3 bucket with name "haddock.stackage.org", which kinda needs AWS credentials ;)

I am just familiar with an error @pythonissam is getting, so I decided to comment with a way it can be solved.

psibi commented

@lehins Thanks for the explanation!

@pythonissam Running stackage-server locally seems slight problematic now: d7a0371

I'm working on this to resolve this so that stackage-server can be built locally without any issues. I will submit a PR in a couple of days. But if you are curious to try, I have updated the README and the code to work in my experimental branch: https://github.com/psibi/stackage-server/tree/local-installation

psibi commented

I have created a PR which will hopefully make installation of stackage-server locally easy: #257

@psibi the PR has been merged, but the "missing file .aws/credentials" error is still there; was that intentional?

@develop7 stackage-server-cron has changed quite a bit since that PR has been merged. Unfortunately aws credentials file is required for the cron job due to amazonka, there is no way around it, since it relies heavily on S3.

What you can try is placing an empty file in .aws/credentials and running the cron job with --do-not-upload flag, which will only use AWS S3 for looking at haddock files, but will not try to upload any hoogle related files, which then will not rely on actual credentials being valid. (Another hacky way would be setting AWS_ variables to bogus values.)

The point is that the requirement of credentials being present comes from amaznoka, not from stackage-server, despite that they might not be used (eg. --do-not-upload is passed)

@lehins empty credentials file was not enough, only bogus credentials and --do-not-upload did the job. Thank you for the tip.