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

Document Postgres setup #81

Closed
sshine opened this issue Jul 2, 2019 · 1 comment · Fixed by #82
Closed

Document Postgres setup #81

sshine opened this issue Jul 2, 2019 · 1 comment · Fixed by #82
Assignees
Labels
Projects

Comments

@sshine
Copy link
Contributor

sshine commented Jul 2, 2019

Doing stack build I get the following error:

--  While building package postgresql-libpq-0.9.4.2 using:
      /tmp/stack-9b8112fa643e992a/postgresql-libpq-0.9.4.2/.stack-work/dist/x86_64-linux/Cabal-2.4.0.1/setup/setup --builddir=.stack-work/dist/x86_64-linux/Cabal-2.4.0.1 configure --with-ghc=/home/simon/.stack/programs/x86_64-linux/ghc-8.6.5/bin/ghc --with-ghc-pkg=/home/simon/.stack/programs/x86_64-linux/ghc-8.6.5/bin/ghc-pkg --user --package-db=clear --package-db=global --package-db=/home/simon/.stack/snapshots/x86_64-linux/lts-13.26/8.6.5/pkgdb --libdir=/home/simon/.stack/snapshots/x86_64-linux/lts-13.26/8.6.5/lib --bindir=/home/simon/.stack/snapshots/x86_64-linux/lts-13.26/8.6.5/bin --datadir=/home/simon/.stack/snapshots/x86_64-linux/lts-13.26/8.6.5/share --libexecdir=/home/simon/.stack/snapshots/x86_64-linux/lts-13.26/8.6.5/libexec --sysconfdir=/home/simon/.stack/snapshots/x86_64-linux/lts-13.26/8.6.5/etc --docdir=/home/simon/.stack/snapshots/x86_64-linux/lts-13.26/8.6.5/doc/postgresql-libpq-0.9.4.2 --htmldir=/home/simon/.stack/snapshots/x86_64-linux/lts-13.26/8.6.5/doc/postgresql-libpq-0.9.4.2 --haddockdir=/home/simon/.stack/snapshots/x86_64-linux/lts-13.26/8.6.5/doc/postgresql-libpq-0.9.4.2 --dependency=Cabal=Cabal-2.4.1.0-9MZFDeNrcJI10bcroa6pq8 --dependency=base=base-4.12.0.0 --dependency=bytestring=bytestring-0.10.8.2 --dependency=unix=unix-2.7.2.2
    Process exited with code: ExitFailure 1

I spent a little time figuring out that on Ubuntu I need to apt install libpq-dev to compile this.

For running Postgres, I need to

$ sudo apt install postgresql postgresql-contrib
$ sudo service postgres start
$ sudo -u postgres psql
postgres=# create database "issue-wanted";
postgres=# create user simon;
postgres=# grant all privileges on database "issue-wanted" to simon;

I modified pg_hba.conf with the lines

local all simon          trust
host all simon 0.0.0.0/0 trust

(This is a little unsafe, I realize, but for some reason 127.0.0.1/8 didn't cut it.)

and changed user=simon in config.toml and added listen_address = '127.0.0.1' in /etc/postgresql/10/main/postgresql.conf.

I then restarted Postgres and initialized the database manually:

$ sudo service postgres restart
$ psql issue-wanted < sql/schema.sql
$ psql issue-wanted < sql/seed.sql
$ stack exec issue-wanted

At this point the /issues endpoint is responding positively!

Perhaps we should document some of this in README.md?

@sshine sshine changed the title Document external library dependencies Document Postgres setup Jul 2, 2019
@rashadg1030
Copy link
Collaborator

Thank you for finding! All of this is important. I will work on adding it to the README.

@rashadg1030 rashadg1030 self-assigned this Jul 2, 2019
@rashadg1030 rashadg1030 added this to Next week in GSoC 2019 via automation Jul 2, 2019
rashadg1030 added a commit that referenced this issue Jul 2, 2019
GSoC 2019 automation moved this from Next week to Done Jul 3, 2019
chshersh pushed a commit that referenced this issue Jul 3, 2019
* [#81] Update docs

Resolves #81
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
GSoC 2019
  
Done
Development

Successfully merging a pull request may close this issue.

2 participants