Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Quick start guide and simplified gm-world tutorial #360

Merged
merged 18 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ function nav() {
return [
{ text: "Intro", link: "/learn/intro" },
{ text: "Learn", link: "/learn/overview" },
{ text: "Tutorials", link: "/tutorials/overview" },
{ text: "Tutorials", link: "/tutorials/quick-start" },
{ text: "How To Guides", link: "/guides/overview" },
{ text: "Testnets", link: "/testnets/cosmwasm-testnet" },
{ text: "Blog", link: "/blog/overview" },
Expand Down Expand Up @@ -207,15 +207,18 @@ function sidebarHome() {
text: "Tutorials",
collapsed: true,
items: [
{ text: "Overview", link: "/tutorials/overview" },
{
text: "Rollkit",
collapsed: true,
items: [
// { text: 'Starter Rollup with Docker', link: '/tutorials/rollup-docker'},
// { text: 'Starter Rollup', link: '/tutorials/starter-rollup'},
{
text: "GM world rollup: Part 1, local devnet",
text: "Quick start guide",
link: "/tutorials/quick-start",
},
{
text: "GM world rollup",
link: "/tutorials/gm-world",
},
{ text: "GM world frontend", link: "/tutorials/gm-world-frontend" },
Expand Down
4 changes: 2 additions & 2 deletions index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ hero:
alt: Rollkit
actions:
- theme: brand
text: Starter Rollup
link: /tutorials/gm-world
text: Quick Start
link: /tutorials/quick-start
- theme: alt
text: Introduction
link: /learn/intro
Expand Down
8 changes: 8 additions & 0 deletions scripts/install-gm-rollup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

echo "Downloading GM tutorial rollup source code..."
git clone https://github.com/rollkit/gm.git
cd gm || { echo "Failed to find the downloaded repository"; exit 1; }
git fetch && git checkout remotes/origin/tutorial-local-da
echo "Building and configuring rollup chain..."
bash init.sh
120 changes: 120 additions & 0 deletions scripts/install-go.sh
MSevey marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
#!/bin/bash -e

# This script installs or updates to the latest version of Go.
# Multi-platform (Linux and macOS)
# Multi-architecture (amd64, arm64, arm) support

deps=( curl jq )

for dep in "${deps[@]}"; do
if ! command -v "$dep" &> /dev/null; then
echo "$dep is not installed. Downloading and executing the script..."
curl -sSL https://raw.githubusercontent.com/rollkit/docs/main/scripts/install-jq.sh | bash
exit $?
fi
done

version="${1:-$(curl -s 'https://go.dev/dl/?mode=json' | jq -r '.[0].version')}"
current="$(/usr/local/go/bin/go version 2>/dev/null | awk '{print $3}')"
if [[ "$current" == "$version" ]]; then
echo "Go is already up-to-date at version ${version}"
exit 0
fi

update_go() {
local arch="$1"
local os="$2"

local go_url="https://golang.org/dl/${version}.${os}-${arch}.tar.gz"

curl -so "/tmp/${version}.${os}-${arch}.tar.gz" -L "$go_url" && \
rm -rf /usr/local/go && tar -C /usr/local -xzf /tmp/${version}.${os}-${arch}.tar.gz

tar -C /usr/local -xzf "/tmp/${version}.${os}-${arch}.tar.gz" && \
echo "Go updated to version ${version}"

rm "/tmp/${version}.${os}-${arch}.tar.gz"
}

case "$(uname -s)" in
Linux)
case "$(uname -m)" in
armv6l|armv7l)
update_go "armv6l" "linux"
;;
arm64)
update_go "arm64" "linux"
;;
x86_64)
update_go "amd64" "linux"
;;
*)
echo "Unsupported architecture: $(uname -m)" >&2
exit 1
;;
esac
;;
Darwin)
case "$(uname -m)" in
arm64)
update_go "arm64" "darwin"
;;
x86_64)
update_go "amd64" "darwin"
;;
*)
echo "Unsupported architecture: $(uname -m)" >&2
exit 1
;;
esac
;;
*)
echo "Unsupported operating system: $(uname -s)" >&2
exit 1
;;
esac

