Skip to content

Commit

Permalink
chore: update pgrest (#816)
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos authored Dec 28, 2021
1 parent b5710d2 commit 574baad
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 60 deletions.
2 changes: 1 addition & 1 deletion packages/db/postgres/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3.6'

services:
rest:
image: postgrest/postgrest:v8.0.0
image: postgrest/postgrest:v9.0.0
depends_on:
- db
restart: always
Expand Down
33 changes: 22 additions & 11 deletions packages/infra/heroku/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ heroku login --interactive
heroku apps:create web3-storage-staging --team=web3-storage
heroku apps:create web3-storage-prod --team=web3-storage

# # Add PostgreSQL databases
# Add PostgreSQL databases
heroku addons:create heroku-postgresql:premium-4 --app=web3-storage-staging --name=web3-storage-staging-0
heroku addons:create heroku-postgresql:premium-4 --app=web3-storage-prod --name=web3-storage-prod-0

Expand All @@ -34,8 +34,8 @@ heroku pg:psql web3-storage-prod-0 --app=web3-storage-prod
# Create PostgREST staging and production apps and connect them to staging/production DBs
# https://elements.heroku.com/buildpacks/postgrest/postgrest-heroku
# (App name has 30 char limit)
heroku apps:create web3-storage-pgrest-staging --buildpack https://github.com/PostgREST/postgrest-heroku --team=web3-storage
heroku apps:create web3-storage-pgrest-prod --buildpack https://github.com/PostgREST/postgrest-heroku --team=web3-storage
heroku apps:create web3-storage-pgrest-staging --buildpack https://github.com/hugomrdias/postgrest-heroku --team=web3-storage
heroku apps:create web3-storage-pgrest-prod --buildpack https://github.com/hugomrdias/postgrest-heroku --team=web3-storage

# Bump dyno sizes
heroku dyno:resize web=standard-1x --app web3-storage-pgrest-staging
Expand All @@ -58,21 +58,32 @@ heroku pg:credentials:create web3-storage-prod-0 --name=web3_storage --app=web3-
heroku pg:psql web3-storage-staging-0 --app=web3-storage-staging < grant-postgrest.sql
heroku pg:psql web3-storage-prod-0 --app=web3-storage-prod < grant-postgrest.sql

# Configure the DB_URI and JWT_SECRET for PostgREST
heroku config:set DB_URI=$(heroku config:get DATABASE_URL --app=web3-storage-staging) --app=web3-storage-pgrest-staging
heroku config:set DB_URI=$(heroku config:get DATABASE_URL --app=web3-storage-prod) --app=web3-storage-pgrest-prod
# Obtain secret from 1password vault!
heroku config:set JWT_SECRET="supersecret" --app=web3-storage-pgrest-staging
heroku config:set JWT_SECRET="supersecret" --app=web3-storage-pgrest-prod
# Attach databases to apps
heroku addons:attach web3-storage-prod-0 --app=web3-storage-pgrest-prod
heroku addons:attach web3-storage-replica-0 --app=web3-storage-pgrest-prod
heroku addons:attach web3-storage-staging-0 --app=web3-storage-pgrest-staging

# PGREST config vars
heroku config:set DB_ANON_ROLE=web_anon --app=web3-storage-pgrest-prod
heroku config:set DB_POOL=450 --app=web3-storage-pgrest-prod
heroku config:set DB_SCHEMA=public --app=web3-storage-pgrest-prod
heroku config:set JWT_SECRET=secret --app=web3-storage-pgrest-prod # Obtain secret from 1password vault!
heroku config:set POSTGREST_VER=9.0.0 --app=web3-storage-pgrest-prod

heroku config:set DB_ANON_ROLE=web_anon --app=web3-storage-pgrest-staging
heroku config:set DB_POOL=450 --app=web3-storage-pgrest-staging
heroku config:set DB_SCHEMA=public --app=web3-storage-pgrest-staging
heroku config:set JWT_SECRET=secret --app=web3-storage-pgrest-staging # Obtain secret from 1password vault!
heroku config:set POSTGREST_VER=9.0.0 --app=web3-storage-pgrest-staging

# Deploy
cd postgrest/
git init
git add -A
git commit -m "chore: configure postgrest"

heroku git:remote --app=web3-storage-pgrest-staging
git push heroku main
heroku git:remote --app=web3-storage-pgrest-staging --remote staging
git push staging main
heroku git:remote --app=web3-storage-pgrest-prod
git push heroku main
# go back to heroku directory
Expand Down
45 changes: 0 additions & 45 deletions packages/infra/heroku/postgrest/env-to-config

This file was deleted.

3 changes: 0 additions & 3 deletions packages/infra/heroku/postgrest/postgrest.conf

This file was deleted.

0 comments on commit 574baad

Please sign in to comment.