diff --git a/Vagrantfile b/Vagrantfile index 5434fef875..1f167ff1b6 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -116,6 +116,10 @@ SUPPORTED_OPERATING_SYSTEMS = { box: 'ubuntu/xenial64', box_url: 'https://app.vagrantup.com/ubuntu/boxes/xenial64' }, + 'bionic64' => { + box: 'ubuntu/bionic64', + box_url: 'https://app.vagrantup.com/ubuntu/boxes/bionic64' + }, 'stretch64' => { box: 'debian/stretch64', box_url: 'https://app.vagrantup.com/debian/boxes/stretch64' diff --git a/config/initializers/backport_pg_10_support_to_rails_4.rb b/config/initializers/backport_pg_10_support_to_rails_4.rb new file mode 100644 index 0000000000..10b5096cfa --- /dev/null +++ b/config/initializers/backport_pg_10_support_to_rails_4.rb @@ -0,0 +1,45 @@ +require 'active_record/connection_adapters/postgresql/schema_statements' + +# +# Monkey-patch the refused Rails 4.2 patch at https://github.com/rails/rails/pull /31330 +# +# Updates sequence logic to support PostgreSQL 10. +# + +module ActiveRecord + module ConnectionAdapters + module PostgreSQL + module SchemaStatements + # Resets the sequence of a table's primary key to the maximum value. + def reset_pk_sequence!(table, pk = nil, sequence = nil) #:nodoc: + unless pk and sequence + default_pk, default_sequence = pk_and_sequence_for(table) + + pk ||= default_pk + sequence ||= default_sequence + end + + if @logger && pk && !sequence + @logger.warn "#{table} has primary key #{pk} with no default sequence" + end + + if pk && sequence + quoted_sequence = quote_table_name(sequence) + max_pk = select_value("SELECT MAX(#{quote_column_name pk}) FROM #{quote_table_name(table)}") + if max_pk.nil? + if postgresql_version >= 100000 + minvalue = select_value("SELECT seqmin FROM pg_sequence WHERE seqrelid = #{quote(quoted_sequence)}::regclass") + else + minvalue = select_value("SELECT min_value FROM #{quoted_sequence}") + end + end + + select_value <<-end_sql, 'SCHEMA' + SELECT setval(#{quote(quoted_sequence)}, #{max_pk ? max_pk : minvalue}, #{max_pk ? true : false}) + end_sql + end + end + end + end + end +end diff --git a/config/packages.ubuntu-bionic b/config/packages.ubuntu-bionic new file mode 100644 index 0000000000..bcf09abbef --- /dev/null +++ b/config/packages.ubuntu-bionic @@ -0,0 +1,37 @@ +build-essential +bundler +catdoc +elinks +geoip-database +gettext +ghostscript +gnuplot-nox +imagemagick +libicu-dev +libmagic-dev +libmagickwand-dev +libpq-dev +libsqlite3-dev +libxml2-dev +libxslt-dev +links +lockfile-progs +memcached +mutt +pdftk-java +poppler-utils +postgresql +postgresql-client +python-yaml +rake +ruby +ruby-dev +sqlite3 +tnef +ttf-bitstream-vera +unrtf +unzip +uuid-dev +wkhtmltopdf-static +wv +xapian-tools diff --git a/script/site-specific-install.sh b/script/site-specific-install.sh index 8e543e90d8..63dbe7b40e 100755 --- a/script/site-specific-install.sh +++ b/script/site-specific-install.sh @@ -76,6 +76,26 @@ fi update_mysociety_apt_sources +# Ubuntu Bionic Fixes +if [ x"$DISTRIBUTION" = x"ubuntu" ] && [ x"$DISTVERSION" = x"bionic" ] +then + # Add cosmic repo to get pdftk-java + cat > /etc/apt/sources.list.d/ubuntu-cosmic.list <> /etc/apt/preferences <