-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dockerize processor & query-node (#146)
* Update Dockerfile for building image for processor/query-node * Compose docker images for processor & query-node * Delete old dockerfiles * Add commands for processor & query-node * Update host in env files * Run processor as a container * Keep containers out of the network * Publish ports while starting the container * Create script for query-node * Add command for stopping processor * Update args received by scripts * Assign container_name for processor services * Reorder package scripts alphabetically * Enhance start command for query-node * Rename container names to avoid conflicts * Replace npm with yarn command
- Loading branch information
1 parent
b9140c1
commit 8b8d889
Showing
14 changed files
with
91 additions
and
106 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
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 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
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 |
---|---|---|
@@ -1,14 +1,21 @@ | ||
#!/bin/sh | ||
cd indexer && docker-compose down --remove-orphans | ||
cd indexer | ||
|
||
# Control points of indexer | ||
if [ "$2" = "up" ]; then | ||
cmd="up -d" | ||
else | ||
cmd=$2 | ||
fi | ||
|
||
# Index data from local-network or battery-station or main-net by passing below argument | ||
# Details are specified in docker-compose*.yml files in indexer directory | ||
if [ "$1" = "--local" ]; then | ||
docker-compose -f ./docker-compose.yml -f ./docker-compose.local.yml up -d | ||
elif [ "$1" = "--testnet" ]; then | ||
docker-compose -f ./docker-compose.yml -f ./docker-compose.testnet.yml up -d | ||
elif [ "$1" = "--mainnet" ]; then | ||
docker-compose -f ./docker-compose.yml -f ./docker-compose.mainnet.yml up -d | ||
if [ "$1" = "local" ]; then | ||
docker-compose -f ./docker-compose.yml -f ./docker-compose.local.yml $cmd | ||
elif [ "$1" = "testnet" ]; then | ||
docker-compose -f ./docker-compose.yml -f ./docker-compose.testnet.yml $cmd | ||
elif [ "$1" = "mainnet" ]; then | ||
docker-compose -f ./docker-compose.yml -f ./docker-compose.mainnet.yml $cmd | ||
else | ||
echo "Please specify --local or --testnet or --mainnet" | ||
echo "First argument should be `local` or `testnet` or `mainnet`" | ||
fi |
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,30 +1,38 @@ | ||
#!/bin/sh | ||
|
||
# Control points of processor | ||
if [ "$1" = "--start" ]; then | ||
yarn install --frozen-lockfile | ||
echo "Starting processor" | ||
yarn db:up && yarn redis:up && yarn db:reset && yarn db:migrate | ||
elif [ "$1" = "--resume" ]; then | ||
echo "Resuming processor" | ||
if [ "$1" = "stop" ]; then | ||
echo "Stopping processor..." | ||
docker stop zeitgeist-query-node | ||
docker stop zeitgeist-processor | ||
exit | ||
fi | ||
|
||
if [ "$2" = "start" ]; then | ||
echo "Building processor..." | ||
docker build . --target processor -t processor | ||
docker build . --target query-node -t query-node | ||
echo "Starting processor..." | ||
yarn db:up && yarn redis:up && yarn db:reset && yarn db:migrate | ||
elif [ "$2" = "resume" ]; then | ||
echo "Resuming processor..." | ||
else | ||
echo "Please specify first argument with --start or --resume" | ||
exit | ||
echo "Second argument should be either `start` or `resume`" | ||
exit | ||
fi | ||
|
||
# Process data from local-network or battery-station or main-net by passing below argument | ||
if [ "$2" = "--local" ]; then | ||
yarn build && NODE_ENV=local node lib/processor/index.js | ||
elif [ "$2" = "--dev" ]; then | ||
yarn build && NODE_ENV=dev node lib/processor/index.js | ||
elif [ "$2" = "--t1" ]; then | ||
yarn build && NODE_ENV=t1 node lib/processor/index.js | ||
elif [ "$2" = "--t2" ]; then | ||
yarn build && NODE_ENV=t2 node lib/processor/index.js | ||
elif [ "$2" = "--m1" ]; then | ||
yarn build && NODE_ENV=m1 node lib/processor/index.js | ||
elif [ "$2" = "--m2" ]; then | ||
yarn build && NODE_ENV=m2 node lib/processor/index.js | ||
# For Linux, add --network=host | ||
if [ "$1" = "dev" ]; then | ||
docker run -d -p 9090:9090 --rm -e NODE_ENV=dev --env-file=.env.dev --name=zeitgeist-processor processor | ||
docker run -d -p 4350:4350 --rm -e NODE_ENV=dev --env-file=.env.dev --name zeitgeist-query-node query-node | ||
elif [ "$1" = "local" ]; then | ||
sleep 10 # Wait for local node to be up | ||
docker run -d --network=host --rm -e NODE_ENV=local --env-file=.env.local --name=zeitgeist-processor processor | ||
docker run -d --network=host --rm -e NODE_ENV=local --env-file=.env.local --name=zeitgeist-query-node query-node | ||
elif [ "$1" = "t1" ] || [ "$1" = "t2" ] || [ "$1" = "m1" ] || [ "$1" = "m2" ]; then | ||
docker run -d --network=host --rm -e NODE_ENV=$1 --env-file=.env.$1 --name=zeitgeist-processor processor | ||
docker run -d --network=host --rm -e NODE_ENV=$1 --env-file=.env.$1 --name=zeitgeist-query-node query-node | ||
else | ||
echo "Please specify second argument with --local or --dev" | ||
echo "First argument should be either `local` or `dev`" | ||
fi |
This file was deleted.
Oops, something went wrong.