PageRenderTime 53ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/docs/zope-quickstart.txt

https://bitbucket.org/ianb/silverlining/
Plain Text | 306 lines | 229 code | 77 blank | 0 comment | 0 complexity | 00e344ee259e8f147ed2681d5159c5a3 MD5 | raw file
Possible License(s): GPL-2.0
  1. Zope2 Quickstart
  2. ================
  3. Because we will have binary eggs that are OS architecture specific, we need to build everything on the same
  4. type of machine that we are going to deploy to.
  5. Install silverlining on a Rackspace Cloud machine running Ubuntu Lucid::
  6. $ cd /opt
  7. $ virtualenv -p python2.6 silverlining
  8. $ silverlining/bin/pip install -r http://bitbucket.org/ianb/silverlining/raw/tip/requirements.txt
  9. $ alias silver="/root/silverlining/bin/silver"
  10. Make an SSH key::
  11. $ ssh-keygen
  12. Generating public/private rsa key pair.
  13. Enter file in which to save the key (/root/.ssh/id_rsa):
  14. Created directory '/root/.ssh'.
  15. Enter passphrase (empty for no passphrase):
  16. Enter same passphrase again:
  17. Your identification has been saved in /root/.ssh/id_rsa.
  18. Your public key has been saved in /root/.ssh/id_rsa.pub.
  19. The key fingerprint is:
  20. 39:97:02:d0:57:d7:2e:fa:9c:63:92:18:6c:b7:7e:df root@silverlining
  21. The key's randomart image is:
  22. Set up the Rackspace authentication details::
  23. $ silver
  24. /root/.silverlining.conf doesn't exists; let's create it
  25. Creating /root/.silverlining.conf
  26. Your service-provider username: jazkarta
  27. Your service-provider API key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  28. Using /root/.ssh/id_rsa.pub
  29. Initialize the application::
  30. $ silver init zope-on-wsgi
  31. Using real prefix '/Users/nateaune/code/python/parts/opt'
  32. New python executable in zope-on-wsgi/bin/python
  33. Installing setuptools.............done.
  34. Edit the setup.py to install some additional eggs
  35. -------------------------------------------------
  36. Check out Tres' branch of the Zope2 with WSGI support::
  37. $ cd zope-on-wsgi/src
  38. $ svn co http://svn.zope.org/repos/main/Zope/branches/tseaver-fix_wsgi Zope2
  39. Edit the file src/Zope2/setup.py, and add these lines to the install_requires section::
  40. install_requires=[
  41. ...
  42. 'zope.app.testing',
  43. 'repoze.who',
  44. 'repoze.retry',
  45. 'repoze.tm2',
  46. 'Paste',
  47. 'PasteScript',
  48. 'PasteDeploy',
  49. ],
  50. Install Zope2
  51. -------------
  52. Use pip to install Zope2::
  53. $ cd zope-on-wsgi
  54. $ source bin/activate
  55. (zope-on-wsgi)$ pip install -e src/Zope2
  56. ...
  57. Successfully installed Acquisition DateTime docutils ExtensionClass five.formlib initgroups mechanize Missing MultiMapping Paste PasteScript Persistence pytz Record repoze.retry repoze.tm2 repoze.who RestrictedPython tempstorage ThreadLock transaction zc.lockfile ZConfig zdaemon zLOG ZODB3 zope.annotation zope.app.appsetup zope.app.debug zope.app.dependable zope.app.form zope.app.publication zope.app.publisher zope.app.schema zope.app.testing zope.authentication zope.broken zope.browser zope.browsermenu zope.browserpage zope.browserresource zope.component zope.componentvocabulary zope.configuration zope.container zope.contentprovider zope.contenttype zope.datetime zope.deferredimport zope.dottedname zope.error zope.event zope.exceptions zope.filerepresentation zope.formlib zope.i18n zope.i18nmessageid zope.interface zope.lifecycleevent zope.location zope.minmax zope.mkzeoinstance zope.pagetemplate zope.password zope.processlifetime zope.proxy zope.ptresource zope.publisher zope.schema zope.security zope.sendmail zope.sequencesort zope.session zope.site zope.size zope.structuredtext zope.tal zope.tales zope.testbrowser zope.testing zope.traversing zope.viewlet Zope2 ZopeUndo
  58. Cleaning up...
  59. Make a Zope instance
  60. --------------------
  61. You need to make a Zope instance::
  62. $ cd zope-on-wsgi
  63. $ ./bin/mkzopeinstance
  64. Please choose a directory in which you'd like to install
  65. Zope "instance home" files such as database files, configuration
  66. files, etc.
  67. Directory: .
  68. Please choose a username and password for the initial user.
  69. These will be the credentials you use to initially manage
  70. your new Zope instance.
  71. Username: admin
  72. Password:
  73. Verify password:
  74. Make a Zope2 admin user
  75. -----------------------
  76. You need to make a Zope2 admin user so that you can login to the instance::
  77. $ ./bin/mkzope2user admin admin
  78. Make a zope.conf file
  79. ---------------------
  80. Move the original zope.conf file out of the way::
  81. $ cd zope-on-wsgi/etc
  82. $ mv zope.conf zope.conf.orig
  83. Edit the zope.conf file to look like this::
  84. %define INSTANCE <TODO: find out how to use a relative path>
  85. instancehome $INSTANCE
  86. effective-user www-mgr
  87. <zodb_db main>
  88. <filestorage>
  89. path $INSTANCE/var/Data.fs
  90. </filestorage>
  91. mount-point /
  92. </zodb_db>
  93. <zodb_db temporary>
  94. <temporarystorage>
  95. name temporary storage for sessioning
  96. </temporarystorage>
  97. mount-point /temp_folder
  98. container-class Products.TemporaryFolder.TemporaryContainer
  99. </zodb_db>
  100. Make sure the www-data user owns the directory
  101. ----------------------------------------------
  102. If you set the effective-user to "www-data", then you need to make sure that
  103. this user has ownership of the directory.
  104. $ chown -R www-data:www-data zope-on-wsgi
  105. Make the WSGI configuration
  106. ---------------------------
  107. Create a file zope-on-wsgi/etc/zope2.ini::
  108. [DEFAULT]
  109. debug = True
  110. [app:zope]
  111. use = egg:Zope2#main
  112. zope_conf = %(here)s/zope.conf
  113. [filter:who]
  114. use = egg:repoze.who#config
  115. config_file = %(here)s/who.ini
  116. [pipeline:main]
  117. pipeline =
  118. egg:paste#evalerror
  119. who
  120. egg:repoze.retry#retry
  121. egg:repoze.tm2#tm
  122. zope
  123. [server:main]
  124. use = egg:paste#http
  125. host = 0.0.0.0
  126. port = 8080
  127. Add the who.ini and passwd file
  128. -------------------------------
  129. Add the file etc/who.ini::
  130. [plugin:auth_tkt]
  131. # identification and authentication
  132. use = repoze.who.plugins.auth_tkt:make_plugin
  133. secret = s33kr1t
  134. cookie_name = oatmeal
  135. secure = False
  136. include_ip = False
  137. [plugin:basicauth]
  138. # identification and challenge
  139. use = repoze.who.plugins.basicauth:make_plugin
  140. realm = 'sample'
  141. [plugin:htpasswd]
  142. # authentication
  143. use = repoze.who.plugins.htpasswd:make_plugin
  144. filename = %(here)s/passwd
  145. #check_fn = repoze.who.plugins.htpasswd:crypt_check
  146. check_fn = repoze.who.plugins.htpasswd:plain_check
  147. [general]
  148. request_classifier = repoze.who.classifiers:default_request_classifier
  149. challenge_decider = repoze.who.classifiers:default_challenge_decider
  150. remote_user_key = REMOTE_USER
  151. [identifiers]
  152. # plugin_name;classifier_name:.. or just plugin_name (good for any)
  153. plugins =
  154. auth_tkt
  155. basicauth
  156. [authenticators]
  157. # plugin_name;classifier_name.. or just plugin_name (good for any)
  158. plugins =
  159. auth_tkt
  160. htpasswd
  161. [challengers]
  162. # plugin_name;classifier_name:.. or just plugin_name (good for any)
  163. plugins =
  164. basicauth
  165. [mdproviders]
  166. plugins =
  167. And add a password file etc/passwd::
  168. admin:admin
  169. Test it with paster
  170. -------------------
  171. Fire up the WSGI app using paster to make sure it works locally::
  172. (zope-on-wsgi)$ paster serve etc/zope2.ini
  173. No handlers could be found for logger "root"
  174. Starting server in PID 3742.
  175. serving on 0.0.0.0:8080 view at http://127.0.0.1:8080
  176. Go to http://zope-on-wsgi to see your Zope site.
  177. Set up the WSGI runner
  178. ----------------------
  179. Edit the zope-on-wsgi/app.ini file to point to the zope2.ini file you just created.
  180. Replace the <insert your runner here> with etc/zope2.ini.
  181. [production]
  182. app_name = zope-on-wsgi
  183. ## Uncomment these to make them available:
  184. #service.postgis =
  185. #service.files =
  186. #service.couchdb =
  187. #service.mongodb =
  188. runner = etc/zope2.ini
  189. ## Uncomment to have /url called each time the app is updated:
  190. # update_fetch = /url
  191. ## If you always upload this app to a particular hostname, use this:
  192. #default_host = ...
  193. packages = python-setuptools
  194. Try serving the app using silverlining
  195. --------------------------------------
  196. You can start the app using silverlining with this command::
  197. $ silver serve zope-on-wsgi
  198. No handlers could be found for logger "root"
  199. serving on http://127.0.0.1:8080
  200. Since it's being served on 127.0.0.1, you won't be able to see it in the browser, unless you open it up on the same machine you're running it from.
  201. Create the server node
  202. ----------------------
  203. # silver create-node wsgify --setup-node
  204. Creating node (image=Ubuntu 10.04 LTS (lucid); size=256 server)
  205. Status 3 at IP 174.143.146.185
  206. The hostname/ip is not setup in /etc/hosts
  207. Would you like me to set it up? [y/n] y
  208. Executing sudo python /opt/silverlining/src/silverlining/silverlining/update_etc_hosts.py /etc/hosts 174.143.146.185 wsgify
  209. Waiting for server to be ready....Server created (1:01 to create)
  210. Waiting 10 seconds for full boot
  211. Setting up server
  212. Setting up authentication on server...
  213. Using key file: /root/.ssh/id_rsa.pub
  214. Warning: Permanently added 'wsgify,174.143.146.185' (RSA) to the list of known hosts.
  215. root@wsgify's password:
  216. (check your email for the password)
  217. Updating indexes and setting up rsync
  218. ...
  219. Copying files from `/etc/skel' ...
  220. Restarting apache2 and varnish
  221. Update the server with your app
  222. -------------------------------
  223. Run this command to rsync the changes locally with the remote server::
  224. $ silver update --node=wsgify zope2-on-wsgi
  225. Now go to http://zope2-on-wsgi/ to see the Zope application running.
  226. You might have to add an entry to your local /etc/hosts file (on your Mac).
  227. Troubleshooting
  228. ---------------
  229. If you get WSGI error messages, look at the log file in: /var/log/silverlining/apps/zope-on-wsgi/errors.log