Setting up Elgg VM on CedeusGeoNode

From stgo
Revision as of 18:36, 27 May 2015 by StefanS (Talk | contribs)

Jump to: navigation, search

>> return to Cedeus_IDE


Elgg VM setup

  1. copying basicubunutu1404.vdi file and renaming to elgg.vdi
  2. creating the elgg VM on CedeusDB (ip.18):
    • VBoxManage createvm --name elgg --ostype Ubuntu_64 --register
    • VBoxManage modifyvm elgg --memory 4096
    • VBoxManage modifyvm elgg --cpus 4
    • VBoxManage modifyvm elgg --nic1 nat
    • VBoxManage storagectl elgg --name "SATA Controller" --add sata --controller IntelAhci
    • assign the (old) disk image a new uuid
      VBoxManage internalcommands sethduuid elgg.vdi
    • attach the (old) disk image:
      VBoxManage storageattach "elgg" --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium elgg.vdi
    • VBoxManage storagectl elgg --name "IDE Controller" --add ide --controller PIIX4
    • set the nat rules (ports):
      VBoxManage modifyvm elgg --natpf1 "ssh,tcp,,15022,,22"
      VBoxManage modifyvm elgg --natpf1 "apache,tcp,,15080,,80"
  3. optional - set VRDE port:
    • VBoxManage modifyvm elgg --vrdeport 7765 (Note: 3389 is the default port anyway)
  4. start the VM
    VBoxHeadless -s elgg --vrde on &
    the VM will listen on port 7765
  5. The following step do not seem to be necessary with Ubuntu 14.04 and new VirtualBox - however, are necesary for 12.04. But if so: connect with VRD and adjust network card settings (remember the existing VM have an old password)
    • open /etc/udev/rules.d/70-persistent-net.rules and comment out existing network adapters
    • reboot
    • check if ssh connection works
  6. change the computers name in /etc/hosts and /etc/hostname
  7. restarting Apache gives the error message: "apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 ..."
=> solve this by adding ServerName elgg as the last line in /etc/apache2/apache2.conf file

Elgg Setup

General Docs: http://learn.elgg.org/en/latest/

Install docs:

  • Elgg needs LAMPS (MySQL 5+, PHP 5.3.3+), so:
  • check what software packages are installed on the VM with dpkg -l
=> looks like 14.04 comes with MySQL 5.5 and PHP 5.5
  • however, I am missing php5 gd lib, so lets (re-)install the bunch of libs
sudo apt-get install php5 php5-gd php-xml-parser php5-mysql
  • Apache rewrite module should be enabled too
sudo a2enmod rewrite
  • downnload Elgg from http://elgg.org/download.php => I downloaded 1.8.19, the latest available and stable (= non RC) version
  • unzip and place in www folder of server
unzip elggXXX
mv elggXXX elgg (i.e. rename folder)
sudo cp -r elgg /var/www/html/ (copy folder to www/html to be accessible for Ubuntu 14.04)
  • create a data folder outside of /www or /public_html (e.g. under /usr/share/elgg/ )and make it accessible via for elgg:
sudo chown -R www-data:www-data FolderPATH/elggdata
=> www-data is apache's user that writes to file system. The above command grants apache ownership of the data directory.
  • create a database for elgg:
mysql -u root -p (pw 20...s)
CREATE DATABASE elgg;
CREATE USER elgguser IDENTIFIED BY 'elggpassword'; -- (elggpwd: elggc...s) -- perhaps may be better to use CREATE USER 'elgguser'@'localhost' IDENTIFIED BY 'elggpasswd';
GRANT ALL ON elgg.* TO elgguser;
\q
  • to be enable .htaccess in document root the access settings need to be changed in /etc/apache2/sites-available/default from AllowOverride None to AllowOverride All for the directory /var/www/html/ => Problem, this was for older Apache version, now in Ubuntu 14.04 we have 000-default.conf that does not contain this setting yet. So we do the following:
