Skip to content

Commit 97e7da8

Browse files
authored
Merge pull request #122 from ubccr/johrstrom-ood-src
OOD source builds for aarch64
2 parents ba8ed1e + 36efb9a commit 97e7da8

6 files changed

Lines changed: 183 additions & 75 deletions

File tree

ondemand/Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,23 @@
11
ARG HPCTS_VERSION=latest
22

33
FROM --platform=linux/amd64 ubccr/hpcts:slurm-${HPCTS_VERSION} as stage-amd64
4+
RUN dnf install -y https://yum.osc.edu/ondemand/2.0/ondemand-release-web-2.0-1.noarch.rpm
5+
RUN dnf install -y netcat ondemand ondemand-dex
6+
RUN sed -i 's/\-nohttpd//' /opt/ood/ondemand/root/usr/share/gems/2.7/ondemand/2.0.26/gems/ood_core-0.19.0/lib/ood_core/batch_connect/templates/vnc.rb
47

58
FROM --platform=linux/arm64 ubccr/hpcts:slurm-${HPCTS_VERSION} as stage-arm64
9+
RUN dnf install -y file lsof sudo gcc gcc-c++ git \
10+
patch lua-posix rsync ruby ruby-devel python2 python3 \
11+
nodejs sqlite sqlite-devel nmap-ncat httpd httpd-devel mod_ssl \
12+
libcurl-devel autoconf openssl-devel jansson-devel libxml2-devel \
13+
libxslt-devel gd-devel libaio-devel
14+
RUN gem install rake dotenv bcrypt
15+
COPY . /build
16+
RUN /build/install-dex-arm64.sh
17+
RUN /build/install-passenger-arm64.sh
18+
RUN /build/install-ood-arm64.sh
19+
RUN sed -i 's/\-nohttpd//' /usr/share/gems/gems/ood_core-0.19.0/lib/ood_core/batch_connect/templates/vnc.rb
20+
RUN rm -rf /build
621

722
ARG TARGETARCH
823

ondemand/entrypoint.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ then
2323
echo "---> Starting sshd on ondemand..."
2424
/usr/sbin/sshd -e
2525

26+
echo "---> Running update ood portal..."
27+
/opt/ood/ood-portal-generator/sbin/update_ood_portal
28+
2629
echo "---> Starting ondemand-dex..."
2730
gosu ondemand-dex /usr/sbin/ondemand-dex serve /etc/ood/dex/config.yaml &
2831

ondemand/install-dex-arm64.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
set -e
3+
4+
trap 'ret=$?; test $ret -ne 0 && printf "failed\n\n" >&2; exit $ret' EXIT
5+
6+
log_info() {
7+
printf "\n\e[0;35m $1\e[0m\n\n"
8+
}
9+
10+
DEX_VERSION=${DEX_VERSION:-2.31.1}
11+
DEX_PATCH_VERSION=${DEX_PATCH_VERSION:-703e26bc109e86d00be22ef1803bdb96b2dc09e2}
12+
13+
dnf install -y golang-bin
14+
log_info "Install dex ${DEX_VERSION}..."
15+
wget -O /tmp/dex-${DEX_VERSION}.tar.gz https://github.com/dexidp/dex/archive/v${DEX_VERSION}.tar.gz
16+
wget -O /tmp/dex-ood.patch https://github.com/OSC/dex/commit/${DEX_PATCH_VERSION}.patch
17+
pushd /tmp
18+
tar xvf dex-${DEX_VERSION}.tar.gz
19+
pushd dex-${DEX_VERSION}
20+
make build
21+
mv bin/dex bin/dex-orig
22+
patch -p1 < ../dex-ood.patch
23+
make build
24+
mv bin/dex /usr/sbin/ondemand-dex-session
25+
mv bin/dex-orig /usr/sbin/ondemand-dex
26+
popd
27+
rm -rf /tmp/dex*
28+
mkdir -p /usr/share/ondemand-dex/
29+
git clone https://github.com/OSC/ondemand-dex.git
30+
pushd ondemand-dex
31+
mv web /usr/share/ondemand-dex/
32+
popd
33+
rm -Rf ondemand-dex
34+
groupadd -r ondemand-dex
35+
useradd -r -d /var/lib/ondemand-dex -g ondemand-dex -s /sbin/nologin -c "OnDemand Dex" ondemand-dex
36+
mkdir -p /etc/ood/dex
37+
chown ondemand-dex:ondemand-dex /etc/ood/dex

