Skip to content

Commit

Permalink
Merge PR cosmos#14: Fix system service config
Browse files Browse the repository at this point in the history
* Use configured faucet key for faucet service

* Update testnets.go

* Update README.md

* Update testnets.go

* Fix validations

* Fix cmd for creating system services
  • Loading branch information
anilcse authored Mar 20, 2020
1 parent b50bbf1 commit 2cf98f9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
26 changes: 13 additions & 13 deletions cmd/testnets.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,24 @@ func testnetsCmd() *cobra.Command {

func gaiaServiceCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "gaia-service [user]",
Use: "gaia-service [user] [home]",
Short: "gaia-service returns a sample gaiad service file",
Args: cobra.ExactArgs(1),
Args: cobra.ExactArgs(2),
Run: func(cmd *cobra.Command, args []string) {
fmt.Printf(`[Unit]
Description=gaiad
After=network.target
[Service]
Type=simple
User=%s
WorkingDirectory=/home/%s
ExecStart=/home/%s/go/bin/gaiad start
WorkingDirectory=%s
ExecStart=%s/go/bin/gaiad start
Restart=on-failure
RestartSec=3
LimitNOFILE=4096
[Install]
WantedBy=multi-user.target
`, args[0], args[0], args[0])
`, args[0], args[1], args[1])
return
},
}
Expand All @@ -59,19 +59,19 @@ WantedBy=multi-user.target

func faucetService() *cobra.Command {
cmd := &cobra.Command{
Use: "faucet-service [user] [chain-id] [key-name] [amount]",
Use: "faucet-service [user] [home] [chain-id] [key-name] [amount]",
Short: "faucet-service returns a sample faucet service file",
Args: cobra.ExactArgs(4),
Args: cobra.ExactArgs(5),
RunE: func(cmd *cobra.Command, args []string) error {
chain, err := config.Chains.Get(args[1])
chain, err := config.Chains.Get(args[2])
if err != nil {
return err
}
_, err = chain.Keybase.Get(args[2])
_, err = chain.Keybase.Get(args[3])
if err != nil {
return err
}
_, err = sdk.ParseCoin(args[3])
_, err = sdk.ParseCoin(args[4])
if err != nil {
return err
}
Expand All @@ -81,14 +81,14 @@ After=network.target
[Service]
Type=simple
User=%s
WorkingDirectory=/home/%s
ExecStart=/home/%s/go/bin/relayer testnets faucet %s %s %s
WorkingDirectory=%s
ExecStart=%s/go/bin/rly testnets faucet %s %s %s
Restart=on-failure
RestartSec=3
LimitNOFILE=4096
[Install]
WantedBy=multi-user.target
`, args[0], args[0], args[0], args[1], args[2], args[3])
`, args[0], args[1], args[1], args[2], args[3], args[4])
return nil
},
}
Expand Down
4 changes: 2 additions & 2 deletions testnets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ gaiad gentx --name validator --amount 90000000000$DENOM
gaiad collect-gentxs

# Setup the service definitions
rly testnets gaia-service $USER > gaiad.service
rly testnets faucet-service $USER $CHAINID faucet 100000$DENOM > faucet.service
rly testnets gaia-service $USER $HOME > gaiad.service
rly testnets faucet-service $USER $HOME $CHAINID $RLYKEY 100000$DENOM > faucet.service
sudo mv gaiad.service /etc/systemd/system/gaiad.service
sudo mv faucet.service /etc/systemd/system/faucet.service
sudo systemctl daemon-reload
Expand Down

0 comments on commit 2cf98f9

Please sign in to comment.