Skip to content

Commit

Permalink
Test OCI with parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
isboston committed Jan 24, 2025
1 parent 08cb7a2 commit 153aa4f
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 77 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/ci-oci-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ jobs:
run: |
matrix=$(echo '{
"include": [
{"execute": '${{ github.event.inputs.ubuntu2204 || true }}', "name": "Ubuntu22.04", "os": "ubuntu2204", "distr": "generic"},
{"execute": '${{ github.event.inputs.fedora41 || true }}', "name": "Fedora41", "os": "41-cloud-base", "distr": "fedora"}
]
}')
Expand Down Expand Up @@ -175,8 +174,8 @@ jobs:
TEST_CASE='--local-install' \
DISTR='${{ matrix.distr }}' \
OS='${{matrix.os}}' \
RAM='8192' \
CPU='3' \
RAM='9192' \
CPU='4' \
DOWNLOAD_SCRIPT='-ds false' \
TEST_REPO='-tr true' \
ARGUMENTS="-arg '--skiphardwarecheck true --localscripts true'" \
Expand Down
62 changes: 32 additions & 30 deletions install/OneClickInstall/docspace-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,63 +31,63 @@
# terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
#

PARAMETERS="$PARAMETERS -it COMMUNITY";
DOCKER="";
PARAMETERS="$PARAMETERS -it COMMUNITY"
DOCKER=""
LOCAL_SCRIPTS="false"
product="docspace"
product_sysname="onlyoffice";
product_sysname="onlyoffice"
FILE_NAME="$(basename "$0")"

while [ "$1" != "" ]; do
case $1 in
-ls | --localscripts )
if [ "$2" == "true" ] || [ "$2" == "false" ]; then
PARAMETERS="$PARAMETERS ${1}";
PARAMETERS="$PARAMETERS ${1}"
LOCAL_SCRIPTS=$2
shift
fi
;;

-gb | --gitbranch )
if [ "$2" != "" ]; then
PARAMETERS="$PARAMETERS ${1}";
PARAMETERS="$PARAMETERS ${1}"
GIT_BRANCH=$2
shift
fi
;;

docker )
DOCKER="true";
DOCKER="true"
shift && continue
;;

package )
DOCKER="false";
DOCKER="false"
shift && continue
;;

"-?" | -h | --help )
if [ -z "$DOCKER" ]; then
echo "Run 'bash $FILE_NAME docker' to install docker version of application or 'bash $FILE_NAME package' to install deb/rpm version."
echo "Run 'bash $FILE_NAME docker -h' or 'bash $FILE_NAME package -h' to get more details."
exit 0;
exit 0
fi
PARAMETERS="$PARAMETERS -ht $FILE_NAME";
PARAMETERS="$PARAMETERS -ht $FILE_NAME"
;;
esac
PARAMETERS="$PARAMETERS ${1}";
PARAMETERS="$PARAMETERS ${1}"
shift
done

root_checking () {
if [ ! $( id -u ) -eq 0 ]; then
if [[ $EUID -ne 0 ]]; then
echo "To perform this action you must be logged in with root rights"
exit 1;
exit 1
fi
}

command_exists () {
type "$1" &> /dev/null;
type "$1" &> /dev/null
}

install_curl () {
Expand All @@ -100,65 +100,67 @@ install_curl () {

if ! command_exists curl; then
echo "command curl not found"
exit 1;
exit 1
fi
}

read_installation_method () {
echo "Select 'Y' to install ${product_sysname^^} $product using Docker (recommended). Select 'N' to install it using RPM/DEB packages.";
echo "Select 'Y' to install ${product_sysname^^} $product using Docker (recommended). Select 'N' to install it using RPM/DEB packages."
read -p "Install with Docker [Y/N/C]? " choice
case "$choice" in
y|Y )
DOCKER="true";
DOCKER="true"
;;

n|N )
DOCKER="false";
DOCKER="false"
;;

c|C )
exit 0;
exit 0
;;

* )
echo "Please, enter Y, N or C to cancel";
echo "Please, enter Y, N or C to cancel"
;;
esac

if [ "$DOCKER" == "" ]; then
read_installation_method;
read_installation_method
fi
}

root_checking

if ! command_exists curl ; then
install_curl;
install_curl
fi

if command_exists docker &> /dev/null && docker ps -a --format '{{.Names}}' | grep -q "${product_sysname}-api"; then
DOCKER="true"
PARAMETERS="-u true $PARAMETERS"
elif command_exists apt-get &> /dev/null && dpkg -s ${product}-api >/dev/null 2>&1; then
DOCKER="false"
PARAMETERS="-u true $PARAMETERS"
elif command_exists yum &> /dev/null && rpm -q ${product}-api >/dev/null 2>&1; then
DOCKER="false"
fi

