Forums

Resolved
0 votes
Hi everyone,

Some changes were made to the development environment in order to:

- Add git/github support
- Provide a migration path to github (which is happening post ClearOS 6.5.0)
- Provide a stable version of the framework (no more "SVN trunk")

Under the hood, the default engine is switching from using the development framework & theme in SVN (typically exported to ~/clearos/webconfig) to the live framework & theme version in /usr/clearos. It's not a big change, but it is one that requires some manual changes detailed below.

Sorry for the hassle, but these changes will prevent such annoyances in the future! If you have any problems, please contact me.

Upgrade to the latest ClearOS version

First, you need to upgrade your development system to the latest ClearOS release: 6.5.0 (beta)
If you don't want to upgrade right now, that's fine too of course.

yum --enablerepo=clearos-updates-testing,clearos-developer upgrade


Update framework settings

Most of you probably want to start using the stable version of the framework instead of SVN trunk. If you want to move to the stable version, remove the references to the CLEAROS_BOOTSTRAP environment variable in ~/.bash_profile. You will need to re-login, or unset the environment variable after making the change.

If you want to continue use the bleeding edge framework in SVN, leave the CLEAROS_BOOTSTRAP environment variable as is. However, you need to update to the latest framework version in SVN trunk:

svn update ~/clearos/webconfig/framework



Update the Apache configlet

Using your regular user account (not root), update the Apache configlet. Make a backup just in case you need to review it:

sudo cp /usr/clearos/sandbox/etc/httpd/conf.d/devel.conf \
/usr/clearos/sandbox/etc/httpd/conf.d/devel.conf.bak
clearos -w setup


The "clearos -w setup" command resets the /usr/clearos/sandbox/etc/httpd/conf.d/devel.conf file so that the default framework and theme are used.


Create/update your ~/.clearos configuration

If you want to keep the development/SVN versions of the ClearFoundation and ClearCenter apps / themes in your environment, your .clearos file should look like:


<?php
\clearos\framework\Config::$apps_paths[] = 'clearcenter/webconfig/apps';
\clearos\framework\Config::$apps_paths[] = 'clearos/webconfig/apps';
\clearos\framework\Config::$theme_paths = array('clearos/webconfig/themes');

After making necessary changes to .clearos, you need to reload webconfig with the new path information:

clearos reload

If all you need to see is your own app, then your .clearos configuration should have a single entry:

<?php
\clearos\framework\Config::$apps_paths[] = 'my_apps';

Change my_apps to whatever subdirectory in your home directory contains your app source code.


Framework Development

If you ever need to use the development versions of the framework, you can find the document on the topic here:

