-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add ./start-graph - Remove ./docker-cleanup.sh (replaced by ./start-graph --reset) - Rename ./deploy to ./deploy-subgraph for clarity - Update README with new instructions
- Loading branch information
Showing
6 changed files
with
84 additions
and
46 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
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 |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { $, echo, minimist, question } from "zx"; | ||
|
||
const HELP = ` | ||
start-graph - start a Graph Node | ||
Usage: | ||
./start-graph [OPTIONS] | ||
Options: | ||
--reset Remove all containers and volumes. | ||
--help, -h Show this help message. | ||
`; | ||
|
||
const argv = minimist(process.argv.slice(2), { | ||
alias: { | ||
h: "help", | ||
}, | ||
boolean: [ | ||
"reset", | ||
"help", | ||
], | ||
}); | ||
|
||
async function resetCheck() { | ||
if (argv.reset) { | ||
return true; | ||
} | ||
const response = ( | ||
await question("Do you want to remove all containers and volumes? [y/N] ") | ||
).toLowerCase(); | ||
return response === "y" || response === "yes"; | ||
} | ||
|
||
export async function main() { | ||
if (argv.help) { | ||
echo`${HELP}`; | ||
process.exit(0); | ||
} | ||
|
||
$.verbose = true; | ||
|
||
if (await resetCheck()) { | ||
echo``; | ||
echo`Stopping and removing containers…`; | ||
echo``; | ||
await $`docker compose rm -fsv`; | ||
|
||
echo``; | ||
echo`Removing volumes…`; | ||
echo``; | ||
await $`docker volume rm subgraph_ipfs`; | ||
await $`docker volume rm subgraph_postgres`; | ||
} | ||
|
||
echo``; | ||
echo`Starting Graph Node…`; | ||
|
||
// TODO: handle SIGINT | ||
// process.on("SIGINT", async () => { | ||
// echo`Caught interrupt signal. Shutting down containers…`; | ||
// await $`docker compose down`; | ||
// process.exit(); | ||
// }); | ||
|
||
await $`docker compose up`; | ||
} |
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env -S pnpm exec tsx | ||
|
||
require("./cli/start-graph").main().catch(({ message }) => { | ||
console.error(""); | ||
console.error(` Error: ${message}`); | ||
console.error(""); | ||
process.exit(1); | ||
}); |