Skip to content

Commit

Permalink
Add advanced example for PostgreSQL connection
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenzoAncora authored and arp242 committed Feb 16, 2022
1 parent 5738869 commit 0b6b90a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,17 @@ To use PostgreSQL run GoatCounter with a custom `-db` flag; for example:
This follows the format in the `psql` CLI; you can also use the `PG*`
environment variables:

$ PGDATABASE=goatcounter DBHOST=/run/postgresql goatcounter serve -db 'postgresql'
$ PGDATABASE=goatcounter DBHOST=/run/postgresql goatcounter serve -db 'postgresql'

The database will be created automatically if possible; if you want to create it
for a specific user you can use:

$ createuser --interactive --pwprompt goatcounter
$ createdb --owner goatcounter goatcounter

You can manually import the schema with:

$ goatcounter db schema-pgsql | psql --user=goatcounter --dbname=goatcounter

See `goatcounter help db` and the [pq docs][pq] for more details.

Expand Down

0 comments on commit 0b6b90a

Please sign in to comment.