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:

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 Bain 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)

Sohaib Akhter 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 Bain 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 Bain 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