sudo nano /etc/apache2/sites-available/000-default.conf
Search for DocumentRoot /var/www/html and add the following lines directly below::
<Directory "/var/www/html">
AllowOverride All
</Directory>
and do restart apache2

N.B.: The following instructions do not seem to be necessary for Elgg 1.11. Instead visit the Elgg directly. (Btw. I adjusted the the document root before that, so that my elgg1-11 folder is now the doc root folder)

  • move and rename files (perhaps use sudo)
mv /var/www/html/elgg/htaccess_dist /var/www/html/elgg/.htaccess
mv /var/www/html/elgg/engine/settings.example.php /var/www/html/elgg/engine/settings.php
  • Open up the settings.php file and fill in the database access details:
sudo nano /var/www/html/elgg/engine/settings.php
set:
  • $CONFIG->dbuser = 'elgguser';
  • $CONFIG->dbpass = 'elggc...s';
  • $CONFIG->dbname = 'elgg';
  • $CONFIG->dbhost = 'localhost';
  • $CONFIG->dbprefix = ;
  • navigate to http://146.155.17.19:15080/elgg/install.php to perform the setup
  • some settings I did:
    • registration open/public accessible
    • name Cedeus - miCiudad
    • login ssteinig (2..s) : registered email is uzh (2nd user: ment...r : s...o4...)
    • outgoing email fuer elgg(!): ssteiniger-uc (not shure if this works, though)

Setting as Landing Page

I wanted that I get the Elgg page directly when I call http://miciudad.geosteiniger.cl. The files for Elgg 1.9.2 are physically in the folder var/www/html/elgg.

Therefore (aside from the change at my gesosteiniger.cl domain) I needed to change "/etc/apache2/sites-available/000-default.conf" as follows:

<VirtualHost *:80>
       # The ServerName directive sets the request scheme, hostname and port that
       # the server uses to identify itself. This is used when creating
       # redirection URLs. In the context of virtual hosts, the ServerName
       # specifies what hostname must appear in the request's Host: header to
       # match this virtual host. For the default virtual host (this file) this
       # value is not decisive as it is used as a last resort host regardless.
       # However, you must set it for any further virtual host explicitly.
       #ServerName www.example.com

       ServerName cedeusgeonode.ing.puc.cl:15080
       ServerAlias miciudad.geosteiniger.cl

       ServerAdmin webmaster@localhost
       DocumentRoot /var/www/html/elgg
       <Directory "/var/www/html/elgg">
          AllowOverride All
       </Directory>

       Alias /elgg18/ /var/www/html/elgg18/
       <Directory "var/www/html/elgg18">
          AllowOverride All
       </Directory>

       # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
       # error, crit, alert, emerg.
       # It is also possible to configure the loglevel for particular
       # modules, e.g.
       #LogLevel info ssl:warn

       ErrorLog ${APACHE_LOG_DIR}/error.log
       CustomLog ${APACHE_LOG_DIR}/access.log combined

       # For most configuration files from conf-available/, which are
       # enabled or disabled at a global level, it is possible to
       # include a line for only one particular virtual host. For example the
       # following line enables the CGI configuration for this host only
       # after it has been globally disabled with "a2disconf".
       #Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

I also have an elgg18 installation (v 1.8.19) in var/www/html/elgg18 that is accessible viha ttp://146.155.17.19:15080/elgg18/

Settings after Elgg installation

Elgg 1.8.19 ist installed/accessible now via http://146.155.17.19:15080/elgg/ (the test version with Elgg 1.8.3: if the VM is running http://146.155.17.19:31080/elgg/)

Some notes on programming with Elgg

  • dev environment: IDE PhpStorm (start it using sh ./dev/PhpStorm-133.1777/bin/phpstorm.sh)
    • Note, I have setup the programming environment so, that the elgg plugin's project/files are directly modified in /var/www/html/elgg/mod/...
    • It is helpful to to load/import the folder /elgg/engine/ as library so elgg commands are found.
  • disable caching (in admin settings) and enable display of php errors
  • documentation :
  • we also have the Elgg book by C Costello and M. Sharma : http://www.packtpub.com/web-development/elgg-18-social-networking
  • (plugin) examples can be found in .../elgg/documentation/examples/ + .../plugins in particular for start.php and manifest.xml files that have to be in a plugins root folder