# Define the Go binary path
GO_BIN_PATH="/usr/local/go/bin"

# Function to add path to the specific shell config file
add_path_to_config() {
local config_file="$1"

# Check if the Go bin path is already in the config file to prevent duplicates
if ! grep -q "export PATH=.*$GO_BIN_PATH" "$config_file" ; then
echo "export PATH=\$PATH:$GO_BIN_PATH" >> "$config_file"
echo "Added $GO_BIN_PATH to $config_file"
else
echo "$GO_BIN_PATH is already in $config_file"
fi
}

# Determine shell and appropriate config file
if [[ -n "$ZSH_VERSION" ]]; then
# Assuming the user is using Zsh
CONFIG_FILE="$HOME/.zshenv"
elif [[ -n "$BASH_VERSION" ]]; then
# Check if .bash_profile exists, otherwise use .profile
if [[ -f "$HOME/.bash_profile" ]]; then
CONFIG_FILE="$HOME/.bash_profile"
else
CONFIG_FILE="$HOME/.profile"
fi
else
echo "Unsupported shell. Only Bash and Zsh are supported."
exit 1
fi

# Check if the Go bin path is already in the PATH
if [[ ":$PATH:" != *":$GO_BIN_PATH:"* ]]; then
echo "Adding $GO_BIN_PATH to PATH."
add_path_to_config "$CONFIG_FILE"
# Source the config file to update the current session
source "$CONFIG_FILE"
echo "$GO_BIN_PATH added to PATH successfully."
else
echo "$GO_BIN_PATH is already in PATH."
fi

/usr/local/go/bin/go version
29 changes: 29 additions & 0 deletions scripts/install-jq.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

if [[ "$OSTYPE" == "darwin"* ]]; then
echo "Detected macOS. Installing jq..."
if ! command -v brew &> /dev/null; then
echo "Homebrew is not installed. Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
brew install jq
echo "jq has been installed successfully."

elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
echo "Detected Linux. Installing jq..."
if command -v apt &> /dev/null; then
sudo apt update
sudo apt install -y jq
elif command -v yum &> /dev/null; then
sudo yum install -y epel-release
sudo yum install -y jq
else
echo "Unsupported package manager. Please install jq manually."
exit 1
fi
echo "jq has been installed successfully."

else
echo "Unsupported operating system."
exit 1
fi
10 changes: 10 additions & 0 deletions scripts/install-mock-da.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

echo "Downloading Mock-DA source code..."
git clone https://github.com/rollkit/mock-da.git
MSevey marked this conversation as resolved.
Show resolved Hide resolved
cd mock-da || { echo "Failed to find the downloaded repository"; exit 1; }
git checkout $1
coderabbitai[bot] marked this conversation as resolved.
Show resolved Hide resolved
echo "Building and installing Mock DA..."
make install
jcstein marked this conversation as resolved.
Show resolved Hide resolved
echo "Starting Mock DA..."
./build/mock-da
23 changes: 23 additions & 0 deletions scripts/install-rollkit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

echo "Downloading Rollkit source code..."
git clone https://github.com/rollkit/rollkit.git

if ! which go > /dev/null; then
echo "Go is not installed. Attempting to install Go..."
if ! which go > /dev/null; then
curl -sL https://raw.githubusercontent.com/rollkit/docs/main/scripts/install-go.sh | sh -s 1.22.2
if ! which go > /dev/null; then
echo "Failed to install Go. Please install it manually and rerun this script."
exit 1
fi
fi
fi

cd rollkit || { echo "Failed to find the downloaded repository."; exit 1; }
git checkout $1
echo "Building and installing Rollkit..."
make install
cd ..
echo "Installation completed successfully."

Loading
Loading