Local Development - bschmalhofer/otobo-ideas GitHub Wiki

This page contains notes on how to set up a local development environment. This includes how to run the test suite. The OTOBO web app runs under Apache 2.4.

Create a regular installation

Start with creating a regular installation. This assures that the requirements, including the database server, are met. Follow the instructions from https://doc.otobo.org/manual/installation/10.1/en/content/index.html up to step 9, the initial login.

Switch to a devel installation

In the sample commands we use the branch rel-10_1, but any other branch should work the same way. The OS is Ubuntu 20.04. We assume that git has already been set up.

  • mkdir ~/devel/OTOBO arbitrarily
  • cd !$
  • git clone https://github.com/RotherOSS/otobo
  • cd /opt
  • sudo rm -rf otobo ATTENTION: is important data deleted? Should be fine when /opt/otobo already exists as a symlink.
  • sudo ln -s ~/devel/OTOBO/otobo create /opt/otobo as a symlink
  • sudo rm /etc/apache2/sites-enabled/zzz_otobo.conf /etc/apache2/sites-available/zzz_otobo.conf ATTENTION: is important data deleted?
  • cd /etc/apache2/sites-available
  • sudo ln -s ~/devel/OTOBO/otobo/scripts/apache2-httpd.include.conf zzz_otobo.conf
  • sudo a2ensite zzz_otobo.conf
  • check with sudo a2query -s
  • apachectl -M | grep mpm mpm_prefork is recommended

Restarting on a clean slate

Commands for both, the initial setup and for starting over.

  • cd ~/devel/OTOBO/otobo the git sandbox
  • git checkout rel-10_1 or whatever branch is of interest
  • sudo service apache2 stop
  • sudo bin/otobo.SetPermissions.pl --otobo-user=$USER for development I want to avoid having to switch to otobo
  • rm -rf Kernel/Config/Files/ZZZ*.pm var/article/* var/tmp/*
  • cp --backup Kernel/Config.pm.dist Kernel/Config.pm # skip this and the next step if nothing has changed
  • Activate Selenium testing in Kernel/Config.pm. For [HOSTNAME] insert the hostname of your host. If the hostname does not work, try the IP-Address. localhost does not work because the remote controlled web browser is running in a Docker container. Add the following to Kernel/Config.pm:
# activate Selenium tests if the the host is available
$Self->{'TestHTTPHostname'}    = q{[HOSTNAME]};
$Self->{'SeleniumTestsConfig'} = {
    remote_server_addr  => '127.0.0.1',
    port                => '4444',
    browser_name        => 'chrome',
    platform            => 'ANY',
};
  • bin/otobo.CheckSum.pl -a create # there is an unit test for that
  • mysql -u root -p -e "drop database otobo" ATTENTION: is important data deleted?
  • mysql -u root -p -e "drop user otobo@'%'" ATTENTION: is important data deleted? when quick_setup was used before
  • mysql -u root -p -e "drop user otobo@localhost" ATTENTION: is important data deleted? when installer.pl was used before
  • sudo service apache2 start
  • bin/docker/quick_setup.pl --db-password YOUR_ROOT_DB_PASSWORD unless installer.pl should be tested, the script is not really Docker specific, TODO: interactive input of the password
  • As a santiy check, try to log in based on the output of the last command.

Set up and launch a remote controllable Chrome browser

Start a Docker container with Chrome called otobo_selenium-chrome. The used image is https://hub.docker.com/layers/rotheross/otobo-selenium-chrome/latest/images/sha256-0eaa4c03207afcfd7a0116626f21bf7086e1abd088acde4d4f530b3304442d01?context=repo. 4444 is the port for remote controlling. 7900 is for VNC.

  • docker ps check whether the browser is already running
  • bin/devel/run_selenium-chrome.sh build a container from the image and start it

Watch the browser with Remina: localhost/secret. This does not work for me. Some setup issue???

run the test suite

  • grep DefaultLanguage Kernel/Config/Files/ZZZAAuto.pm verify that the default language is English
  • bin/docker/run_test_suite.sh script is not really Docker specific
  • open up a new console, screen is your friend
  • ls -lrt prove_* for getting the latest report file
  • wc -l prove_10.1.x_2021-06-08-151632_.out ; grep '^not ok ' prove_10.1.x_2021-06-08-151632_.out | grep -v -c '# TODO' ; ps waux | grep perl adapt the name of the logfile

get rid of the still running Selenium container

  • bin/devel/stop_selenium-chrome.sh stop the running container and remove it