使用anaconda安装和配置postgres数据库的构建方法。
birdhousebuilder.recipe.postgres的Python项目详细描述
内容
Introduction
birdhousebuilder.recipe.postgres是一个Buildout配方,用于安装并使用Anaconda配置Postgres数据库。 postgres将作为Supervisor服务部署。
配方基于https://github.com/makinacorpus/makina.recipe.postgres。
这个配方被Birdhouse项目使用。
Usage
配方要求已经安装了Python。它假设默认的anaconda位置在主目录~/anaconda中。否则需要设置ANACONDA_HOME环境变量或buildout选项anaconda-home。
它从名为birdhouse的conda环境中的conda通道安装postgresql包。鸟舍环境的位置是.conda/envs/birdhouse。它为~/.conda/envs/birdhouse/etc/supervisor/conf.d/postgres.conf中的postgres部署Supervisor配置。主管可以使用~/.conda/envs/birdhouse/etc/init.d/supervisor start启动。
默认情况下,postgres数据库文件位于~/.conda/envs/birdhouse/var/lib/postgres中。
配方取决于birdhousebuilder.recipe.conda和birdhousebuilder.recipe.supervisor。
Supported options
配方支持以下选项:
- anaconda home
带有anaconda安装根文件夹的buildout选项。默认值:$HOME/anaconda。 也可以使用环境变量ANACONDA_HOME设置默认位置。示例:
export ANACONDA_HOME=/opt/anaconda
搜索优先级为:
- anaconda-home在buildout.cfg
- $ANACONDA_HOME
- $HOME/anaconda
- 端口
- 用于Postgres的端口。默认值:5433。
- pgdata
- 数据库文件的路径。默认值:~/.conda/envs/birdhouse/var/lib/postgres
- initdb
- Postgres初始化选项。默认值:--auth=trust
- cmds
- psql设置数据库架构和用户的命令。
Example usage
下面的示例buildout.cfg使用anaconda安装postgres:
[buildout] parts = postgres anaconda-home = /home/myself/anaconda [postgres] recipe = birdhousebuilder.recipe.postgres port = 5433 cmds = createuser -p 5433 --createdb --no-createrole --no-superuser --login demo createdb -p 5433 --owner=demo demo
使用buildout安装后,使用以下命令启动postgres服务:
$ cd /home/myself/.conda/envs/birdhouse $ etc/init.d/supervisord start # start|stop|restart $ bin/supervisorctl status # check that postgres is running
Change History
0.2.0 (2015-03-31)
- 使用来自anaconda的postgresql
- 重构Postgres设置
- 使用子流程而不是os.system
0.1.0 (2015-03-30)
初次发布。