From cf129147e306abb3b6cfa751913040c728b2487a Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Mon, 16 Jun 2014 16:05:42 +0100 Subject: Configure locale on fresh systems --- docs/installing/manual_install.md | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'docs/installing') diff --git a/docs/installing/manual_install.md b/docs/installing/manual_install.md index 0c6efb1d9..13d31eea8 100644 --- a/docs/installing/manual_install.md +++ b/docs/installing/manual_install.md @@ -25,6 +25,17 @@ have instructions for [installing on MacOS]({{ site.baseurl }}docs/installing/ma Commands are intended to be run via the terminal or over ssh. +## Set the locale + +**Debian Squeeze** + +Follow the [Debian guide](https://wiki.debian.org/Locale#Standard) for configuring the locale of the operating system. + +Generate the locales you wish to make available. When the interactive screen asks you to pick a default locale, choose "None", as the SSH session will provide the locale required. + + # dpkg-reconfigure locales + +Start a new SSH session to use your SSH locale. ## Get Alaveteli -- cgit v1.2.3 From 9f20e09b082bb0762a8581015ee39cbe01835072 Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Thu, 19 Jun 2014 14:57:05 +0100 Subject: Remove references to run-with-lockfile Once #112 is closed with the replacement of run-with-lockfile by the shell script version, remove references to it from the documentation. --- docs/installing/manual_install.md | 5 ----- 1 file changed, 5 deletions(-) (limited to 'docs/installing') diff --git a/docs/installing/manual_install.md b/docs/installing/manual_install.md index 777d95139..8c6f6d838 100644 --- a/docs/installing/manual_install.md +++ b/docs/installing/manual_install.md @@ -402,11 +402,6 @@ by your deploy user (named `deploy` in this case): deploy ALL = NOPASSWD: /etc/init.d/foi-alert-tracks, /etc/init.d/foi-purge-varnish -The cron jobs refer to a program `run-with-lockfile`. See [this -issue](https://github.com/mysociety/alaveteli/issues/112) for a discussion of -where to find this program, and how you might replace it. This [one line -script](https://gist.github.com/3741194) can install this program system-wide. - ## Set up production web server It is not recommended to run the website using the default Rails web server. -- cgit v1.2.3 From d0a8e9b3eb82176faec6896af3eb0333e794962f Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Fri, 6 Jun 2014 16:58:44 +0100 Subject: Use template for setting up postgres databases Seems to be the cleanest way for ensuring databases are always created with UTF-8 encoding, if for example the admin has not configured the system locale. --- docs/installing/macos.md | 32 +++++++++++++++++++++----------- docs/installing/manual_install.md | 23 ++++++++++++----------- 2 files changed, 33 insertions(+), 22 deletions(-) (limited to 'docs/installing') diff --git a/docs/installing/macos.md b/docs/installing/macos.md index c46bdf4ba..bdb4c90d8 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 foi_production + createdb -T template_utf8 -O foi foi_test + createdb -T template_utf8 -O foi foi_development ### Clone Alaveteli diff --git a/docs/installing/manual_install.md b/docs/installing/manual_install.md index d3a629155..d523a199a 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 foi_production + # sudo -u postgres createdb -T template_utf8 -O foi foi_test + # sudo -u postgres createdb -T template_utf8 -O foi foi_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,6 +198,7 @@ Example `development` section of `config/database.yml`: development: adapter: postgresql + template: template_utf8 database: foi_development username: foi password: secure-password-here -- cgit v1.2.3 From 3cd30c9952f9d174ff4b774b43659900f1d444d8 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Wed, 25 Jun 2014 11:43:00 +0100 Subject: Use alaveteli_ as database prefix rather than foi_ Clearer what app the database belongs to --- docs/installing/macos.md | 6 +++--- docs/installing/manual_install.md | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'docs/installing') diff --git a/docs/installing/macos.md b/docs/installing/macos.md index bdb4c90d8..e93ea452f 100644 --- a/docs/installing/macos.md +++ b/docs/installing/macos.md @@ -106,9 +106,9 @@ We'll create a template for our Alaveteli databases: Then create the databases: - createdb -T template_utf8 -O foi foi_production - createdb -T template_utf8 -O foi foi_test - createdb -T template_utf8 -O foi foi_development + 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 d523a199a..bf2f9b7cd 100644 --- a/docs/installing/manual_install.md +++ b/docs/installing/manual_install.md @@ -183,9 +183,9 @@ We'll create a template for our Alaveteli databases: Then create the databases: - # sudo -u postgres createdb -T template_utf8 -O foi foi_production - # sudo -u postgres createdb -T template_utf8 -O foi foi_test - # sudo -u postgres createdb -T template_utf8 -O foi foi_development + # 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 so that the application can connect to the postgres database. @@ -199,7 +199,7 @@ Example `development` section of `config/database.yml`: development: adapter: postgresql template: template_utf8 - database: foi_development + database: alaveteli_development username: foi password: secure-password-here host: localhost -- cgit v1.2.3