SettingUpLocalUmpleOnlineWebServer

TCLethbridge edited this page Dec 1, 2016 · 6 revisions
Clone this wiki locally

This page tells you how to create a local UmpleOnline web server. There are two approaches to setting things up. The longer process configures apache on your machine and run through a /etc/hosts mapping so that you can run off of port 80 (the default for websites). The easier approach thanks to newer versions of PHP is to simply use their built in server as shown below

Prerequisite: Doing a full build of Umple on your machine

The instructions on this page assume that you have cloned Umple from github and have done a full build. Follow the development setup instructions first, before setting up a local UmpleOnline.

Using PHP's Built In Web Server

cd UMPLE_PATH/umpleonline/
php -S localhost:8001

This will start up a server running on port 8001 with an output similar to

PHP 5.5.14 Development Server started at Wed Jan 28 10:46:48 2015
Listening on http://localhost:8001
Document root is /Users/andrewforward/tp/project/uottawa/umple/umpleonline
Press Ctrl-C to quit.

Execute 'Step 7' below after every build in order to ensure that the latest jars you have built are used by your UmpleOnline.

You can now visit "http://localhost:8001/umple.php" to have full access to umpleonline.

Only PHP versions 5.4 and up come with a built-in web server. If your PHP version doesn't support -S, consider upgrading, or follow the instructions below.

Using Apache Web Server

The following instructions assume you are using Apache; and are most relevant to Mac/Linux. If you are running Windows, refer to this page.

Step 0: Ensuring permissions are set

Ensure that the parent directories of umpleonline have execute permission for the user under which the web server runs, such as apache2.

umpleonline/ump needs to have write permissions for the web user

Step 1: Locate your Apache httpd.conf file (or apache2.conf)

On Mac/Linux:

  cd /etc/apache2

If you find httpd.conf here, then you will edit this file directly. If you instead find apache2.conf, then the edits below are to be put in new files you create in certain directories.

For Mac users, when you install a new version of the operating system (e.g. Sierra) the previous httpd.conf is put in http.conf~previous If the edits you do below are clobbered, simply restore from this file and restart (step 6).

Step 2a: Add a virtual host

You will need to be a superuser. E.g. you have an https.conf file the following is an example of the command you might use. You could also use nano, or vi, or some other editor instead of pico.

  sudo pico httpd.conf

Add a virtual host to point to the umpleonline directory in your working copy. The following are sample entries that work on Mac OS. YOURPATH is the path to the umpleonline directory in the trunk of your working copy.

If you have httpd.conf then search for 'Virtual hosts' in the file, and add it there. If you have apache2.conf then add a file called umpleonline.conf in the sites-enabled directory and add the lines there

# Virtual hosts
# Modification for Umple

<VirtualHost cruise.local:80>
   DocumentRoot "YOURPATH/umpleonline"
   ServerName cruise.local
   ErrorDocument 404 /404.shtml
</VirtualHost>

<Directory "YOURPATH/umpleonline">
    Options Indexes MultiViews Includes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
    Require all granted
</Directory>

Step 2b: Enable php for httpd.conf

If you have httpd.conf do the following. If you have apache2.conf skip to step 2c

, search for the following and make sure it is not commented out; in other words make sure there is no # before it:

LoadModule php5_module        libexec/apache2/libphp5.so

The above gives the path for php5_module on Mac OS. On other operating systems, the path will be different. The key is to make sure it is not commented out.

Note: You may receive a warning:

apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName

And it will still proceed to start. To fix this go back to your httpd.conf file and give it an entry as follows:

ServerName name

Where "name" is the name you wish to give. For myself I just give the computer name (Emperor for example).

Important When you are done this step, create a backup of your changes, for example httpd.conf.modforumple. If you don't do this, you may find that the https.conf file becomes overwritten during an operating system update.

Step 2c. Enabling php if you have apache2.conf

Run

a2enmod php5

if that doesn't work run

sudo apt-get install libapache2-mod-php5

This should update or create a file in the conf.d directory called php5.conf. The contents may look like the following:

<IfModule mod_php5.c>
    AddHandler application/x-httpd-php .php4
    AddHandler application/x-httpd-php .php5
    AddHandler application/x-httpd-php .php
    AddHandler application/x-httpd-php-source .php4s
    AddHandler application/x-httpd-php-source .php5s
    AddHandler application/x-httpd-php-source .phps
    DirectoryIndex index.php4
    DirectoryIndex index.php5
    DirectoryIndex index.php
</IfModule>

Step 3: On Unix/Mac/Linux Add a line to your /etc/hosts

127.0.0.1       cruise.local

Step 4: Make sure Apache can read your files

You will need to ensure that apache can read each of the directories in YOURPATH, as well as the umpleonline and scripts directory. In other words, starting with YOURPATH/umpleonline/scripts, execute the following, then cd .. and repeat until you are at your home directory

   chmod a+rx DIRECTORY

Step 5: Make sure the 'ump' directory can be written

The ump directory is where umpleonline stores files it is working on. You need to make sure it is writable:

  chmod a+w YOURPATH/umpleonline/ump

Step 6: You may need to restart your web server

On MAC OS X:

  sudo apachectl restart  

You may also need to ensure that httpd is started whenever you reboot: (the requirement for this is new in Yosemite)

  sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist

On Linux (Ubuntu):

   sudo service apache2 restart

Step 6: Go to the URL you have created on your machine

   http://cruise.local

Note: You can also simply enter "cruise.local" and it will work with most browsers.

Step 7 (repeated after every local build as needed): Give UmpleOnline access to your changes

When you modify UmpleOnline or the compiler, you will need to ensure that Jars are properly installed for your local version of UmpleOnline. The following copies them to the right place.

   ant -DshouldPackageUmpleOnline=true -Dmyenv=local -f build.umple.xml packageUmpleonline

Step 8 (optional): Enable UIGU code generation for umpleonline

UIGU is a part of Umple that generates Java Server Faces (JSF) code for an umple model. Without this optional step, you can obtain the generated Web Archive (war) file to deploy on your own Tomcat. But if you're interested in seeing the generated user interface on your umpleonline follow the instructions to integrate integrate Tomcat and Apache for this purpose. Note that using UIGU in umple online has some limitations.

Troubleshooting

If you have problems on a Mac, You may need to turn on web sharing. Go to the 'Sharing' panel in System Preferences and turn on Web Sharing. This may help resolve problems. It should not be necessary, however. Try turning it off again late.

If you have httpd.conf and apache2.conf

If you have both a httpd.conf and apache2.conf and httpd.conf isempty the process should be even simpler. Do step 2a as if you only had apache2.conf, add the lines in 2a to a file called umpleonline.conf in the directory called sites-enabled. Add the line below to httpd.conf

   ServerName name

to get rid of the warning. name is whatever you want it to be.

You should not have to do anything to enable php if you installed it after apache2. If for some reason it does not load, or you want to verify that it should work, first make sure you have php5 installed along with the apache mod for it

   sudo apt-get php5
   sudo apt-get install libapache2-mod-php5

Then verify that the lines below are present in apache2.conf and are not commented out. Also verify that php5.load and php5.conf files are present in the mods-enabled directory.

   Include mods-enabled/*.load
   Include mods-enabled/*.conf
   Include httpd.conf

Continue at step 3.

More help

A good tutorial on setting up a local web server on Mac OS is here: http://oreilly.com/pub/ct/49

The first page of this tutorial http://macdevcenter.com/pub/a/mac/2001/12/07/apache.html