-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #62 from tkiapril/chore/remove-dataproxy
Remove dataproxy
- Loading branch information
Showing
27 changed files
with
80 additions
and
5,207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
# default env file, to prevent Deno dotenv from complaining for optional values | ||
|
||
DATABASE_URL="('DATABASE_URL'_was_not_provided)" | ||
DIRECT_URL="('DIRECT_URL'_was_not_provided)" | ||
CHAIN_DEFINITION_URL="('CHAIN_DEFINITION_URL'_was_not_provided)" | ||
AMQP_BROKER_URL="('AMQP_BROKER_URL'_was_not_provided)" | ||
API_URL="('API_URL'_was_not_provided)" | ||
API_BEHIND_REVERSE_PROXY="false" | ||
WEBUI_URL="('WEBUI_URL'_was_not_provided)" | ||
BLOCK_FINALITY="('BLOCK_FINALITY'_was_not_provided)" | ||
DATAPROXY_INTERNAL_PORT="0" | ||
LOG_LEVEL="WARNING" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,12 +8,10 @@ import { parseOptions } from "amqp/src/amqp_connect_options.ts"; | |
import { broker } from "https://deno.land/x/[email protected]/mod.ts"; | ||
|
||
import { api } from "./api.ts"; | ||
import { dataproxy, generateDataproxy } from "./dataproxy.ts"; | ||
import { emitter } from "./emitter.ts"; | ||
import { AmqpBrokerUrlEnvKey, combinedEnv } from "./envUtils.ts"; | ||
import { | ||
ApiLoggerName, | ||
DataproxyLoggerName, | ||
defaultLogFormatter, | ||
DevLoggerName, | ||
EmitterLoggerName, | ||
|
@@ -23,30 +21,24 @@ import { | |
WebLoggerName, | ||
} from "./logUtils.ts"; | ||
import { observer } from "./observer.ts"; | ||
import { getSchemaPath, shouldUseDataproxy } from "./prismaSchemaUtils.ts"; | ||
import { | ||
block, | ||
type CleanupFunction, | ||
runWithAmqp, | ||
runWithChainDefinition, | ||
runWithPrisma, | ||
} from "./runHelpers.ts"; | ||
import { testWebhookReceiver } from "./testWebhookReceiver.ts"; | ||
|
||
async function prepareAndMain() { | ||
await new Deno.Command("deno", { | ||
args: ["task", "prisma-generate"], | ||
const status = await new Deno.Command("deno", { | ||
args: ["task", "prisma", "db", "push"], | ||
stdout: "inherit", | ||
stderr: "inherit", | ||
}).spawn().status; | ||
await new Deno.Command("deno", { | ||
if (!status.success) Deno.exit(status.code); | ||
new Deno.Command("deno", { | ||
args: [ | ||
"run", | ||
...( | ||
await shouldUseDataproxy() | ||
? ["--unsafely-ignore-certificate-errors=localhost"] | ||
: [] | ||
), | ||
"--allow-read", | ||
"--allow-write", | ||
"--allow-env", | ||
|
@@ -62,7 +54,7 @@ async function prepareAndMain() { | |
cwd: Deno.cwd(), | ||
uid: Deno.uid() !== null ? Deno.uid()! : undefined, | ||
gid: Deno.gid() !== null ? Deno.gid()! : undefined, | ||
}).spawn().status; | ||
}).spawn().ref(); | ||
} | ||
|
||
async function main() { | ||
|
@@ -95,10 +87,6 @@ async function main() { | |
level: "DEBUG", | ||
handlers: ["console"], | ||
}, | ||
[DataproxyLoggerName]: { | ||
level: "DEBUG", | ||
handlers: ["console"], | ||
}, | ||
[TestWebhookReceiverLoggerName]: { | ||
level: "INFO", | ||
handlers: ["console"], | ||
|
@@ -112,24 +100,6 @@ async function main() { | |
|
||
const logger = getLogger(DevLoggerName); | ||
|
||
let useDataproxy: boolean; | ||
try { | ||
useDataproxy = await shouldUseDataproxy(); | ||
} catch (e) { | ||
logger.critical( | ||
`Irrecoverable error, could not load ${ | ||
getSchemaPath({ useParams: true }) | ||
}.`, | ||
); | ||
throw e; | ||
} | ||
if (useDataproxy) { | ||
logger.warning( | ||
"Using data proxy, as sqlite is being used for the database.", | ||
); | ||
await generateDataproxy(); | ||
} | ||
|
||
logger.debug( | ||
`Serving AMQP Broker, URL: ${combinedEnv[AmqpBrokerUrlEnvKey]}.`, | ||
); | ||
|
@@ -138,8 +108,6 @@ async function main() { | |
hostname: amqpOptions.hostname, | ||
port: amqpOptions.port, | ||
}); | ||
let cleanupDataProxy: CleanupFunction | undefined; | ||
if (useDataproxy) ({ cleanup: cleanupDataProxy } = await dataproxy()); | ||
try { | ||
await runWithChainDefinition((chain) => ({ | ||
runningPromise: runWithPrisma(async (prisma) => { | ||
|
@@ -176,7 +144,6 @@ async function main() { | |
}), | ||
})); | ||
} finally { | ||
if (cleanupDataProxy !== undefined) await cleanupDataProxy(); | ||
abortBroker(); | ||
} | ||
} | ||
|
Oops, something went wrong.