Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
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
181 changes: 181 additions & 0 deletions .bashrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac

# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth

# append to the history file, don't overwrite it
shopt -s histappend

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color|*-256color) color_prompt=yes;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi

if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'

alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi

# colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'

# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'

# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi



dc() {
DC_FILE="${DOCKER_COMPOSE_FILE:-/home/ubuntu/deployment/docker-compose.yml}"
docker-compose -f "$DC_FILE" "$@"
}

#alias dc="docker-compose -f $DC_FILE"
alias logs="docker-compose -f $DC_FILE logs"
alias n-logs="docker-compose -f $DC_FILE logs nginx"
alias ms-logs="docker-compose -f $DC_FILE logs ethereum-reader"
alias ew-logs="docker-compose -f $DC_FILE logs ethereum-writer"
alias s-logs="docker-compose -f $DC_FILE logs signer"
alias ms-exec="docker-compose -f $DC_FILE exec ethereum-reader sh"
alias ew-exec="docker-compose -f $DC_FILE exec ethereum-writer sh"
alias s-exec="docker-compose -f $DC_FILE exec signer sh"
alias docker=podman
alias sync="rsync -aq --progress --exclude='.venv' --exclude='.git' $HOME/orbs-node-on-host/ $ORBS_ROOT"

# fix crontab -e to use VIM

if [ "$color_prompt" = yes ]; then
# PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\] $(parse_git_branch)\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt


export EDITOR=vim
export VISUAL=vim

# Enable history search with Up and Down arrows
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'

# need to install fzf - apt install fzf

