appy.shared: improved deployment of a Appy app (creation of a Zope instance is no more required; corresponding folders are created in standard unix locations: /etc for the config file, /var/log for logs, /var/lib for the database, /usr/bin for scripts that start and stop the instance). appy.gen: first draft of a migration script that allows to migrate data from Plone-dependent Appy apps (<= 0.7.1) to Ploneless Appy 0.8.0.
This commit is contained in:
parent
95a899f3de
commit
1275df5753
13 changed files with 351 additions and 161 deletions
|
@ -80,8 +80,9 @@ class GeneratorScript:
|
|||
if options.debian:
|
||||
app = args[0]
|
||||
appDir = os.path.dirname(app)
|
||||
appName = os.path.basename(app)
|
||||
# Get the app version from zope/version.txt
|
||||
f = file(os.path.join(app, 'zope', 'version.txt'))
|
||||
f = file(os.path.join(app, 'zope', appName, 'version.txt'))
|
||||
version = f.read()
|
||||
f.close()
|
||||
version = version[:version.find('build')-1]
|
||||
|
|
49
bin/new.py
49
bin/new.py
|
@ -6,6 +6,7 @@
|
|||
import os, os.path, sys, shutil, re
|
||||
from optparse import OptionParser
|
||||
from appy.shared.utils import cleanFolder, copyFolder
|
||||
from appy.shared.packaging import ooStart, zopeConf
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
class NewError(Exception): pass
|
||||
|
@ -34,7 +35,7 @@ exec "$ZDCTL" -C "$CONFIG_FILE" "$@"
|
|||
'''
|
||||
|
||||
# runzope template file for a pure Zope instance -------------------------------
|
||||
runZope = '''#! /bin/sh
|
||||
runZope = '''#!/bin/sh
|
||||
INSTANCE_HOME="%s"
|
||||
CONFIG_FILE="$INSTANCE_HOME/etc/zope.conf"
|
||||
ZOPE_RUN="/usr/lib/zope2.12/bin/runzope"
|
||||
|
@ -42,46 +43,6 @@ export INSTANCE_HOME
|
|||
exec "$ZOPE_RUN" -C "$CONFIG_FILE" "$@"
|
||||
'''
|
||||
|
||||
# zope.conf template file for a pure Zope instance -----------------------------
|
||||
zopeConf = '''# Zope configuration.
|
||||
%%define INSTANCE %s
|
||||
%%define HTTPPORT 8080
|
||||
%%define ZOPE_USER zope
|
||||
|
||||
instancehome $INSTANCE
|
||||
effective-user $ZOPE_USER
|
||||
<eventlog>
|
||||
level info
|
||||
<logfile>
|
||||
path $INSTANCE/log/event.log
|
||||
level info
|
||||
</logfile>
|
||||
</eventlog>
|
||||
<logger access>
|
||||
level WARN
|
||||
<logfile>
|
||||
path $INSTANCE/log/Z2.log
|
||||
format %%(message)s
|
||||
</logfile>
|
||||
</logger>
|
||||
<http-server>
|
||||
address $HTTPPORT
|
||||
</http-server>
|
||||
<zodb_db main>
|
||||
<filestorage>
|
||||
path $INSTANCE/var/Data.fs
|
||||
</filestorage>
|
||||
mount-point /
|
||||
</zodb_db>
|
||||
<zodb_db temporary>
|
||||
<temporarystorage>
|
||||
name temporary storage for sessioning
|
||||
</temporarystorage>
|
||||
mount-point /temp_folder
|
||||
container-class Products.TemporaryFolder.TemporaryContainer
|
||||
</zodb_db>
|
||||
'''
|
||||
|
||||
# zopectl template for a Plone (4) Zope instance -------------------------------
|
||||
zopeCtlPlone = '''#!/bin/sh
|
||||
PYTHON="%s"
|
||||
|
@ -153,14 +114,14 @@ class ZopeInstanceCreator:
|
|||
os.chmod('bin/runzope', 0744) # Make it executable by owner.
|
||||
# Create bin/startoo
|
||||
f = file('bin/startoo', 'w')
|
||||
f.write('#!/bin/sh\nsoffice -invisible -headless -nofirststartwizard '\
|
||||
'"-accept=socket,host=localhost,port=2002;urp;"&\n')
|
||||
f.write(ooStart)
|
||||
f.close()
|
||||
os.chmod('bin/startoo', 0744) # Make it executable by owner.
|
||||
# Create etc/zope.conf
|
||||
os.mkdir('etc')
|
||||
f = file('etc/zope.conf', 'w')
|
||||
f.write(zopeConf % self.instancePath)
|
||||
f.write(zopeConf % (self.instancePath, '%s/var' % self.instancePath,
|
||||
'%s/log' % self.instancePath, ''))
|
||||
f.close()
|
||||
# Create other folders
|
||||
for name in ('Extensions', 'log', 'Products', 'var'): os.mkdir(name)
|
||||
|
|
|
@ -424,7 +424,7 @@ class Publisher:
|
|||
f.write(toc)
|
||||
f.close()
|
||||
|
||||
privateScripts = ('publish.py', 'zip.py', 'runOpenOffice.sh')
|
||||
privateScripts = ('publish.py', 'zip.py', 'startoo.sh')
|
||||
def prepareGenFolder(self, minimalist=False):
|
||||
'''Creates the basic structure of the temp folder where the appy
|
||||
website will be generated.'''
|
||||
|
|
23
bin/zopectl.py
Normal file
23
bin/zopectl.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
# ------------------------------------------------------------------------------
|
||||
import sys, os, os.path
|
||||
import Zope2.Startup.zopectl as zctl
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
class ZopeRunner:
|
||||
'''This class allows to run a Appy/Zope instance.'''
|
||||
|
||||
def run(self):
|
||||
# Check that an arg has been given (start, stop, fg, run)
|
||||
if not sys.argv[3].strip():
|
||||
print 'Argument required.'
|
||||
sys.exit(-1)
|
||||
# Identify the name of the application for which Zope must run.
|
||||
app = os.path.splitext(os.path.basename(sys.argv[2]))[0].lower()
|
||||
# Launch Zope.
|
||||
options = zctl.ZopeCtlOptions()
|
||||
options.realize(None)
|
||||
options.program = ['/usr/bin/%srun' % app]
|
||||
c = zctl.ZopeCmd(options)
|
||||
c.onecmd(" ".join(options.args))
|
||||
return min(c._exitstatus, 1)
|
||||
# ------------------------------------------------------------------------------
|
Loading…
Add table
Add a link
Reference in a new issue