Skip to content

feat: interactive setup#31

Open
Maith8Ae wants to merge 35 commits intomasterfrom
feat/interactive-setup
Open

feat: interactive setup#31
Maith8Ae wants to merge 35 commits intomasterfrom
feat/interactive-setup

Conversation

@Maith8Ae
Copy link
Collaborator

@Maith8Ae Maith8Ae commented Mar 2, 2021

1. Why is this pull request needed and what does it do?

This PR brings old xud-docker CLI interactive setup flow back.

Network selection

1) Testnet
2) Mainnet
Please choose the network:

Update checking

🚀 Launching mainnet environment
🌍 Checking for updates ...

Syncing indicator

Syncing light clients:
┌─────────┬─────────────────────────────────────────────────────┐
│ SERVICE │ STATUS                                              │
├─────────┼─────────────────────────────────────────────────────┤
│ lndbtc  │ Syncing 34.24% (610000/1781443)                     │
├─────────┼─────────────────────────────────────────────────────┤
│ lndltc  │ Syncing 12.17% (191000/1568645)                     │
└─────────┴─────────────────────────────────────────────────────┘

Wallet setup question

Do you want to create a new opendexd environment or restore an existing one?
1) Create New
2) Restore Existing
Please choose: 1
You are creating an opendexd node key and underlying wallets. All will be secured by a single password provided below.

Enter a password: 
Re-enter password: 

----------------------BEGIN OPENDEX SEED---------------------
 1. you         2. won't       3. find        4. money      
 5. in          6. this        7. seed        8. but    
 9. good       10. thinking   11. if         12. you      
13. are        14. interested 15. in         16. getting     
17. rewarded   18. for        19. testing    20. opendex  
21. security   22. hit        23. us         24. up   
-----------------------END OPENDEX SEED----------------------

The following wallets were initialized: BTC, LTC, ERC20(ETH)

Auto-unlock question

Backup setup question

Please enter a path to a destination where to store a backup of your environment. It includes everything, but NOT your on-chain wallet balance which is secured by your opendexd SEED. The path should be an external drive, like a USB or network drive, which is permanently available on your device since backups are written constantly.

Enter path to backup location: /media/USB/
Checking... OK.

The most familiar console

mainnet > status
┌───────────┬────────────────────────────────────────────────┐
│ SERVICE   │ STATUS                                         │
├───────────┼────────────────────────────────────────────────┤
│ bitcoind  │ Ready (light mode)                             │
├───────────┼────────────────────────────────────────────────┤
│ litecoind │ Ready (light mode)                             │
├───────────┼────────────────────────────────────────────────┤
│ geth      │ Ready (light mode)                             │
├───────────┼────────────────────────────────────────────────┤
│ lndbtc    │ Syncing                                        │
├───────────┼────────────────────────────────────────────────┤
│ lndltc    │ Syncing                                        │
├───────────┼────────────────────────────────────────────────┤
│ connext   │ Ready                                          │
├───────────┼────────────────────────────────────────────────┤
│ opendexd  │ Waiting for lndbtc, lndltc                     │
└───────────┴────────────────────────────────────────────────┘

2. Which issues (if any) are related?

Close #7.

3. Which documentation changes (if any) need to be made?

https://opendex.network/docs/swap-providers#lets-roll

  1. Single line bootstrap command
sh -c "$(curl -sfL https://raw.githubusercontent.com/opendexnetwork/opendex-docker/master/opendex.sh)"
  1. Remove simnet
1) Testnet
2) Mainnet

4. Does this introduce a backward incompatible change or deprecation?

It may affects the old non-interactive setup flow.

5. How to test?

export BRANCH=feat/interactive-setup
sh -c "$(curl -sfL https://raw.githubusercontent.com/opendexnetwork/opendex-docker/feat/interactive-setup/opendex.sh)"

Todos

  • Handle create/unlock failure case
  • Backup setup missing
  • status command missing
  • Interactive update checking

@Maith8Ae Maith8Ae self-assigned this Mar 2, 2021
@Maith8Ae Maith8Ae requested a review from BitcoinOG March 3, 2021 05:34
@Maith8Ae
Copy link
Collaborator Author

Maith8Ae commented Mar 4, 2021

Failed with this bug on Linux only.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x6b9fb2]

goroutine 1 [running]:
github.com/opendexnetwork/opendex-launcher/core.(*Launcher).Start(0xc000024100, 0xc000000180, 0xc0000d3f78)
        /home/runner/work/opendex-launcher/opendex-launcher/core/launcher.go:244 +0x92
main.main()
        /home/runner/work/opendex-launcher/opendex-launcher/main.go:11 +0x2b

@Maith8Ae
Copy link
Collaborator Author

Maith8Ae commented Mar 9, 2021

Ubuntu 20.04.2 unzip not found

Copy link
Contributor

@BitcoinOG BitcoinOG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just ran this. Weirdly I don't get the unzip not found error today, just the shell exiting when I choose testnet:

