Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
pub
node config generator
Commits
3425707f
Commit
3425707f
authored
Nov 06, 2019
by
Victor Khilin
Browse files
Tons of edits
parent
93969b6f
Changes
8
Hide whitespace changes
Inline
Side-by-side
Dockerfile
View file @
3425707f
FROM
anapsix/alpine-java:8_server-jre
ARG
node_version
ENV
env_node_version=${node_version}
ARG
node_version=we1.0
COPY
Dockerfile_content/accounts_template.conf /node/
COPY
Dockerfile_content/generate.sh /node/
...
...
@@ -11,8 +10,7 @@ COPY tmp/jcp-*.tar.gz /node/jcp/
RUN
chmod
+x /node/generate.sh
&&
\
apk update
&&
\
apk add wget gettext bash libxext libxrender libxtst libxi
&&
\
wget
-q
https://artifacts.vostokservices.com/repository/fileshare/node_build/generators-
${
node_version
}
.jar
-O
/node/generator.jar
&&
\
wget
-q
https://artifacts.vostokservices.com/repository/fileshare/node_build/generators-
${
env_node_version
}
.jar
-O
/node/generator.jar
wget
-q
https://artifacts.vostokservices.com/repository/fileshare/node_build/generators-
${
node_version
}
.jar
-O
/node/generator.jar
ENTRYPOINT
"/node/generate.sh"
Dockerfile_content/generate.sh
View file @
3425707f
#!/bin/bash
tar
xvfz /node/jcp/jcp
*
--directory
/node/jcp
rm
/node/jcp/jcp
*
.gz
cd
/node/jcp
tar
xfz /node/jcp/jcp
*
-C
/node/jcp/ 2>/dev/null
&&
rm
-rf
/node/jcp/jcp
*
gz
cd
/node/jcp/jcp-2.0.40035/
||
cd
/node/jcp/
/bin/sh setup_console.sh /opt/jdk1.8.0_202
-force
-en
-install
-jcp
-jcryptop
cd
/node
java ru.CryptoPro.JCP.Random.BioRandomConsole
...
...
README.md
View file @
3425707f
First:
python3 -m pip install -r requirements.txt
Usage:
-c Seed letter A-Z
-w Waves chain (yes/no)
-a Count of keys to generate
-p Wallet password
--create-configmap [yes|no] (default: yes), generates configmap with config and wallet inside
--existing-genesis [yes|no] (default: no), use genesis from previous generation if genesis_backup.conf exists.
Example:
./launcher.py -c A -w no -a 3 -p
<wallet
password
>
Usage:
-c Seed letter A-Z
-w Waves chain (yes/no)
-a Count of keys to generate
-p Wallet password
-e Evolved. N if it's old (not WE release) node. Y if it is (WE release 1.0 or higher).
--create-configmap [yes|no] (default: yes), generates configmap with config and wallet inside
--existing-genesis [yes|no] (default: no), use genesis from previous generation if genesis_backup.conf exists.
Example:
./launcher.py -c A -w no -a 3 -e Y -p
<wallet
password
>
launcher.py
View file @
3425707f
...
...
@@ -16,6 +16,7 @@ import re
import
yaml
import
base64
import
time
import
fileinput
def
randomString
(
stringLength
=
10
):
letters
=
string
.
ascii_lowercase
...
...
@@ -49,7 +50,6 @@ def create_configmap(config_name, filetype='text'):
if
__name__
==
"__main__"
:
parser
=
OptionParser
()
parser
.
add_option
(
"-n"
,
"--node_version"
,
type
=
"string"
,
dest
=
"node_version"
,
default
=
"we1.0"
,
help
=
"define node version"
)
parser
.
add_option
(
"-c"
,
"--chain-id"
,
type
=
"string"
,
dest
=
"chain_id"
,
default
=
"V"
,
help
=
"network byte"
)
parser
.
add_option
(
"-w"
,
"--waves-crypto"
,
type
=
"choice"
,
action
=
"store"
,
dest
=
"waves_crypto"
,
choices
=
[
"yes"
,
"no"
],
default
=
"yes"
,
help
=
"use waves crypto(yes - waves, no - gost)"
)
parser
.
add_option
(
"-a"
,
"--amount"
,
type
=
"int"
,
dest
=
"amount"
,
default
=
3
,
help
=
"amount of keys"
)
...
...
@@ -82,13 +82,10 @@ if __name__=="__main__":
r
=
requests
.
get
(
r_url
)
with
open
(
'{}/{}'
.
format
(
dst_jcp
,
jcp_name
[
options
.
node_evolved
]),
'wb'
)
as
f
:
f
.
write
(
r
.
content
)
build_image_build_arg_line
=
'node_version='
+
options
.
node_version
build_image_cmd
=
[
docker
,
'build'
,
'--build-arg'
,
build_image_build_arg_line
,
'-t'
,
'node_config_generator'
,
'.'
]
print
(
"Running "
+
str
(
build_image_cmd
)
+
" ..."
)
build_image_cmd
=
[
docker
,
'build'
,
'-t'
,
'node_config_generator'
,
'.'
]
subprocess
.
run
(
build_image_cmd
)
generate_cmd
=
[
docker
,
'run'
,
'-it'
,
'-e'
,
'node_version={}'
,
format
(
options
.
node_version
),
'-e'
,
'VOSTOK_NODE_OWNER_PASSWORD={}'
.
format
(
options
.
password
),
'-e'
,
'VOSTOK_NODE_OWNER_PASSWORD_EMPTY=true'
,
'-e'
,
'waves_crypto={}'
.
format
(
options
.
waves_crypto
),
...
...
@@ -108,13 +105,13 @@ if __name__=="__main__":
shutil
.
rmtree
(
dst_jcp
)
#generate config template
if
options
.
node_evolved
==
'
Y
'
:
if
options
.
node_evolved
==
'
N
'
:
conf
=
ConfigFactory
.
parse_file
(
'{}/node_config_templates/main.conf'
.
format
(
get_current_path
()))
vostok
=
'vostok'
else
:
if
options
.
node_evolved
==
'Y'
:
conf
=
ConfigFactory
.
parse_file
(
'{}/node_config_templates/we_main.conf'
.
format
(
get_current_path
()))
vostok
=
'node'
conf
[
vostok
][
'waves-crypto'
]
=
options
.
waves_crypto
conf
[
vostok
][
'wallet'
][
'password'
]
=
options
.
password
conf
[
vostok
][
'blockchain'
][
'custom'
][
'address-scheme-character'
]
=
options
.
chain_id
...
...
@@ -146,6 +143,31 @@ if __name__=="__main__":
f
.
write
(
HOCONConverter
.
convert
(
conf
,
'hocon'
))
f
.
close
()
#replace '=' to ':' in signature and genesis-public-key-base-58
with
open
(
'output/presign_genesis.conf'
,
'r'
)
as
file
:
filedata
=
file
.
read
()
filedata
=
filedata
.
replace
(
'signature = ""'
,
'signature: "qwertyuio"'
)
filedata
=
filedata
.
replace
(
'genesis-public-key-base-58 = ""'
,
'genesis-public-key-base-58: "asdfghjk"'
)
filedata
=
filedata
.
replace
(
'average-block-delay = '
,
'average-block-delay: '
)
filedata
=
filedata
.
replace
(
'initial-base-target = '
,
'initial-base-target: '
)
filedata
=
filedata
.
replace
(
'timestamp = '
,
'timestamp: '
)
filedata
=
filedata
.
replace
(
'block-timestamp = '
,
'block-timestamp: '
)
filedata
=
filedata
.
replace
(
'initial-balance = '
,
'initial-balance: '
)
filedata
=
filedata
.
replace
(
'recipient = '
,
'recipient: '
)
filedata
=
filedata
.
replace
(
'amount = '
,
'amount: '
)
filedata
=
filedata
.
replace
(
'public-key = '
,
'public-key: '
)
filedata
=
filedata
.
replace
(
'roles = '
,
'roles: '
)
with
open
(
'output/presign_genesis.conf'
,
'w'
)
as
file
:
file
.
write
(
filedata
)
file
.
close
()
# with fileinput.FileInput('output/presign_genesis.conf', inplace=True, backup='.bak') as file:
# for line in file:
# print (line.replace('signature = ', 'signature: '), end='')
# print (line.replace('genesis-public-key-base-58 = ', 'genesis-public-key-base-58: '), end='')
#set genesis block
if
options
.
use_existing_genesis
==
'yes'
:
genesis_yaml
=
ConfigFactory
.
parse_file
(
'{}/genesis_backup.conf'
.
format
(
get_current_path
()))
...
...
@@ -153,8 +175,7 @@ if __name__=="__main__":
signed_template_yaml
[
vostok
][
'blockchain'
][
'custom'
][
'genesis'
]
=
genesis_yaml
else
:
subprocess
.
run
([
'docker'
,
'run'
,
'-it'
,
'--rm'
,
'-v'
,
'{}/output:/output'
.
format
(
os
.
getcwd
()),
'-e'
,
'SIGN_GENESIS=1'
,
'-e'
,
'NODE_CONFIG=/output/presign_genesis.conf'
,
'node_config_generator'
])
signed_template_yaml
=
ConfigFactory
.
parse_file
(
'{}/output/presign_genesis.conf'
.
format
(
get_current_path
()))
signed_template_yaml
=
ConfigFactory
.
parse_file
(
'{}/output/presign_genesis.conf'
.
format
(
get_current_path
()),
)
f
=
open
(
'{}/genesis_backup.conf'
.
format
(
get_current_path
()),
'w'
)
f
.
write
(
HOCONConverter
.
convert
(
signed_template_yaml
[
vostok
][
'blockchain'
][
'custom'
][
'genesis'
],
'hocon'
))
f
.
close
()
...
...
node_config_templates/local_template.conf
0 → 100644
View file @
3425707f
vostok
{
wallet
{
file
=
"wallet"
password
=
"svupkey"
}
owner
-
address
=
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
privacy
.
storage
.
url
=
"jdbc:postgresql://example.com:5432/database_name?user=username&password=password&sslmode=require"
}
local_template.conf
→
node_config_templates/we_
local_template.conf
View file @
3425707f
File moved
node_config_templates/we_main.conf
View file @
3425707f
...
...
@@ -156,4 +156,4 @@ node {
}
}
include
"local_template.conf"
include
"
we_
local_template.conf"
tmp/jcp-2.0.40035.tar.gz
0 → 100644
View file @
3425707f
File added
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment