opendexnetwork / opendex-docker

Streamlined setup of OpenDEX via Docker đŸŗ
GNU Affero General Public License v3.0
4 stars 1 forks source link

feat: interactive setup #31

Open Maith8Ae opened 3 years ago

Maith8Ae commented 3 years ago

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)"
  2. 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

Maith8Ae commented 3 years ago

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 commented 3 years ago

Ubuntu 20.04.2 unzip not found

Maith8Ae commented 3 years ago

Ubuntu 20.04.2 unzip not found

Fixed by using gunzip on Linux.

Maith8Ae commented 3 years ago

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: https://github.com/opendexnetwork/opendex-launcher/issues/3

BitcoinOG commented 3 years ago

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 commented 3 years ago

Noticed these smaller issues:

Syncing light clients: ┌─────────â”Ŧ───────────────────────────────────────────────────┐ │ SERVICE │ STATUS │ ├─────────â”ŧ───────────────────────────────────────────────────┤ │ lndbtc │ Ready │ ├─────────â”ŧ───────────────────────────────────────────────────┤ │ lndltc │ Ready │ └─────────┴───────────────────────────────────────────────────┘

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

testnet >

- [ ] `down` missing

testnet > down Not implemented yet!


- [x] 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`
- [x] let's change the grafiti from `dex ctl` to simply `OpenDEX`
BitcoinOG commented 3 years ago

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 commented 3 years ago

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