~$ export BRANCH=feat/interactive-setup
~$ sh -c "$(curl -sfL https://raw.githubusercontent.com/opendexnetwork/opendex-docker/feat/interactive-setup/opendex.sh)"
Installing opendex-launcher v1.0.0-rc.5 ...
https://github.com/opendexnetwork/opendex-launcher/releases/download/v1.0.0-rc.5/opendex-launcher-linux-amd64.zip
1) Testnet
2) Mainnet
Please choose the network: 1
~$ 

@Maith8Ae
Copy link
Collaborator Author

Ubuntu 20.04.2 unzip not found

Fixed by using gunzip on Linux.

@Maith8Ae
Copy link
Collaborator Author

Just ran this. Weirdly I don't get the unzip not found error today, just the shell exiting when I choose testnet:

~$ export BRANCH=feat/interactive-setup
~$ sh -c "$(curl -sfL https://raw.githubusercontent.com/opendexnetwork/opendex-docker/feat/interactive-setup/opendex.sh)"
Installing opendex-launcher v1.0.0-rc.5 ...
https://github.com/opendexnetwork/opendex-launcher/releases/download/v1.0.0-rc.5/opendex-launcher-linux-amd64.zip
1) Testnet
2) Mainnet
Please choose the network: 1
~$ 

You could run export DEBUG=on to print more debug messages. I guess it's becuase your GitHub access token is not set. It's required to run feature branch.

Probably related to this issue: opendexnetwork/opendex-launcher#3

@BitcoinOG
Copy link
Contributor

BitcoinOG commented Mar 12, 2021

Ran this on testnet, basic setup is working 🎉

~$ export BRANCH=feat/interactive-setup
~$ sh -c "$(curl -sfL https://raw.githubusercontent.com/opendexnetwork/opendex-docker/feat/interactive-setup/opendex.sh)"
Installing opendex-launcher v1.0.0-rc.5 ...
https://github.com/opendexnetwork/opendex-launcher/releases/download/v1.0.0-rc.5/opendex-launcher-linux-amd64.zip
1) Testnet
2) Mainnet
Please choose the network: 1
🚀 Launching testnet environment
🌍 Checking for updates ...
🏃 Warming up ...

Syncing light clients:
┌─────────┬───────────────────────────────────────────────────┐
│ SERVICE │ STATUS                                            │
├─────────┼───────────────────────────────────────────────────┤
│ lndbtc  │ Syncing 100.00% (1939978/1939978)                 │
├─────────┼───────────────────────────────────────────────────┤
│ lndltc  │ Syncing 100.00% (1841256/1841256)                 │
└─────────┴───────────────────────────────────────────────────┘
You are creating an opendex node key and underlying wallets. All will be secured by a single password provided below.

Enter a password: 
Re-enter password: 

----------------------BEGIN OpenDEX SEED---------------------
 1. abandon     2. betray      3. tackle      4. twist     
 5. response    6. april       7. ball        8. clinic    
 9. virtual    10. never      11. deny       12. soup      
13. sand       14. blind      15. device     16. invite    
17. spray      18. bar        19. satoshi    20. copper    
21. tiger      22. latin      23. hotel      24. put       
-----------------------END OpenDEX SEED----------------------

Please write down your 24 word mnemonic. It will allow you to recover your OpenDEX node key and on-chain funds for the initialized wallets listed above should you forget your password or lose your device. Off-chain funds in channels can NOT be recovered with it and must be backed up and recovered separately. Keep it somewhere safe, it is your ONLY backup in case of data loss.

The following wallets were initialized: BTC, LTC, ETH




             .___                         __  .__   
           __| _/____ ___  ___      _____/  |_|  |  
          / __ |/ __ \\  \/  /    _/ ___\   __\  |  
         / /_/ \  ___/ >    <     \  \___|  | |  |__
         \____ |\___  >__/\_ \     \___  >__| |____/
              \/    \/      \/         \/           

--------------------------------------------------------------

testnet > 

@BitcoinOG
Copy link
Contributor

BitcoinOG commented Mar 12, 2021

Noticed these smaller issues:

  • if I exit the shell, what's the best way to get in again? I ran sh -c "$(curl -sfL https://raw.githubusercontent.com/opendexnetwork/opendex-docker/feat/interactive-setup/opendex.sh)" again, that the correct way? Anyhow, it brought up the light client sync status again which it shouldn't:
~$ sh -c "$(curl -sfL https://raw.githubusercontent.com/opendexnetwork/opendex-docker/feat/interactive-setup/opendex.sh)"
1) Testnet
2) Mainnet
Please choose the network: 1
🚀 Launching testnet environment
🌍 Checking for updates ...
🏃 Warming up ...

Syncing light clients:
┌─────────┬───────────────────────────────────────────────────┐
│ SERVICE │ STATUS                                            │
├─────────┼───────────────────────────────────────────────────┤
│ lndbtc  │ Ready                                             │
├─────────┼───────────────────────────────────────────────────┤
│ lndltc  │ Ready                                             │
└─────────┴───────────────────────────────────────────────────┘

             .___                         __  .__   
           __| _/____ ___  ___      _____/  |_|  |  
          / __ |/ __ \\  \/  /    _/ ___\   __\  |  
         / /_/ \  ___/ >    <     \  \___|  | |  |__
         \____ |\___  >__/\_ \     \___  >__| |____/
              \/    \/      \/         \/           

