Menu

Developer Environment

hshyket William Piel

iCBUG Deployment

These are instructions for setting up your developer environment.

  1. Install Perl (if needed) .

  2. Download and install ImageMagick with Perl.
    On mac using ports run the following command
    sudo port install ImageMagick +perl

  3. Download Eclipse (you should be able to use the classic version).
    http://www.eclipse.org/downloads/

  4. Open Eclipse.

  5. Install Subclipse plugin.
    -Click on the Help item in the menu
    -Install New Software
    -Add the following site http://subclipse.tigris.org/update_1.6.x and install all the components

  6. Install EPIC plug.
    -Click on the Help item in the menu
    -Install New Software
    -Add the following site http://e-p-i-c.sf.net/updates/testing and install all the components

  7. Using Eclipse, grab the sourcecode from SVN.
    -File -> New Project
    -Choose SVN (click plus sign) and select Checkout Projects from SVN
    -Click Next
    -Select Create a new repository location (most likely already selected)
    -Click Next
    -Put in the following in the URL field: https://icbug.svn.sourceforge.net/svnroot/icbug/trunk/
    -Click Next
    -Choose check out as a project in the workspace and give it a name
    -Click next

  8. Download and install PostgreSQL.
    http://www.postgresql.org/download/
    For the Mac you can get PostgreSQL here: https://sourceforge.net/projects/pgsqlformac/files/

  9. Download and install PostGIS.
    http://postgis.refractions.net/download/
    For the Mac you can get PostGIS here: http://www.kyngchaos.com/software:postgres
    Which requires PROJ and GEOS frameworks: http://www.kyngchaos.com/software/frameworks

  10. Create a new database (preferablly named icbug) from a PostGIS template.
    -This can be done either in pgAdmin or through the shell
    -The shell script is createdb -T template_postgis icbug
    -If you are using the packages for Mac listed above, you should check that the file /Library/PostgreSQL/lib/postgis.sql does not have "$libdir" placeholders in it. If it does, you should do a find-and-replace to change them all to the correct path, e.g. "/Library/PostgreSQL/lib"
    -For those with Mac packages, create your database like so:
    createdb -U postgres -T template1 icbug
    psql -U postgres -d icbug -f /Library/PostgreSQL/share/contrib/postgis-1.5/postgis.sql
    psql -U postgres -d icbug -f /Library/PostgreSQL/share/contrib/postgis-1.5/spatial_ref_sys.sql

  11. In the project files for iCBug, open the database/install/icbug.sql folder and run the script inside of your newly created Postgres database.

  12. Install Perl modules. It is recommended to use CPAN. The list of modules is available in the Makefile.PL and below. It may take a while to install all of the modules.

    • Task::Catalyst (This will most likely install many of the modules below.)
    • Catalyst::Runtime
    • Catalyst::Plugin::ConfigLoader
    • Catalyst::Plugin::Static::Simple
    • Catalyst::Plugin::Authentication
    • Catalyst::Plugin::Session
    • Catalyst::Plugin::Session::Store::FastMmap
    • Catalyst::Plugin::Session::State::Cookie
    • Catalyst::Plugin::Authorization::Roles
    • Catalyst::Plugin::Authorization::ACL
    • Catalyst::Plugin::StackTrace
    • Catalyst::Plugin::Compress::Gzip
    • Catalyst::Authentication::Store::DBIx::Class
    • Catalyst::Authentication::Realm::SimpleDB
    • Catalyst::Action::RenderView
    • Catalyst::Controller::Combine
    • Catalyst::Helper::View::TT
    • Catalyst::Engine::Apache
    • Catalyst::Model::DBIC::Schema
    • Catalyst::View::JSON
    • Catalyst::View::Email
    • Catalyst::View::Email::Template
    • Catalyst::Helper::Email::Template
    • DBIx::Class::TimeStamp
    • DBIx::Class:EncodedColumn
    • DBD::Pg (For this module, make sure that the database is installed. Also, you may need to set the location of the pg_config in your environment variables).
    • DateTime::Format::Pg
    • HTML::FormHandler::Model::DBIC
    • Net::OAuth
    • LWP::UserAgent
    • JSON
    • HTTP::BrowserDetect
    • Try::Tiny
    • YAML::Tiny
    • Data::Random
    • Geo::Coder::Google
    • Image::Magick (You most likely won't have to install this if you already installed Image::Magick with Perl.)
    • Moose
    • MooseX::NonMoose
    • namespace::autoclean
    • Perl6::Junction
    • Term::ReadLine::Perl
    • Config::General
    • File::Find::Rule
  13. Rename the file icbug.template.conf to icbug.conf and update the file contents
    Change all the values contained within [[ ]] to application values. You must make sure that the proper database credentials are set as well as the application id, consumer secret, etc for Facebook and Twitter (for user registration). Also the Google Maps application id must be set

  14. Right click on the project in Eclipse and say add Perl Nature

  15. Create a Run Configuration for the project
    -Go to the Run menu at the top and choose Run Configurations
    -Right click on Perl Local and click New
    -Give the run configuaration a name (such as Catalyst Server)
    -Click browse (for project name) and choose your project (icbug)
    -Click browse (for file to execute) and choose the option that has web/icbug/script/icbug_server.pl
    -Go to arguments and type -r in the Perl arguments box
    -Click apply and then click close

  16. In the Eclipse package explorer browse to the following folder
    -web->icbug->script
    -right click on icbug_server.pl
    -this should start the server

  17. Alternatively, you can start the server from the command line. Just browse to the icbug_server.pl folder and type icbug_server.pl -r. For typical Eclipse installations, you can execute:
    perl /Users/username/Documents/workspace/icbug/web/icbug/script/icbug_server.pl -r

  18. Go to a web browser and type in http://{{{the IP address of your machine}}}:3000. Your port 3000 should be kept open for the development server to work.

ISSUES

On some Macs, Perl Catalyst does not work well with ImageMagick +Perl. If you are having issues with image creation, then read and follow the steps below.

Make sure to BACKUP the following files

/usr/lib/libltd (all files with that filename)
/usr/lib/libiconv (all files with that filename).
/usr/lib/libcharset(all files with that filename).

Two system libraries need to be updated. The following instructions are run from the command line

  • update libiconv
  • sudo mkdir /src
  • sudo mkdir /src/libiconv && cd /src/libiconv
  • sudo curl http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz -O
  • sudo tar -xzvf libiconv-1.13.1.tar.gz
  • cd libiconv-1.13.1
  • MACOSX_DEPLOYMENT_TARGET=10.6
  • CFLAGS="-arch ppc -arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp"
  • CCFLAGS="-arch ppc -arch i386 -arch x86_64 -g -Os -pipe"
  • CXXFLAGS="-arch ppc -arch i386 -arch x86_64 -g -Os -pipe"
  • LDFLAGS="-arch ppc -arch i386 -arch x86_64 -bind_at_load"
  • export CFLAGS CXXFLAGS LDFLAGS CCFLAGS MACOSX_DEPLOYMENT_TARGET
  • sudo ./configure --prefix=/usr --enable-static --enable-extra-encodings
  • sudo make
  • sudo make install

  • move over the new files from /usr/local/lib to /usr/lib


  • update libtool
  • sudo mkdir /src
  • sudo mkdir /src/libtool && cd /src/libtool
  • sudo curl http://ftp.gnu.org/gnu/libtool/libtool-2.4.tar.gz -O
  • sudo tar -xzvf libtool-2.4.tar.gz
  • cd libtool-2.4
  • sudo ./configure
  • sudo make
  • sudo make install

  • move over the new files from /usr/local/lib to /usr/lib

Assigning Privileges

You may want to create a user for your database who does not have superuser privileges. For example, suppose that you want the application to interface with the database using a user named "icbug_user". For this to work, it is necessary to assign icbug_user with privileges for all visible relations, sequences, and functions. The following should accomplish this:

psql -U postgres -d icbug
CREATE USER icbug_user WITH PASSWORD 'myPassword';

\a
\t
\o /tmp/grant_privileges
SELECT 'GRANT ALL PRIVILEGES ON TABLE ' || c.relname || ' TO icbug_user;' 
FROM pg_catalog.pg_class c 
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace 
WHERE relkind = 'r' 
AND n.nspname NOT IN ('pg_catalog', 'pg_toast') 
AND pg_catalog.pg_table_is_visible(c.oid);
SELECT 'GRANT ALL PRIVILEGES ON SEQUENCE ' || c.relname || ' TO icbug_user;' 
FROM pg_catalog.pg_class c 
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace 
WHERE relkind = 'S' 
AND n.nspname NOT LIKE 'pg_%' 
AND pg_catalog.pg_table_is_visible(c.oid);
GRANT ALL PRIVILEGES ON ALL FUNCTIONS IN SCHEMA public TO icbug_user;
\o
\i /tmp/grant_privileges

Related

Wiki: Home

Monday.com Logo