From 8e6a72122de1d47a45e7e190b961f4c0a23e52d5 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Thu, 19 Jun 2014 11:45:42 +0100 Subject: config_files:convert_crontab now allows MAILTO No longer have to manually edit the crontab as MAILTO can be specified when generating the file. --- docs/installing/manual_install.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'docs/installing/manual_install.md') diff --git a/docs/installing/manual_install.md b/docs/installing/manual_install.md index bf2f9b7cd..4122aa181 100644 --- a/docs/installing/manual_install.md +++ b/docs/installing/manual_install.md @@ -385,6 +385,7 @@ The `ugly` format uses simple variable substitution. A variable looks like replaced with `/var/www/alaveteli` in your cron tab * `user`: the user that the software runs as * `site`: a string to identify your alaveteli instance +* `mailto`: The email address that cron output will be sent to There is a rake task that will help to rewrite this file into one that is useful to you, which can be invoked with: @@ -394,11 +395,11 @@ useful to you, which can be invoked with: VHOST_DIR=/dir/above/alaveteli \ VCSPATH=alaveteli \ SITE=alaveteli \ + MAILTO=cron-alaveteli@example.org \ CRONTAB=config/crontab-example > crontab -You should change the `DEPLOY_USER`, `VHOST_DIR`, `VCSPATH` and `SITE` -environment variables to match your server and installation. You should also -edit the resulting `crontab` file to customize the `MAILTO` variable. +You should change the `DEPLOY_USER`, `VHOST_DIR`, `VCSPATH` `MAILTO` and `SITE` +environment variables to match your server and installation. One of the cron jobs refers to a script at `/etc/init.d/foi-alert-tracks`. This is an init script, a copy of which lives in `config/alert-tracks-debian.ugly`. -- cgit v1.2.3 From ab0a1c3032dbf88e4deddbf66963fc142c5b30f2 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Thu, 19 Jun 2014 11:47:13 +0100 Subject: Minor example code formatting --- docs/installing/manual_install.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'docs/installing/manual_install.md') diff --git a/docs/installing/manual_install.md b/docs/installing/manual_install.md index 4122aa181..070f441df 100644 --- a/docs/installing/manual_install.md +++ b/docs/installing/manual_install.md @@ -392,11 +392,11 @@ useful to you, which can be invoked with: bundle exec rake config_files:convert_crontab \ DEPLOY_USER=deploy \ - VHOST_DIR=/dir/above/alaveteli \ - VCSPATH=alaveteli \ - SITE=alaveteli \ - MAILTO=cron-alaveteli@example.org \ - CRONTAB=config/crontab-example > crontab + VHOST_DIR=/dir/above/alaveteli \ + VCSPATH=alaveteli \ + SITE=alaveteli \ + MAILTO=cron-alaveteli@example.org \ + CRONTAB=config/crontab-example > crontab You should change the `DEPLOY_USER`, `VHOST_DIR`, `VCSPATH` `MAILTO` and `SITE` environment variables to match your server and installation. -- cgit v1.2.3 From 855929f04efcc1033489a2df85c328ddbba73404 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Thu, 19 Jun 2014 12:20:20 +0100 Subject: Remove unused cron example variable Not used in config/crontab-example.ugly --- docs/installing/manual_install.md | 5 ----- 1 file changed, 5 deletions(-) (limited to 'docs/installing/manual_install.md') diff --git a/docs/installing/manual_install.md b/docs/installing/manual_install.md index 070f441df..abb05f978 100644 --- a/docs/installing/manual_install.md +++ b/docs/installing/manual_install.md @@ -371,11 +371,6 @@ server. The `ugly` format uses simple variable substitution. A variable looks like `!!(*= $this *)!!`. The variables are: -* `vhost`: part of the path to the directory where the software is - served from. In the mySociety files, it usually comes as - `/data/vhost/!!(*= $vhost *)!!` -- you should replace that whole - port with a path to the directory where your Alaveteli software - installation lives, e.g. `/var/www/` * `vhost_dir`: the entire path to the directory where the software is served from. -- you should replace this with a path to the directory where your Alaveteli software installation lives, -- cgit v1.2.3 From aaa0348f61d48711125dbeba89ef144c53e5cab4 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Thu, 19 Jun 2014 12:20:53 +0100 Subject: Update cron variables documentation --- docs/installing/manual_install.md | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'docs/installing/manual_install.md') diff --git a/docs/installing/manual_install.md b/docs/installing/manual_install.md index abb05f978..4cea0f1c8 100644 --- a/docs/installing/manual_install.md +++ b/docs/installing/manual_install.md @@ -371,13 +371,10 @@ server. The `ugly` format uses simple variable substitution. A variable looks like `!!(*= $this *)!!`. The variables are: -* `vhost_dir`: the entire path to the directory where the software is - served from. -- you should replace this with a path to the - directory where your Alaveteli software installation lives, - e.g. `/var/www/` -* `vcspath`: the name of the alaveteli checkout, e.g. `alaveteli`. - Thus, `/data/vhost/!!(*= $vhost *)!!/!!(*= $vcspath *)!!` might be - replaced with `/var/www/alaveteli` in your cron tab +* `vhost_dir`: the full path to the directory where alaveteli is checked out. + e.g. If your checkout is at `/var/www/alaveteli` then set this to `/var/www` +* `vcspath`: the name of the directory that contains the alaveteli code. + e.g. `alaveteli` * `user`: the user that the software runs as * `site`: a string to identify your alaveteli instance * `mailto`: The email address that cron output will be sent to -- cgit v1.2.3 From 7f610e92b64ea5d5259566c624657845ed63d83a Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Thu, 19 Jun 2014 12:32:19 +0100 Subject: Remove superfluous crontab docs --- docs/installing/manual_install.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'docs/installing/manual_install.md') diff --git a/docs/installing/manual_install.md b/docs/installing/manual_install.md index 4cea0f1c8..1f218d2c6 100644 --- a/docs/installing/manual_install.md +++ b/docs/installing/manual_install.md @@ -380,7 +380,7 @@ The `ugly` format uses simple variable substitution. A variable looks like * `mailto`: The email address that cron output will be sent to There is a rake task that will help to rewrite this file into one that is -useful to you, which can be invoked with: +useful to you. Change the variables to suit your installation. bundle exec rake config_files:convert_crontab \ DEPLOY_USER=deploy \ @@ -390,9 +390,6 @@ useful to you, which can be invoked with: MAILTO=cron-alaveteli@example.org \ CRONTAB=config/crontab-example > crontab -You should change the `DEPLOY_USER`, `VHOST_DIR`, `VCSPATH` `MAILTO` and `SITE` -environment variables to match your server and installation. - One of the cron jobs refers to a script at `/etc/init.d/foi-alert-tracks`. This is an init script, a copy of which lives in `config/alert-tracks-debian.ugly`. As with the cron jobs above, replace the variables (and/or bits near the -- cgit v1.2.3 From 7752e3528aa5f5778be39f98e90630136fe7a9a8 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Thu, 19 Jun 2014 12:35:27 +0100 Subject: Generate crontab to /etc/cron.d/ Might as well put it in the right place --- docs/installing/manual_install.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/installing/manual_install.md') diff --git a/docs/installing/manual_install.md b/docs/installing/manual_install.md index 1f218d2c6..14e9b718c 100644 --- a/docs/installing/manual_install.md +++ b/docs/installing/manual_install.md @@ -388,7 +388,7 @@ useful to you. Change the variables to suit your installation. VCSPATH=alaveteli \ SITE=alaveteli \ MAILTO=cron-alaveteli@example.org \ - CRONTAB=config/crontab-example > crontab + CRONTAB=config/crontab-example > /etc/cron.d/alaveteli One of the cron jobs refers to a script at `/etc/init.d/foi-alert-tracks`. This is an init script, a copy of which lives in `config/alert-tracks-debian.ugly`. -- cgit v1.2.3 From acd70085bb4f8e69d248d5916314012f51da476f Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Thu, 19 Jun 2014 12:35:46 +0100 Subject: Use better default for VHOST_DIR in cron example --- docs/installing/manual_install.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/installing/manual_install.md') diff --git a/docs/installing/manual_install.md b/docs/installing/manual_install.md index 14e9b718c..6911ab0e4 100644 --- a/docs/installing/manual_install.md +++ b/docs/installing/manual_install.md @@ -384,7 +384,7 @@ useful to you. Change the variables to suit your installation. bundle exec rake config_files:convert_crontab \ DEPLOY_USER=deploy \ - VHOST_DIR=/dir/above/alaveteli \ + VHOST_DIR=/var/www \ VCSPATH=alaveteli \ SITE=alaveteli \ MAILTO=cron-alaveteli@example.org \ -- cgit v1.2.3 From ec7ee8389f9e1508635e9910aae51586b5304ec9 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Thu, 19 Jun 2014 12:43:28 +0100 Subject: Add better sections to crontab and init setup --- docs/installing/manual_install.md | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'docs/installing/manual_install.md') diff --git a/docs/installing/manual_install.md b/docs/installing/manual_install.md index 6911ab0e4..6002682fe 100644 --- a/docs/installing/manual_install.md +++ b/docs/installing/manual_install.md @@ -363,13 +363,19 @@ setting `SKIP_ADMIN_AUTH` to `true` in `general.yml`. ## Cron jobs and init scripts -`config/crontab-example` contains the cronjobs run on WhatDoTheyKnow. It's in a -strange templating format they use in mySociety. mySociety render the example -file to reference absolute paths, and then drop it in `/etc/cron.d/` on the -server. +The crontab and init scripts use the `.ugly` file format, which is a strange +templating format used by mySociety. The `ugly` format uses simple variable substitution. A variable looks like -`!!(*= $this *)!!`. The variables are: +`!!(*= $this *)!!`. + +### Generate crontab + +`config/crontab-example` contains the cron jobs that run on +WhatDoTheyKnow. mySociety render the example file to reference absolute paths, +and then drop it in `/etc/cron.d/` on the server. + +The variables are: * `vhost_dir`: the full path to the directory where alaveteli is checked out. e.g. If your checkout is at `/var/www/alaveteli` then set this to `/var/www` @@ -390,12 +396,16 @@ useful to you. Change the variables to suit your installation. MAILTO=cron-alaveteli@example.org \ CRONTAB=config/crontab-example > /etc/cron.d/alaveteli +### Generate alert daemon + One of the cron jobs refers to a script at `/etc/init.d/foi-alert-tracks`. This is an init script, a copy of which lives in `config/alert-tracks-debian.ugly`. As with the cron jobs above, replace the variables (and/or bits near the variables) with paths to your software. You can use the rake task `rake config_files:convert_init_script` to do this. +### Generate varnish purge daemon + `config/purge-varnish-debian.ugly` is a similar init script, which is optional and not required if you choose not to run your site behind Varnish (see below). Either tweak the file permissions to make the scripts executable by your deploy -- cgit v1.2.3 From f425944c05feeba1a5ad471884474e5cce26a515 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Thu, 19 Jun 2014 13:07:36 +0100 Subject: Add better examples for generating the alert daemon --- docs/installing/manual_install.md | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'docs/installing/manual_install.md') diff --git a/docs/installing/manual_install.md b/docs/installing/manual_install.md index 6002682fe..b9686f7a5 100644 --- a/docs/installing/manual_install.md +++ b/docs/installing/manual_install.md @@ -375,7 +375,7 @@ The `ugly` format uses simple variable substitution. A variable looks like WhatDoTheyKnow. mySociety render the example file to reference absolute paths, and then drop it in `/etc/cron.d/` on the server. -The variables are: +**Template Variables:** * `vhost_dir`: the full path to the directory where alaveteli is checked out. e.g. If your checkout is at `/var/www/alaveteli` then set this to `/var/www` @@ -399,10 +399,22 @@ useful to you. Change the variables to suit your installation. ### Generate alert daemon One of the cron jobs refers to a script at `/etc/init.d/foi-alert-tracks`. This -is an init script, a copy of which lives in `config/alert-tracks-debian.ugly`. -As with the cron jobs above, replace the variables (and/or bits near the -variables) with paths to your software. You can use the rake task `rake -config_files:convert_init_script` to do this. +is an init script, which can be generated from the +`config/alert-tracks-debian.ugly` template. + +**Template Variables:** + +* `vhost_dir`: the full path to the directory where alaveteli is checked out. + e.g. If your checkout is at `/var/www/alaveteli` then set this to `/var/www` +* `user`: the user that the software runs as + +There is a rake task that will help to rewrite this file into one that is +useful to you. Change the variables to suit your installation. + + bundle exec rake config_files:convert_init_script \ + DEPLOY_USER=deploy \ + VHOST_DIR=/var/www \ + SCRIPT_FILE=config/alert-tracks-debian.ugly > /etc/init.d/foi-alert-tracks ### Generate varnish purge daemon -- cgit v1.2.3 From 85163e9a7169025b91536ee43eeb72eb37d90fad Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Thu, 19 Jun 2014 13:14:04 +0100 Subject: Add variables for purge varnish init script --- docs/installing/manual_install.md | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'docs/installing/manual_install.md') diff --git a/docs/installing/manual_install.md b/docs/installing/manual_install.md index b9686f7a5..77f915283 100644 --- a/docs/installing/manual_install.md +++ b/docs/installing/manual_install.md @@ -420,6 +420,16 @@ useful to you. Change the variables to suit your installation. `config/purge-varnish-debian.ugly` is a similar init script, which is optional and not required if you choose not to run your site behind Varnish (see below). + +**Template Variables:** + +* `daemon_name`: The name of the daemon. Set this to `purge-varnish`. +* `vhost_dir`: the full path to the directory where alaveteli is checked out. + e.g. If your checkout is at `/var/www/alaveteli` then set this to `/var/www` +* `user`: the user that the software runs as + +This template does not yet have a rake task to generate it. + Either tweak the file permissions to make the scripts executable by your deploy user, or add the following line to your sudoers file to allow these to be run by your deploy user (named `deploy` in this case): -- cgit v1.2.3 From 9365ff67895c28d94a8874cd0808a1b8472b1671 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Thu, 19 Jun 2014 13:27:23 +0100 Subject: Minor updates to init script setup --- docs/installing/manual_install.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'docs/installing/manual_install.md') diff --git a/docs/installing/manual_install.md b/docs/installing/manual_install.md index 77f915283..c84e0f145 100644 --- a/docs/installing/manual_install.md +++ b/docs/installing/manual_install.md @@ -430,11 +430,13 @@ and not required if you choose not to run your site behind Varnish (see below). This template does not yet have a rake task to generate it. +### Init script permissions + Either tweak the file permissions to make the scripts executable by your deploy user, or add the following line to your sudoers file to allow these to be run -by your deploy user (named `deploy` in this case): +by your deploy user (named `deploy` in this case). - deploy ALL = NOPASSWD: /etc/init.d/foi-alert-tracks, /etc/init.d/foi-purge-varnish + deploy ALL = NOPASSWD: /etc/init.d/foi-alert-tracks, /etc/init.d/foi-purge-varnish ## Set up production web server -- cgit v1.2.3