--------------------------------------------------------------

testnet > 
  • down missing
testnet > down
Not implemented yet!
  • the jump from The following wallets were initialized: BTC, LTC, ETH to entering the shell took several seconds, if this is expected and can't be changed, we should add sth like Loading opendex shell
  • let's change the grafiti from dex ctl to simply OpenDEX

@BitcoinOG BitcoinOG self-requested a review March 17, 2021 09:40
Copy link
Contributor

@BitcoinOG BitcoinOG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exits here...

Syncing light clients:
┌─────────┬───────────────────────────────────────────────────┐
│ SERVICE │ STATUS                                            │
├─────────┼───────────────────────────────────────────────────┤
│ lndbtc  │ Syncing 100.00% (1940583/1940583)                 │
├─────────┼───────────────────────────────────────────────────┤
│ lndltc  │ Syncing 100.00% (1843256/1843256)                 │
└─────────┴───────────────────────────────────────────────────┘
Do you want to create a new opendexd environment or restore an existing one?
1) Create New
2) Restore Existing
Please choose: 1
ERROR: type not a pointer: string
~/.opendex-docker

@BitcoinOG
Copy link
Contributor

BitcoinOG commented Mar 17, 2021

Same when re-entering env, all I did was pressing 1 and Enter:

~/.opendex-docker$ sh -c "$(curl -sfL https://raw.githubusercontent.com/opendexnetwork/opendex-docker/feat/interactive-setup/opendex.sh)"
1) Testnet
2) Mainnet
Please choose the network: 1
🚀 Launching testnet environment
🌍 Checking for updates ...
🏃 Warming up ...

Syncing light clients:
┌─────────┬───────────────────────────────────────────────────┐
│ SERVICE │ STATUS                                            │
├─────────┼───────────────────────────────────────────────────┤
│ lndbtc  │ Syncing 100.00% (1940583/1940583)                 │
├─────────┼───────────────────────────────────────────────────┤
│ lndltc  │ Syncing 100.00% (1843256/1843256)                 │
└─────────┴───────────────────────────────────────────────────┘
🕹️ Loading OpenDEX console ...
Do you want to create a new opendexd environment or restore an existing one?
1) Create New
2) Restore Existing
Please choose: 1
ERROR: type not a pointer: string
~/.opendex-docker

@BitcoinOG BitcoinOG self-requested a review March 24, 2021 16:42
Copy link
Contributor

@BitcoinOG BitcoinOG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small bug to fix: enter the OpenDEX console instead of throwing the Create New / Restore Existing selection again, when this is fixed we can merge:

~/.opendex-docker$ sh -c "$(curl -sfL https://raw.githubusercontent.com/opendexnetwork/opendex-docker/feat/interactive-setup/opendex.sh)"
Installing opendex-launcher v1.0.0-rc.5 ...
https://github.com/opendexnetwork/opendex-launcher/releases/download/v1.0.0-rc.5/opendex-launcher-linux-amd64.zip
1) Testnet
2) Mainnet
Please choose the network: 1
🚀 Launching testnet environment
🌍 Checking for updates ...
🏃 Warming up ...

Syncing light clients:
┌─────────┬───────────────────────────────────────────────────┐
│ SERVICE │ STATUS                                            │
├─────────┼───────────────────────────────────────────────────┤
│ lndbtc  │ Syncing 100.00% (1964007/1964007)                 │
├─────────┼───────────────────────────────────────────────────┤
│ lndltc  │ Syncing 100.00% (1845256/1845256)                 │
└─────────┴───────────────────────────────────────────────────┘
🕹️ Loading OpenDEX console ...
Do you want to create a new opendexd environment or restore an existing one?
1) Create New
2) Restore Existing
Please choose: 1
You are creating an opendex node key and underlying wallets. All will be secured by a single password provided below.

Enter a password: 
Re-enter password: 

----------------------BEGIN OpenDEX SEED---------------------
 1. abandon     2. trick       3. palm        4. spot      
 5. hover       6. fringe      7. you         8. upgrade   
 9. rice       10. early      11. lock       12. cup       
13. lemon      14. man        15. chunk      16. staff     
17. clump      18. try        19. frog       20. mind      
21. garment    22. fork       23. venture    24. silver    
-----------------------END OpenDEX SEED----------------------


Please write down your 24 word mnemonic. It will allow you to recover your OpenDEX node key and on-chain funds for the initialized wallets listed above should you forget your password or lose your device. Off-chain funds in channels can NOT be recovered with it and must be backed up and recovered separately. Keep it somewhere safe, it is your ONLY backup in case of data loss.

The following wallets were initialized: BTC, LTC, ETH
Do you want to create a new opendexd environment or restore an existing one?
1) Create New
2) Restore Existing

@BitcoinOG
Copy link
Contributor

BitcoinOG commented Mar 24, 2021

Other than that, when I exited and entered the env again, the OpenDEX console loaded, down worked too 👍🏾

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bring back interactive CLI mode

2 participants