Compare commits
	
		
			3 Commits
		
	
	
		
			e184819d16
			...
			af3895a5f0
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| af3895a5f0 | |||
| 5af5647987 | |||
| 6343fb573a | 
							
								
								
									
										2
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							@ -1186,7 +1186,7 @@ dependencies = [
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "casper-runtime"
 | 
					name = "casper-runtime"
 | 
				
			||||||
version = "3.5.17"
 | 
					version = "3.5.18"
 | 
				
			||||||
dependencies = [
 | 
					dependencies = [
 | 
				
			||||||
 "casper-runtime-constants",
 | 
					 "casper-runtime-constants",
 | 
				
			||||||
 "frame-benchmarking",
 | 
					 "frame-benchmarking",
 | 
				
			||||||
 | 
				
			|||||||
@ -6,6 +6,7 @@ Documentation=https://git.ghostchain.io/ghostchain/ghost-node
 | 
				
			|||||||
[Service]
 | 
					[Service]
 | 
				
			||||||
EnvironmentFile=-/etc/default/ghost
 | 
					EnvironmentFile=-/etc/default/ghost
 | 
				
			||||||
ExecStart=/usr/bin/ghost $GHOST_CLI_ARGS
 | 
					ExecStart=/usr/bin/ghost $GHOST_CLI_ARGS
 | 
				
			||||||
 | 
					ReadWritePaths=/var/lib/ghost
 | 
				
			||||||
User=ghost
 | 
					User=ghost
 | 
				
			||||||
Restart=always
 | 
					Restart=always
 | 
				
			||||||
RestartSec=30
 | 
					RestartSec=30
 | 
				
			||||||
 | 
				
			|||||||
@ -9,7 +9,7 @@ SKIP_BUILD=false
 | 
				
			|||||||
SET_ENVIRONMENT=false
 | 
					SET_ENVIRONMENT=false
 | 
				
			||||||
EXECUTABLE_PATH="/usr/bin/"
 | 
					EXECUTABLE_PATH="/usr/bin/"
 | 
				
			||||||
SPECIFICATION_PATH="/etc/ghost/"
 | 
					SPECIFICATION_PATH="/etc/ghost/"
 | 
				
			||||||
NODE_PATH="/var/lib/ghost"
 | 
					BASE_PATH="/var/lib/ghost"
 | 
				
			||||||
SPECIFICATION_NAME="casper"
 | 
					SPECIFICATION_NAME="casper"
 | 
				
			||||||
TARGET="release"
 | 
					TARGET="release"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -86,11 +86,12 @@ help() {
 | 
				
			|||||||
    echo -e "-m, --make-global\n\tStore compiled ghost executable and chain specification globally."
 | 
					    echo -e "-m, --make-global\n\tStore compiled ghost executable and chain specification globally."
 | 
				
			||||||
    echo -e "-a, --set-arguments\n\tPrepare CLI arguments for running ghost node."
 | 
					    echo -e "-a, --set-arguments\n\tPrepare CLI arguments for running ghost node."
 | 
				
			||||||
    echo -e "-k, --check-keys\n\tCheck if your keys are already included in 'ghosties' file."
 | 
					    echo -e "-k, --check-keys\n\tCheck if your keys are already included in 'ghosties' file."
 | 
				
			||||||
    echo -e "-r, --insert-keys\n\tInsert session keys to the keystore via JSON RPC."
 | 
					    echo -e "-y, --insert-keys\n\tInsert session keys to the keystore via JSON RPC."
 | 
				
			||||||
    echo -e "-r, --release\n\tCompile node with '--release' flag."
 | 
					    echo -e "-r, --release\n\tCompile node with '--release' flag."
 | 
				
			||||||
    echo -e "-p, --profile\n\tCompile node with '--profile [PROFILE]' flag."
 | 
					    echo -e "-p, --profile\n\tCompile node with '--profile [PROFILE]' flag."
 | 
				
			||||||
    echo -e "-f, --features\n\tCompilation features '--features=\"FEATURE1,FEATURE2\"'"
 | 
					    echo -e "-f, --features\n\tCompilation features '--features=\"FEATURE1,FEATURE2\"'"
 | 
				
			||||||
    echo -e "-e, --executable-path\n\tPath to executable ('/usr/lib/' is default)."
 | 
					    echo -e "-e, --executable-path\n\tPath to the executable ('/usr/lib/' is default)."
 | 
				
			||||||
 | 
					    echo -e "-s, --base-path\n\tPath to the folder with chain database ('/var/lib/ghost' is default)."
 | 
				
			||||||
    echo -e "-c, --specification-path\n\tPath to specification ('/etc/ghost' is default)."
 | 
					    echo -e "-c, --specification-path\n\tPath to specification ('/etc/ghost' is default)."
 | 
				
			||||||
    echo -e "-n, --specification-name\n\tSpecification name to be used ('casper' is default)."
 | 
					    echo -e "-n, --specification-name\n\tSpecification name to be used ('casper' is default)."
 | 
				
			||||||
    echo -e "-h, --help\n\tPrints help information."
 | 
					    echo -e "-h, --help\n\tPrints help information."
 | 
				
			||||||
@ -149,7 +150,12 @@ while [ $# -gt 0 ]; do
 | 
				
			|||||||
            if [[ "$1" != *=* ]]; then shift; fi
 | 
					            if [[ "$1" != *=* ]]; then shift; fi
 | 
				
			||||||
            SPECIFICATION_PATH=$(echo ${1#*=}/ | tr -s /)
 | 
					            SPECIFICATION_PATH=$(echo ${1#*=}/ | tr -s /)
 | 
				
			||||||
            ;;
 | 
					            ;;
 | 
				
			||||||
        --specification-name*|-n*) if [[ "$1" != *=* ]]; then shift; fi
 | 
					        --base-path*|-?)
 | 
				
			||||||
 | 
					            if [[ "$1" != *=* ]]; then shift; fi
 | 
				
			||||||
 | 
					            BASE_PATH=$(echo ${1#*=}/ | tr -s /)
 | 
				
			||||||
 | 
					            ;;
 | 
				
			||||||
 | 
					        --specification-name*|-n*) 
 | 
				
			||||||
 | 
					            if [[ "$1" != *=* ]]; then shift; fi
 | 
				
			||||||
            SPECIFICATION_NAME="${1#*=}"
 | 
					            SPECIFICATION_NAME="${1#*=}"
 | 
				
			||||||
            ;;
 | 
					            ;;
 | 
				
			||||||
        --help|-h)
 | 
					        --help|-h)
 | 
				
			||||||
@ -259,6 +265,7 @@ fi
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
if [[ $MAKE_GLOBAL = true ]]; then
 | 
					if [[ $MAKE_GLOBAL = true ]]; then
 | 
				
			||||||
    cd $PROJECT_FOLDER
 | 
					    cd $PROJECT_FOLDER
 | 
				
			||||||
 | 
					    echo "[+] trying to copy executable to '$EXECUTABLE_PATH'"
 | 
				
			||||||
    sudo cp target/$TARGET/ghost $EXECUTABLE_PATH
 | 
					    sudo cp target/$TARGET/ghost $EXECUTABLE_PATH
 | 
				
			||||||
    cp service/chain-specs/$SPECIFICATION_NAME.json $SPECIFICATION_PATH
 | 
					    cp service/chain-specs/$SPECIFICATION_NAME.json $SPECIFICATION_PATH
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -282,21 +289,24 @@ if [ $UNIT_FILE = true ]; then
 | 
				
			|||||||
        echo "[!] user ghost not found"
 | 
					        echo "[!] user ghost not found"
 | 
				
			||||||
        if prompt "[?] do you want to create ghost user? (NOT RECOMMENDED: current $(whoami))"; then 
 | 
					        if prompt "[?] do you want to create ghost user? (NOT RECOMMENDED: current $(whoami))"; then 
 | 
				
			||||||
            sudo useradd --system --create-home $user_name
 | 
					            sudo useradd --system --create-home $user_name
 | 
				
			||||||
            if [ ! -d $NODE_PATH ]; then
 | 
					            if [ ! -d $BASE_PATH ]; then
 | 
				
			||||||
                echo "[+] create folder for the node at '$NODE_PATH'"
 | 
					                echo "[+] create folder for the node at '$BASE_PATH'"
 | 
				
			||||||
                sudo mkdir $NODE_PATH
 | 
					                sudo mkdir $BASE_PATH
 | 
				
			||||||
            fi
 | 
					            fi
 | 
				
			||||||
        else
 | 
					        else
 | 
				
			||||||
            user_name=$(whoami)
 | 
					            user_name=$(whoami)
 | 
				
			||||||
        fi
 | 
					        fi
 | 
				
			||||||
        sudo chown $user_name $NODE_PATH
 | 
					        echo "[+] make $user_name owner of $BASE_PATH"
 | 
				
			||||||
        echo "[+] write permission to '$NODE_PATH'"
 | 
					        sudo chown -R "$user_name:" $BASE_PATH
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    cp packaging/template.service /tmp/$unit_name
 | 
					    cp packaging/template.service /tmp/$unit_name
 | 
				
			||||||
    sed -i -e "s/User=ghost/User=$user_name/g" /tmp/$unit_name
 | 
					    sed -i -e "s/User=ghost/User=$user_name/g" /tmp/$unit_name
 | 
				
			||||||
 | 
					    sed -i -e "s#/ReadWritePaths=/var/lib/ghost#/ReadWritePaths=$BASE_PATH#g" /tmp/$unit_name
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    echo "[+] prepare unit file for the $unit_name"
 | 
				
			||||||
    sudo cp packaging/template.service /etc/systemd/system/$unit_name
 | 
					    sudo cp packaging/template.service /etc/systemd/system/$unit_name
 | 
				
			||||||
 | 
					    echo "[+] reloading systemd because of updated unit file"
 | 
				
			||||||
    sudo systemctl daemon-reload
 | 
					    sudo systemctl daemon-reload
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if prompt "[?] do you want to start the $unit_name?"; then 
 | 
					    if prompt "[?] do you want to start the $unit_name?"; then 
 | 
				
			||||||
@ -347,7 +357,7 @@ if [[ $ARGUMENTS = true ]]; then
 | 
				
			|||||||
    fi
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # default for now
 | 
					    # default for now
 | 
				
			||||||
    CLI_ARGS+=("--base-path=$NODE_PATH")
 | 
					    CLI_ARGS+=("--base-path=$BASE_PATH")
 | 
				
			||||||
    CLI_ARGS+=("--state-pruning=archive")
 | 
					    CLI_ARGS+=("--state-pruning=archive")
 | 
				
			||||||
    CLI_ARGS+=("--blocks-pruning=archive")
 | 
					    CLI_ARGS+=("--blocks-pruning=archive")
 | 
				
			||||||
    CLI_ARGS+=("--rpc-methods=auto")
 | 
					    CLI_ARGS+=("--rpc-methods=auto")
 | 
				
			||||||
@ -356,7 +366,7 @@ if [[ $ARGUMENTS = true ]]; then
 | 
				
			|||||||
    CLI_ARGS+=("--no-mdns")
 | 
					    CLI_ARGS+=("--no-mdns")
 | 
				
			||||||
    CLI_ARGS+=("--no-hardware-benchmarks")
 | 
					    CLI_ARGS+=("--no-hardware-benchmarks")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    echo "GHOST_CLI_ARGS=\"$(IFS=' '; echo "${CLI_ARGS[*]}")\"" > /tmp/ghost
 | 
					    echo "[+] trying to save GHOST_CLI_ARGS=\"$(IFS=' '; echo "${CLI_ARGS[*]}")\"" > /tmp/ghost
 | 
				
			||||||
    sudo cp /tmp/ghost /etc/default/ghost
 | 
					    sudo cp /tmp/ghost /etc/default/ghost
 | 
				
			||||||
    rm /tmp/ghost
 | 
					    rm /tmp/ghost
 | 
				
			||||||
    echo "[+] new CLI arguments stored in '/etc/default/ghost'"
 | 
					    echo "[+] new CLI arguments stored in '/etc/default/ghost'"
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user