# Use fzf for history search
fzf-history-widget() {
local selected num
selected=$(history | fzf --tac +s --query="$READLINE_LINE")
if [[ -n $selected ]]; then
READLINE_LINE=$(echo $selected | sed -E 's/^[ ]*[0-9]+[ ]+//')
READLINE_POINT=${#READLINE_LINE}
fi
}

bind -x '"\C-r": fzf-history-widget'

parse_git_branch() {
git branch 2>/dev/null | sed -n '/\* /s///p'
}

shopt -s histappend

# Save each command to the history file immediately and reload the history
if [[ -n "$PROMPT_COMMAND" ]]; then
PROMPT_COMMAND="$PROMPT_COMMAND; history -a; history -c; history -r"
else
PROMPT_COMMAND="history -a; history -c; history -r"
fi
12 changes: 6 additions & 6 deletions .github/workflows/manager.yml → .github/workflows/control.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Manager validation
name: Control Validation

on:
pull_request:
Expand All @@ -14,18 +14,18 @@ jobs:
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v6.1.0
with:
python-version: "3.10"
python-version: "3.11"

- name: Install Poetry
uses: snok/install-poetry@v1
uses: snok/install-poetry@v1.4.1

- name: Install dependencies with Poetry
run: |
poetry install --no-interaction
working-directory: manager
working-directory: control

- name: Run pytest
run: make test
working-directory: manager
working-directory: control
8 changes: 4 additions & 4 deletions .github/workflows/smoke-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
env:
ETH_ENDPOINT: ${{ secrets.ETH_ENDPOINT }}
run: |
docker run -d -p 80:80 -e ETH_ENDPOINT=$ETH_ENDPOINT --privileged --name smoke_test test-ubuntu tail -f /dev/null
docker run -d -p 80:80 -e ETH_ENDPOINT=$ETH_ENDPOINT -e ORBS_ROOT="/home/ubuntu" --privileged --name smoke_test test-ubuntu tail -f /dev/null

- name: Run install script
run: |
Expand All @@ -43,13 +43,13 @@ jobs:
run: |
curl -f http://localhost/service/ethereum-reader/status

- name: Check manager's status is being served using legacy name (boyar)
- name: Check control's status is being served using legacy name (boyar)
run: |
curl -f http://localhost/service/boyar/status

- name: Check manager's status is being served using v4 name
- name: Check control's status is being served using v4 name
run: |
curl -f http://localhost/service/manager/status
curl -f http://localhost/service/control/status

- name: Check logger's status is being served using legacy name (logs-service)
run: |
Expand Down
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
config.json

*venv
home/
docs/
node_modules/
__pycache__/
home/
ignore
uv.sh

.env
log.txt
registry-data
node_exporter*

**/.DS_Store
8 changes: 5 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ FROM ubuntu:22.04
ARG DEBIAN_FRONTEND=noninteractive

# Add sudo to make more like EC2 instance
RUN apt-get update && apt-get install -y software-properties-common python3 python3-pip sudo locales vim
#RUN apt-get update && apt-get install -y software-properties-common python3 python3-pip sudo locales vim
# Add sudo to make more like EC2 instance
RUN apt-get update && apt-get install -y fzf software-properties-common python3 python3-pip sudo locales vim curl rsync git

# EC2 instances usually have locale settings
RUN locale-gen en_US.UTF-8 && update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
Expand Down Expand Up @@ -35,8 +37,8 @@ RUN echo 'alias ew-exec="docker-compose -f /home/ubuntu/deployment/docker-compos
RUN echo 'alias s-exec="docker-compose -f /home/ubuntu/deployment/docker-compose.yml exec signer sh"' >> ~/.bashrc

COPY --chown=ubuntu:ubuntu setup setup
COPY --chown=ubuntu:ubuntu manager manager
COPY --chown=ubuntu:ubuntu control control
COPY --chown=ubuntu:ubuntu deployment deployment
COPY --chown=ubuntu:ubuntu logging logging

CMD ["/bin/bash"]
CMD ["/bin/bash"]
28 changes: 28 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
registry:
@mkdir -p registry-data
@docker rm -f local-registry 2>/dev/null || true
docker run -d -p 6000:5000 -v $$(realpath registry-data):/var/lib/registry --name local-registry registry:2

build_docker_dev:
@docker buildx build --platform linux/arm64 -f local-dev.Dockerfile -t test-ubuntu_arm64 .

run_docker_dev:
@if [ -n "$(vol)" ]; then \
docker run --privileged -v $$(pwd):/home/ubuntu/orbs-node-on-host -v $(vol):/home/ubuntu/orbs-node-remote-repo-simulate -p 80:80 --rm -it test-ubuntu_arm64; \
else \
docker run --privileged -v $$(pwd):/home/ubuntu/orbs-node-on-host -p 80:80 --rm -it test-ubuntu_arm64; \
fi
#@docker run --privileged -v $$(pwd):/home/ubuntu/orbs-node-on-host -p 80:80 --rm -it test-ubuntu_arm64
#@docker run --privileged -v $$(pwd):/opt/orbs-node -v $$(pwd)/control/.venvdocker:/home/ubuntu/control/.venv -v $$(pwd)/deployment:/home/ubuntu/deployment -v $$(pwd)/logging:/home/ubuntu/logging -v $$(pwd)/control:/home/ubuntu/control -v $$(pwd)/setup:/home/ubuntu/setup -p 80:80 --rm -it test-ubuntu_arm64
#@docker run --privileged -v $$(pwd):/opt/orbs-node-on-host -v $$(pwd)/control/.venvdocker:/home/ubuntu/control/.venv -v $$(pwd)/deployment:/home/ubuntu/deployment -v $$(pwd)/logging:/home/ubuntu/logging -v $$(pwd)/control:/home/ubuntu/control -v $$(pwd)/setup:/home/ubuntu/setup -p 80:80 --rm -it test-ubuntu_arm64

run_docker_dev2:
@docker run --privileged -v $$(pwd)/control/.venvdocker:/home/ubuntu/control/.venv -v $$(pwd)/deployment:/home/ubuntu/deployment -v $$(pwd)/logging:/home/ubuntu/logging -v $$(pwd)/control:/home/ubuntu/control -v $$(pwd)/setup:/home/ubuntu/setup -p 81:80 --rm -it test-ubuntu_arm64

run_node:
. setup/scripts/base.sh && \
docker-compose -f "$$DOCKER_COMPOSE_FILE" up -d

stop_node:
. setup/scripts/base.sh && \
docker-compose -f "$$DOCKER_COMPOSE_FILE" down
39 changes: 34 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@

## What's this?

This repo is temporarily being used to hold all the Orbs v3 node validator install, manager and deployment files. In the future, they will be split into different repos
This repo is temporarily being used to hold all the Orbs v3 node validator install, control and deployment files. In the future, they will be split into different repos

## Folders

- `deployment` - Manifest files. These will eventually live at https://github.com/orbs-network/v3-deployment
- `manager` - Validator Python manager. These files will eventually live at https://github.com/orbs-network/v3-node-manager
- `setup` - Install scripts. These files will eventually live by themselves in this current repo (https://github.com/orbs-network/v3-node-setup)
- `deployment` - Manifest files.
- `control` - Validator Python control (manager) which replaced boyar.
- `setup` - Install scripts.
- `logging` - A service to expose container logs. These files will also live elsewhere in the future TBD

## Developing
Expand All @@ -24,7 +24,7 @@ This repo is temporarily being used to hold all the Orbs v3 node validator insta
docker run \
-v $(pwd)/deployment:/home/ubuntu/deployment \
-v $(pwd)/logging:/home/ubuntu/logging \
-v $(pwd)/manager:/home/ubuntu/manager \
-v $(pwd)/control:/home/ubuntu/control \
-v $(pwd)/setup:/home/ubuntu/setup \
-p 80:80 --rm -it --privileged test-ubuntu
```
Expand Down Expand Up @@ -58,3 +58,32 @@ From Mac host, run `curl http://localhost/service/ethereum-reader/status`
#### Healthcheck always shows "starting"

[Podman uses systemd timers to run healtchecks periodically](https://github.com/containers/podman/issues/19326), which do not work in our dev Docker-in-Docker setup. As a workaround, you can run the command [`podman healthcheck run SERVICE`](https://docs.podman.io/en/v4.4/markdown/podman-healthcheck-run.1.html) to manually run a specific container healthcheck.


# New version - jordan notes: -

Run locally on MacOS:

Build the dev guardian image:

```make build_docker_dev```

Run the dev guardian image:

```make run_docker_dev```

Run the installation script after getting docker container prompt:

```source ./orbs-node-on-host/setup/install.sh --skip-req```

Inside the container, playing with docker-compose, make sure to run the dc command, not docker-compose, it's
an alias to docker-compose with mapping to the right docker-compose-dev.yml if any.

```dc up -d``` for example.

To synchronize changes made by local host to the container (e.g. after modifying a file in the host), run:

```sync```



12 changes: 12 additions & 0 deletions containers.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[containers]
netns="host"
userns="host"
ipcns="host"
utsns="host"
cgroupns="host"
cgroups="disabled"
log_driver = "k8s-file"
[engine]
cgroup_manager = "cgroupfs"
events_logger="file"
runtime="crun"
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"editor.codeActionsOnSave": {
"source.organizeImports": true
},
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.defaultFormatter": "charliermarsh.ruff",
"isort.args": [
"--profile",
"black"
Expand Down
Loading