Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions docker-compose/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,3 @@ DB_USER=myuser
DB_PASSWORD=mypassword
DB_NAME=mydatabase
DOCKER_NETWORK=backend
WALLET_JSON = '{
"kty": "RSA",
"e": "test",
"n": "test",
"d": "test",
"p": "test",
"q": "test",
"dp": "test",
"dq": "test",
"qi": "test"
}'
1 change: 0 additions & 1 deletion docker-compose/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ services:
DB_PASSWORD: ${DB_PASSWORD:-mypassword}
DB_NAME: ${DB_NAME:-mydatabase}
PATH_TO_WALLET: /app/wallet.json # Path inside the container
WALLET_JSON: ${WALLET_JSON}
DOCKER_NETWORK: backend # Passing the network name
networks:
- backend
Expand Down
12 changes: 7 additions & 5 deletions orchestrator/src/app.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import { readFile } from 'node:fs/promises';
import Docker from 'dockerode';
import AWS from 'aws-sdk';
import { connectWithRetry, setupDatabase } from './db_tools.js';
import Arweave from 'arweave';
import { checkAndFetchIfNeeded, cleanupFulfilledEntries, getProviderRequests, processChallengeRequests, processOutputRequests, shutdown } from './helperFunctions.js';
import {monitorDockerContainers } from './containerManagment.js';


if (!process.env.PATH_TO_WALLET) {
console.error("Env var PATH_TO_WALLET is not set!");
process.exit(1);
}

export const docker = new Docker();
export const ecs = new AWS.ECS({ region: process.env.AWS_REGION || 'us-east-1' });
Expand Down Expand Up @@ -126,10 +130,8 @@ async function run(): Promise<void> {
const client = await connectWithRetry();
await setupDatabase(client);

arweave.wallets.jwkToAddress(JSON.parse(process.env.WALLET_JSON!)).then((address) => {
console.log(address);
PROVIDER_ID = address
});
const providerAddress = arweave.wallets.jwkToAddress(JSON.parse(await readFile(process.env.PATH_TO_WALLET!, 'utf8')));
console.log('Provider address:', providerAddress);

// setInterval(async () => {
// const res = await client.query('SELECT COUNT(*) as count FROM time_lock_puzzles');
Expand Down
3 changes: 2 additions & 1 deletion orchestrator/src/helperFunctions.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { readFile } from 'node:fs/promises';
import { GetOpenRandomRequestsResponse, GetProviderAvailableValuesResponse, Logger, LogLevel, RandomClient, RequestList } from "ao-process-clients";
import { Client } from "pg";
import { COMPLETION_RETENTION_PERIOD_MS, MINIMUM_ENTRIES, UNCHAIN_VS_OFFCHAIN_MAX_DIF } from "./app";
Expand Down Expand Up @@ -27,7 +28,7 @@ export async function getRandomClient(): Promise<RandomClient> {
if (!randomClientInstance || (currentTime - lastInitTime) > REINIT_INTERVAL) {
randomClientInstance = ((await RandomClient.defaultBuilder()))
//.withAOConfig(AO_CONFIG)
.withWallet(JSON.parse(process.env.WALLET_JSON!))
.withWallet(JSON.parse(await readFile(process.env.PATH_TO_WALLET!, 'utf8')))
.build();
lastInitTime = currentTime;
}
Expand Down