diff --git a/apps/cic-meta/.config/pgp.ini b/apps/cic-meta/.config/pgp.ini index 8c8826cd..60925980 100644 --- a/apps/cic-meta/.config/pgp.ini +++ b/apps/cic-meta/.config/pgp.ini @@ -1,5 +1,5 @@ [pgp] -exports_dir = pgp +exports_dir = /root/pgp privatekey_file = privatekeys.asc passphrase = merman publickey_trusted_file = publickeys.asc diff --git a/apps/cic-meta/docker/Dockerfile b/apps/cic-meta/docker/Dockerfile index f81e6720..ebfa884f 100644 --- a/apps/cic-meta/docker/Dockerfile +++ b/apps/cic-meta/docker/Dockerfile @@ -2,26 +2,31 @@ FROM node:15.3.0-alpine3.10 WORKDIR /tmp/src/cic-meta +RUN apk add --no-cache postgresql + COPY cic-meta/package.json \ ./ COPY cic-meta/src/ src/ COPY cic-meta/tests/ tests/ COPY cic-meta/scripts/ scripts/ -#COPY docker/*.sh /root/ - -RUN alias tsc=node_modules/typescript/bin/tsc RUN npm install +# see exports_dir gpg.ini +COPY cic-meta/tests/*.asc /root/pgp/ +RUN alias tsc=node_modules/typescript/bin/tsc + + COPY cic-meta/.config/ /usr/local/etc/cic-meta/ # COPY cic-meta/scripts/server/initdb/server.postgres.sql /usr/local/share/cic-meta/sql/server.sql COPY cic-meta/docker/db.sh ./db.sh RUN chmod 755 ./db.sh -RUN alias ts-node=/tmp/src/cic-meta/node_modules/ts-node/dist/bin.js -ENTRYPOINT [ "./node_modules/ts-node/dist/bin.js", "./scripts/server/server.ts" ] +#RUN alias ts-node=/tmp/src/cic-meta/node_modules/ts-node/dist/bin.js +#ENTRYPOINT [ "./node_modules/ts-node/dist/bin.js", "./scripts/server/server.ts" ] -# COPY cic-meta/docker/start_server.sh ./start_server.sh -# RUN chmod 755 ./start_server.sh +COPY cic-meta/docker/start_server.sh ./start_server.sh +RUN chmod 755 ./start_server.sh +ENTRYPOINT ["sh", "./start_server.sh"] diff --git a/apps/cic-meta/docker/db.sh b/apps/cic-meta/docker/db.sh index 78b97359..8b222fd6 100644 --- a/apps/cic-meta/docker/db.sh +++ b/apps/cic-meta/docker/db.sh @@ -1,3 +1,3 @@ #!/bin/bash -PGPASSWORD=$DATABASE_PASSWORD psql -U $DATABASE_USER -h $DATABASE_HOST -p $DATABASE_PORT -d $DATABASE_NAME /usr/local/share/cic-meta/sql/server.sql +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 ff11d35e..5c3ced7e 100644 --- a/apps/cic-meta/docker/start_server.sh +++ b/apps/cic-meta/docker/start_server.sh @@ -1,3 +1,5 @@ sh ./db.sh -/usr/local/bin/node /usr/local/bin/cic-meta-server $@ +# /usr/local/bin/node /usr/local/bin/cic-meta-server $@ +# ./node_modules/ts-node/dist/bin.js", "./scripts/server/server.ts $@ +npm run start "$@" diff --git a/apps/cic-meta/package.json b/apps/cic-meta/package.json index fd3bd050..a04d01dc 100644 --- a/apps/cic-meta/package.json +++ b/apps/cic-meta/package.json @@ -10,7 +10,8 @@ "build-server": "tsc -d --outDir dist-server scripts/server/*.ts", "pack": "node_modules/typescript/bin/tsc -d --outDir dist && webpack", "clean": "rm -rf dist", - "prepare": "npm run build && npm run build-server" + "prepare": "npm run build && npm run build-server", + "start": "./node_modules/ts-node/dist/bin.js ./scripts/server/server.ts" }, "dependencies": { "@ethereumjs/tx": "^3.0.0-beta.1", diff --git a/apps/cic-meta/scripts/initdb/postgresql.sh b/apps/cic-meta/scripts/initdb/postgresql.sh deleted file mode 100755 index 75b8ac07..00000000 --- a/apps/cic-meta/scripts/initdb/postgresql.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -set -e - -psql -v ON_ERROR_STOP=1 --username grassroots --dbname cic_meta <<-EOSQL - create table if not exists store ( - id serial primary key not null, - owner_fingerprint text not null, - hash char(64) not null unique, - content text not null - ); - - create index if not exists idx_fp on store ((lower(owner_fingerprint))); -EOSQL - - diff --git a/docker-compose.yml b/docker-compose.yml index dc18fe7d..15261f30 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -53,8 +53,6 @@ services: command: [ "-c", "max_connections=200" ] volumes: - ./scripts/initdb/create_db.sql:/docker-entrypoint-initdb.d/1-create_all_db.sql - - ./apps/cic-meta/scripts/initdb/postgresql.sh:/docker-entrypoint-initdb.d/2-init-cic-meta.sh - - ./apps/cic-cache/db/psycopg2/db.sql:/docker-entrypoint-initdb.d/3-init-cic-meta.sql - postgres-db:/var/lib/postgresql/data redis: @@ -477,6 +475,7 @@ services: PGP_PUBLICKEY_TRUSTED_FILE: publickeys.asc PGP_PUBLICKEY_ACTIVE_FILE: publickeys.asc PGP_PUBLICKEY_ENCRYPT_FILE: publickeys.asc + SCHEMA_SQL_PATH: scripts/initdb/server.postgres.sql ports: - ${HTTP_PORT_CIC_META:-63380}:8000 depends_on: