diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a31599ad..dd88d27b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,14 +12,14 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - os: [debian10, ubuntu1804, ubuntu2004, ubuntu2204] + os: [rockylinux9, debian10, ubuntu1804, ubuntu2004, ubuntu2204] pg: [pg13, pg14] exclude: - os: ubuntu2204 pg: pg13 steps: - name: Checkout - uses: actions/checkout@v1 + uses: actions/checkout@v2 - name: Install shunit2 run: sudo apt-get install -y shunit2 - name: Build walkthroughs @@ -30,7 +30,7 @@ jobs: run: | cd linux/test PGVER=$PGVER ./docker-build.sh $ENV - ./test_services.sh + ./test_services.sh env: ENV: ${{ matrix.os }} PGVER: ${{ matrix.pg }} diff --git a/linux/autogenerate.sh b/linux/autogenerate.sh index 14ec3e86..d4fe6182 100755 --- a/linux/autogenerate.sh +++ b/linux/autogenerate.sh @@ -7,14 +7,14 @@ dir=`dirname $0` remove_docker_workaround () { l="$(echo -e "${@}" | sed -e 's/^[[:space:]]*//')" l="$(echo -e "${l}" | sed -e 's/^if.*!.*then//' )" -l="$(echo -e "${l}" | sed -e '/^if.*container.*then/,/else/d' )" +l="$(echo -e "${l}" | sed -e '/^if.*docker.*then/,/else/d' )" l="$(echo -e "${l}" | sed -e 's/^fi//')" echo "${l}" } #generate the walkthrough for all supported os function generate_all() { - values=(centos7 debian10 ubuntu1804 ubuntu2004 ubuntu2204) + values=(centos7 debian10 ubuntu1804 ubuntu2004 ubuntu2204 rocky9) for os in "${values[@]}"; do echo "${os}" generate ${os} @@ -36,6 +36,8 @@ EOF N=$OS if [[ $OS =~ "debian" ]] || [[ $OS =~ "ubuntu" ]] ; then N="ubuntu" +elif [[ $OS =~ "rocky" ]] ; then + N="centos7" elif [[ $OS =~ "centos" ]] ; then N="centos7" fi @@ -48,6 +50,8 @@ echo "$line" >> $file N=$OS if [[ $OS =~ "centos" ]] ; then N="centos" +elif [[ $OS =~ "rocky" ]] ; then + N="centos" elif [[ $OS =~ "ubuntu1804" ]] ; then N="ubuntu1804" elif [[ $OS =~ "ubuntu" ]] ; then @@ -70,6 +74,8 @@ echo "# install dependencies" >> $file N=$OS if [[ $OS =~ "ubuntu" ]] ; then N="ubuntu1804" +elif [[ $OS =~ "rocky" ]] ; then + N="centos7" fi line=$(sed -n '2,$p' $dir/step01_"$N"_deps.sh) @@ -95,23 +101,26 @@ echo -en '\n' >> $file # install postgres N=$OS +if [[ $OS =~ "rocky" ]] ; then + N="centos" +fi echo -en '\n' >> $file echo "# install Postgres" >> $file -if [[ $OS =~ "centos" ]] ; then - number=$(sed -n '/#start-postgresql-installation-general/=' $dir/step01_"$N"_pg_deps.sh) +if [[ $N =~ "centos" ]] ; then + number=$(sed -n '/#start-postgresql-installation-general/=' $dir/step01_"$OS"_pg_deps.sh) nrs=$((number+1)) - number=$(sed -n '/#end-postgresql-installation-general/=' $dir/step01_"$N"_pg_deps.sh) + number=$(sed -n '/#end-postgresql-installation-general/=' $dir/step01_"$OS"_pg_deps.sh) nre=$((number-1)) - line=$(sed -n ''$nrs','$nre'p' $dir/step01_"$N"_pg_deps.sh) + line=$(sed -n ''$nrs','$nre'p' $dir/step01_"$OS"_pg_deps.sh) line="$(echo -e "${line}" | sed -e 's/^[[:space:]]*//')" echo "$line" >> $file - number=$(sed -n '/#start-recommended/=' $dir/step01_"$N"_pg_deps.sh) + number=$(sed -n '/#start-recommended/=' $dir/step01_"$OS"_pg_deps.sh) nrs=$((number+1)) - number=$(sed -n '/#end-recommended/=' $dir/step01_"$N"_pg_deps.sh) + number=$(sed -n '/#end-recommended/=' $dir/step01_"$OS"_pg_deps.sh) nre=$((number-1)) - line=$(sed -n ''$nrs','$nre'p' $dir/step01_"$N"_pg_deps.sh) + line=$(sed -n ''$nrs','$nre'p' $dir/step01_"$OS"_pg_deps.sh) # remove docker conditional line=`remove_docker_workaround "${line}"` else @@ -121,6 +130,7 @@ else ne=$((number-1)) line=$(sed -n ''$ns','$ne'p' $dir/step01_"$N"_pg_deps.sh) fi +N=$OS # remove leading whitespace line="$(echo -e "${line}" | sed -e 's/^[[:space:]]*//')" diff --git a/linux/install_rocky9.sh b/linux/install_rocky9.sh new file mode 100644 index 00000000..5fc76d71 --- /dev/null +++ b/linux/install_rocky9.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +set -e -u -x + +OMEROVER=${OMEROVER:-latest} + +. `dirname $0`/settings.env + +bash -eux step01_centos7_init.sh + +bash -eux step01_centos7_deps.sh + +# install java +bash -eux step01_centos_java_deps.sh + +# install ice +bash -eux step01_rocky9_ice_deps.sh + +# install Postgres +bash -eux step01_rocky9_pg_deps.sh + +bash -eux step02_all_setup.sh + +bash -eux step03_all_postgres.sh + +bash -eux step01_rocky9_ice_venv.sh + +# Those steps are valid if an omero-server user exists +# This might not be the case when used in the context of devspace +if [ "$(getent passwd omero-server)" ]; then + cp settings.env step04_all_omero.sh setup_omero_db.sh ~omero-server + + OMEROVER=$OMEROVER bash -eux step04_all_omero_install.sh + + su - omero-server -c " bash -eux step04_all_omero.sh" + + su - omero-server -c "bash setup_omero_db.sh" +fi + + +#If you don't want to use the systemd scripts you can start OMERO manually: +#su - omero-server -c ". /home/omero-server/settings.env omero admin start" + +bash -eux step06_centos7_daemon.sh diff --git a/linux/settings.env b/linux/settings.env index 2e0cb5b3..40d22de9 100644 --- a/linux/settings.env +++ b/linux/settings.env @@ -17,4 +17,6 @@ export OMERODIR=/opt/omero/server/OMERO.server # Location of the virtual environment for omero-py VENV_SERVER=/opt/omero/server/venv3 -export PATH=$VENV_SERVER/bin:$PATH +export ICE_HOME=/opt/ice-3.6.5 + +export PATH=$ICE_HOME/bin:$VENV_SERVER/bin:$PATH diff --git a/linux/step01_rocky9_ice_deps.sh b/linux/step01_rocky9_ice_deps.sh new file mode 100644 index 00000000..82e451d2 --- /dev/null +++ b/linux/step01_rocky9_ice_deps.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +#start-recommended +dnf config-manager --set-enabled crb +yum -y install bzip2 expat libdb-cxx + +cd /tmp +wget https://github.com/sbesson/zeroc-ice-rockylinux9-x86_64/releases/download/202307018/Ice-3.6.5-rockylinux9-x86_64.tar.gz +tar xf Ice-3.6.5-rockylinux9-x86_64.tar.gz +mv Ice-3.6.5 /opt/ice-3.6.5 +echo /opt/ice-3.6.5/lib64 > /etc/ld.so.conf.d/ice-x86_64.conf +ldconfig +#end-recommended \ No newline at end of file diff --git a/linux/step01_rocky9_ice_venv.sh b/linux/step01_rocky9_ice_venv.sh new file mode 100644 index 00000000..3af259fd --- /dev/null +++ b/linux/step01_rocky9_ice_venv.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +set -e -u -x + +VENV_SERVER=${VENV_SERVER:-/opt/omero/server/venv3} +#start-ice-py +# Create a virtual env +python3 -mvenv $VENV_SERVER + +# Upgrade pip +$VENV_SERVER/bin/pip install --upgrade pip + +# Install the Ice Python binding +$VENV_SERVER/bin/pip install https://github.com/sbesson/zeroc-ice-py-rockylinux9-x86_64/releases/download/20230719/zeroc_ice-3.6.5-cp39-cp39-linux_x86_64.whl + +# Install server dependencies +$VENV_SERVER/bin/pip install omero-server +#end-ice-py diff --git a/linux/step01_rocky9_pg_deps.sh b/linux/step01_rocky9_pg_deps.sh new file mode 100644 index 00000000..f6c3e024 --- /dev/null +++ b/linux/step01_rocky9_pg_deps.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +PGVER=${PGVER:-pg13} # pg 13 is installed by default + +#start-postgresql-installation-general + +#end-postgresql-installation-general +#start-recommended +yum -y install postgresql-server postgresql + +if [ -f /.dockerenv ]; then + su - postgres -c "/usr/bin/initdb -D /var/lib/pgsql/data --encoding=UTF8" + echo "listen_addresses='*'" >> /var/lib/pgsql/data/postgresql.conf +else + PGSETUP_INITDB_OPTIONS=--encoding=UTF8 /usr/bin/postgresql-setup --initdb +fi +sed -i.bak -re 's/^(host.*)ident/\1md5/' /var/lib/pgsql/data/pg_hba.conf + +if [ -f /.dockerenv ]; then + su - postgres -c "/usr/bin/pg_ctl start -D /var/lib/pgsql/data -w" +else + systemctl start postgresql +fi + systemctl enable postgresql + +sed -i 's/ ident/ trust/g' /var/lib/pgsql/data/pg_hba.conf + +#end-recommended diff --git a/linux/step04_all_omero_install.sh b/linux/step04_all_omero_install.sh index 17cf43ea..f635b13a 100644 --- a/linux/step04_all_omero_install.sh +++ b/linux/step04_all_omero_install.sh @@ -1,6 +1,5 @@ #!/bin/bash OMEROVER=${OMEROVER:-latest} -ICEVER=${ICEVER:-ice36} set -eux @@ -8,16 +7,14 @@ set -eux #start-install -if [ "$ICEVER" = "ice36" ] || [ "$ICEVER" = "ice36-devel" ]; then - if [ $OMEROVER == "latest" ]; then - #start-release-ice36 - cd /opt/omero/server - SERVER=https://downloads.openmicroscopy.org/omero/5.6/server-ice36.zip - wget -q $SERVER -O OMERO.server-ice36.zip - unzip -q OMERO.server* - #end-release-ice36 - rm OMERO.server-ice36.zip - fi +if [ $OMEROVER == "latest" ]; then + #start-release-ice36 + cd /opt/omero/server + SERVER=https://downloads.openmicroscopy.org/omero/5.6/server-ice36.zip + wget -q $SERVER -O OMERO.server-ice36.zip + unzip -q OMERO.server* + #end-release-ice36 + rm OMERO.server-ice36.zip fi #start-link diff --git a/linux/step06_centos7_daemon.sh b/linux/step06_centos7_daemon.sh index 08e88c65..1bc95772 100644 --- a/linux/step06_centos7_daemon.sh +++ b/linux/step06_centos7_daemon.sh @@ -2,7 +2,7 @@ #start-recommended cp omero-server-systemd.service /etc/systemd/system/omero-server.service -if [ ! "${container:-}" = docker ]; then +if [ ! -f /.dockerenv ]; then systemctl daemon-reload fi systemctl enable omero-server.service diff --git a/linux/test/rockylinux9/Dockerfile b/linux/test/rockylinux9/Dockerfile new file mode 100644 index 00000000..83d27f22 --- /dev/null +++ b/linux/test/rockylinux9/Dockerfile @@ -0,0 +1,21 @@ +# Dockerfile for testing the OMERO Linux installation instructions +# Not intended for production use +FROM rockylinux:9 +MAINTAINER ome-devel@lists.openmicroscopy.org.uk + +ARG OMEROVER=latest +ARG JAVAVER=openjdk11 +ARG ICEVER=ice36 +ARG PGVER=pg13 + +RUN touch /.dockerenv +ADD omero-install-test.zip / +RUN dnf -y install unzip && unzip omero-install-test.zip + +RUN cd omero-install-test && \ + bash install_rocky9.sh + +ADD run.sh /home/omero-server/run.sh + +EXPOSE 80 4063 4064 +CMD ["/bin/bash", "-e", "/home/omero-server/run.sh"] diff --git a/linux/test/rockylinux9/run.sh b/linux/test/rockylinux9/run.sh new file mode 100644 index 00000000..8e105b18 --- /dev/null +++ b/linux/test/rockylinux9/run.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +su - postgres -c "/usr/bin/pg_ctl start -D /var/lib/pgsql/data -w" + +#service crond start # Doesn't work in Docker +su - omero-server -c ". /home/omero-server/settings.env && omero admin start" +if [ -t 1 ] ; then + exec bash +else + exec tail -F /opt/omero/server/OMERO.server/var/log/* +fi diff --git a/linux/test/test_services.sh b/linux/test/test_services.sh index 9ca03c22..e37e5ee7 100755 --- a/linux/test/test_services.sh +++ b/linux/test/test_services.sh @@ -39,9 +39,6 @@ docker exec $CNAME /bin/bash -c 'd=10; \ done; \ echo "Entry found"; exit' -#check OMERO.server service status -docker exec $CNAME /bin/bash -c "service omero-server status -l --no-pager" - docker exec $CNAME /bin/bash -c "su - omero-server -c \". ${SETTINGS} && omero admin diagnostics\"" # Log in to OMERO.server