Skip to content

Commit

Permalink
Custom scripts, web terminal, welcome message
Browse files Browse the repository at this point in the history
  • Loading branch information
Xalava committed May 30, 2020
1 parent 7ff5ec1 commit d67b14b
Show file tree
Hide file tree
Showing 13 changed files with 128 additions and 16 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Cryptotux is a Linux image preconfigured with tools for crypto development and education.

Cryptotux is currently supplied as .ova images that can be directly imported into Virtualbox (6.X+).
Cryptotux is currently supplied as .ova images that can be directly imported into Virtualbox (6.X+) and VMWare.
It is particularly suited for workshops. Username is *bobby*, password is *bricodeur*.

![screenshot](screenshot.png)
Expand All @@ -24,7 +24,8 @@ To launch only nodes or tooling you can use the server version.
* Install [virtualbox](https://virtualbox.org)
* Download the latest "Server image" on [cryptotux.org](https://cryptotux.org)
* Click on the file or on "↶ import appliance" in virtualbox
* Connect via ssh `ssh bobby@192.168.33.10 ` (add `-o IdentitiesOnly=yes` if you have many keys) <!-- or have a preview by opening a browser at http://192.168.33.10:3030 -->
* Connect via ssh `ssh bobby@192.168.33.10 ` (add `-o IdentitiesOnly=yes` if you have many keys)
* Or open a browser at http://192.168.33.10:7681/

For ease you can also sync a local folder, let's call it 'remote', and the internal user folder of the machine with `sshfs -o IdentitiesOnly=yes bobby@192.168.33.10:/home/bobby ~/remote`

Expand Down
3 changes: 2 additions & 1 deletion assets/.bitcoin/bitcoin.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ rpcuser=bobby
rpcpassword=bricodeur
rpcallowip=127.0.0.1


zmqpubrawblock=tcp://127.0.0.1:28332
zmqpubrawtx=tcp://127.0.0.1:28333
9 changes: 7 additions & 2 deletions assets/.cryptotux/scripts/clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@ echo ">> Warning : Script designed for light image release, might be harsh for u
sudo apt-get autoclean -y;
sudo apt-get -y clean;
sudo apt-get -y --purge autoremove;
bleachbit -c --preset
# bleachbit -c --preset
rm -rf ~/.cache/thumbnails/*
sudo rm -rf /var/log/*
sudo rm -rf /home/*/.local/share/Trash/*
sudo rm -rf /root/.local/share/Trash/*
sudo find /tmp -type f -atime +1 -delete

dd if=/dev/zero of=/var/tmp/bigemptyfile bs=4096k
rm /var/tmp/bigemptyfile

rm .cryptotux/greeted
rm ~/.bash_history
history -c

echo ">>> Cleaning done <<<"
14 changes: 14 additions & 0 deletions assets/.cryptotux/scripts/libra.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

mkdir ~/Projects/
cd ~/Projects/
git clone https://github.com/libra/libra.git
cd libra
git checkout testnet
yes | ./scripts/dev_setup.sh
./scripts/cli/start_cli_testnet.sh
libraAlias="alias libra=~/Projects/libra//scripts/cli/start_cli_testnet.sh"
$libraAlias
echo $libraAlias >> ~/.bashrc
echo -e '\033[1mLibra installed\033[0m'
libra
14 changes: 14 additions & 0 deletions assets/.cryptotux/scripts/lightning.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
mkdir -p ~/Projects/
cd ~/Projects/
git clone https://github.com/bitcoin/bitcoin.git Bitcoin

go get -u github.com/golang/dep/cmd/dep
go get -d github.com/lightningnetwork/lnd
cd $GOPATH/src/github.com/lightningnetwork/lnd
make && make install
make check
# TODO add better configuration and walktrough
echo -e '\033[1mBitcoin source and Lightning node installed\033[0m'
echo -e 'launch \033[1mbitcoind \033[0min one terminal and in another one'
echo -e '\033[1mlnd --bitcoin.active --bitcoin.testnet --debuglevel=debug --bitcoin.node=bitcoind --bitcoind.rpcuser=bobby --bitcoind.rpcpass=bricodeur --bitcoind.zmqpubrawblock=tcp://127.0.0.1:28332 --bitcoind.zmqpubrawtx=tcp://127.0.0.1:28333\033[0m'
12 changes: 12 additions & 0 deletions assets/.cryptotux/scripts/tendermint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

echo export GO111MODULE=on >> ~/.bash_profile
mkdir -p $GOPATH/src/github.com/tendermint
cd $GOPATH/src/github.com/tendermint
git clone https://github.com/tendermint/tendermint.git
cd tendermint
make tools
make install
echo -e '\033[1mTendermint is ready to be used.\033[0m'
echo "Version : $(tendermint version)"

16 changes: 16 additions & 0 deletions assets/.cryptotux/scripts/tezos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
tezosHome="~/Projects/Tezos"
mkdir -p $tezosHome
cd $tezosHome
wget -O carthagenet.sh https://gitlab.com/tezos/tezos/raw/latest-release/scripts/tezos-docker-manager.sh
chmod +x carthagenet.sh
tezosAlias="alias tezos=$tezosHome/carthagenet.sh"
$tezosAlias
echo $tezosAlias >> ~/.bashrc
tezos start
cd
echo -e '\033[1mNode is launched and syncing to Tezos testnet \e[92mCarthagenet\e[39m \033[0m'
echo "Next steps:"
echo "- Claim some testnest tezzies on https://faucet.tzalpha.net/"
echo -e "- \033[1mtezos client\033[0m to connect to the node (tezos-client in the documentation)"
echo -e "- \033[1mtezos node stop \033[0mto stop the node"
2 changes: 2 additions & 0 deletions assets/.cryptotux/scripts/ttyd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
/home/bobby/.cryptotux/
6 changes: 3 additions & 3 deletions assets/.cryptotux/scripts/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ npm update -g
echo ">> Update local git repositories"
cd /home/bobby/Tutorials
for i in */.git; do ( echo "> $i ";cd $i/..; git pull;); done;
cd ~/Cryptotux-respository
git pull
cd ~/Projects/
for i in */.git; do ( echo "> $i ";cd $i/..; git pull;); done;
# TODO : update tooling based on the new versions in cryptotux
cd
echo ">> Update done "
echo ">>> Update done <<<"
6 changes: 4 additions & 2 deletions assets/.cryptotux/scripts/versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ echo ${vv#"Description:"}

echo -e "\n Languages"
# python -V # deprecated
gcc --version | head -n 1
python3 -V
go version
rustc --version
Expand All @@ -16,6 +17,7 @@ echo -e "\n Tooling"
docker --version
echo "geth" $(geth version | sed -n 2p)
bitcoind --version | head -n 1
# Optionnal installs
[ -x "$(command -v tendermint)" ] && tendermint version

echo ">> done <<"

echo ">>> done <<<"
15 changes: 15 additions & 0 deletions assets/.cryptotux/welcome.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@


As this is your first run, let me introduce available commands:
Blockchain nodes: bitcoind (locally), bitcoin-cli, geth
Programming languages: go, node, rust, gcc
Text editors: vim, nano, micro

General commands:
cryptotux-update: update everything
cryptotux-desktop: install a light desktop environment
cryptotux-versions: display the current version of the main toolings
cryptotux-help: display this help

To install specific blockchains tools and nodes
cryptotux-lightning,cryptotux-tendermint, cryptotux-tezos, cryptotux-libra...
5 changes: 4 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# Changelog
## 0.6.1 > TBR
## 0.6.1 > 30 May 2020
#### Users
- [server] Addition of micro, a command line text editor
- [server] Added web terminal
- [desktop] Default mimetypes for convenience
- [server] Welcome message with available commands
#### Internal
- install-server.sh can now be safely executed on a server independently of Vagrant
- Better script portability
- Additional scripts to install lightning, tendermint, Libra and Tezos (carthagenet)
## 0.6.0 > 27 May 2020
#### Users
- Extended to 40GB max sized harddrive. Allows testnets launch
Expand Down
37 changes: 32 additions & 5 deletions install-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ source ~/.bashrc
# snap install bitcoin
# Direct download
bitcoinCoreVersion=0.19.1
if [-e "/vagrant/dataShare/bitcoin-$bitcoinCoreVersion-x86_64-linux-gnu.tar.gz"]
then
if [[ -e "/vagrant/dataShare/bitcoin-$bitcoinCoreVersion-x86_64-linux-gnu.tar.gz" ]] ; then
# During development, import from a folder "dataShare" if available
cp "/vagrant/dataShare/bitcoin-$bitcoinCoreVersion-x86_64-linux-gnu.tar.gz" .
else
Expand Down Expand Up @@ -120,6 +119,25 @@ sudo install -m 0755 -o root -g root -t /usr/local/bin micro-$microVersion/micro
rm -rf micro-$microVersion/
rm "micro-$microVersion-linux64-static.tar.gz"

## Web terminal
ttydVersion=1.6.0
wget https://github.com/tsl0922/ttyd/releases/download/$ttydVersion/ttyd_linux.x86_64 -O ttyd
chmod +x ttyd
sudo mv ttyd /usr/local/bin
sudo sh -c 'echo "[Unit]
Description=Web based command line
[Service]
User=bobby
ExecStart=/usr/local/bin/ttyd -p 3310 -u bobby bash
WorkingDirectory=/home/bobby/
[Install]
WantedBy=multi-user.target" > /etc/systemd/system/ttyd.service'
sudo systemctl daemon-reload
sudo systemctl enable ttyd
sudo service ttyd start

## Tutorials
# Suggestions welcomed
cd
Expand All @@ -137,9 +155,10 @@ git clone https://github.com/cosmos/sdk-application-tutorial.git Cosmos-sdk-tuto
## Configuration Preferences
cd
# Retrieve configuration files from this repo
git clone https://github.com/cryptotuxorg/cryptotux ~/Cryptotux-repository
mkdir ~/Projects/
git clone https://github.com/cryptotuxorg/cryptotux ~/Projects/Cryptotux
# Use Vagrant shared folder if available for the latest version or the github imported version
[ -d "/vagrant/assets" ] && cryptopath="/vagrant" || cryptopath="/home/$USER/Cryptotux-repository"
[ -d "/vagrant/assets" ] && cryptopath="/vagrant" || cryptopath="/home/$USER/Projects/Cryptotux"
cp -R "${cryptopath}/assets/.bitcoin" .
cp -R "${cryptopath}/assets/.cryptotux" .
cp "${cryptopath}/install-desktop.sh" .cryptotux/scripts/
Expand All @@ -152,6 +171,13 @@ echo '
alias cryptotux-update="source ~/.cryptotux/scripts/update.sh"
alias cryptotux-clean="source ~/.cryptotux/scripts/clean.sh"
alias cryptotux-versions="source ~/.cryptotux/scripts/versions.sh"
alias cryptotux-help="cat .cryptotux/welcome.txt"
alias cryptotux-tezos="source ~/.cryptotux/scripts/tezos.sh"
alias cryptotux-libra="source ~/.cryptotux/scripts/libra.sh"
alias cryptotux-tendermint="source ~/.cryptotux/scripts/tendermint.sh"
alias cryptotux-lightning="source ~/.cryptotux/scripts/lightning.sh"
alias cryptotux-desktop="bash ~/.cryptotux/scripts/install-desktop.sh"' >> ~/.bashrc

#Nice command line help for beginners
Expand All @@ -160,8 +186,9 @@ echo 'alias tldr="tldr -t ocean"' >> ~/.bashrc
/home/bobby/.npm-global/bin/tldr update

sudo apt-get install -y cowsay
echo '(echo "Welcome to Cryptotux !"; )| cowsay -f turtle ' >> ~/.bashrc
echo '(echo "Welcome to Cryptotux !"; )| /usr/games/cowsay -f turtle ' >> ~/.bashrc
sed -i -e 's/#force_color_prompt/force_color_prompt/g' ~/.bashrc
echo '[ ! -e ~/.cryptotux/greeted ] && cryptotux-help && touch ~/.cryptotux/greeted' >> ~/.bashrc

## Optimization attempt (potential security and dependencies issues)
# Check if it is a local build, otherwise do nothign
Expand Down

0 comments on commit d67b14b

Please sign in to comment.