Wednesday, July 24, 2013

Plone Quickstart on the Cloud in less than 5 minutes: Installing Plone on the Nitrous.io Platform


(update: August 18, 2015 the Nitrous.io free tier is no more, so you'll want to look at installing Plone on Cloud9 IDE)

(update: July 31, 2015)
A better free alternative to this is installing Plone on Cloud9 IDE.


(update: December 2, 2013, the script has been updated for Plone 4.3.2)
I learnt about Nitrous.io from +Tarik Carey at the July Plone Jamaica Meetup. He suggested that I should check it out and see if it can run Plone, so I did a few tests. Not only does it run Plone, but the installation can be done in less than 4 minutes*. I've created a little script (really a wrapper around the Plone Unified Installer) that does all the installation for you.

* I say 5 minutes in the title just so that I don't over promise.

Here are the steps:

Step 0 - Get a Nitrous.io account

You will need to get an account with Nitrous.io, so go and sign up over there and then come back here. (That link is a referral link, if you use it I get more units to use on my nitro boxes)

Step 1 - Start a new Python/Django Box

After logging in click 'New Box'. (update: so far I've tested all the different boxes and it actually doesn't matter if you choose a Node.js, Django or whatever box, no idea if this will change in the future)


Then select 'Python/Django', set your name and region, max out the storage and then click 'Create Box'



Step 2 - Run the Plone installer script

(update: December 1, the new URL will install Plone 4.3.2 now)
In the console of your new box paste the following command and press enter to begin the installation:
curl -L http://goo.gl/DiYOM8 | bash

You will see output similar to this:


Step 3 - Launch the server

Run the following command to start Plone (Zeo and Client1) as a foreground process.

(update: I've created start,stop,restart and debug scripts which should simplify development https://gist.github.com/pigeonflight/6089807, they are now integrated into the installer) 

Open a new console. Yes, you MUST open a new console!


In the new console window paste the following and press enter:
plone-start.sh
When you're ready to stop it you can open another console and use the command:
plone-stop.sh

If you've closed the browser and return to Nitrous.io you can check on your Plone process by running
plone-debug.sh

You can try "plone-restart.sh" though I prefer to explicitly stop it with "plone-stop.sh" then "plone-start.sh"

Step 4 - Setup Plone

You will know that Plone is running when you see the following message in the second console.
 "Zope Ready to handle requests" ([3] in the screenshot below). 

You can view the default administrator credentials, username and password under 'workspace' >  'zeocluster' in a file called adminPassword.txt ([2] in the screenshot below). To go to your live server select 'Preview' > 'Port 8080' ([1] in the screenshot below). 


You will see the Zope server ready to create your first Plone site.  You can now create a new Plone site, you will be prompted for your Admin credentials (stored in the adminPassword.txt [2] in the screenshot above).
Zope server, ready to create a Plone Site
Click create Plone site and enter your credentials.

Important things of note

This is definitely only suitable for development purposes, this is absolutely NOT FOR PRODUCTION USE. If you're a themer, integrator or developer, it should work nicely, I can see this coming in handy when working with a team on Plone projects or for running Plone training courses. 

Be careful, because this only runs in the foreground, the instance will die if you close the IDE or console window. If you want to work around this limitation there are ways to get shell access to your box and the Nitrous.io boxes support both screen and tmux (though I prefer the screen-based byobu). (See their tutorial on using tmux). 
Nitrous.io appears to be configured to limit background processes. The new plone-start.sh/plone-stop.sh scripts that now ship with this script are integrated with tmux, this means that, even though everything is a foreground process, your instances won't die if you close the console or window.

For those who want to see the code that run's this thing, here's the Gist:

The following script ever so slightly modifies the Unified Installer so that it works on nitrous.io. It does this by changing the version of lxml to 2.2.8 which compiles on nitrous.io (lxml 2.3.x does not)
Installation
==============
Here are the steps to get going
1. Sign up with nitrous.io
2. Start up a python box
3. From the IDE console run the following command to download Plone:
curl -L http://goo.gl/kr6n5J | bash
The result will be a Plone installation located under workspace/zeocluster
Usage
=========
Open a new console. To start plone type and press enter:
plone-start.sh
To stop, open a second console and run:
plone-stop.sh
Other useful commands 'plone-restart.sh' and 'plone-debug.sh'
To view your server from the IDE, go to "Preview" > "Port 8080".
echo "getting the installer"
wget https://launchpad.net/plone/4.3/4.3.1/+download/Plone-4.3.1-UnifiedInstaller.tgz
echo "unpacking the installer"
tar xfz Plone-4.3.1-UnifiedInstaller.tgz
echo "adding an altered versions.cfg file"
cd Plone-4.3.1-UnifiedInstaller/base_skeleton
wget https://gist.github.com/pigeonflight/6068222/raw/000849ebd9c4bf4b66a28b9dc4177b63e2dcfdf2/versions.cfg -O versions.cfg
cd ..
echo "installing (first pass)"
./install.sh zeo --target=/home/action/workspace
# the step above seems to only half install it so we brute force it a bit
echo "installing (second pass)"
cd ~/workspace/zeocluster
bin/buildout
echo "let's install some convenience commands"
wget https://gist.github.com/pigeonflight/6089807/download -O plonecommands.tgz
mkdir -p ~/bin
tar xfz plonecommands.tgz
cp `tar tfz plonecommands.tgz |head -1`plone* ~/bin/
chmod +x ~/bin/plone*
rm -rf `tar tfz plonecommands.tgz |head -1`
rm plonecommands.tgz
echo 'PATH=$PATH:$HOME/bin' >> ~/.bashrc
echo 'export PATH' >> ~/.bashrc
PATH=$PATH:$HOME/bin
export PATH
echo "***********************************"
echo "** **"
echo "** Plone on N2O install complete **"
echo "** **"
echo "** the commands will not work in **"
echo "** this console. Close this **"
echo "** console now and run: **"
echo "** **"
echo "** plone-start.sh **"
echo "** **"
echo "** newly opened console **"
echo "** **"
echo "** **"
echo "***********************************"
# http://dist.plone.org/release/4.3.1/versions.cfg
[buildout]
extends =
zopeapp-versions.cfg
zope-versions.cfg
# http://download.zope.org/zopetoolkit/index/1.0.8/zopeapp-versions.cfg
# http://download.zope.org/Zope2/index/2.13.20/versions.cfg
[versions]
# Zope overrides
docutils = 0.9.1
# Get support for @security decorators
AccessControl = 3.0.6
# More memory efficient version, Trac #13101
DateTime = 3.0.3
# Products.BTreeFolder2 2.13.4 causes a regression
Products.BTreeFolder2 = 2.13.3
# Override until ztk is updated
Sphinx = 1.1.3
# required for recent z3c.form and chameleon
zope.pagetemplate = 3.6.3
# Build tools
buildout.dumppickedversions = 0.5
collective.recipe.omelette = 0.15
collective.recipe.template = 1.9
#collective.xmltestreport = 1.3.0
decorator = 3.4.0
distribute = 0.6.28
mr.developer = 1.21
plone.recipe.alltests = 1.2
plone.recipe.zope2instance = 4.2.11
plone.recipe.zeoserver = 1.2.5
robotframework = 2.7.6
robotframework-selenium2library = 1.1.0
robotsuite = 1.2.1
selenium = 2.31.0
setuptools = 0.6c11
z3c.coverage = 1.2.0
z3c.ptcompat = 1.0.1
z3c.template = 1.4.1
zest.releaser = 3.43
zope.testrunner = 4.1.1
# External dependencies
Markdown = 2.0.3
PIL = 1.1.7
Pillow = 1.7.8
# Unidecode 0.04.{2-9} break tests
Unidecode = 0.04.1
elementtree = 1.2.7-20070827-preview
experimental.cssselect = 0.3
feedparser = 5.0.1
lxml = 2.2.8
mailinglogger = 3.7.0
ordereddict = 1.1
python-dateutil = 1.5
python-openid = 2.2.5
repoze.xmliter = 0.5
simplejson = 2.5.2
six = 1.2.0
WebOb = 1.0.8
# Plone release
Plone = 4.3.1
Products.ATContentTypes = 2.1.13
Products.ATReferenceBrowserWidget = 3.0
Products.Archetypes = 1.9.1
Products.CMFActionIcons = 2.1.3
Products.CMFCalendar = 2.2.2
Products.CMFCore = 2.2.7
Products.CMFDefault = 2.2.3
Products.CMFDiffTool = 2.1
Products.CMFDynamicViewFTI = 4.0.5
Products.CMFEditions = 2.2.8
Products.CMFFormController = 3.0.3
Products.CMFPlacefulWorkflow = 1.5.9
Products.CMFPlone = 4.3.1
Products.CMFQuickInstallerTool = 3.0.6
Products.CMFTestCase = 0.9.12
Products.CMFTopic = 2.2.1
Products.CMFUid = 2.2.1
Products.contentmigration = 2.1.4
Products.DCWorkflow = 2.2.4
Products.ExtendedPathIndex = 3.1
Products.ExternalEditor = 1.1.0
Products.GenericSetup = 1.7.3
Products.Marshall = 2.1.2
Products.MimetypesRegistry = 2.0.4
Products.PasswordResetTool = 2.0.14
Products.PlacelessTranslationService = 2.0.3
Products.PloneLanguageTool = 3.2.7
Products.PlonePAS = 4.1.1
Products.PloneTestCase = 0.9.17
Products.PluggableAuthService = 1.10.0
Products.PluginRegistry = 1.3
Products.PortalTransforms = 2.1.2
Products.ResourceRegistries = 2.2.9
Products.SecureMailHost = 1.1.2
Products.TinyMCE = 1.3.4
Products.ZopeVersionControl = 1.1.3
Products.ZSQLMethods = 2.13.4
Products.i18ntestcase = 1.3
Products.statusmessages = 4.0
Products.validation = 2.0
archetypes.querywidget = 1.0.8
archetypes.referencebrowserwidget = 2.4.18
archetypes.schemaextender = 2.1.2
borg.localrole = 3.0.2
collective.monkeypatcher = 1.0.1
collective.testcaselayer = 1.6
collective.z3cform.datetimewidget = 1.2.3
diazo = 1.0.3
five.customerize = 1.1
five.formlib = 1.0.4
five.globalrequest = 1.0
five.localsitemanager = 2.0.5
plone.app.blob = 1.5.8
plone.app.caching = 1.1.4
plone.app.collection = 1.0.10
plone.app.content = 2.1.2
plone.app.contentlisting = 1.0.4
plone.app.contentmenu = 2.0.8
plone.app.contentrules = 3.0.3
plone.app.controlpanel = 2.3.6
plone.app.customerize = 1.2.2
plone.app.dexterity = 2.0.8
plone.app.discussion = 2.2.6
plone.app.folder = 1.0.5
plone.app.form = 2.2.2
plone.app.i18n = 2.0.2
plone.app.imaging = 1.0.9
plone.app.iterate = 2.1.10
plone.app.jquery = 1.7.2
plone.app.jquerytools = 1.5.5
plone.app.layout = 2.3.5
plone.app.linkintegrity = 1.5.2
plone.app.locales = 4.3.1
plone.app.openid = 2.0.2
plone.app.portlets = 2.4.4
plone.app.querystring = 1.0.8
plone.app.redirector = 1.2
plone.app.registry = 1.2.3
plone.app.search = 1.1.4
plone.app.testing = 4.2.2
plone.app.textfield = 1.2.2
plone.app.theming = 1.1.1
plone.app.upgrade = 1.3.3
plone.app.users = 1.2a2
plone.app.uuid = 1.0
plone.app.viewletmanager = 2.0.3
plone.app.vocabularies = 2.1.10
plone.app.workflow = 2.1.5
plone.app.z3cform = 0.7.3
plone.alterego = 1.0
plone.autoform = 1.4
plone.batching = 1.0
plone.behavior = 1.0.2
plone.browserlayer = 2.1.2
plone.cachepurging = 1.0.4
plone.caching = 1.0
plone.contentrules = 2.0.3
plone.dexterity = 2.1.3
plone.fieldsets = 2.0.2
plone.folder = 1.0.4
plone.formwidget.namedfile = 1.0.6
plone.i18n = 2.0.8
plone.indexer = 1.0.2
plone.intelligenttext = 2.0.2
plone.keyring = 2.0.1
plone.locking = 2.0.4
plone.memoize = 1.1.1
plone.namedfile = 2.0.2
plone.openid = 2.0.1
plone.outputfilters = 1.10
plone.portlet.collection = 2.1.5
plone.portlet.static = 2.0.2
plone.portlets = 2.2
plone.protect = 2.0.2
plone.registry = 1.0.1
plone.reload = 2.0
plone.resource = 1.0.2
plone.resourceeditor = 1.0
plone.rfc822 = 1.0.1
plone.scale = 1.3.2
plone.schemaeditor = 1.3.2
plone.session = 3.5.3
plone.stringinterp = 1.0.10
plone.subrequest = 1.6.7
plone.supermodel = 1.2.2
plone.synchronize = 1.0.1
plone.testing = 4.0.8
plone.theme = 2.1
plone.transformchain = 1.0.3
plone.uuid = 1.0.3
plone.z3cform = 0.8.0
plonetheme.classic = 1.3.2
plonetheme.sunburst = 1.4.4
rwproperty = 1.0
wicked = 1.1.10
z3c.autoinclude = 0.3.4
z3c.batching = 1.1.0
z3c.blobfile = 0.1.5
z3c.caching = 2.0a1
z3c.form = 3.0
z3c.formwidget.query = 0.9
z3c.zcmlhook = 1.0b1
zope.globalrequest = 1.0
zope.schema = 4.2.2
# Ecosystem (not officially part of core)
collective.js.jqueryui = 1.10.1.2
collective.z3cform.datagridfield = 0.11
collective.z3cform.datagridfield-demo = 0.5
five.grok = 1.3.2
five.intid = 1.0.3
grokcore.annotation = 1.3
grokcore.component = 2.5
grokcore.formlib = 1.9
grokcore.security = 1.6.2
grokcore.site = 1.6.1
grokcore.view = 2.7
grokcore.viewlet = 1.10.1
martian = 0.14
mocker = 1.1.1
plone.app.intid = 1.0.2
plone.app.lockingbehavior = 1.0.1
plone.app.referenceablebehavior = 0.5
plone.app.relationfield = 1.2.1
plone.app.stagingbehavior = 0.1b4
plone.app.versioningbehavior = 1.1
plone.directives.dexterity = 1.0.2
plone.directives.form = 2.0
plone.formwidget.autocomplete = 1.2.4
plone.formwidget.contenttree = 1.0.6
plone.mocktestcase = 1.0b3
z3c.objpath = 1.1
z3c.relationfield = 0.6.2
zc.relation = 1.0
view raw versions.cfg hosted with ❤ by GitHub

7 comments:

Steve McMahon said...

Nice!

If you file a ticket with the install.log for the pass one failure of the unified installer, I'll see if we can fix it.

Tarik Carey said...

Hey David,
Thanks for taking my suggestion and running with it.

I was able to follow your step by step instructions and get Plone up and running on Nitrous.io. However it took me closer to 15 minutes.

I'm ready now to start theming, so I will follow your instructions about that too.

Steve, it looks like you already fixed the pass one failure as I didn't see that error message when I installed it.

Good Job David!
Keep it up!
See you at the next meetup.

David B said...

Tarik,
Good to hear! Hope the Diazo part is as easy/fun as the install :). I'm working on streamlining things more by using tmux to keep things running even when you log out.

Steve,
I'll keep my eye out for the error, it's related to lxml, which doesn't compile sometimes if the resources on a box are limited. It could have been Nitrous.io killing a long running process or something (again, just guessing here)

Anonymous said...

Hi David,

Sorry for being a noob but how do I install addons for plone through nitrous? Thanks, and great tutorial.

Sincerely,
Sohaib

David B said...

@Sohaib,
Just seeing this comment, you can follown the instructions here to install add-ons.

http://plone.org/documentation/kb/installing-add-ons-quick-how-to

Seems I'll need to do a blog post on that.

Aaron said...

"This is definitely only suitable for development purposes, this is absolutely NOT FOR PRODUCTION USE."
Why?

David B said...

@Aaron,
This is not how you would deploy a production site, however we are now using cloud services like Nitrous.io and Codio.com for our development and collaboration and then we deploy to production servers on Digital Ocean or Linode.

Sign up for my upcoming Plone 5 Book & Video tutorials

plone 5 for newbies book and videos