ondemand/install-ood-arm64.sh

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/bin/bash
2+
set -e
3+
4+
trap 'ret=$?; test $ret -ne 0 && printf "failed\n\n" >&2; exit $ret' EXIT
5+
6+
log_info() {
7+
printf "\n\e[0;35m $1\e[0m\n\n"
8+
}
9+
10+
BUILD_DIR=$(mktemp -d -p /build)
11+
cd $BUILD_DIR
12+
13+
git clone https://github.com/cisco/cjose
14+
cd cjose
15+
git checkout 0.6.1
16+
./configure
17+
make && make install
18+
19+
# so mod_auth_openidc can find cjose
20+
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
21+
22+
cd $BUILD_DIR
23+
git clone https://github.com/zmartzone/mod_auth_openidc.git
24+
cd mod_auth_openidc
25+
git checkout v2.4.9.4
26+
sh autogen.sh
27+
./configure
28+
make && make install
29+
30+
cd $BUILD_DIR
31+
OOD_VERSION='2.0.27'
32+
wget "https://github.com/OSC/ondemand/archive/refs/tags/v$OOD_VERSION.tar.gz"
33+
tar -xf "v$OOD_VERSION.tar.gz"
34+
cd ondemand-$OOD_VERSION
35+
bundle config --local path ~/vendor/bundle
36+
bundle config build.nokogiri --use-system-libraries
37+
bundle config set force_ruby_platform true
38+
bundle install
39+
rake build -mj$(nproc)
40+
41+
mkdir -p /opt/ood
42+
mkdir -p /var/www/ood/{apps,public,discover}
43+
mkdir -p /var/www/ood/apps/{sys,dev,usr}
44+
mkdir -p /etc/ood/config
45+
46+
mv mod_ood_proxy /opt/ood/
47+
mv nginx_stage /opt/ood/
48+
mv ood-portal-generator /opt/ood/
49+
mv ood_auth_map /opt/ood/
50+
mv apps/* /var/www/ood/apps/sys/
51+
52+
mkdir -p /var/lib/ondemand-nginx/config/apps/sys/
53+
touch /var/lib/ondemand-nginx/config/apps/sys/dashboard.conf
54+
touch /var/lib/ondemand-nginx/config/apps/sys/shell.conf
55+
touch /var/lib/ondemand-nginx/config/apps/sys/myjobs.conf
56+
/opt/ood/nginx_stage/sbin/update_nginx_stage
57+
58+
tee /etc/httpd/conf.d/enabled_mods.conf <<EOF
59+
LoadModule auth_openidc_module modules/mod_auth_openidc.so
60+
LoadModule ssl_module modules/mod_ssl.so
61+
EOF
62+
63+
tee /etc/sudoers.d/ood <<EOF
64+
Defaults:apache !requiretty, !authenticate
65+
Defaults:apache env_keep += "NGINX_STAGE_* OOD_*"
66+
apache ALL=(ALL) NOPASSWD: /opt/ood/nginx_stage/sbin/nginx_stage
67+
Cmnd_Alias KUBECTL = /usr/local/bin/kubectl, /usr/bin/kubectl, /bin/kubectl
68+
Defaults!KUBECTL !syslog
69+
EOF
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/bin/bash
2+
set -e
3+
4+
trap 'ret=$?; test $ret -ne 0 && printf "failed\n\n" >&2; exit $ret' EXIT
5+
6+
log_info() {
7+
printf "\n\e[0;35m $1\e[0m\n\n"
8+
}
9+
10+
11+
PASS_VERSION='6.0.7'
12+
NGINX_VERSION='1.18.0'
13+
BUILD_DIR=$(mktemp -d -p /build)
14+
15+
wget -O $BUILD_DIR/passenger.tar.gz https://github.com/phusion/passenger/releases/download/release-$PASS_VERSION/passenger-$PASS_VERSION.tar.gz
16+
cd $BUILD_DIR
17+
tar xf passenger.tar.gz
18+
wget -O $BUILD_DIR/nginx.tar.gz http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz
19+
cd "$BUILD_DIR/passenger-$PASS_VERSION"
20+
tar xf $BUILD_DIR/nginx.tar.gz
21+
22+
PREFIX=/opt/ood/ondemand/root
23+
NGINX_DATADIR=$PREFIX/usr/share/nginx
24+
NGINX_CONFDIR=$PREFIX/etc/nginx
25+
NGINX_HOME=/var/lib/ondemand-nginx
26+
NGINX_HOME_TMP=$NGINX_HOME/tmp
27+
NGINX_LOGDIR=/var/log/ondemand-nginx
28+
BASE_CCOPTS='-g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -march=native -mtune=native'
29+
NGINX_CCOPTS="-O2 $BASE_CCOPTS"
30+
PASSENGER_CCOPTS="$BASE_CCOPTS -Wno-deprecated"
31+
LDOPTS="-Wl,-z,relro -Wl,-E"
32+
RUBY_LIBDIR=$PREFIX/usr/share/ruby/vendor_ruby
33+
34+
rake nginx OPTIMIZE=yes CACHING=false
35+
cd "$BUILD_DIR/passenger-$PASS_VERSION/nginx-$NGINX_VERSION"
36+
./configure --prefix=$NGINX_DATADIR --sbin-path=$PREFIX/usr/sbin/nginx --conf-path=$NGINX_CONFDIR/nginx.conf --error-log-path=$NGINX_LOGDIR/error.log --http-log-path=$NGINX_LOGDIR/access.log --http-client-body-temp-path=$NGINX_HOME_TMP/client_body --http-proxy-temp-path=$NGINX_HOME_TMP/proxy --http-fastcgi-temp-path=$NGINX_HOME_TMP/fastcgi --http-uwsgi-temp-path=$NGINX_HOME_TMP/uwsgi --http-scgi-temp-path=$NGINX_HOME_TMP/scgi --pid-path=/run/ondemand-nginx.pid --lock-path=/run/lock/subsys/ondemand-nginx --user=ondemand-nginx --group=ondemand-nginx --with-file-aio --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module --with-http_image_filter_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_stub_status_module --with-mail --with-mail_ssl_module --with-pcre --with-pcre-jit --add-module=../src/nginx_module --with-cc-opt="$NGINX_CCOPTS" --with-ld-opt="$LDOPTS" --with-debug
37+
38+
make -j$(nproc) && make install INSTALLDIRS=vendor
39+
mkdir -p $NGINX_DATADIR/html
40+
mkdir -p $NGINX_CONFDIR
41+
mkdir -p $NGINX_HOME
42+
mkdir -p $NGINX_HOME_TMP
43+
mkdir -p $NGINX_LOGDIR
44+
45+
set -x
46+
cd "$BUILD_DIR/passenger-$PASS_VERSION"
47+
which ruby
48+
rake fakeroot NATIVE_PACKAGING_METHOD=rpm FS_PREFIX=$PREFIX FS_BINDIR=$PREFIX/bin FS_SBINDIR=$PREFIX/sbin FS_DATADIR=$PREFIX/usr/share FS_LIBDIR=$PREFIX/lib64 FS_DOCDIR=$PREFIX/usr/share/doc RUBY=$(which ruby) RUBYLIBDIR=$RUBY_LIBDIR RUBYARCHDIR=$RUBY_LIBDIR APACHE2_MODULE_PATH=$PREFIX/usr/lib/apache2/modules/mod_passenger.so OPTIMIZE=yes CACHING=false EXTRA_CFLAGS="$PASSENGER_CCOPTS" EXTRA_CXXFLAGS="$PASSENGER_CCOPTS"
49+
50+
cp -a $BUILD_DIR/passenger-$PASS_VERSION/pkg/fakeroot/* /
51+
cd $BUILD_DIR/passenger-$PASS_VERSION
52+
./dev/install_scripts_bootstrap_code.rb --ruby $RUBY_LIBDIR $PREFIX/bin/passenger* $PREFIX/sbin/passenger* `find $PREFIX -name rack_handler.rb`
53+
54+
./dev/install_scripts_bootstrap_code.rb --nginx-module-config $PREFIX/bin $PREFIX/usr/share/passenger/ngx_http_passenger_module/config
55+
chmod +x $PREFIX/usr/share/passenger/helper-scripts/wsgi-loader.py

ondemand/install.sh

Lines changed: 4 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -7,75 +7,6 @@ log_info() {
77
printf "\n\e[0;35m $1\e[0m\n\n"
88
}
99

10-
ARCHTYPE=`uname -m`
11-
DEX_VERSION=${DEX_VERSION:-2.31.1}
12-
DEX_PATCH_VERSION=${DEX_PATCH_VERSION:-703e26bc109e86d00be22ef1803bdb96b2dc09e2}
13-
14-
log_info "Installing required packages for Ondemand ${ARCHTYPE}.."
15-
16-
if [[ "${ARCHTYPE}" = "x86_64" ]]; then
17-
dnf install -y https://yum.osc.edu/ondemand/2.0/ondemand-release-web-2.0-1.noarch.rpm
18-
dnf install -y \
19-
netcat \
20-
ondemand \
21-
ondemand-dex
22-
elif [[ "${ARCHTYPE}" = "aarch64" ]]; then
23-
# TODO: flesh out arm64 builds?
24-
dnf install -y golang-bin
25-
log_info "Install dex ${DEX_VERSION}..."
26-
wget -O /tmp/dex-${DEX_VERSION}.tar.gz https://github.com/dexidp/dex/archive/v${DEX_VERSION}.tar.gz
27-
wget -O /tmp/dex-ood.patch https://github.com/OSC/dex/commit/${DEX_PATCH_VERSION}.patch
28-
pushd /tmp
29-
tar xvf dex-${DEX_VERSION}.tar.gz
30-
pushd dex-${DEX_VERSION}
31-
make build
32-
mv bin/dex bin/dex-orig
33-
patch -p1 < ../dex-ood.patch
34-
make build
35-
mv bin/dex /usr/sbin/ondemand-dex-session
36-
mv bin/dex-orig /usr/sbin/ondemand-dex
37-
popd
38-
rm -rf /tmp/dex*
39-
mkdir -p /usr/share/ondemand-dex/
40-
git clone https://github.com/OSC/ondemand-dex.git
41-
pushd ondemand-dex
42-
mv web /usr/share/ondemand-dex/
43-
popd
44-
rm -Rf ondemand-dex
45-
groupadd -r ondemand-dex
46-
useradd -r -d /var/lib/ondemand-dex -g ondemand-dex -s /sbin/nologin -c "OnDemand Dex" ondemand-dex
47-
mkdir -p /etc/ood/dex
48-
tee /etc/ood/dex/config.yaml <<EOF
49-
---
50-
issuer: http://eb8307ff82be:5556
51-
storage:
52-
type: sqlite3
53-
config:
54-
file: "/etc/ood/dex/dex.db"
55-
web:
56-
http: 0.0.0.0:5556
57-
telemetry:
58-
http: 0.0.0.0:5558
59-
staticClients:
60-
- id: eb8307ff82be
61-
redirectURIs:
62-
- http://eb8307ff82be/oidc
63-
name: OnDemand
64-
secret: 7c6c2f51-2f97-4866-886e-2fcf5b974224
65-
oauth2:
66-
skipApprovalScreen: true
67-
enablePasswordDB: true
68-
staticPasswords:
69-
- email: ood@localhost
70-
hash: "$2a$10$2b2cU8CPhOTaGrs1HRQuAueS7JTT5ZHsHSzYiFPm1leZck7Mc8T4W"
71-
username: ood
72-
userID: '08a8684b-db88-4b73-90a9-3cd1661f5466'
73-
frontend:
74-
dir: "/usr/share/ondemand-dex/web"
75-
theme: hpc-coop
76-
EOF
77-
fi
78-
7910
log_info "Setting up Ondemand"
8011
mkdir -p /etc/ood/config/clusters.d
8112
mkdir -p /etc/ood/config/apps/shell
@@ -141,13 +72,11 @@ dex:
14172
theme: ondemand
14273
EOF
14374

144-
if [[ ${ARCHTYPE} = "x86_64" ]]; then
145-
log_info "Generating new httpd24 and dex configs.."
146-
/opt/ood/ood-portal-generator/sbin/update_ood_portal
75+
log_info "Generating new httpd24 and dex configs.."
76+
/opt/ood/ood-portal-generator/sbin/update_ood_portal
14777

148-
log_info "Adding new theme to dex"
149-
sed -i "s/theme: ondemand/theme: hpc-coop/g" /etc/ood/dex/config.yaml
150-
fi
78+
log_info "Adding new theme to dex"
79+
sed -i "s/theme: ondemand/theme: hpc-coop/g" /etc/ood/dex/config.yaml
15180

15281
dnf clean all
15382
rm -rf /var/cache/dnf

0 commit comments

Comments
 (0)