In addition to the general process described in Set Up a Development Machine, follow these extra steps when setting up OSX machines for LabKey development.

Software Installation

1. Install the Apple OSX developer tools. This contains a number of important tools you will need.

2. Java for OSX (FAQs for your reference: https://www.java.com/en/download/faq/java_mac.xml#havejava)

  • OSX 10.6 and below: Apple's Java comes pre-installed with OSX.
  • OSX 10.7 (Lion) and above: Java is not pre-installed with OSX versions 10.7 and above. To get the latest version of OpenJDK, you will need OSX 10.7.3 and above.
3. Set up environment variables:
  • CATALINA_HOME = <CATALINA_HOME>
  • PATH = <LABKEY_HOME>/build/deploy/bin:<your-normal-path>
    • This directory won't exist yet, but add it to the PATH anyway. The Gradle build downloads binaries used by the server, such as graphvis, dot, and proteomics tools, to this directory.
You can do this via traditional linux methods (in ~/.bash_profile) or via OSX's plist environment system.

To add the environment variables using ~/.bash_profile, edit the file and add the lines:

export JAVA_HOME=`/usr/libexec/java_home -v 11`
export CATALINA_HOME=$HOME/apps/tomcat
export LABKEY_HOME=$HOME/labkey/labkeyHome
export PATH=$LABKEY_HOME/build/deploy/bin:$PATH

To add the environment variables using the OSX plist editor, open the file ~/.MacOSX/environment.plist. This should open in the plist editor (from Apple developer tools).

  • Create the env vars shown above
  • logout and in

IntelliJ IDEA

The setup for IntelliJ is described in the common documentation, but a few additional troubleshooting notes may be helpful:

Run/Debug LabKey Error

You might see this error in the console when attempting to start LabKey server:

Error: "Could not find or load main class org.apache.catalina.startup.Bootstrap"

  • Check that you are using the correct path separators for the Mac:
    • Update the '-classpath' VM options for your Run/Debug configuration to use a colon (:) instead of the semicolon (;) used on Windows.

SVN/Subversion related errors

LabKey now stores all source code on GitHub. For assistance with errors from older versions that include svn or subversion related messages, review the documentation archive here.

VirtualBox

To do development or testing using a database that is not supported on OSX (e.g., SQL Server or Oracle), it is recommended to set up a VirtualBox instance for the target operating system (Windows or Linux). (This is generally preferred for developers over using Parallels, but the installation instructions once you have an OS installed are the same regardless. )

  1. Download and install Virtual Box : https://www.virtualbox.org/wiki/Downloads
  2. Create a new Virtual Box VM and install the desired OS on it. The easiest way is to download an ISO file for the OS and use it as the installation media for your VM.
  3. Once the ISO file is downloaded start Virtual Box and create a new VM for your target OS (most defaults are acceptable).
  4. Start the new VM for the first time.
  5. When a VM gets started for the first time, another wizard -- the "First Start Wizard" -- will pop up to help you select an installation medium. Since the VM is created empty, it would otherwise behave just like a real computer with no operating system installed: it will do nothing and display an error message that no bootable operating system was found.
  6. Select the ISO file that was previously downloaded, this should result in the installation wizard getting run.
  7. You may also want to install the Guest Additions for the VM so the window can be expanded to a more usable size (https://www.virtualbox.org/manual/ch04.html#idp95956608). This will also enable you to share files between your OSX machine and the VM, which can sometimes be helpful.
  8. Once the OS is installed, you can install your target database on it. See below for specifics on SQLServer or Oracle.
  9. To allow for remote access to the database you've installed, you will need to create a hole for the database connections in the firewall. For Windows, follow the instructions in the "TCP Access" section of this TechNet note using the port number appropriate for your database installation.
  10. You also need to configure Virtual Box so that a connection to the database can be made from the instance of LabKey running on your Mac. The easiest way to do this is through port forwarding over NAT.
In the Virtual Box Manager, select your Windows VM and edit the settings, in the network tab, select NAT and click on port forwarding.

Create a new record using TCP, and localhost (127.0.0.1). Set the host and guest port to be the same as the configuration in your mssql.properties file (typically 1433) Note: To get the IP address of the Guest OS, you can run "ipconfig" in a command window on the Windows VM. You will want the IPv4 address.

SQL Server on VM (Premium Feature)

Premium Feature — Using SQL Server is available with Premium Editions of LabKey Server. Learn more or contact LabKey.

Typically SQL Server Express is adequate for development. Follow the instructions here for the installation. Note that you should not need to do the extra steps to get GROUP_CONCAT installed. It will be installed automatically when you start up LabKey server for the first time pointing to your SQL Server database.

SQL Server Browser Setup

During the installation, you will want to set the SQL Server Browser to start automatically. You can do this from within the SQL Server Configuration Manager. Under SQL Server Services, right click on the SQL Server Browser and open the Properties window. Go to the Service tab and change the Start Mode to "Automatic."

Remote Access to SQL Server

To allow for remote access to SQL Server, you will need to:

  1. Create a hole for SQL Server in the Windows firewall. Follow the instructions in the "TCP Access" section of this TechNet note.
  2. Make some configuration changes to allow remote connections and set up a login for LabKey server to use:
  • Open SQL Server Management Studio (which is not the same as the SQL Server Configuration Manager)
  • Right click on the <Server Name> and choose Properties -->Connections, check "Allow remote connections to this server"
  • From <Server Name> --> Properties, --> Security, set Server Authentication to “SQL Server & Windows Authentication mode”
  • Click OK and Close the Properties window
  • Choose Security --> Logins --> double click on 'sa' --> Status, set Login to Enabled. This is the user that will be used by LabKey server, so set the password and take note of it.
  • From Sql Server Configuration Manager, select SQL Server Network Configuration --> Protocols for MSSQLSERVER.
    • Enable TCP/IP (If not enabled already).
    • Right Click on TCP/IP --> Properties --> IP Addresses tab
    • Make sure ports with IP Addresses of 127.0.0.1 and other other IP Address (thats used in Port Forwarding that you found using ipconfig), are Enabled.
    • Restart your computer.
  1. Restart SQL Server & SQL Server Browser from the Services control panel.

LabKey Properties Files

  1. Edit the mssql.properties config file under /Labkey/server/configs. If you have setup the NAT forwarding mentioned above, then set the databaseDefaultHost to 127.0.0.1. Otherwise, set the databaseDefaultHost to the windows IP (use ipconfig to find out what this is; you want the IPv4 address) (seems like this is necessary; just using the name of the host instead doesn't seem to work). If you have multiple datasources defined in your labkey.xml file, the IP address needs to be used for those data sources as well.
  2. Edit the mssql.properties config file further by updating the jdbcUser and jdbcPassword information. This is where you use the "sa" user and the password you had setup during the SQL Server install.
  3. Pick SQL Server for LabKey (run "gradlew pickMSSQL" - either from the command line or within IntelliJ)
  4. Restart your LabKey server instance.

Oracle on VM

Oracle Express Edition is probably sufficient for development and testing purposes. Follow the instructions in the installation docs on Oracle's site and then refer to the page for using Oracle as an external data source for some LabKey specifics.

Remote Access to Oracle

After the initial installation, Oracle Database XE will be available only from the local server, not remotely. Be sure to follow the steps for making Oracle available to Remote Clients. In particular, you will need to run the following command from within SQL*Plus connected as the system user

SQL> EXEC DBMS_XDB.SETLISTENERLOCALACCESS(FALSE);

SQL Developer (Oracle Client UI).

For troubleshooting and development, you will probably want to install a version of SQL Developer, the Oracle client application. There is a version of the client that works on OSX, so it is probably easiest to download and install on your OSX machine. It may also be useful to install a version on the VM. If installing on the VM, Java is required unless you get the version of SQL Developer that also bundles Java.

Related Topics

Was this content helpful?

Log in or register an account to provide feedback


previousnext
 
expand allcollapse all