diff options
-rw-r--r-- | CHANGELOG.md | 2 | ||||
-rwxr-xr-x | bin/run-tests | 6 | ||||
-rw-r--r-- | cpanfile | 2 | ||||
-rw-r--r-- | cpanfile.snapshot | 13 | ||||
-rw-r--r-- | docs/install/ami.md | 43 | ||||
-rw-r--r-- | docs/install/database.md | 7 | ||||
-rw-r--r-- | docs/install/troubleshooting.md | 18 | ||||
-rw-r--r-- | docs/updating/ami.md | 13 | ||||
-rw-r--r-- | docs/updating/index.md | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Around.pm | 1 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Photo.pm | 3 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/New.pm | 2 | ||||
-rw-r--r-- | t/app/controller/develop.t | 3 | ||||
-rw-r--r-- | t/app/controller/root.t | 1 | ||||
-rw-r--r-- | t/cobrand/zurich.t | 1 | ||||
-rw-r--r-- | t/i18n.t | 1 | ||||
-rw-r--r-- | t/open311/getservicerequestupdates.t | 5 | ||||
-rw-r--r-- | t/photostorage/s3.t | 5 | ||||
-rw-r--r-- | templates/web/base/pagination.html | 2 | ||||
-rw-r--r-- | web/cobrands/oxfordshire/assets.js | 6 |
20 files changed, 95 insertions, 41 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 0caa88003..a0a3d2d5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ - Dashboard now has update CSV export. #2249 - Front end improvements: - Clearer relocation options while you’re reporting a problem #2238 + - Bugfixes: + - Add perl 5.26/5.28 support. * v2.4.1 (2nd October 2018) - New features: diff --git a/bin/run-tests b/bin/run-tests index c384516c8..de495dd05 100755 --- a/bin/run-tests +++ b/bin/run-tests @@ -1,13 +1,17 @@ #!/usr/bin/env perl use strict; use warnings; +my $d; BEGIN { use File::Basename qw(dirname); use File::Spec; - my $d = dirname(File::Spec->rel2abs($0)); + $d = dirname(File::Spec->rel2abs($0)); require "$d/../setenv.pl"; } +# So the t::Mock:: modules can be found +$ENV{PERL5LIB} = "$d/..:$ENV{PERL5LIB}"; + use FixMyStreet::TestAppProve; =head1 NAME @@ -14,6 +14,8 @@ requires 'aliased', '0.34'; requires 'Net::SSLeay', '1.81'; requires 'Module::ScanDeps', '1.24'; requires 'CGI', '4.38'; +requires 'Lingua::EN::Tagger', '0.27'; +requires 'Params::Classify', '0.014'; # Catalyst itself, and modules/plugins used requires 'Catalyst', '5.80031'; diff --git a/cpanfile.snapshot b/cpanfile.snapshot index aa00250ae..ef37a146c 100644 --- a/cpanfile.snapshot +++ b/cpanfile.snapshot @@ -3852,10 +3852,10 @@ DISTRIBUTIONS Try::Tiny 0 strict 0 warnings 0 - Lingua-EN-Tagger-0.23 - pathname: A/AC/ACOBURN/Lingua-EN-Tagger-0.23.tar.gz + Lingua-EN-Tagger-0.30 + pathname: A/AC/ACOBURN/Lingua-EN-Tagger-0.30.tar.gz provides: - Lingua::EN::Tagger 0.23 + Lingua::EN::Tagger 0.30 requirements: ExtUtils::MakeMaker 0 File::Spec 0.84 @@ -5463,13 +5463,12 @@ DISTRIBUTIONS requirements: ExtUtils::MakeMaker 0 perl 5.008001 - Params-Classify-0.013 - pathname: Z/ZE/ZEFRAM/Params-Classify-0.013.tar.gz + Params-Classify-0.015 + pathname: Z/ZE/ZEFRAM/Params-Classify-0.015.tar.gz provides: - Params::Classify 0.013 + Params::Classify 0.015 requirements: Exporter 0 - ExtUtils::ParseXS 2.2006 Module::Build 0 Scalar::Util 1.01 Test::More 0 diff --git a/docs/install/ami.md b/docs/install/ami.md index 5f6df3af4..744bfc87f 100644 --- a/docs/install/ami.md +++ b/docs/install/ami.md @@ -21,27 +21,31 @@ can use Amazon Web Services (AWS) instead. They provide difference scale servers, called instances. The smallest instance, the Micro, will be [free for a year](http://aws.amazon.com/free/). +### Using our pre-built AMI + The AMI we've prepared for you can be found in the **EU West (Ireland)** -region, with the ID `ami-0a9b70ca6708395b5` and name "FixMyStreet installation -2018-09-06". You can launch an instance based on that AMI with -[this link](https://console.aws.amazon.com/ec2/home?region=eu-west-1#launchAmi=ami-0a9b70ca6708395b5). +region, with the ID `ami-04bf74a231b875394` and name "FixMyStreet installation +full 2018-10-03". You can launch an instance based on that AMI with +[this link](https://console.aws.amazon.com/ec2/home?region=eu-west-1#launchAmi=ami-04bf74a231b875394). + This AMI is based on the [latest tagged release](https://github.com/mysociety/fixmystreet/releases) + and contains everything you need to get a base install up and running. When you create an EC2 instance based on that AMI, make sure that you choose Security Groups that allow at least inbound HTTP, HTTPS and SSH, and perhaps SMTP as well for email. When your EC2 instance is launched, you will be able to log in as the -`ubuntu` user. This user can `sudo` freely to run commands as root. +`admin` user. This user can `sudo` freely to run commands as root. However, the code is actually owned by (and runs as) the `fms` user. After creating the instance, you may want to edit a configuration file to set a couple of parameters. That configuration file is `/home/fms/fixmystreet/conf/general.yml`, which can be edited with: - ubuntu@ip-10-58-191-98:~$ sudo su - fms + admin@ip-10-58-191-98:~$ sudo su - fms fms@ip-10-58-191-98:~$ cd fixmystreet fms@ip-10-58-191-98:~/fixmystreet$ nano conf/general.yml -You should set +You should set <code><a href="{{ "/customising/config/#contact_email" | relative_url }}">CONTACT_EMAIL</a></code> and <code><a href="{{ "/customising/config/#do_not_reply_email" | relative_url }}">DO_NOT_REPLY_EMAIL</a></code> @@ -51,7 +55,7 @@ work, but this may need further configuration. Then you should restart the Catalyst FastCGI server with: fms@ip-10-58-191-98:~/fixmystreet$ logout - ubuntu@ip-10-58-191-98:~$ sudo /etc/init.d/fixmystreet restart + admin@ip-10-58-191-98:~$ sudo service fixmystreet restart If you find the hostname of your EC2 instance from the AWS console, you should then be able to see the site at http://your-ec2-hostname.eu-west-1.compute.amazonaws.com @@ -62,7 +66,7 @@ interface, you will need to create a username and password for one or more superusers. To add such a user, you can use the `createsuperuser` command, as follows: - ubuntu@ip-10-58-66-208:~$ sudo su - fms + admin@ip-10-58-66-208:~$ sudo su - fms fms@ip-10-58-191-98:~$ cd fixmystreet fms@ip-10-58-191-98:~/fixmystreet$ bin/createsuperuser fmsadmin@example.org password fmsadmin@example.org is now a superuser. @@ -70,6 +74,29 @@ command, as follows: This basic installation uses the default cobrand, with a (deliberately) rather garish colour scheme. +### Building your own AMI + +You may have specific requirements that mean you want to create your own +customised AMI so we provide access to the Packer configuration files we +use to generate our images in our [Public Builds repository](https://github.com/mysociety/public-builds) +together with some guidance on how you can customise the build process. + +#### Integrating with other AWS services + +One option that we get asked about is how to integrate the AMI with other services +within AWS such as RDS. This is more challenging as we can't know about each +potential environment, but the Public Builds repository contains a recipe that can +be used to create a slim version of the AMI that omits the Postgres database +and memcache instance, similar in some respects to [the Docker build we provide](/install/docker/). + +In order to use this effectively you will need to provide a Postgres database +with the FixMyStreet schema loaded and a memcached endpoint, perhaps using RDS +and Elasticache. You would then need to build a custom slim AMI and seed the +relevant configuration files. + +See the [FixMyStreet specific notes](https://github.com/mysociety/public-builds/blob/master/docs/fixmystreet.md) +in the Pubic Builds repository for more information. + ## Installation complete... now customise You should then proceed diff --git a/docs/install/database.md b/docs/install/database.md index f282c8985..5b5ffa19f 100644 --- a/docs/install/database.md +++ b/docs/install/database.md @@ -12,14 +12,15 @@ title: Database troubleshooting At this point you might need to configure PostgreSQL to allow password-based access to the `fms` database as the user `fms` from using Unix-domain sockets. -Edit the file `/etc/postgresql/8.4/main/pg_hba.conf` and add as the -first line: +Edit the file `/etc/postgresql/9.6/main/pg_hba.conf` (note that the version +number in this path will vary depending on the version of Debian you are +using) and add as the first line: local fms fms md5 You will then need to restart PostgreSQL with: - $ sudo /etc/init.d/postgresql restart + $ sudo service postgresql restart If you want to access the database from the command line, you can add the following line to `~/.pgpass`: diff --git a/docs/install/troubleshooting.md b/docs/install/troubleshooting.md index b006d18a4..fdae90a07 100644 --- a/docs/install/troubleshooting.md +++ b/docs/install/troubleshooting.md @@ -6,12 +6,12 @@ title: Installation troubleshooting # Installation troubleshooting <p class="lead"> - If you've installed FixMyStreet using an automated method such as the + If you've installed FixMyStreet using an automated method such as the <a href="{{ "/install/install-script" | relative_url }}">installation script</a> - or the + or the <a href="{{ "/install/ami" | relative_url }}">AMI</a>, you should be good to go. - However, if you've done a - <a href="{{ "/install/manual-install" | relative_url }}">manual install</a>, + However, if you've done a + <a href="{{ "/install/manual-install" | relative_url }}">manual install</a>, sometimes you might bump into a problem if your system is different from what FixMyStreet expects. These hints might help. </p> @@ -31,7 +31,7 @@ title: Installation troubleshooting ### locale: must be installed -By default, FixMyStreet uses the `en_GB.UTF-8` +By default, FixMyStreet uses the `en_GB.UTF-8` <a href="{{ "/glossary/#locale" | relative_url }}" class="glossary__link">locale</a>. If it is not installed then it may not start. You need this locale on your system even if you're planning on running your site in a different language. @@ -48,7 +48,7 @@ Check to see what locales your system currently supports with: ### Template caching -FixMyStreet caches compiled +FixMyStreet caches compiled <a href="{{ "/glossary/#template" | relative_url }}" class="glossary__link">templates</a> alongside the source files, so the `templates/web/` directory needs to be writable by the process that is running FixMyStreet. @@ -101,7 +101,7 @@ There are YAML lint tools available for checking the well-formedness of YAML fil Remember that your config settings may include sensitive information (your database password, for example) so be sensible before using online validators. -Simple things to be wary of: always quote strings that themselves contain a colon, +Simple things to be wary of: always quote strings that themselves contain a colon, be sure to close any open quotes, and avoid using tabs. <a name="requires-restart"> </a> @@ -113,6 +113,4 @@ is running, you may need to restart the process for the change to take effect. For example, restart the Catalyst FastCGI server with: -<pre><code>sudo /etc/init.d/fixmystreet restart -</code></pre> - + $ sudo service fixmystreet restart diff --git a/docs/updating/ami.md b/docs/updating/ami.md index 48d8cb065..ff83e3aec 100644 --- a/docs/updating/ami.md +++ b/docs/updating/ami.md @@ -12,11 +12,17 @@ help.</p> (If you forked the code on GitHub and cloned it yourself, you probably want to see our main [update help](/updating/).) -Firstly, log in to your EC2 instance as the `ubuntu` user, as you did when +**Note:** Up to and including version 2.4 we based our AMI on Ubuntu. From version 2.4.1 +the AMI is based on Debian. This shouldn't affect the process below; the main +difference is that in AMIs created before the release of version 2.4.1 the user +account will be `ubuntu` while for those created since the user account will be +`admin`, so be careful to check which applies in your case. + +Firstly, log in to your EC2 instance as the relevant user, as you did when setting up the instance. You should become the fms user and switch to the right directory: - ubuntu@ip-10-58-191-98:~$ sudo su - fms + admin@ip-10-58-191-98:~$ sudo su - fms fms@ip-10-58-191-98:~$ cd fixmystreet fms@ip-10-58-191-98:~/fixmystreet$ @@ -47,5 +53,4 @@ please feel free to [contact us](/community/) to discuss it first. Lastly, you should restart the Catalyst FastCGI server with: fms@ip-10-58-191-98:~/fixmystreet$ logout - ubuntu@ip-10-58-191-98:~$ sudo /etc/init.d/fixmystreet restart - + admin@ip-10-58-191-98:~$ sudo service fixmystreet restart diff --git a/docs/updating/index.md b/docs/updating/index.md index e65097e6d..2ab8ed6f5 100644 --- a/docs/updating/index.md +++ b/docs/updating/index.md @@ -70,5 +70,5 @@ Lastly, you should restart your application server, this may be restarting your webserver, or if it is running separately, something like: {% highlight bash %} -sudo /etc/init.d/fixmystreet restart +sudo service fixmystreet restart {% endhighlight %} diff --git a/perllib/FixMyStreet/App/Controller/Around.pm b/perllib/FixMyStreet/App/Controller/Around.pm index db2eceda3..a1258ccaa 100644 --- a/perllib/FixMyStreet/App/Controller/Around.pm +++ b/perllib/FixMyStreet/App/Controller/Around.pm @@ -258,6 +258,7 @@ sub map_features : Private { my ($self, $c, $extra) = @_; $c->stash->{page} = 'around'; # Needed by _item.html / so the map knows to make clickable pins, update on pan + $c->stash->{num_old_reports} = 0; $c->forward( '/reports/stash_report_filter_status' ); $c->forward( '/reports/stash_report_sort', [ 'created-desc' ]); diff --git a/perllib/FixMyStreet/App/Controller/Photo.pm b/perllib/FixMyStreet/App/Controller/Photo.pm index 1884b9f26..4ae25db24 100644 --- a/perllib/FixMyStreet/App/Controller/Photo.pm +++ b/perllib/FixMyStreet/App/Controller/Photo.pm @@ -47,6 +47,9 @@ sub index :LocalRegex('^(c/)?([1-9]\d*)(?:\.(\d+))?(?:\.(full|tn|fp))?\.(?:jpeg| my ( $self, $c ) = @_; my ( $is_update, $id, $photo_number, $size ) = @{ $c->req->captures }; + $photo_number ||= 0; + $size ||= ''; + my $item; if ( $is_update ) { ($item) = $c->model('DB::Comment')->search( { diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index dd4fef388..f057a31f6 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -258,7 +258,7 @@ sub by_category_ajax_data : Private { my ($self, $c, $type, $category) = @_; my $generate; - if (($c->stash->{category_extras}->{$category} && @{ $c->stash->{category_extras}->{$category} } >= 1) or \ + if (($c->stash->{category_extras}->{$category} && @{ $c->stash->{category_extras}->{$category} } >= 1) or $c->stash->{unresponsive}->{$category} or $c->stash->{report_extra_fields}) { $generate = 1; } diff --git a/t/app/controller/develop.t b/t/app/controller/develop.t index 8f26a9f16..7fde5ef83 100644 --- a/t/app/controller/develop.t +++ b/t/app/controller/develop.t @@ -1,5 +1,8 @@ use FixMyStreet::TestMech; +FixMyStreet::App->log->disable('info'); +END { FixMyStreet::App->log->enable('info'); } + ok( my $mech = FixMyStreet::TestMech->new, 'Created mech object' ); my ($problem) = $mech->create_problems_for_body(1, 2504, 'title'); diff --git a/t/app/controller/root.t b/t/app/controller/root.t index b5f8ba031..85119da24 100644 --- a/t/app/controller/root.t +++ b/t/app/controller/root.t @@ -75,7 +75,6 @@ FixMyStreet::override_config { }; subtest "check_login_disallowed cobrand hook" => sub { - warn '#' x 50 . "\n"; my $cobrand = Test::MockModule->new('FixMyStreet::Cobrand::Default'); $cobrand->mock('check_login_disallowed', sub { my $self = shift; diff --git a/t/cobrand/zurich.t b/t/cobrand/zurich.t index dbd6ec882..2f60231ab 100644 --- a/t/cobrand/zurich.t +++ b/t/cobrand/zurich.t @@ -959,7 +959,6 @@ subtest "test stats" => sub { }; subtest "test admin_log" => sub { - diag $report->id; my @entries = FixMyStreet::DB->resultset('AdminLog')->search({ object_type => 'problem', object_id => $report->id, @@ -1,5 +1,6 @@ use strict; use warnings; +use utf8; use Test::More; diff --git a/t/open311/getservicerequestupdates.t b/t/open311/getservicerequestupdates.t index 995338063..2f7917946 100644 --- a/t/open311/getservicerequestupdates.t +++ b/t/open311/getservicerequestupdates.t @@ -421,7 +421,10 @@ for my $test ( $problem->state( $test->{start_state} ); $problem->update; - my $update = Open311::GetServiceRequestUpdates->new( system_user => $user ); + my $update = Open311::GetServiceRequestUpdates->new( + system_user => $user, + blank_updates_permitted => 1, + ); $update->update_comments( $o, $bodies{2482} ); is $problem->comments->count, 1, 'comment count'; diff --git a/t/photostorage/s3.t b/t/photostorage/s3.t index fa989374f..ec0fadc15 100644 --- a/t/photostorage/s3.t +++ b/t/photostorage/s3.t @@ -2,6 +2,7 @@ use FixMyStreet::Test; use Test::MockModule; +use Test::Warn; use Path::Tiny 'path'; use Net::Amazon::S3::Client::Bucket; @@ -112,7 +113,9 @@ FixMyStreet::override_config { $create_bucket_called = 1; }); - ok !$s3->init(), "PhotoStorage::S3::init failed"; + warning_like { + $s3->init(); + } qr/S3 bucket 'fms-test-photos' doesn't exist and CREATE_BUCKET is not set./, 'PhotoStorage::S3::init failed'; ok $buckets_called, "Client::buckets called"; ok !$create_bucket_called, "Client::create_bucket not called"; }; diff --git a/templates/web/base/pagination.html b/templates/web/base/pagination.html index 7ae3559ce..3b7bdc0b2 100644 --- a/templates/web/base/pagination.html +++ b/templates/web/base/pagination.html @@ -8,7 +8,7 @@ [% IF pager.next_page %] <a class="next" href="[% c.uri_with({ $param => pager.next_page, ajax => undefined }) %][% '#' _ hash IF hash %]">[% loc('Next') %]</a> - [% ELSIF num_old_reports > 0 AND NOT show_old_reports AND page == 'around' %] + [% ELSIF page == 'around' AND num_old_reports > 0 AND NOT show_old_reports %] <a class="next show_old" href="[% c.uri_with({ $param => pager.current_page, show_old_reports = 1, ajax => undefined }) %][% '#' _ hash IF hash %]">[% loc('Show older') %]</a> [% END %] </p> diff --git a/web/cobrands/oxfordshire/assets.js b/web/cobrands/oxfordshire/assets.js index 8858ee66e..46357b061 100644 --- a/web/cobrands/oxfordshire/assets.js +++ b/web/cobrands/oxfordshire/assets.js @@ -5,7 +5,11 @@ } function check_rights_of_way() { - if (OpenLayers.Util.indexOf(fixmystreet.bodies, 'Oxfordshire County Council') > -1 && $('#form_category').val() == 'Countryside Paths / Public Rights of Way (usually not tarmac)') { + if (OpenLayers.Util.indexOf(fixmystreet.bodies, 'Oxfordshire County Council') == -1) { + return; + } + + if ($('#form_category').val() == 'Countryside Paths / Public Rights of Way (usually not tarmac)') { $('#category_meta').html('<p class="category-message">Please report problems with rights of way using <a href="https://publicrightsofway.oxfordshire.gov.uk/web/standardmap.aspx">this page</a>.</p>'); disable_form(true); } else { |