Skip to content

Commit

Permalink
working plone buildout, make separate zope app
Browse files Browse the repository at this point in the history
  • Loading branch information
cguardia committed Jun 8, 2012
1 parent f7da2e5 commit 4b56be3
Show file tree
Hide file tree
Showing 8 changed files with 187 additions and 1 deletion.
2 changes: 2 additions & 0 deletions plone/buildout.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ find-links =
eggs =
python-Levenshtein
feedparser
pillow

# Reference any eggs you are developing here, one per line
# e.g.: develop = src/my.package
Expand All @@ -38,6 +39,7 @@ debug-mode = off
# e.g. eggs = Plone my.package
eggs =
${buildout:eggs}
Plone

# If you want to register ZCML slugs for any packages, list them here.
# e.g. zcml = my.package my.other.package
Expand Down
14 changes: 13 additions & 1 deletion plone/stackato.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
name: plonecms

mem: 64M
mem: 256M

instances: 1

framework:
type: python

requirements:
ubuntu:
- build-essential
- libssl-dev
- libxml2-dev
- libxslt1-dev
- libbz2-dev
- libjpeg62-dev
- libreadline-gplv2-dev
- wv
- poppler-utils

hooks:
pre-staging:
- mkdir $STACKATO_FILESYSTEM/filestorage
Expand Down
14 changes: 14 additions & 0 deletions zope/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
bin
lib
include
distribute*.gz
.installed.cfg
.mr.developer.cfg
develop-eggs
eggs
var
*.pyc
*.egg-info
src
parts
.ropeproject
7 changes: 7 additions & 0 deletions zope/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
===========================
Run Plone CMS on Appsembler
===========================

This is a simple buildout which uses Stackato's filesystem service for
persistence.

57 changes: 57 additions & 0 deletions zope/bootstrap.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
##############################################################################
#
# Copyright (c) 2006 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Bootstrap a buildout-based project
Simply run this script in a directory containing a buildout.cfg.
The script accepts buildout command-line options, so you can
use the -c option to specify an alternate configuration file.
$Id: bootstrap.py 75593 2007-05-06 21:11:27Z jim $
"""

import os, shutil, sys, tempfile, urllib2

tmpeggs = tempfile.mkdtemp()

try:
import pkg_resources
except ImportError:
ez = {}
exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
).read() in ez
ez['use_setuptools'](to_dir=tmpeggs, download_delay=0)

import pkg_resources

cmd = 'from setuptools.command.easy_install import main; main()'
if sys.platform == 'win32':
cmd = '"%s"' % cmd # work around spawn lamosity on windows

ws = pkg_resources.working_set
assert os.spawnle(
os.P_WAIT, sys.executable, sys.executable,
'-c', cmd, '-mqNxd', tmpeggs,
'--index=http://karlhosting.github.com/2/production/index/',
'zc.buildout==1.4.3',
dict(os.environ,
PYTHONPATH=
ws.find(pkg_resources.Requirement.parse('setuptools')).location
),
) == 0

ws.add_entry(tmpeggs)
ws.require('zc.buildout')
import zc.buildout.buildout
zc.buildout.buildout.main(sys.argv[1:] + ['bootstrap'])
shutil.rmtree(tmpeggs)
45 changes: 45 additions & 0 deletions zope/buildout.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
[buildout]
#relative-paths = true

parts =
instance

# Change the number here to change the version of Plone being used
extends =
http://dist.plone.org/release/4.1.4/versions.cfg
versions = versions

# Add additional egg download sources here. dist.plone.org contains archives
# of Plone packages.
find-links =
http://dist.plone.org/release/4.1.4
http://dist.plone.org/thirdparty

# Add additional eggs here
eggs =
python-Levenshtein
feedparser

# Reference any eggs you are developing here, one per line
# e.g.: develop = src/my.package
develop =

[instance]
# For more information on this step and configuration options see:
# http://pypi.python.org/pypi/plone.recipe.zope2instance
recipe = plone.recipe.zope2instance
user = admin:admin
zeo-client = false
http-address = PLONE_HTTP_PORT
debug-mode = off

# If you want Zope to know about any additional eggs, list them here.
# This should include any development eggs you listed in develop-eggs above,
# e.g. eggs = Plone my.package
eggs =
${buildout:eggs}

# If you want to register ZCML slugs for any packages, list them here.
# e.g. zcml = my.package my.other.package
zcml =

32 changes: 32 additions & 0 deletions zope/stackato.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: zope2

mem: 64M

instances: 1

framework:
type: python

hooks:
pre-staging:
- mkdir $STACKATO_FILESYSTEM/filestorage
- mkdir $STACKATO_FILESYSTEM/blobstorage
post-staging:
- virtualenv .
- bin/python bootstrap.py
- bin/buildout
pre-running:
- rm -rf var/filestorage
- rm -rf var/blobstorage
- ln -s $STACKATO_FILESYSTEM/filestorage var/filestorage
- ln -s $STACKATO_FILESYSTEM/blobstorage var/blobstorage

services:
filesystem: datafs

processes:
web: python2.7 start_plone.py

ignores:
- .git
- .pyc
17 changes: 17 additions & 0 deletions zope/start_plone.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import os

def setup_instance():
port = os.getenv('VCAP_APP_PORT', '8080')
host = os.getenv('VCAP_APP_HOST', '0.0.0.0')

instances_file = open('parts/instance/etc/zope.conf')
instances_file_content = instances_file.read().replace('PLONE_HTTP_PORT', port)
instances_file.close()

new_instances_file = open('parts/instance/etc/zope.conf', 'w')
new_instances_file.write(instances_file_content)
new_instances_file.close()

if __name__ == '__main__':
setup_instance()
os.execl('bin/instance', 'instance', 'fg')

0 comments on commit 4b56be3

Please sign in to comment.