From 82f650e81d0b36a984a95d110345904f1b500a63 Mon Sep 17 00:00:00 2001 From: Blair Vanderlugt Date: Sat, 1 May 2021 12:52:03 -0700 Subject: [PATCH] meta exit error fixed --- apps/cic-meta/docker/Dockerfile | 2 +- apps/cic-meta/docker/db.sh | 5 ++++- apps/cic-meta/docker/start_server.sh | 4 ++++ apps/cic-meta/scripts/initdb/server.postgres.sql | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/apps/cic-meta/docker/Dockerfile b/apps/cic-meta/docker/Dockerfile index ebfa884f..de6a66c5 100644 --- a/apps/cic-meta/docker/Dockerfile +++ b/apps/cic-meta/docker/Dockerfile @@ -2,7 +2,7 @@ FROM node:15.3.0-alpine3.10 WORKDIR /tmp/src/cic-meta -RUN apk add --no-cache postgresql +RUN apk add --no-cache postgresql bash COPY cic-meta/package.json \ ./ diff --git a/apps/cic-meta/docker/db.sh b/apps/cic-meta/docker/db.sh index 8b222fd6..a853a15f 100644 --- a/apps/cic-meta/docker/db.sh +++ b/apps/cic-meta/docker/db.sh @@ -1,3 +1,6 @@ #!/bin/bash +set -e + +PGPASSWORD=$DATABASE_PASSWORD psql -v ON_ERROR_STOP=1 -U $DATABASE_USER -h $DATABASE_HOST -p $DATABASE_PORT -d $DATABASE_NAME -f $SCHEMA_SQL_PATH + -PGPASSWORD=$DATABASE_PASSWORD psql -U $DATABASE_USER -h $DATABASE_HOST -p $DATABASE_PORT -d $DATABASE_NAME -f $SCHEMA_SQL_PATH diff --git a/apps/cic-meta/docker/start_server.sh b/apps/cic-meta/docker/start_server.sh index 5c3ced7e..74d91125 100644 --- a/apps/cic-meta/docker/start_server.sh +++ b/apps/cic-meta/docker/start_server.sh @@ -1,3 +1,7 @@ +#!/bin/bash +set -euo pipefail + +# db migration sh ./db.sh # /usr/local/bin/node /usr/local/bin/cic-meta-server $@ diff --git a/apps/cic-meta/scripts/initdb/server.postgres.sql b/apps/cic-meta/scripts/initdb/server.postgres.sql index 3eb032ba..93a2d13a 100755 --- a/apps/cic-meta/scripts/initdb/server.postgres.sql +++ b/apps/cic-meta/scripts/initdb/server.postgres.sql @@ -1,4 +1,4 @@ -create table if not exists cic_meta.store ( +create table if not exists store ( id serial primary key not null, owner_fingerprint text not null, hash char(64) not null unique,