Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Automated] Merge 5.x into master #180

Merged
merged 2 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/docker-compose-verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
-w "/v" \
koalaman/shellcheck \
-e SC1091 -e SC1117 \
setup.sh
*.sh

- name: docker compose config test
run: |
Expand Down
25 changes: 24 additions & 1 deletion .github/workflows/docker-monolithic-verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,32 @@ jobs:
-w "/v" \
koalaman/shellcheck \
-e SC1091 -e SC1117 \
setup.sh
*.sh

- name: docker compose config test
run: |
echo "" > .env
docker compose config

- name: install supportpal
run: |
bash setup.sh --local -n --host "http://localhost" --email "[email protected]"
docker compose up -d

sudo apt install -y expect
expect verify-install.exp

sleep 5
curl -fSL -o /tmp/test.txt http://localhost/
if ! grep -q "SupportPal" /tmp/test.txt; then
echo "ERROR: SupportPal is not loading via HTTP"
exit 3
fi
env:
SUPPORTPAL_LICENSE_KEY: "${{ secrets.SUPPORTPAL_MONO_LICENSE_KEY }}"

- name: test backup/restore
run: |
bash backup.sh
sleep 60
bash restore.sh
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ This repository contains templates to get started using SupportPal.

## Docker Compose

This [template](https://docs.supportpal.com/current/Deploy+on+Docker) relies on docker-compose to manage the helpdesk software deployment. A typical use case for this template would be a standalone server.
This [template](https://docs.supportpal.com/current/Deploy+on+Docker+HA) is intended for use in a microservice style architecture, whereby each service is deployed to a separate container. It provides a functional example for how you may deploy SupportPal in a HA environment.

## Docker Monolithic

This [template](https://docs.supportpal.com/current/Deploy+on+Docker) uses a monolithic image which runs all the necessary services in a single container. This is our recommended installation method.

## Linux

Expand Down
19 changes: 15 additions & 4 deletions templates/docker-monolithic/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ usage="Options:

-n Run the command non interactively.

--local The script is being ran from the repository, so don't use CURL to download them.

-r,--ref= Git ref (commit sha, ref name, tag) to run the script on.

-H,--host= Domain name to use with SupportPal.
Expand All @@ -14,6 +16,7 @@ usage="Options:
"

# Options
local=0
interactive=1
host=
email=
Expand All @@ -23,6 +26,7 @@ while [[ "$#" -gt 0 ]]; do
case $1 in
-h|--help) echo "$usage" ; exit 0 ;;
-n) interactive=0 ;;
--local) local=1 ;;
-H|--host) host="$2" ; shift ;;
-e|--email) email="$2" ; shift ;;
-r|--ref) ref="$2" ; shift ;;
Expand Down Expand Up @@ -186,13 +190,16 @@ create_volume() {
configure() {
# download docker-compose.yml example
printf "generating docker-compose.yml ... "
if [[ -f "docker-compose.yml" ]]; then
if [[ -f "docker-compose.yml" ]] && [[ "$local" -eq 0 ]]; then
echo
echo "error: $(pwd)/docker-compose.yml already exists. Delete the file and try again."
exit 1
fi
curl -fLsS https://raw.githubusercontent.com/supportpal/helpdesk-install/"${ref}"/templates/docker-monolithic/docker-compose.yml -o docker-compose.yml
curl -fLsS https://raw.githubusercontent.com/supportpal/helpdesk-install/"${ref}"/templates/docker-monolithic/docker-compose.override.yml -o docker-compose.override.yml

if [[ "$local" -eq 0 ]]; then
curl -fLsS https://raw.githubusercontent.com/supportpal/helpdesk-install/"${ref}"/templates/docker-monolithic/docker-compose.yml -o docker-compose.yml
curl -fLsS https://raw.githubusercontent.com/supportpal/helpdesk-install/"${ref}"/templates/docker-monolithic/docker-compose.override.yml -o docker-compose.override.yml
fi

echo "" > .env

Expand Down Expand Up @@ -221,7 +228,11 @@ configure() {
fi

# create volumes
bash <(curl -LsS https://raw.githubusercontent.com/supportpal/helpdesk-install/"${ref}"/templates/docker-monolithic/create_volumes.sh)
if [[ "$local" -eq 0 ]]; then
bash <(curl -LsS https://raw.githubusercontent.com/supportpal/helpdesk-install/"${ref}"/templates/docker-monolithic/create_volumes.sh)
else
bash create_volumes.sh
fi
}

check_memory() {
Expand Down
79 changes: 79 additions & 0 deletions templates/docker-monolithic/verify-install.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/usr/bin/expect -f
#
# This Expect script was generated by autoexpect on Mon Feb 5 13:07:01 2024
# Expect and autoexpect were both written by Don Libes, NIST.
#
# Note that autoexpect does not guarantee a working script. It
# necessarily has to guess about certain things. Two reasons a script
# might fail are:
#
# 1) timing - A surprising number of programs (rn, ksh, zsh, telnet,
# etc.) and devices discard or ignore keystrokes that arrive "too
# quickly" after prompts. If you find your new script hanging up at
# one spot, try adding a short sleep just before the previous send.
# Setting "force_conservative" to 1 (see below) makes Expect do this
# automatically - pausing briefly before sending each character. This
# pacifies every program I know of. The -c flag makes the script do
# this in the first place. The -C flag allows you to define a
# character to toggle this mode off and on.

set force_conservative 0 ;# set to 1 to force conservative mode even if
;# script wasn't run conservatively originally
if {$force_conservative} {
set send_slow {1 .1}
proc send {ignore arg} {
sleep .1
exp_send -s -- $arg
}
}

#
# 2) differing output - Some programs produce different output each time
# they run. The "date" command is an obvious example. Another is
# ftp, if it produces throughput statistics at the end of a file
# transfer. If this causes a problem, delete these patterns or replace
# them with wildcards. An alternative is to use the -p flag (for
# "prompt") which makes Expect only look for the last line of output
# (i.e., the prompt). The -P flag allows you to define a character to
# toggle this mode off and on.
#
# Read the man page for more info.
#
# -Don


set timeout -1

match_max 100000

spawn docker compose exec supportpal bash -c {bash /init/init-helpdesk.sh}

expect "I Accept and Continue (yes/no)*:\r"
send -- "yes\r"

expect "SupportPal requires a valid license to function, please enter one below.*:*"
sleep 1
send "$env(SUPPORTPAL_LICENSE_KEY)\r"

expect "Email*:*"
send -- "[email protected]\r"

expect "Password*:*"
send -- "test\r"

expect "First Name*:*"
send -- "Joe\r"

expect "Last Name*:*"
send -- "Blogs\r"

expect "Brand Name*:*"
send -- "My Company\r"

expect "Enter the full web address of your installation*:*"
send -- "http://localhost\r"

expect "Enter your main company email address*:*"
send -- "[email protected]\r"

expect eof
Loading