Skip to content
Snippets Groups Projects
Select Git revision
  • master default protected
1 result

postgrest-formula

  • Clone with SSH
  • Clone with HTTPS
  • The postgrest-formula is used to deploy postgREST instances.

    Configuration

    Have a look at the pillar.example (which is used for testing as well) to get an idea of how it works.

    /srv/pillar/postgrest/your_instance.sls:

    postgrest:
      your_instance:
        tag: v5.2.0
        hash: '5f564d1c6dfad2fd25d5394c2cae42ebe0d736342eba25742cd45d2cbf61cf38'
        config:
          db-uri: "postgres://api_v2_authenticator@127.0.0.1/api_db"
          db-schema: "api_v2"
          jwt-secret: "aimi6fiep2ohPahqu6Jithahphai1aJe"
          db-anon-role: "api_v2_anonymous"
          server-host: 0.0.0.0

    /srv/pillar/top.sls:

    base:
      'your_instance*':
        - postgrest.your_instance

    But how do I know all these values?

    tag: Pick a release, that's your tag. hash: Since as of now there are no hashes provided on github, you have to do it yourself:

    sha256sum postgrest-v5.2.0-ubuntu.tar.xz
    5f564d1c6dfad2fd25d5394c2cae42ebe0d736342eba25742cd45d2cbf61cf38  postgrest-v5.2.0-ubuntu.tar.xz

    config: This is postgREST specific configuration as explained here

    How do I know the jwt-secret though?

    You don't. You generate it: pwgen -sn 32

    Development

    Dependencies

    This formula relies on vagrant and virtualbox as its provider.

    Since PostgREST connects to a schema of a PostgreSQL database you should have one running somewhere. If it's running on localhost be aware that inside of your box localhost does not refer to your host's localhost but rather to the emulated one. You can access your host's localhost through 10.0.2.2 instead (see pillar.example).

    Getting started

    git clone ssh://git@lab.it.hs-hannover.de:2222/salt/postgrest-formula.git
    cd postgrest-formula
    vagrant up

    Add these 2 lines to your /etc/hosts:

    127.0.0.1   apiv2.postgrest.local
    127.0.0.1   icmscache.postgrest.local

    You can access your PostgREST instances at:

    • apiv2.postgrest.local:4431
    • icmscache.postgrest.local:4431
    • apiv2.postgrest.local:4432
    • icmscache.postgrest.local:4432

    nginx

    This formula is capable of installing and configuring nginx. Therefore you need to have an nginx block below your instance configuration as you can see in pillar.example. If you omit this block the formula does not care about nginx. This is useful, if you want to use the nginx formula.