if [ -z "$DOCKER" ]; then
read_installation_method;
read_installation_method
fi

if [ -z $GIT_BRANCH ]; then
if [ -z "$GIT_BRANCH" ]; then
DOWNLOAD_URL_PREFIX="https://download.${product_sysname}.com/${product}"
else
DOWNLOAD_URL_PREFIX="https://raw.githubusercontent.com/${product_sysname^^}/${product}-buildtools/${GIT_BRANCH}/install/OneClickInstall"
fi

if [ "$DOCKER" == "true" ]; then
if [ "$LOCAL_SCRIPTS" == "true" ]; then
bash install-Docker.sh ${PARAMETERS} || EXIT_CODE=$?
bash install-Docker.sh "${PARAMETERS}" || EXIT_CODE=$?
else
curl -s -O ${DOWNLOAD_URL_PREFIX}/install-Docker.sh
curl -s -O "${DOWNLOAD_URL_PREFIX}"/install-Docker.sh
bash install-Docker.sh ${PARAMETERS} || EXIT_CODE=$?
rm install-Docker.sh
fi
Expand All @@ -167,21 +169,21 @@ else
if [ "$LOCAL_SCRIPTS" == "true" ]; then
bash install-RedHat.sh ${PARAMETERS} || EXIT_CODE=$?
else
curl -s -O ${DOWNLOAD_URL_PREFIX}/install-RedHat.sh
curl -s -O "${DOWNLOAD_URL_PREFIX}"/install-RedHat.sh
bash install-RedHat.sh ${PARAMETERS} || EXIT_CODE=$?
rm install-RedHat.sh
fi
elif [ -f /etc/debian_version ] ; then
if [ "$LOCAL_SCRIPTS" == "true" ]; then
bash install-Debian.sh ${PARAMETERS} || EXIT_CODE=$?
bash install-Debian.sh "${PARAMETERS}" || EXIT_CODE=$?
else
curl -s -O ${DOWNLOAD_URL_PREFIX}/install-Debian.sh
curl -s -O "${DOWNLOAD_URL_PREFIX}"/install-Debian.sh
bash install-Debian.sh ${PARAMETERS} || EXIT_CODE=$?
rm install-Debian.sh
fi
else
echo "Not supported OS";
exit 1;
echo "Not supported OS"
exit 1
fi
fi

Expand Down
2 changes: 1 addition & 1 deletion install/OneClickInstall/install-Debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ while [ "$1" != "" ]; do

-it | --installation_type )
if [ "$2" != "" ]; then
INSTALLATION_TYPE=$(echo "$2" | awk '{print toupper($0)}')
INSTALLATION_TYPE="${2^^}"
shift
fi
;;
Expand Down
62 changes: 40 additions & 22 deletions install/OneClickInstall/install-RedHat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
set -e

package_manager="yum"
package_sysname="onlyoffice";
package_sysname="onlyoffice"
product_name="DocSpace"
product=$(tr '[:upper:]' '[:lower:]' <<< ${product_name})
INSTALLATION_TYPE="ENTERPRISE"
MAKESWAP="true"
RES_APP_INSTALLED="is already installed";
RES_APP_INSTALLED="is already installed"
RES_APP_CHECK_PORTS="uses ports"
RES_CHECK_PORTS="please, make sure that the ports are free.";
RES_INSTALL_SUCCESS="Thank you for installing ONLYOFFICE ${product_name}.";
RES_CHECK_PORTS="please, make sure that the ports are free."
RES_INSTALL_SUCCESS="Thank you for installing ONLYOFFICE ${product_name}."
RES_QUESTIONS="In case you have any questions contact us via http://support.onlyoffice.com or visit our forum at http://forum.onlyoffice.com"
RES_MARIADB="To continue the installation, you need to remove MariaDB"
INSTALL_FLUENT_BIT="true"
Expand All @@ -26,6 +26,13 @@ while [ "$1" != "" ]; do
fi
;;

-uni | --uninstall )
if [ "$2" != "" ]; then
UNINSTALL=$2
shift
fi
;;

-je | --jwtenabled )
if [ "$2" != "" ]; then
JWT_ENABLED=$2
Expand All @@ -49,7 +56,7 @@ while [ "$1" != "" ]; do

-gb | --gitbranch )
if [ "$2" != "" ]; then
PARAMETERS="$PARAMETERS ${1}";
PARAMETERS="$PARAMETERS ${1}"
GIT_BRANCH=$2
shift
fi
Expand All @@ -62,14 +69,14 @@ while [ "$1" != "" ]; do
fi
;;