http://www.clearfoundation.com/docs/developer/framework/tutorials/framework_development_version
Monday, November 11 2013, 05:59 PM
Share this post:
Responses (13)
  • Accepted Answer

    Tuesday, November 26 2013, 03:34 PM - #Permalink
    Resolved
    0 votes
    All went fine for me too except I bumped into the same problem as Tim reported (blank /usr/clearos/sandbox/etc/httpd/conf.d/devel-paths.conf file)...even after 'clearos reload' when checking the sudoers file.

    As soon as I added the directives you posted in a previous post, everything worked.

    Thx.

    B.
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, November 12 2013, 03:43 PM - #Permalink
    Resolved
    0 votes
    Tim Burgess wrote:
    @Pete - no it created a blank devel-paths.conf file. It may be because I have an LDAP developer user and setup my dev environment manually before the clearos command... I'll check

    Doh! The "clearos reload" command assumes that you have the same sudo access rights as webconfig. Adding the following to /etc/sudoers should resolve the issue:

    your_username ALL=NOPASSWD: CC
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, November 12 2013, 03:40 PM - #Permalink
    Resolved
    0 votes
    Hi Fredrik,

    In the tutorial in the first post in this thread it says that I should run "clearos -w setup" as an "regular" user. But that will not work since either the developer user account has not yet been created or a regular user (created in the user mgmt app in webconfig) will not be allowed to login at the console (and is as Peter says bad practice).

    Sorry for the confusion - I knew this was going to be a bit of a hassle!

    The "-w" flag is only intended for those who already have a development environment up and running (i.e. ran "clearos setup" weeks or months ago). For new development environments, you can ignore the upgrade instructions posted here and jump right into the regular documentation.

    Here's what I suggest:

    - Move your current development directory out of the way (e.g. mv /home/testguy /home/testguy.bak)
    - Delete the development account (e.g. testguy) from LDAP and/or the shadow system
    - Follow these instructions
    - Copy files out of /home/testguy.bak to restore what you need

    One gotcha: please check the /etc/sudoers file for duplicate lines that start with your user account.
    The reply is currently minimized Show
  • Accepted Answer

    yaye
    yaye
    Offline
    Tuesday, November 12 2013, 12:41 PM - #Permalink
    Resolved
    0 votes
    Tim Burgess wrote:
    @Yaye - no only for webconfig app development. Building RPMs is completely seperate


    OK. Thanks Tim.
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, November 12 2013, 11:28 AM - #Permalink
    Resolved
    0 votes
    @Yaye - no only for webconfig app development. Building RPMs is completely seperate

    @Frederik - Sorry I had mislead you in my reply (I used an LDAP user for bash login so used the shell extension). As Pete notes the 'clearos setup' command creates a system user for development, and therefore the 'clearos -w setup' is normally run first time as the root user. For more details see the other developer docs http://www.clearfoundation.com/docs/developer/development_environment

    @Pete - no it created a blank devel-paths.conf file. It may be because I have an LDAP developer user and setup my dev environment manually before the clearos command... I'll check
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, November 12 2013, 09:59 AM - #Permalink
    Resolved
    0 votes
    Hm,
    Do we have a chicken/egg situation here? I really would like to setup my environment to meet all good practices etc, but I do not quite get it in this case.

    In the tutorial in the first post in this thread it says that I should run "clearos -w setup" as an "regular" user. But that will not work since either the developer user account has not yet been created or a regular user (created in the user mgmt app in webconfig) will not be allowed to login at the console (and is as Peter says bad practice).

    Should the command

    clearos -w setup


    be run as root, and after that I should continue and login as the new user and continue there to do all commands?

    /Fred
    The reply is currently minimized Show
  • Accepted Answer

    yaye
    yaye
    Offline
    Tuesday, November 12 2013, 05:39 AM - #Permalink
    Resolved
    0 votes
    Does any of this apply to those of us who may compile an occasional rpm from a srpm (having already set up the development environment)?
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, November 12 2013, 03:44 AM - #Permalink
    Resolved
    0 votes
    Hi Tim,

    Pete - is there some extra config for 'approot'? none of the SVN images or paths seems to work.

    Does the "clearos reload" command work? This creates the /usr/clearos/sandbox/etc/httpd/conf.d/devel-paths.conf which should contain something like the following (per app root):

    Alias /clearos/approot/ /home/devuser/clearos/webconfig/apps/

    <Directory /home/devuser/clearos/webconfig/apps/*/htdocs>
    Order Deny,Allow
    Allow from All
    </Directory>

    <Directory /home/devuser/clearos/webconfig/apps/*/*/htdocs>
    Order Deny,Allow
    Allow from All
    </Directory>

    <Directory /home/devuser/clearos/webconfig/apps>
    Order Deny,Allow
    Deny from All
    </Directory>
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, November 12 2013, 03:37 AM - #Permalink
    Resolved
    0 votes
    Hi Fredrik,

    1. It is neccessary to download the Shell Extension app from the marketplace and change the login Shell for the "ordinary development" user to something else than "nologin".

    The "clearos setup" command as described here creates a developer user account in the old school shadow system (/etc/passwd /etc/shadow). Keeping the account outside LDAP is handy for developers working on the various account drivers (OpenLDAP, Samba 4)... no LDAP required.

    3. Before you can do a "sudo" command as an "ordinary user" you need (as root), edit the /etc/sudoers file and add YourUserNameHere ALL=(ALL) ALL as a new line just after the "root ALL=(ALL) ALL" entry

    The "clearos setup" command handles this step too :-) It doesn't grant all access but the same access as webconfig. The gory details are in this doc (which is a continuation of Tim's setup script/doc!)
    The reply is currently minimized Show
  • Accepted Answer

    Monday, November 11 2013, 10:32 PM - #Permalink
    Resolved
    0 votes
    Pete - is there some extra config for 'approot'? none of the SVN images or paths seems to work.
    The reply is currently minimized Show
  • Accepted Answer

    Monday, November 11 2013, 10:20 PM - #Permalink
    Resolved
    0 votes
    1. Yes - good point! It assumes that your login has basic bash access (yum install app-shell-extension-core)
    2. Home directory of the developer user
    3. This is not normally required, and probably discouraged as you shouldn't want to or need to give your developer user sudo rights. I tend to just 'su' back and forth if required to get root access, or run two terminals...
    The reply is currently minimized Show
  • Accepted Answer

    Monday, November 11 2013, 10:15 PM - #Permalink
    Resolved
    0 votes
    Thanks for the tutorial.
    However a few comments from a beginners Point of view:

    1. It is neccessary to download the Shell Extension app from the marketplace and change the login Shell for the "ordinary development" user to something else than "nologin".

    2. The file ~/.clearos : Does it belong to the home dir of the root user or the "ordinary user"? (My guess is the ordinary user)

    3. Before you can do a "sudo" command as an "ordinary user" you need (as root), edit the /etc/sudoers file and add YourUserNameHere ALL=(ALL) ALL as a new line just after the "root ALL=(ALL) ALL" entry

    /Fred
    The reply is currently minimized Show
  • Accepted Answer

    Monday, November 11 2013, 10:10 PM - #Permalink
    Resolved
    0 votes
    Works well for me! thanks Pete :)
    The reply is currently minimized Show
Your Reply