Notes on PYP Theming Plugin

  • it looks like this was done overly complicated. After reading the book chapters with examples (chapter 7,8,9), it seems like a re-write is in order to using page one-column layout instead, e.g.: elgg_view_layout('one_column', $vars);

Theming ToDos

  1. create Cedeus/MiCiudad Elgg style
  2. create Cedeus welcome page
  3. perhaps adapt Elgg CSS so it can be used as entry page for observatory website?

Btw. new name of PlanYourPlace platform now is e-Planning Platform.

Notes on MapComment/ Plugin

  • there is no extra DB needed. Its all written to the default DB.
    see also the php warning: "Invalid argument supplied for foreach()" in file /var/www/html/elgg/modpypMapComment/pages/category.php (line 14) that seems to be resolved when initial items are added
  • switching to the index page (i.e. vy clicking on "Add new comment...") shows everything that is needed (no changes here?)

MapComment ToDos:

  1. the category page doesn't show a map after setup, as items in the like and dislike groups required.
    => after creation of an item/mapComment for each group, a map is shown!
  2. done: set to OSM --- still ToDo: create custom tile map for south of chile
  3. almost done: translate to Spanish --- still requires check by a spanish speaker
  4. done : there is an offset for locations (marker was placed a few blocks towards south, i.e. 1.5-2 times the dot-icon size, for a zoom level)
    => note, when zooming in and out, while adding the item, the dot's position (not yet fixed) changes strongly in north-south direction :(
    => there was a difference between map <height> definition in map.css (500px) vs category/index page (600px) but setting them the same did not fix the issue. So, maybe it is a marker issue (defined marker centre, and dimensions???).
    Solution: turns out the reason have been the marker size settings, i.e.
    • settings in index.php did stem from the drop-marker coming with leaflet, while a circle marker was used, so I reset the icon image to the default leaflet marker and added also the shadow icon (already present under css/images)
    • settings in category.php required adjustment for iconAnchor: [10, 0] => [10, 10]
  5. done: perhaps remove header part (that allows search for an address and placing a comment) - as it seems a bit confusing to me
  6. done: add option to upload a image and to display the image
  7. done: correct map focus on "issue" selection (map will sometimes not be centered on map comment location)
  8. done: adjust comment privacy level as I am not able to see the map/comments when I am logged out (this may be a general setting issue?)
    => yes, mapcomments are private if the general user created comments are set to private. (friends can see friends comments). So the general elgg setting of "privacy" needs to be "public" to see comments without being logged in; or:
    => see: e.g. $blog->access_id = ACCESS_PUBLIC; in http://learn.elgg.org/en/latest/tutorials/blog.html
    => solution: replace in pypMapComment/action/save.php the line $access_id = get_input('access_id'); by $access_id = ACCESS_PUBLIC;
  9. to improve: give user a feedback that new comment is added because the current message is not very visible (the user focus more one the change in the map)
  10. done: add notice of a new mapcomment issue submission to the Elgg-River (=> see how this is done, in the Blog plugin - requires creation of a new river view)
  11. done: rename "activities" plugin/name (showing Elgg-River) to "latest comments"/"ultimos comentarios"
  12. done: rename MapComment plugin; i.e. do i18n => non called Cuantanos Map
  13. there is a weird behavior when setting the map focus to an issue and using zoom level-17 => the tiles are not refreshed. However, there is no problem when I use zoom level-18.
  14. to improve: beautify issue icons
  15. done: on click: don't center on map issue when clicked on in the map
  16. done: on click: show pop-up with subject title of map issue when clicked on in the map
  17. enable anonymous comment submission
  18. done: create a button on the mapcomment info view/form to delete this particular comment
    • however, ToDo, perhaps add an additional message, asking if the user is sure to delete - as done when files are deleted.