-du | --dashboadrsusername )
-du | --dashboardsusername )
if [ "$2" != "" ]; then
DASHBOARDS_USERNAME=$2
shift
fi
;;

-dp | --dashboadrspassword )
-dp | --dashboardspassword )
if [ "$2" != "" ]; then
DASHBOARDS_PASSWORD=$2
shift
Expand All @@ -92,7 +99,7 @@ while [ "$1" != "" ]; do

-it | --installation_type )
if [ "$2" != "" ]; then
INSTALLATION_TYPE=$(echo "$2" | awk '{print toupper($0)}');
INSTALLATION_TYPE="${2^^}"
shift
fi
;;
Expand All @@ -104,17 +111,18 @@ while [ "$1" != "" ]; do
fi
;;

-? | -h | --help )
-h | -? | --help )
echo " Usage $0 [PARAMETER] [[PARAMETER], ...]"
echo " Parameters:"
echo " -it, --installation_type installation type (community|developer|enterprise)"
echo " -u, --update use to update existing components (true|false)"
echo " -uni, --uninstall uninstall existing installation (true|false)"
echo " -je, --jwtenabled specifies the enabling the JWT validation (true|false)"
echo " -jh, --jwtheader defines the http header that will be used to send the JWT"
echo " -js, --jwtsecret defines the secret key to validate the JWT in the request"
echo " -ifb, --installfluentbit install or update fluent-bit (true|false)"
echo " -du, --dashboadrsusername login for authorization in /dashboards/"
echo " -dp, --dashboadrspassword password for authorization in /dashboards/"
echo " -du, --dashboardsusername login for authorization in /dashboards/"
echo " -dp, --dashboardspassword password for authorization in /dashboards/"
echo " -ls, --local_scripts use 'true' to run local scripts (true|false)"
echo " -skiphc, --skiphardwarecheck use to skip hardware check (true|false)"
echo " -ms, --makeswap make swap file (true|false)"
Expand All @@ -139,6 +147,22 @@ if [ -z "${SKIP_HARDWARE_CHECK}" ]; then
SKIP_HARDWARE_CHECK="false";
fi

if [ -z "$GIT_BRANCH" ]; then
DOWNLOAD_URL_PREFIX="https://download.onlyoffice.com/${product}/install-RedHat"
else
DOWNLOAD_URL_PREFIX="https://raw.githubusercontent.com/ONLYOFFICE/${product}-buildtools/${GIT_BRANCH}/install/OneClickInstall/install-RedHat"
fi

# Run uninstall if requested
if [ "${UNINSTALL}" == "true" ]; then
if [ "${LOCAL_SCRIPTS}" == "true" ]; then
source install-RedHat/uninstall.sh
else
source <(curl -fsSL "${DOWNLOAD_URL_PREFIX}"/uninstall.sh)
fi
exit 0
fi

cat > /etc/yum.repos.d/onlyoffice.repo <<END
[onlyoffice]
name=onlyoffice repo
Expand All @@ -148,22 +172,16 @@ enabled=1
gpgkey=https://download.onlyoffice.com/GPG-KEY-ONLYOFFICE
END

if [ -z $GIT_BRANCH ]; then
DOWNLOAD_URL_PREFIX="https://download.onlyoffice.com/${product}/install-RedHat"
else
DOWNLOAD_URL_PREFIX="https://raw.githubusercontent.com/ONLYOFFICE/${product}-buildtools/${GIT_BRANCH}/install/OneClickInstall/install-RedHat"
fi

if [ "$LOCAL_SCRIPTS" = "true" ]; then
source install-RedHat/tools.sh
source install-RedHat/bootstrap.sh
source install-RedHat/check-ports.sh
source install-RedHat/install-preq.sh
source install-RedHat/install-app.sh
else
source <(curl ${DOWNLOAD_URL_PREFIX}/tools.sh)
source <(curl ${DOWNLOAD_URL_PREFIX}/bootstrap.sh)
source <(curl ${DOWNLOAD_URL_PREFIX}/check-ports.sh)
source <(curl ${DOWNLOAD_URL_PREFIX}/install-preq.sh)
source <(curl ${DOWNLOAD_URL_PREFIX}/install-app.sh)
source <(curl "${DOWNLOAD_URL_PREFIX}"/tools.sh)
source <(curl "${DOWNLOAD_URL_PREFIX}"/bootstrap.sh)
source <(curl "${DOWNLOAD_URL_PREFIX}"/check-ports.sh)
source <(curl "${DOWNLOAD_URL_PREFIX}"/install-preq.sh)
source <(curl "${DOWNLOAD_URL_PREFIX}"/install-app.sh)
fi
Loading

0 comments on commit 153aa4f

Please sign in to comment.