TurnKey Linux Virtual Appliance Library

TKLPatch - Concrete5 v0.5

Jeremy's picture

[update 2012-01-18] Major work on the patch as testing revealed that it was quite broken... (I was going to update it to v5.5.0 but decided to fix it first). Should now work with the latest v5.4.x branch. Next stop v5.5... Major update of firstboot scripts and lots of tidying up, now asks for Admin email on firstboot. I have attached the latest patch here. I would still like to apply a few tweaks to the install but will have to ponder that further... (I have also tidied up this post).

Concrete5 is an open source (MIT licence) CMS written in php which is really easy to use. It's actually quite easy to install yourself (on LAMP) but I thought I'd create a TKLPatch (which will hopefully lead to an official TKL appliance) that will lower the bar even more. I think Concrete5 would make a great addition to the TKL library.

Rationale

As requested here and mentioned here.

I have been looking for an easy to use CMS with a nice flat learning curve. I want something for a newb friendly, staff editable intranet site at my work (reduce my workload). One of the great things about Concrete5 that makes it really useful for my purposes is that it keeps track of modifications (think wiki) so newb mistakes can be easily rectified. Concrete5 is pretty much WYSIWYG although some more advanced modifications require a little more effort under the hood. There are a range of themes and add-ons (both free and pay-for) available on the Concrete5 marketplace. Add-ons (as the name suggests) add functionality such as a Google search box, Google Maps, etc. None are included (or required) by default.

What the patch does so far (in order): [updated 2011-10-23]

  • Add Apache2 site "concrete5-standalone" [overlay]
  • Add an amended services.txt to Confconsole output. [overlay]
  • Add concrete5.sql database, concrete5-usr.sql user setup and site.php (unconfigured config file) to webroot (loaded later by conf - custom site.php generated by firstboot inithooks). [overlay]
  • Add firstboot inithooks (concrete5.py, 20rengen-c5-secrets & 40concrete5) [overlay]
  • Sets hostname to 'concrete5'. [conf]
  • Install  php5-gd and php5-curl. [conf]
  • Download and unzip (then delete) current stable Concrete5 (concrete5.4.2.2) archive to /var/www/concrete5. [conf]
  • Disable default apache site, enable concrete5-standalone (doc root of /var/www/concrete5). [conf]
  • Copy in site.php (custom site.php generated by firstboot scripts - overwrites default). [conf]
  • Create MySQL user, create and populate database (from concrete5-usr.sql & concrete5.sql). [conf]
  • Set ownership of specific folders to www-data:www-data as required. [conf]
  • Stop Apache2 & MySQL services (so patching finalises cleanly). [conf]
  • Clean up. [conf]

Things that ideally should be done

  • Allow default user (admin) password to be set at first boot (currently '549488') - I've had a dig around and found some more info. From what I can gather by default:
    • A random salt string is created on install (this needs to happen on first boot - currently this is set staticly). It is stored in the site.php config file. It is used to encode all passwords. This bit I can do!
    • Passwords are stored in the DB - I can write to the DB ok.
    • The password is a md5 hash of the salt + password - can't figure out how to do this :(
      [Done as of v3.0]
  • Create random Concrete5 MySQL password? (not sure if this is necessary but probably be better). [Done as of v0.3]
  • Set base appliance URL/domain on first boot (see "Additional end-user config" below). I think ideally it should ask for domain on first boot, with the option to leave blank and it just picks up the IP.
    [Done as of v0.3]
  • Set admin email address first boot (set to admin@example.com by default). FYI this is stored in the db - not in site.php. [Done as of v0.5]
  • Some specific tweaks for things like the file browser (I had problems with it by default) + some others I'll think of.
  • Configure date/timezone on firstboot. I think that'd

