"Gather cpu/memory/network statistics of running Crunch jobs"
package_go_binary services/health arvados-health "$FORMAT" "$ARCH" \
"Check health of all Arvados cluster services"
-package_go_binary services/keep-balance keep-balance "$FORMAT" "$ARCH" \
+package_go_binary cmd/arvados-server keep-balance "$FORMAT" "$ARCH" \
"Rebalance and garbage-collect data blocks stored in Arvados Keep"
package_go_binary cmd/arvados-server keepproxy "$FORMAT" "$ARCH" \
"Make a Keep cluster accessible to clients that are not on the LAN"
temp=
temp_preserve=
+ignore_sigint=
+
clear_temp() {
if [[ -z "$temp" ]]; then
# we did not even get as far as making a temp dir
}
interrupt() {
+ if [[ -n "$ignore_sigint" ]]; then
+ echo >&2 "ignored SIGINT"
+ return
+ fi
failures+=("($(basename $0) interrupted)")
exit_cleanly
}
setnextcmd
HISTFILE="$WORKSPACE/tmp/.history"
history -r
+ ignore_sigint=1
while read -p 'What next? ' -e -i "$nextcmd" nextcmd; do
history -s "$nextcmd"
history -w
"git.arvados.org/arvados.git/lib/recovercollection"
"git.arvados.org/arvados.git/sdk/go/health"
"git.arvados.org/arvados.git/services/githttpd"
+ keepbalance "git.arvados.org/arvados.git/services/keep-balance"
keepweb "git.arvados.org/arvados.git/services/keep-web"
"git.arvados.org/arvados.git/services/keepproxy"
"git.arvados.org/arvados.git/services/keepstore"
"git-httpd": githttpd.Command,
"install": install.Command,
"init": install.InitCommand,
+ "keep-balance": keepbalance.Command,
"keep-web": keepweb.Command,
"keepproxy": keepproxy.Command,
"keepstore": keepstore.Command,
Description=Arvados Keep Balance
Documentation=https://doc.arvados.org/
After=network.target
+AssertPathExists=/etc/arvados/config.yml
# systemd>=230 (debian:9) obeys StartLimitIntervalSec in the [Unit] section
StartLimitIntervalSec=0
[Service]
-Type=simple
+Type=notify
+EnvironmentFile=-/etc/arvados/environment
ExecStart=/usr/bin/keep-balance -commit-pulls -commit-trash
# Set a reasonable default for the open file limit
LimitNOFILE=65536
if super.ClusterType != "test" {
tasks = append(tasks,
runServiceCommand{name: "dispatch-cloud", svc: super.cluster.Services.DispatchCloud},
- runGoProgram{src: "services/keep-balance", svc: super.cluster.Services.Keepbalance},
+ runServiceCommand{name: "keep-balance", svc: super.cluster.Services.Keepbalance},
)
}
super.tasksReady = map[string]chan bool{}
format(args.action, actions),
file=sys.stderr)
sys.exit(1)
+ # Create a new process group so our child processes don't exit on
+ # ^C in run-tests.sh interactive mode.
+ os.setpgid(0, 0)
if args.action == 'start':
stop(force=('ARVADOS_TEST_API_HOST' not in os.environ))
run(leave_running_atexit=True)
});
<% end %>
<div id="intropage">
- <img class="arvados-logo" src="<%= asset_path('logo.png') %>" style="display:block; margin:2em auto"/>
+ <img class="arvados-logo" src="<%= asset_path('logo.png') %>" style="display:block; margin:2em auto" alt="arvados logo"/>
<div style="width:30em; margin:2em auto 0 auto">
<h1>Welcome</h1>
<h4>ARVADOS</h4>
<div id="intropage">
- <img class="arvados-logo" src="<%= asset_path('logo.png') rescue '/logo.png' %>" style="display:block; margin:2em auto"/>
+ <img class="arvados-logo" src="<%= asset_path('logo.png') rescue '/logo.png' %>" style="display:block; margin:2em auto" alt="arvados logo" />
<div style="width:30em; margin:2em auto 0 auto">
<h1>Error</h1>
//
// SPDX-License-Identifier: AGPL-3.0
-package main
+package keepbalance
import (
"bytes"
//
// SPDX-License-Identifier: AGPL-3.0
-package main
+package keepbalance
import (
"bytes"
//
// SPDX-License-Identifier: AGPL-3.0
-package main
+package keepbalance
import (
"crypto/md5"
//
// SPDX-License-Identifier: AGPL-3.0
-package main
+package keepbalance
import (
"sync"
//
// SPDX-License-Identifier: AGPL-3.0
-package main
+package keepbalance
import (
"time"
//
// SPDX-License-Identifier: AGPL-3.0
-package main
+package keepbalance
import (
"encoding/json"
//
// SPDX-License-Identifier: AGPL-3.0
-package main
+package keepbalance
import (
"encoding/json"
//
// SPDX-License-Identifier: AGPL-3.0
-package main
+package keepbalance
import (
"context"
//
// SPDX-License-Identifier: AGPL-3.0
-package main
+package keepbalance
import (
"context"
//
// SPDX-License-Identifier: AGPL-3.0
-package main
+package keepbalance
import (
"bytes"
//
// SPDX-License-Identifier: AGPL-3.0
-package main
+package keepbalance
import (
"context"
//
// SPDX-License-Identifier: AGPL-3.0
-package main
+package keepbalance
import (
+ "bytes"
"context"
"flag"
"fmt"
"io"
- "net/http"
_ "net/http/pprof"
- "os"
"git.arvados.org/arvados.git/lib/cmd"
"git.arvados.org/arvados.git/lib/config"
"github.com/jmoiron/sqlx"
_ "github.com/lib/pq"
"github.com/prometheus/client_golang/prometheus"
- "github.com/sirupsen/logrus"
)
-func main() {
- os.Exit(runCommand(os.Args[0], os.Args[1:], os.Stdin, os.Stdout, os.Stderr))
-}
+type command struct{}
-func runCommand(prog string, args []string, stdin io.Reader, stdout, stderr io.Writer) int {
- logger := ctxlog.FromContext(context.Background())
+var Command = command{}
+func (command) RunCommand(prog string, args []string, stdin io.Reader, stdout, stderr io.Writer) int {
var options RunOptions
flags := flag.NewFlagSet(prog, flag.ContinueOnError)
flags.BoolVar(&options.Once, "once", false,
"send trash requests (delete unreferenced old blocks, and excess replicas of overreplicated blocks)")
flags.BoolVar(&options.CommitConfirmedFields, "commit-confirmed-fields", true,
"update collection fields (replicas_confirmed, storage_classes_confirmed, etc.)")
- dumpFlag := flags.Bool("dump", false, "dump details for each block to stdout")
- pprofAddr := flags.String("pprof", "", "serve Go profile data at `[addr]:port`")
- // "show version" is implemented by service.Command, so we
- // don't need the var here -- we just need the -version flag
+ // These options are implemented by service.Command, so we
+ // don't need the vars here -- we just need the flags
// to pass flags.Parse().
+ flags.Bool("dump", false, "dump details for each block to stdout")
+ flags.String("pprof", "", "serve Go profile data at `[addr]:port`")
flags.Bool("version", false, "Write version information to stdout and exit 0")
- if *pprofAddr != "" {
- go func() {
- logrus.Println(http.ListenAndServe(*pprofAddr, nil))
- }()
- }
-
- loader := config.NewLoader(os.Stdin, logger)
+ logger := ctxlog.New(stderr, "json", "info")
+ loader := config.NewLoader(&bytes.Buffer{}, logger)
loader.SetupFlags(flags)
-
munged := loader.MungeLegacyConfigArgs(logger, args, "-legacy-keepbalance-config")
if ok, code := cmd.ParseFlags(flags, prog, munged, "", stderr); !ok {
return code
}
- if *dumpFlag {
- dumper := logrus.New()
- dumper.Out = os.Stdout
- dumper.Formatter = &logrus.TextFormatter{}
- options.Dumper = dumper
- }
-
// Drop our custom args that would be rejected by the generic
// service.Command
args = nil
//
// SPDX-License-Identifier: AGPL-3.0
-package main
+package keepbalance
import (
"bytes"
func (s *mainSuite) TestVersionFlag(c *check.C) {
var stdout, stderr bytes.Buffer
- runCommand("keep-balance", []string{"-version"}, nil, &stdout, &stderr)
+ Command.RunCommand("keep-balance", []string{"-version"}, nil, &stdout, &stderr)
c.Check(stderr.String(), check.Equals, "")
c.Log(stdout.String())
c.Check(stdout.String(), check.Matches, `keep-balance.*\(go1.*\)\n`)
c.Assert(err, check.IsNil)
var stdout bytes.Buffer
- go runCommand("keep-balance", []string{"-config", "-"}, bytes.NewBuffer(config), &stdout, &stdout)
+ go Command.RunCommand("keep-balance", []string{"-config", "-"}, bytes.NewBuffer(config), &stdout, &stdout)
done := make(chan struct{})
go func() {
defer close(done)
//
// SPDX-License-Identifier: AGPL-3.0
-package main
+package keepbalance
import (
"fmt"
//
// SPDX-License-Identifier: AGPL-3.0
-package main
+package keepbalance
import (
"net/http"
### SERVER
server:
config:
+ # Needed for RVM, harmless otherwise. Cf. https://dev.arvados.org/issues/19015
+ env: GEM_HOME
# As we now differentiate where passenger is required or not, we need to
# load this module conditionally, so we add this conditional just to use
# the same pillar file
--- /dev/null
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
+
+{%- if grains.os_family in ('RedHat',) %}
+ {%- set group = 'nginx' %}
+{%- else %}
+ {%- set group = 'www-data' %}
+{%- endif %}
+
+# Make sure that /var/www/.passenger exists with the proper ownership
+# so that passenger can build passenger_native_support.so
+extra_var_www_passenger:
+ file.directory:
+ - name: /var/www/.passenger
+ - user: {{ group }}
+ - group: {{ group }}
+ - mode: '0755'
+ - makedirs: True
+
+{%- if grains.osfinger in ('CentOS Linux-7', 'Ubuntu-18.04', 'Debian-10') %}
+# Work around passenger issue when RVM is in use, cf
+# https://dev.arvados.org/issues/19015
+extra_nginx_set_gem_home:
+ file.managed:
+ - name: /etc/systemd/system/nginx.service.d/override.conf
+ - mode: '0644'
+ - user: root
+ - group: root
+ - makedirs: True
+ - replace: False
+ - contents: |
+ [Service]
+ ExecStart=
+ ExecStart=/bin/bash -a -c "GEM_HOME=`[ -x /usr/local/rvm/bin/rvm-exec ] && /usr/local/rvm/bin/rvm-exec default env |grep GEM_HOME=|cut -f2 -d= || true` && /usr/sbin/nginx -g 'daemon on; master_process on;'"
+ cmd.run:
+ - name: systemctl daemon-reload
+ - require:
+ - file: extra_nginx_set_gem_home
+ - file: extra_var_www_passenger
+ - onchanges:
+ - file: extra_nginx_set_gem_home
+{%- endif -%}
### SERVER
server:
config:
+ # Needed for RVM, harmless otherwise. Cf. https://dev.arvados.org/issues/19015
+ env: GEM_HOME
# As we now differentiate where passenger is required or not, we need to
# load this module conditionally, so we add this conditional just to use
# the same pillar file
--- /dev/null
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
+
+{%- if grains.os_family in ('RedHat',) %}
+ {%- set group = 'nginx' %}
+{%- else %}
+ {%- set group = 'www-data' %}
+{%- endif %}
+
+# Make sure that /var/www/.passenger exists with the proper ownership
+# so that passenger can build passenger_native_support.so
+extra_var_www_passenger:
+ file.directory:
+ - name: /var/www/.passenger
+ - user: {{ group }}
+ - group: {{ group }}
+ - mode: '0755'
+ - makedirs: True
+
+{%- if grains.osfinger in ('CentOS Linux-7', 'Ubuntu-18.04', 'Debian-10') %}
+# Work around passenger issue when RVM is in use, cf
+# https://dev.arvados.org/issues/19015
+extra_nginx_set_gem_home:
+ file.managed:
+ - name: /etc/systemd/system/nginx.service.d/override.conf
+ - mode: '0644'
+ - user: root
+ - group: root
+ - makedirs: True
+ - replace: False
+ - contents: |
+ [Service]
+ ExecStart=
+ ExecStart=/bin/bash -a -c "GEM_HOME=`[ -x /usr/local/rvm/bin/rvm-exec ] && /usr/local/rvm/bin/rvm-exec default env |grep GEM_HOME=|cut -f2 -d= || true` && /usr/sbin/nginx -g 'daemon on; master_process on;'"
+ cmd.run:
+ - name: systemctl daemon-reload
+ - require:
+ - file: extra_nginx_set_gem_home
+ - file: extra_var_www_passenger
+ - onchanges:
+ - file: extra_nginx_set_gem_home
+{%- endif -%}
### SERVER
server:
config:
+ # Needed for RVM, harmless otherwise. Cf. https://dev.arvados.org/issues/19015
+ env: GEM_HOME
# As we now differentiate where passenger is required or not, we need to
# load this module conditionally, so we add this conditional just to use
# the same pillar file
--- /dev/null
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
+
+{%- if grains.os_family in ('RedHat',) %}
+ {%- set group = 'nginx' %}
+{%- else %}
+ {%- set group = 'www-data' %}
+{%- endif %}
+
+# Make sure that /var/www/.passenger exists with the proper ownership
+# so that passenger can build passenger_native_support.so
+extra_var_www_passenger:
+ file.directory:
+ - name: /var/www/.passenger
+ - user: {{ group }}
+ - group: {{ group }}
+ - mode: '0755'
+ - makedirs: True
+
+{%- if grains.osfinger in ('CentOS Linux-7', 'Ubuntu-18.04', 'Debian-10') %}
+# Work around passenger issue when RVM is in use, cf
+# https://dev.arvados.org/issues/19015
+extra_nginx_set_gem_home:
+ file.managed:
+ - name: /etc/systemd/system/nginx.service.d/override.conf
+ - mode: '0644'
+ - user: root
+ - group: root
+ - makedirs: True
+ - replace: False
+ - contents: |
+ [Service]
+ ExecStart=
+ ExecStart=/bin/bash -a -c "GEM_HOME=`[ -x /usr/local/rvm/bin/rvm-exec ] && /usr/local/rvm/bin/rvm-exec default env |grep GEM_HOME=|cut -f2 -d= || true` && /usr/sbin/nginx -g 'daemon on; master_process on;'"
+ cmd.run:
+ - name: systemctl daemon-reload
+ - require:
+ - file: extra_nginx_set_gem_home
+ - file: extra_var_www_passenger
+ - onchanges:
+ - file: extra_nginx_set_gem_home
+{%- endif -%}
# Make sure that the value configured as IP_INT is a real IP on the system.
# If we don't error out early here when there is a mismatch, the formula will
# fail with hard to interpret nginx errors later on.
- ip addr list |grep -q "${IP_INT}/"
+ ip addr list |grep "${IP_INT}/" >/dev/null
if [[ $? -ne 0 ]]; then
echo "Unable to find the IP_INT address '${IP_INT}' on the system, please correct the value in local.params. Exiting..."
exit 1
yum install -y curl git jq
;;
"debian"|"ubuntu")
- DEBIAN_FRONTEND=noninteractive apt update
+ # Wait 2 minutes for any apt locks to clear
+ # This option is supported from apt 1.9.1 and ignored in older apt versions.
+ # Cf. https://blog.sinjakli.co.uk/2021/10/25/waiting-for-apt-locks-without-the-hacky-bash-scripts/
+ DEBIAN_FRONTEND=noninteractive apt -o DPkg::Lock::Timeout=120 update
DEBIAN_FRONTEND=noninteractive apt install -y curl git jq
;;
esac
echo " - arvados" >> ${S_DIR}/top.sls
echo " - extra.shell_sudo_passwordless" >> ${S_DIR}/top.sls
echo " - extra.shell_cron_add_login_sync" >> ${S_DIR}/top.sls
+ echo " - extra.passenger_rvm" >> ${S_DIR}/top.sls
# Pillars
echo " - docker" >> ${P_DIR}/top.sls
else
echo " - nginx.passenger" >> ${S_DIR}/top.sls
fi
+ echo " - extra.passenger_rvm" >> ${S_DIR}/top.sls
### If we don't install and run LE before arvados-api-server, it fails and breaks everything
### after it. So we add this here as we are, after all, sharing the host for api and controller
if [ "${SSL_MODE}" = "lets-encrypt" ]; then