Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
da3b9f83
Unverified
Commit
da3b9f83
authored
Oct 19, 2017
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd/puppeth: support deploying services with forced rebuilds
parent
7b258c96
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
52 additions
and
17 deletions
+52
-17
module_dashboard.go
cmd/puppeth/module_dashboard.go
+5
-2
module_ethstats.go
cmd/puppeth/module_ethstats.go
+5
-2
module_faucet.go
cmd/puppeth/module_faucet.go
+5
-2
module_nginx.go
cmd/puppeth/module_nginx.go
+6
-3
module_node.go
cmd/puppeth/module_node.go
+5
-2
wizard_dashboard.go
cmd/puppeth/wizard_dashboard.go
+5
-1
wizard_ethstats.go
cmd/puppeth/wizard_ethstats.go
+5
-1
wizard_faucet.go
cmd/puppeth/wizard_faucet.go
+5
-1
wizard_nginx.go
cmd/puppeth/wizard_nginx.go
+5
-1
wizard_node.go
cmd/puppeth/wizard_node.go
+6
-2
No files found.
cmd/puppeth/module_dashboard.go
View file @
da3b9f83
...
@@ -437,7 +437,7 @@ services:
...
@@ -437,7 +437,7 @@ services:
// deployDashboard deploys a new dashboard container to a remote machine via SSH,
// deployDashboard deploys a new dashboard container to a remote machine via SSH,
// docker and docker-compose. If an instance with the specified network name
// docker and docker-compose. If an instance with the specified network name
// already exists there, it will be overwritten!
// already exists there, it will be overwritten!
func
deployDashboard
(
client
*
sshClient
,
network
string
,
port
int
,
vhost
string
,
services
map
[
string
]
string
,
conf
*
config
,
ethstats
bool
)
([]
byte
,
error
)
{
func
deployDashboard
(
client
*
sshClient
,
network
string
,
port
int
,
vhost
string
,
services
map
[
string
]
string
,
conf
*
config
,
ethstats
bool
,
nocache
bool
)
([]
byte
,
error
)
{
// Generate the content to upload to the server
// Generate the content to upload to the server
workdir
:=
fmt
.
Sprintf
(
"%d"
,
rand
.
Int63
())
workdir
:=
fmt
.
Sprintf
(
"%d"
,
rand
.
Int63
())
files
:=
make
(
map
[
string
][]
byte
)
files
:=
make
(
map
[
string
][]
byte
)
...
@@ -490,7 +490,10 @@ func deployDashboard(client *sshClient, network string, port int, vhost string,
...
@@ -490,7 +490,10 @@ func deployDashboard(client *sshClient, network string, port int, vhost string,
defer
client
.
Run
(
"rm -rf "
+
workdir
)
defer
client
.
Run
(
"rm -rf "
+
workdir
)
// Build and deploy the dashboard service
// Build and deploy the dashboard service
return
nil
,
client
.
Stream
(
fmt
.
Sprintf
(
"cd %s && docker-compose -p %s up -d --build"
,
workdir
,
network
))
if
nocache
{
return
nil
,
client
.
Stream
(
fmt
.
Sprintf
(
"cd %s && docker-compose -p %s build --pull --no-cache && docker-compose -p %s up -d --force-recreate"
,
workdir
,
network
,
network
))
}
return
nil
,
client
.
Stream
(
fmt
.
Sprintf
(
"cd %s && docker-compose -p %s up -d --build --force-recreate"
,
workdir
,
network
))
}
}
// dashboardInfos is returned from an dashboard status check to allow reporting
// dashboardInfos is returned from an dashboard status check to allow reporting
...
...
cmd/puppeth/module_ethstats.go
View file @
da3b9f83
...
@@ -73,7 +73,7 @@ services:
...
@@ -73,7 +73,7 @@ services:
// deployEthstats deploys a new ethstats container to a remote machine via SSH,
// deployEthstats deploys a new ethstats container to a remote machine via SSH,
// docker and docker-compose. If an instance with the specified network name
// docker and docker-compose. If an instance with the specified network name
// already exists there, it will be overwritten!
// already exists there, it will be overwritten!
func
deployEthstats
(
client
*
sshClient
,
network
string
,
port
int
,
secret
string
,
vhost
string
,
trusted
[]
string
,
banned
[]
string
)
([]
byte
,
error
)
{
func
deployEthstats
(
client
*
sshClient
,
network
string
,
port
int
,
secret
string
,
vhost
string
,
trusted
[]
string
,
banned
[]
string
,
nocache
bool
)
([]
byte
,
error
)
{
// Generate the content to upload to the server
// Generate the content to upload to the server
workdir
:=
fmt
.
Sprintf
(
"%d"
,
rand
.
Int63
())
workdir
:=
fmt
.
Sprintf
(
"%d"
,
rand
.
Int63
())
files
:=
make
(
map
[
string
][]
byte
)
files
:=
make
(
map
[
string
][]
byte
)
...
@@ -111,7 +111,10 @@ func deployEthstats(client *sshClient, network string, port int, secret string,
...
@@ -111,7 +111,10 @@ func deployEthstats(client *sshClient, network string, port int, secret string,
defer
client
.
Run
(
"rm -rf "
+
workdir
)
defer
client
.
Run
(
"rm -rf "
+
workdir
)
// Build and deploy the ethstats service
// Build and deploy the ethstats service
return
nil
,
client
.
Stream
(
fmt
.
Sprintf
(
"cd %s && docker-compose -p %s up -d --build"
,
workdir
,
network
))
if
nocache
{
return
nil
,
client
.
Stream
(
fmt
.
Sprintf
(
"cd %s && docker-compose -p %s build --pull --no-cache && docker-compose -p %s up -d --force-recreate"
,
workdir
,
network
,
network
))
}
return
nil
,
client
.
Stream
(
fmt
.
Sprintf
(
"cd %s && docker-compose -p %s up -d --build --force-recreate"
,
workdir
,
network
))
}
}
// ethstatsInfos is returned from an ethstats status check to allow reporting
// ethstatsInfos is returned from an ethstats status check to allow reporting
...
...
cmd/puppeth/module_faucet.go
View file @
da3b9f83
...
@@ -95,7 +95,7 @@ services:
...
@@ -95,7 +95,7 @@ services:
// deployFaucet deploys a new faucet container to a remote machine via SSH,
// deployFaucet deploys a new faucet container to a remote machine via SSH,
// docker and docker-compose. If an instance with the specified network name
// docker and docker-compose. If an instance with the specified network name
// already exists there, it will be overwritten!
// already exists there, it will be overwritten!
func
deployFaucet
(
client
*
sshClient
,
network
string
,
bootnodes
[]
string
,
config
*
faucetInfos
)
([]
byte
,
error
)
{
func
deployFaucet
(
client
*
sshClient
,
network
string
,
bootnodes
[]
string
,
config
*
faucetInfos
,
nocache
bool
)
([]
byte
,
error
)
{
// Generate the content to upload to the server
// Generate the content to upload to the server
workdir
:=
fmt
.
Sprintf
(
"%d"
,
rand
.
Int63
())
workdir
:=
fmt
.
Sprintf
(
"%d"
,
rand
.
Int63
())
files
:=
make
(
map
[
string
][]
byte
)
files
:=
make
(
map
[
string
][]
byte
)
...
@@ -146,7 +146,10 @@ func deployFaucet(client *sshClient, network string, bootnodes []string, config
...
@@ -146,7 +146,10 @@ func deployFaucet(client *sshClient, network string, bootnodes []string, config
defer
client
.
Run
(
"rm -rf "
+
workdir
)
defer
client
.
Run
(
"rm -rf "
+
workdir
)
// Build and deploy the faucet service
// Build and deploy the faucet service
return
nil
,
client
.
Stream
(
fmt
.
Sprintf
(
"cd %s && docker-compose -p %s up -d --build"
,
workdir
,
network
))
if
nocache
{
return
nil
,
client
.
Stream
(
fmt
.
Sprintf
(
"cd %s && docker-compose -p %s build --pull --no-cache && docker-compose -p %s up -d --force-recreate"
,
workdir
,
network
,
network
))
}
return
nil
,
client
.
Stream
(
fmt
.
Sprintf
(
"cd %s && docker-compose -p %s up -d --build --force-recreate"
,
workdir
,
network
))
}
}
// faucetInfos is returned from an faucet status check to allow reporting various
// faucetInfos is returned from an faucet status check to allow reporting various
...
...
cmd/puppeth/module_nginx.go
View file @
da3b9f83
...
@@ -55,7 +55,7 @@ services:
...
@@ -55,7 +55,7 @@ services:
// deployNginx deploys a new nginx reverse-proxy container to expose one or more
// deployNginx deploys a new nginx reverse-proxy container to expose one or more
// HTTP services running on a single host. If an instance with the specified
// HTTP services running on a single host. If an instance with the specified
// network name already exists there, it will be overwritten!
// network name already exists there, it will be overwritten!
func
deployNginx
(
client
*
sshClient
,
network
string
,
port
int
)
([]
byte
,
error
)
{
func
deployNginx
(
client
*
sshClient
,
network
string
,
port
int
,
nocache
bool
)
([]
byte
,
error
)
{
log
.
Info
(
"Deploying nginx reverse-proxy"
,
"server"
,
client
.
server
,
"port"
,
port
)
log
.
Info
(
"Deploying nginx reverse-proxy"
,
"server"
,
client
.
server
,
"port"
,
port
)
// Generate the content to upload to the server
// Generate the content to upload to the server
...
@@ -79,8 +79,11 @@ func deployNginx(client *sshClient, network string, port int) ([]byte, error) {
...
@@ -79,8 +79,11 @@ func deployNginx(client *sshClient, network string, port int) ([]byte, error) {
}
}
defer
client
.
Run
(
"rm -rf "
+
workdir
)
defer
client
.
Run
(
"rm -rf "
+
workdir
)
// Build and deploy the ethstats service
// Build and deploy the reverse-proxy service
return
nil
,
client
.
Stream
(
fmt
.
Sprintf
(
"cd %s && docker-compose -p %s up -d --build"
,
workdir
,
network
))
if
nocache
{
return
nil
,
client
.
Stream
(
fmt
.
Sprintf
(
"cd %s && docker-compose -p %s build --pull --no-cache && docker-compose -p %s up -d --force-recreate"
,
workdir
,
network
,
network
))
}
return
nil
,
client
.
Stream
(
fmt
.
Sprintf
(
"cd %s && docker-compose -p %s up -d --build --force-recreate"
,
workdir
,
network
))
}
}
// nginxInfos is returned from an nginx reverse-proxy status check to allow
// nginxInfos is returned from an nginx reverse-proxy status check to allow
...
...
cmd/puppeth/module_node.go
View file @
da3b9f83
...
@@ -81,7 +81,7 @@ services:
...
@@ -81,7 +81,7 @@ services:
// deployNode deploys a new Ethereum node container to a remote machine via SSH,
// deployNode deploys a new Ethereum node container to a remote machine via SSH,
// docker and docker-compose. If an instance with the specified network name
// docker and docker-compose. If an instance with the specified network name
// already exists there, it will be overwritten!
// already exists there, it will be overwritten!
func
deployNode
(
client
*
sshClient
,
network
string
,
bootv4
,
bootv5
[]
string
,
config
*
nodeInfos
)
([]
byte
,
error
)
{
func
deployNode
(
client
*
sshClient
,
network
string
,
bootv4
,
bootv5
[]
string
,
config
*
nodeInfos
,
nocache
bool
)
([]
byte
,
error
)
{
kind
:=
"sealnode"
kind
:=
"sealnode"
if
config
.
keyJSON
==
""
&&
config
.
etherbase
==
""
{
if
config
.
keyJSON
==
""
&&
config
.
etherbase
==
""
{
kind
=
"bootnode"
kind
=
"bootnode"
...
@@ -143,7 +143,10 @@ func deployNode(client *sshClient, network string, bootv4, bootv5 []string, conf
...
@@ -143,7 +143,10 @@ func deployNode(client *sshClient, network string, bootv4, bootv5 []string, conf
defer
client
.
Run
(
"rm -rf "
+
workdir
)
defer
client
.
Run
(
"rm -rf "
+
workdir
)
// Build and deploy the boot or seal node service
// Build and deploy the boot or seal node service
return
nil
,
client
.
Stream
(
fmt
.
Sprintf
(
"cd %s && docker-compose -p %s up -d --build"
,
workdir
,
network
))
if
nocache
{
return
nil
,
client
.
Stream
(
fmt
.
Sprintf
(
"cd %s && docker-compose -p %s build --pull --no-cache && docker-compose -p %s up -d --force-recreate"
,
workdir
,
network
,
network
))
}
return
nil
,
client
.
Stream
(
fmt
.
Sprintf
(
"cd %s && docker-compose -p %s up -d --build --force-recreate"
,
workdir
,
network
))
}
}
// nodeInfos is returned from a boot or seal node status check to allow reporting
// nodeInfos is returned from a boot or seal node status check to allow reporting
...
...
cmd/puppeth/wizard_dashboard.go
View file @
da3b9f83
...
@@ -120,7 +120,11 @@ func (w *wizard) deployDashboard() {
...
@@ -120,7 +120,11 @@ func (w *wizard) deployDashboard() {
ethstats
=
w
.
readDefaultString
(
"y"
)
==
"y"
ethstats
=
w
.
readDefaultString
(
"y"
)
==
"y"
}
}
// Try to deploy the dashboard container on the host
// Try to deploy the dashboard container on the host
if
out
,
err
:=
deployDashboard
(
client
,
w
.
network
,
infos
.
port
,
infos
.
host
,
listing
,
&
w
.
conf
,
ethstats
);
err
!=
nil
{
fmt
.
Println
()
fmt
.
Printf
(
"Should the dashboard be built from scratch (y/n)? (default = no)
\n
"
)
nocache
:=
w
.
readDefaultString
(
"n"
)
!=
"n"
if
out
,
err
:=
deployDashboard
(
client
,
w
.
network
,
infos
.
port
,
infos
.
host
,
listing
,
&
w
.
conf
,
ethstats
,
nocache
);
err
!=
nil
{
log
.
Error
(
"Failed to deploy dashboard container"
,
"err"
,
err
)
log
.
Error
(
"Failed to deploy dashboard container"
,
"err"
,
err
)
if
len
(
out
)
>
0
{
if
len
(
out
)
>
0
{
fmt
.
Printf
(
"%s
\n
"
,
out
)
fmt
.
Printf
(
"%s
\n
"
,
out
)
...
...
cmd/puppeth/wizard_ethstats.go
View file @
da3b9f83
...
@@ -98,13 +98,17 @@ func (w *wizard) deployEthstats() {
...
@@ -98,13 +98,17 @@ func (w *wizard) deployEthstats() {
sort
.
Strings
(
infos
.
banned
)
sort
.
Strings
(
infos
.
banned
)
}
}
// Try to deploy the ethstats server on the host
// Try to deploy the ethstats server on the host
fmt
.
Println
()
fmt
.
Printf
(
"Should the ethstats be built from scratch (y/n)? (default = no)
\n
"
)
nocache
:=
w
.
readDefaultString
(
"n"
)
!=
"n"
trusted
:=
make
([]
string
,
0
,
len
(
w
.
servers
))
trusted
:=
make
([]
string
,
0
,
len
(
w
.
servers
))
for
_
,
client
:=
range
w
.
servers
{
for
_
,
client
:=
range
w
.
servers
{
if
client
!=
nil
{
if
client
!=
nil
{
trusted
=
append
(
trusted
,
client
.
address
)
trusted
=
append
(
trusted
,
client
.
address
)
}
}
}
}
if
out
,
err
:=
deployEthstats
(
client
,
w
.
network
,
infos
.
port
,
infos
.
secret
,
infos
.
host
,
trusted
,
infos
.
banned
);
err
!=
nil
{
if
out
,
err
:=
deployEthstats
(
client
,
w
.
network
,
infos
.
port
,
infos
.
secret
,
infos
.
host
,
trusted
,
infos
.
banned
,
nocache
);
err
!=
nil
{
log
.
Error
(
"Failed to deploy ethstats container"
,
"err"
,
err
)
log
.
Error
(
"Failed to deploy ethstats container"
,
"err"
,
err
)
if
len
(
out
)
>
0
{
if
len
(
out
)
>
0
{
fmt
.
Printf
(
"%s
\n
"
,
out
)
fmt
.
Printf
(
"%s
\n
"
,
out
)
...
...
cmd/puppeth/wizard_faucet.go
View file @
da3b9f83
...
@@ -190,7 +190,11 @@ func (w *wizard) deployFaucet() {
...
@@ -190,7 +190,11 @@ func (w *wizard) deployFaucet() {
}
}
}
}
// Try to deploy the faucet server on the host
// Try to deploy the faucet server on the host
if
out
,
err
:=
deployFaucet
(
client
,
w
.
network
,
w
.
conf
.
bootLight
,
infos
);
err
!=
nil
{
fmt
.
Println
()
fmt
.
Printf
(
"Should the faucet be built from scratch (y/n)? (default = no)
\n
"
)
nocache
:=
w
.
readDefaultString
(
"n"
)
!=
"n"
if
out
,
err
:=
deployFaucet
(
client
,
w
.
network
,
w
.
conf
.
bootLight
,
infos
,
nocache
);
err
!=
nil
{
log
.
Error
(
"Failed to deploy faucet container"
,
"err"
,
err
)
log
.
Error
(
"Failed to deploy faucet container"
,
"err"
,
err
)
if
len
(
out
)
>
0
{
if
len
(
out
)
>
0
{
fmt
.
Printf
(
"%s
\n
"
,
out
)
fmt
.
Printf
(
"%s
\n
"
,
out
)
...
...
cmd/puppeth/wizard_nginx.go
View file @
da3b9f83
...
@@ -41,7 +41,11 @@ func (w *wizard) ensureVirtualHost(client *sshClient, port int, def string) (str
...
@@ -41,7 +41,11 @@ func (w *wizard) ensureVirtualHost(client *sshClient, port int, def string) (str
fmt
.
Println
()
fmt
.
Println
()
fmt
.
Println
(
"Allow sharing the port with other services (y/n)? (default = yes)"
)
fmt
.
Println
(
"Allow sharing the port with other services (y/n)? (default = yes)"
)
if
w
.
readDefaultString
(
"y"
)
==
"y"
{
if
w
.
readDefaultString
(
"y"
)
==
"y"
{
if
out
,
err
:=
deployNginx
(
client
,
w
.
network
,
port
);
err
!=
nil
{
fmt
.
Println
()
fmt
.
Printf
(
"Should the reverse-proxy be rebuilt from scratch (y/n)? (default = no)
\n
"
)
nocache
:=
w
.
readDefaultString
(
"n"
)
!=
"n"
if
out
,
err
:=
deployNginx
(
client
,
w
.
network
,
port
,
nocache
);
err
!=
nil
{
log
.
Error
(
"Failed to deploy reverse-proxy"
,
"err"
,
err
)
log
.
Error
(
"Failed to deploy reverse-proxy"
,
"err"
,
err
)
if
len
(
out
)
>
0
{
if
len
(
out
)
>
0
{
fmt
.
Printf
(
"%s
\n
"
,
out
)
fmt
.
Printf
(
"%s
\n
"
,
out
)
...
...
cmd/puppeth/wizard_node.go
View file @
da3b9f83
...
@@ -44,7 +44,7 @@ func (w *wizard) deployNode(boot bool) {
...
@@ -44,7 +44,7 @@ func (w *wizard) deployNode(boot bool) {
}
}
client
:=
w
.
servers
[
server
]
client
:=
w
.
servers
[
server
]
// Retrieve any active
ethstats
configurations from the server
// Retrieve any active
node
configurations from the server
infos
,
err
:=
checkNode
(
client
,
w
.
network
,
boot
)
infos
,
err
:=
checkNode
(
client
,
w
.
network
,
boot
)
if
err
!=
nil
{
if
err
!=
nil
{
if
boot
{
if
boot
{
...
@@ -145,7 +145,11 @@ func (w *wizard) deployNode(boot bool) {
...
@@ -145,7 +145,11 @@ func (w *wizard) deployNode(boot bool) {
infos
.
gasPrice
=
w
.
readDefaultFloat
(
infos
.
gasPrice
)
infos
.
gasPrice
=
w
.
readDefaultFloat
(
infos
.
gasPrice
)
}
}
// Try to deploy the full node on the host
// Try to deploy the full node on the host
if
out
,
err
:=
deployNode
(
client
,
w
.
network
,
w
.
conf
.
bootFull
,
w
.
conf
.
bootLight
,
infos
);
err
!=
nil
{
fmt
.
Println
()
fmt
.
Printf
(
"Should the node be built from scratch (y/n)? (default = no)
\n
"
)
nocache
:=
w
.
readDefaultString
(
"n"
)
!=
"n"
if
out
,
err
:=
deployNode
(
client
,
w
.
network
,
w
.
conf
.
bootFull
,
w
.
conf
.
bootLight
,
infos
,
nocache
);
err
!=
nil
{
log
.
Error
(
"Failed to deploy Ethereum node container"
,
"err"
,
err
)
log
.
Error
(
"Failed to deploy Ethereum node container"
,
"err"
,
err
)
if
len
(
out
)
>
0
{
if
len
(
out
)
>
0
{
fmt
.
Printf
(
"%s
\n
"
,
out
)
fmt
.
Printf
(
"%s
\n
"
,
out
)
...
...
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