Skip to content

Commit

Permalink
refactoring for all node types
Browse files Browse the repository at this point in the history
  • Loading branch information
iDmple committed Dec 17, 2023
1 parent 977b2b8 commit 141d971
Show file tree
Hide file tree
Showing 10 changed files with 90 additions and 35 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.DS_Store
node_modules
conf.*.private.yaml
conf.yaml
conf.*.yaml
.env
dist
data
46 changes: 46 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
version: '3.9'

services:
unchained_local:
image: ghcr.io/kenshitech/unchained:latest
container_name: unchained_local
hostname: unchained_local
user: "${UID_GID}"
volumes:
- ./conf.local.yaml:/app/conf.yaml
depends_on:
- mongodb
profiles: ["local"]
restart: always

mongodb:
image: mongodb/mongodb-community-server:7.0.4-ubuntu2204
container_name: mongodb
hostname: mongodb
user: "${UID_GID}"
env_file:
- .env
volumes:
- ./data:/data/db
profiles: ["local"]
restart: always

unchained_lite:
image: ghcr.io/kenshitech/unchained:latest
container_name: unchained_lite
hostname: unchained_lite
user: "${UID_GID}"
volumes:
- ./conf.lite.yaml:/app/conf.yaml
profiles: ["lite"]
restart: always

unchained_atlas:
image: ghcr.io/kenshitech/unchained:latest
container_name: unchained_atlas
hostname: unchained_atlas
user: "${UID_GID}"
volumes:
- ./conf.atlas.yaml:/app/conf.yaml
profiles: ["atlas"]
restart: always
20 changes: 0 additions & 20 deletions compose.yml

This file was deleted.

7 changes: 7 additions & 0 deletions conf.atlas.yaml.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
log: info
name: <name>
rpc:
ethereum: https://ethereum.publicnode.com
database:
url: mongodb+srv://<user>:<password>@<url>/?retryWrites=true&w=majority
name: unchained
5 changes: 5 additions & 0 deletions conf.lite.yaml.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
log: info
lite: true
name: <name>
rpc:
ethereum: https://ethereum.publicnode.com
File renamed without changes.
7 changes: 0 additions & 7 deletions start_node.sh

This file was deleted.

3 changes: 0 additions & 3 deletions stop_node.sh

This file was deleted.

31 changes: 31 additions & 0 deletions unchained.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

usage() {
echo "Usage: $0 [node] [options]"
echo "Node:"
echo " local - Manage unchained local node"
echo " atlas - Manage unchained atlas node"
echo " lite - Manage unchained lite node"
echo "Options:"
echo " Additional options passed directly to 'docker compose'"
echo "Examples:"
echo " To start a node: $0 local up -d"
echo " To stop a node: $0 local stop"
echo " To view the status of a node: $0 local ps"
echo " To view logs of a node: $0 local logs -f"
}

if [ ! $1 == 'local' ] && [ ! $1 == 'atlas' ] && [ ! $1 == 'lite' ] ; then
usage
exit 1
fi

UID_GID="$(id -u):$(id -g)"

if [ $2 == 'up' ] ; then
if [ $1 == 'local' ] && [ ! -d 'data' ]; then
mkdir data
fi
fi

UID_GID=$UID_GID COMPOSE_PROFILES=$1 docker compose "${@:2}"
3 changes: 0 additions & 3 deletions view_node.sh

This file was deleted.

0 comments on commit 141d971

Please sign in to comment.