diff options
author | Gareth Rees <gareth@mysociety.org> | 2014-06-26 11:58:40 +0100 |
---|---|---|
committer | Gareth Rees <gareth@mysociety.org> | 2014-06-26 11:58:40 +0100 |
commit | 359582ff3d981680cc6a9997e1a96381d7341866 (patch) | |
tree | 75aa41cb6d9975491ede8c8198caae58113fa1dc /docs/installing | |
parent | d22f5e949ad55d86f85c0798cef72928ccf53529 (diff) | |
parent | 3cd30c9952f9d174ff4b774b43659900f1d444d8 (diff) |
Merge branch 'gr-gh-pages-develop' into gh-pages
Diffstat (limited to 'docs/installing')
-rw-r--r-- | docs/installing/macos.md | 32 | ||||
-rw-r--r-- | docs/installing/manual_install.md | 25 |
2 files changed, 34 insertions, 23 deletions
diff --git a/docs/installing/macos.md b/docs/installing/macos.md index c46bdf4ba..e93ea452f 100644 --- a/docs/installing/macos.md +++ b/docs/installing/macos.md @@ -88,17 +88,27 @@ The following is mostly from [the manual installation process]({{ site.baseurl}} ### Configure database -Creates Alaveteli databases and an `foi` user with password `foi`. - - echo "CREATE DATABASE foi_development encoding = 'UTF8'; - CREATE DATABASE foi_test encoding = 'UTF8'; - CREATE USER foi WITH CREATEUSER; - ALTER USER foi WITH PASSWORD 'foi'; - ALTER USER foi WITH CREATEDB; - GRANT ALL PRIVILEGES ON DATABASE foi_development TO foi; - GRANT ALL PRIVILEGES ON DATABASE foi_test TO foi; - ALTER DATABASE foi_development OWNER TO foi; - ALTER DATABASE foi_test OWNER TO foi;" | psql -h localhost template1 +Create a database for your Mac user as homebrew doesn't create one by default: + + createdb + +Create a `foi` user from the command line, like this: + + createuser -s -P foi + +_Note:_ Leaving the password blank will cause great confusion if you're new to +PostgreSQL. + +We'll create a template for our Alaveteli databases: + + createdb -T template0 -E UTF-8 template_utf8 + echo "update pg_database set datistemplate=true where datname='template_utf8';" | psql + +Then create the databases: + + createdb -T template_utf8 -O foi alaveteli_production + createdb -T template_utf8 -O foi alaveteli_test + createdb -T template_utf8 -O foi alaveteli_development ### Clone Alaveteli diff --git a/docs/installing/manual_install.md b/docs/installing/manual_install.md index d3a629155..bf2f9b7cd 100644 --- a/docs/installing/manual_install.md +++ b/docs/installing/manual_install.md @@ -175,20 +175,20 @@ Create a `foi` user from the command line, like this: _Note:_ Leaving the password blank will cause great confusion if you're new to PostgreSQL. -Then create the databases: +We'll create a template for our Alaveteli databases: + + # sudo -u postgres createdb -T template0 -E UTF-8 template_utf8 + # echo "update pg_database set datistemplate=true where datname='template_utf8';" > /tmp/update-template.sql + # sudo -u postgres psql -f /tmp/update-template.sql - # sudo -u postgres createdb -T template0 -E SQL_ASCII -O foi foi_production - # sudo -u postgres createdb -T template0 -E SQL_ASCII -O foi foi_test - # sudo -u postgres createdb -T template0 -E SQL_ASCII -O foi foi_development +Then create the databases: -We create using the ``SQL_ASCII`` encoding, because in postgres this is means -"no encoding"; and because we handle and store all kinds of data that may not -be valid UTF (for example, data originating from various broken email clients -that's not 8-bit clean), it's safer to be able to store *anything*, than reject -data at runtime. + # sudo -u postgres createdb -T template_utf8 -O foi alaveteli_production + # sudo -u postgres createdb -T template_utf8 -O foi alaveteli_test + # sudo -u postgres createdb -T template_utf8 -O foi alaveteli_development -Now you need to set up the database config file to contain the name, username -and password of your postgres database. +Now you need to set up the database config file so that the application can +connect to the postgres database. * Copy `database.yml-example` to `database.yml` in `alaveteli/config` * Edit it to point to your local postgresql database in the development @@ -198,7 +198,8 @@ Example `development` section of `config/database.yml`: development: adapter: postgresql - database: foi_development + template: template_utf8 + database: alaveteli_development username: foi password: secure-password-here host: localhost |