Skip to content

Commit

Permalink
DPLT-1084 Add support for Runner infrastructure (#166)
Browse files Browse the repository at this point in the history
  • Loading branch information
morgsmccauley authored Aug 7, 2023
1 parent c64e862 commit ca7aefd
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 15 deletions.
12 changes: 12 additions & 0 deletions runner/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM node:18.17 AS builder
WORKDIR /usr/src/app
COPY . .
RUN npm install
RUN npm run build

FROM node:18.17
WORKDIR /usr/src/app
COPY --from=builder /usr/src/app/package*.json ./
RUN npm install --omit=dev
COPY --from=builder /usr/src/app/dist ./dist
CMD [ "npm", "run", "start:docker" ]
6 changes: 4 additions & 2 deletions runner/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion runner/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
"version": "1.0.0",
"description": "",
"main": "index.js",
"engines": {
"node": "18.17"
},
"scripts": {
"build": "rm -rf ./dist && tsc",
"start": "npm run build && node dist/index.js",
"start:dev": "ts-node ./src/index.ts",
"start:docker": "node dist/index.js",
"test": "node --experimental-vm-modules ./node_modules/.bin/jest",
"lint": "eslint -c .eslintrc.js"
},
Expand All @@ -31,14 +35,14 @@
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-promise": "^6.1.1",
"jest": "^29.6.2",
"pluralize": "^8.0.0",
"prettier": "^3.0.0",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"typescript": "^5.1.6"
},
"dependencies": {
"@near-lake/primitives": "^0.1.0",
"pluralize": "^8.0.0",
"aws-sdk": "^2.1402.0",
"node-fetch": "^2.6.11",
"pg": "^8.11.1",
Expand Down
11 changes: 5 additions & 6 deletions runner/src/globals.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ declare namespace NodeJS {
export interface ProcessEnv {
HASURA_ENDPOINT: string
HASURA_ADMIN_SECRET: string
PG_HOST: string
PG_PORT: string
PG_ADMIN_USER: string
PG_ADMIN_PASSWORD: string
PG_ADMIN_DATABASE: string
REGION: string
PGHOST: string
PGPORT: string
PGUSER: string
PGPASSWORD: string
PGDATABASE: string
}
}
2 changes: 1 addition & 1 deletion runner/src/indexer/indexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default class Indexer {
this.network = network;
this.deps = {
fetch,
s3: new AWS.S3({ region: process.env.REGION }),
s3: new AWS.S3(),
provisioner: new Provisioner(),
...deps,
};
Expand Down
10 changes: 5 additions & 5 deletions runner/src/provisioner/provisioner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import PgClient from '../pg-client';
const DEFAULT_PASSWORD_LENGTH = 16;

const sharedPgClient = new PgClient({
user: process.env.PG_ADMIN_USER,
password: process.env.PG_ADMIN_PASSWORD,
database: process.env.PG_ADMIN_DATABASE,
host: process.env.PG_HOST,
port: Number(process.env.PG_PORT),
user: process.env.PGUSER,
password: process.env.PGPASSWORD,
database: process.env.PGDATABASE,
host: process.env.PGHOST,
port: Number(process.env.PGPORT),
});

export default class Provisioner {
Expand Down

0 comments on commit ca7aefd

Please sign in to comment.