Bugs

  • I have not successfully managed to change the date format (by default it's US MM/DD/YY). This is a known Concrete5 bug which has apparently been fixed in the development version, but hasn't made it to stable yet. [Update 21/08/11] This issue should be fixed next week in the next stable (point) release - see here. Obviously this will require an updated patch. This should now be fixed (as of the v5.4.2.1 app/v0.2 patch release.
  • File manager doesn't work as expected - no upload button. I found a fix for this online but forgot to take note of it. Will hunt it down again when I get a chance and include it in my patch.
  • Updating addons doesn't work by default because the /var/www/concrete5/trash folder doesn't exist. This can be created by the patch and chowned to www-data:www-data with 755 permissions.

Additional end-user config [base URL must be set]

Admin password and email address can be manually reset by end users from "Dashboard" >> "Users & Groups" >> "admin"

[in /var/www/concrete5/config/site.php]

  • Base appliance URL (currently set to http://192.168.1.109 as that was the IP when I setup and installed). Note: This will need to be set prior to first use or your site won't work! [Done as of v0.3]
  • Timezone: By default it's set to UTC but can be changed to whatever. For full list of codes see here. [Because of the way I've done the firstboot hooks, to ensure this is not reset to UTC if firstboot script run again, it will also need to be changed in blanksite.php]

Default Login Credentials [still...]

Username: admin
Password: 549488

Downloads

Download TKL-Concrete5 Appliance ISO or OVZ template from TKL Community SourceForge Downloads.
Or use the TKLPatch below to patch your own TKL-LAMP appliance. Patch is also available via GitHib here.

Alon Swartz's picture

Concrete5 looks very nice...

Concrete5 looks very nice, and kuddos on the patch and the exceptional documentation! I especially like the "things that ideally should be done" and "bugs" sections, as they will guarentee the issues will be taken care of when we add it to the library.

Nice job!

Jeremy's picture

Thanks Alon

Glad to hear that you like it and my documentation is useful. I somewhat based my ideas of documentation on Adrian's fine work. Also glad to hear that it looks very likely to make it into the library. :)

It was a case of scratching my own itch really. So making a patch was natural extention for me. I plan to come back to this and at least update the version of Concrete5 (so the date format bug is resolved - that's whats holding me up from using it as planned at work). I'd like to have a bit of a go at the other stuff too, but we'll see - I've got plenty on at the moment.

we can help

let me know if you guys run into concrete5 specific issues we can help with. We'd love to see this completed and would be happy to lend whatever expertise we can.

 

-frz

ceo, concrete cms.

Jeremy's picture

Thanks Franz

I love the way that open source often breeds cooperation and collarboration (although I know it doesn't always work like that).

For me it will all be good once you get the date format thing sorted (which will apparently happen next week with the point release).

Otherwise I'm sure Alon and Liraz (the TKL core devs) will sort the rest if I don't in the meantime. But thanks heaps for your willingness to help out. You never know I may take you up on it if I do some more work on this before the official TKL Concrete5 appliance is released. :)

Jeremy's picture

Concrete5 has been updated (5.4.2.1)

http://www.concrete5.org/developers/downloads/

I am yet to update the patch. For those interested it should be pretty easy: A case of just editing the conf script in the patch to download the new version.

Hopefully I will get it updated before I go, but haven't got time now. Otherwise I'll do it when I get back (in about 3 weeks).

[edit] Now updated.

BASE_URL

You can comment out the BASE_URL and DIR_REL, and c5 will automatically populate it,

Jeremy's picture

Awesome!

I'll fix that and release a new patch sometime soon. Thanks for the heads up.

Jeremy's picture

Bug in current patch :(

Just testing this patch and there is a bug in the current version (0.2.1) in that it doesn't create the DB user ('concrete_usr' by default). To work around this either add a user for the concrete5 DB (and update /var/www/concrete5/config/site.php with relevant details) or (probably not advised but easier) input the root MySQL user details in the site.php.

I will fix this at some point but just wanted to post the workaround in the meantime.

Jeremy's picture

v0.3 now available

Tested with v11.2 LAMP appliance and all working. I have updated the OP but heres the abrieviated change log:

  • Fixed MySQL Concrete5 user creation bug (added concrete5-usr.sql to create the user properly. For some reason it wasn't working when included with the rest of the DB.
  • concrete5-usr MySQL user account now has a random password (generated on first boot).
  • Firstboot script to set BASE_URL. I tried leaving it out (ie not set - as suggested by Mnkras above) but unless you disable the feature (in another config file elsewhere) it it fails. As this allows for cookie login I decided to go the firstboot route. Users can configure this themselves if they wish to host a Concrete5 site from multiple urls.

I am also in the process of uploading an ISO and OVZ template to TKL Community SourceForge Downloads.

Jeremy's picture

Bug(s) in v0.3 - workaround

Just discovered and fixed a couple of bugs in v0.3 (new version 0.3.1). The result is that the new firstboot scripts don't work as they should. I have fixed them, but at this point only the version on GitHub has been updated.

If you have v0.3 installed already then you can workaround these issues with these lines of code:

chmod +x /usr/lib/inithooks/bin/concrete.py
touch /var/www/concrete5/config/site.php

Then run the relevant firstboot scripts again:

/usr/lib/inithooks/firstboot.d/20rengen-c5-secrets && /usr/lib/inithooks/firstboot.d/40concrete5

Jeremy's picture

New features in patch

I just wanted to (prematurely) announce that after much learning pain I have done some significant updates to this patch. It downloads and installs the latest version of C5 and now sets the admin password on first boot. What a wild ride that has been! Crash course in Python and some playing with my arch nemisis sed! (Although in the end I ended up using grep anyway...)

Warning: as the firstboot script also (re)generates the salt string, if run after intial install it will require all  existing user account passwords to be reset. Ideally it would be nice if it checked for an existing salt string and reused that if it's there (thus avoiding this potential pain) but for now that's how it is. I may get back to that one... Actually now I think about it, possibly the easiest way would be to make the salt string generation a separate firstboot job that passes the salt to the python script. Or better still if the Python script reads the salt from the config file... A job for another day... (Sorry thinking aloud).

I haven't quite finished yet though (still need to set admin email address on firstboot) so it is only available via my GitHib account ATM. Once I have the firstboot email setting integrated I will test it properly and post my new version here (it'll be v.05 as I didn't post v0.4).

Tim Collins's picture

Patching

Hi Jeremy

You seem to be a patching expert, can you give me any help with getting my LAMP Kernel to 2.6.33 or above as I plan on using a cluster filesystem that requires it. Or would it be best I wait until the next official update?

P.S. I'm a great fan of Concrete5 and have been site building in it for most of the year so I'm very pleased to hear there may be an appliance soon, great work.

Jeremy's picture

I wouldn't quite go that far...

But I've had a few wins! But also lots of growing pains... :)

As for your kernel question, if you have a look at the Ubuntu Lucid (10.04 - basis of TKL v11.x) linux-image (kernel metapackage) page you can see that beyond the 2.6.32 kernel (default) there is also 2.6.35, 2.6.38 and 3.0.0 available. They should be installable via apt-get install, with the package name. Eg to install the 2.6.35 server kernel:

apt-get update
apt-get install linux-image-2.6.35-31-server
Tim Collins's picture

Kernel Update

OK that sounds painless...and you think it will be ok to just do that? I note the current Kernel has -ec2 at the end, is that significant that it's a special ec2 version?? I've got a test server so it won't be the end of the world if it breaks.

Many thanks.

Jeremy's picture

Oh so you're running on AWS

I don't know enough about AWS to know whether it's just an optimised EC2 kernel or whether it's a deal breaker to not use it (ie maybe it contains some specific drivers to make EC2 instances work). It seems that there are no EC2 kernels available for Lucid except the default 2.6.32 so you'll need to test and see.

If it doesn't work then you'll either need to wait for the new Ubuntu 12.04 based (TKL v12.x) builds (available sometime Q2 2012 hopefully) or hack it some other way. You could try downloading a newer EC2 kernel from a more recent Ubuntu version but the downside is that you won't get auto updates, so you will need to be vigilant and regularly check for updates and install manually as required. There are other options too but none (including the above hack) are really desirable on a production server...

And a note, to enable the new kernel requires a reboot. You said you are using an unimportant test server, but just in case someone else is reading this - do a backup and confirm your backup works prior to doing any of this!! (TKLBAM is a good option).

Tim Collins's picture

...on AWS yes

Yes sorry kind of assumed everyone is using appliances in the cloud. There are -virtual kernel versions but I too have no idea if they work on ec2. I did try an APT-GET of the suggested release with -virtual at the end and it did install sucessfully and I rebooted but if didn't update the kernel, uname -r still says 2.6.32 ec2 so not sure why. Think I'll have to wait for the official release anyway as there's likely to be too many other consequences if I do update it.

Thanks for taking the time though much appreciated only if to help me decide not to do it.

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <strike> <caption>

More information about formatting options

Leave this field empty. It's part of a security mechanism.
(Dear spammers: moderators are notified of all new posts. Spam is deleted immediately)