Continue work on launchd script for periodic rebuild.

Signed-off-by: Arthur Koziel <arthur@arthurkoziel.com>
This commit is contained in:
Arthur Koziel 2021-08-06 18:49:05 +08:00
parent 075516776d
commit 524566d1b9
No known key found for this signature in database
GPG Key ID: 55B0204F1259CA3A
6 changed files with 108 additions and 9 deletions

View File

@ -15,13 +15,15 @@ beacon_node_netkey_path: '{{ beacon_node_data_path }}/netkey'
beacon_node_rpc_script_path: '{{ beacon_node_path }}/rpc.sh'
beacon_node_build_script_path: '{{ beacon_node_path }}/build.sh'
beacon_node_build_launchd_path: '/Library/LaunchDaemons/com.status.beacon-node-build-unstable.plist'
# beacon_node_build_timer_enabled: true
# beacon_node_build_timer_timeout: 3600
# beacon_node_build_frequency: 'daily'
beacon_node_build_targets: ['nimbus_beacon_node', 'nimbus_signing_process']
beacon_node_repo_url: 'https://github.com/status-im/nimbus-eth2'
beacon_node_repo_branch: 'stable'
beacon_node_repo_branch: 'unstable' # for march=native fix
beacon_node_network: 'mainnet'
beacon_node_log_level: 'INFO'

36
files/zshrc Normal file
View File

@ -0,0 +1,36 @@
autoload colors # enable colors
autoload -U compinit # enable auto completion
colors # initialize
export HISTSIZE=4000 # number of lines kept in history
export SAVEHIST=4000 # number of lines saved in the history after logout
export HISTFILE="$HOME/.zhistory" # location of history
setopt INC_APPEND_HISTORY # append command to history file once executed
setopt APPEND_HISTORY # Dont overwrite, append!
setopt SHARE_HISTORY # for sharing history between zsh proceses
setopt HIST_IGNORE_ALL_DUPS # Ignore duplicates in history
setopt HIST_IGNORE_SPACE # dont record entry if a space is preceeding it
setopt NO_CASE_GLOB # case insensitive globbing
setopt NOFLOWCONTROL # Nobody needs flow control anymore. Troublesome feature.
setopt AUTO_PUSHD # auto directory pushd that you can get dirs list by cd -[tab]
setopt AUTOCD # change directory without using cd command
setopt EXTENDEDGLOB # Regular expressions in files
setopt COMPLETE_IN_WORD # allow tab completion in the middle of a word
setopt CHECK_JOBS # Dont quit console if processes are running
setopt completealiases
# 10ms for key sequences
export KEYTIMEOUT=1
export PROMPT='%F{yellow}%n%f@%F{green}%M%f:%F{blue}%~%f %# '
export EDITOR='vim'
# reload zshrc
function src() {
autoload -U zrecompile
[[ -f ~/.zshrc ]] && zrecompile -p ~/.zshrc
[[ -f ~/.zcompdump ]] && zrecompile -p ~/.zcompdump
[[ -f ~/.zcompdump ]] && zrecompile -p ~/.zcompdump
[[ -f ~/.zshrc.zwc.old ]] && rm -f ~/.zshrc.zwc.old
[[ -f ~/.zcompdump.zwc.old ]] && rm -f ~/.zcompdump.zwc.old
source ~/.zshrc
}

View File

@ -1,4 +1,23 @@
# todo: brew install cmake
- name: Create user for beacon node builds
user:
name: '{{ beacon_node_user }}'
group: '{{ beacon_node_group }}'
shell: '/bin/zsh'
uid: 8000
- name: Copy .zshrc file for beacon node user
copy:
src: 'zshrc'
dest: '/Users/{{ beacon_node_user }}/.zshrc'
owner: '{{ beacon_node_user }}'
group: '{{ beacon_node_group }}'
mode: 0644
- name: Sudoers file for login as nimbus user
template:
src: 'nimbus_sudoers.j2'
dest: '/etc/sudoers.d/81-nimbus-login'
mode: 0440
- name: Create directories
file:
@ -10,11 +29,6 @@
with_items:
- '{{ beacon_node_data_path }}'
- name: Create user for beacon node builds
user:
name: '{{ beacon_node_user }}'
group: '{{ beacon_node_group }}'
- name: Set disable rebase as merge strategy
git_config:
scope: 'global'
@ -38,3 +52,13 @@
owner: '{{ beacon_node_user }}'
group: '{{ beacon_node_group }}'
mode: 0775
- name: Create build script launchd job definition
template:
src: 'launchd.plist.j2'
dest: '{{ beacon_node_build_launchd_path }}'
- name: Reload launchd job definition
community.general.launchd:
name: com.status.beacon-node-build-unstable
state: restarted

View File

@ -18,12 +18,11 @@ function fetchChanges() {
function buildBinaries() {
# Lower CPU and I/O priority so it doesn't affect the running beacon node
# TODO no ionice on macos
NICE="nice -n 19"
${NICE} make -j6 update
${NICE} make -j6 {{ beacon_node_build_targets | join(" ") }} \
LOG_LEVEL="TRACE" NIMFLAGS="-d:disableMarchNative -d:testnet_servers_image -d:noSignalHandler"
LOG_LEVEL="TRACE" NIMFLAGS="-d:testnet_servers_image -d:noSignalHandler"
# Rename binaries to match commit they were built from.
{% for target in beacon_node_build_targets %}

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.status.beacon-node-build-unstable</string>
<key>ProgramArguments</key>
<array>
<string>/Users/nimbus/data/beacon-node-mainnet-unstable/build.sh</string>
</array>
<key>UserName</key>
<string>nimbus</string>
<key>GroupName</key>
<string>staff</string>
<key>StartInterval</key>
<integer>3600</integer>
<key>RootDirectory</key>
<string>/Users/nimbus/data/beacon-node-mainnet-unstable</string>
<key>RunAtLoad</key>
<true/>
<key>StandardErrorPath</key>
<string>/tmp/beacon-node.err</string>
<key>StandardOutPath</key>
<string>/tmp/beacon-node.out</string>
</dict>
</plist>

View File

@ -0,0 +1,4 @@
# Allow non-root users logging in as nimbus user
# %{{ beacon_node_group }} ALL= NOPASSWD: /bin/su postgres
%{{ beacon_node_group }} ALL=({{ beacon_node_user }}) NOPASSWD: ALL