From 854e73cd0eb55ca5d5725b8e12e8f2689bfed885 Mon Sep 17 00:00:00 2001 From: Terence Tuhinanshu Date: Fri, 28 Jun 2024 16:30:19 -0400 Subject: [PATCH 01/15] Upgrade to Ubuntu 22.04 --- Vagrantfile | 2 +- deployment/ansible/group_vars/all | 13 +++++++------ .../tasks/dev-and-test-dependencies.yml | 2 +- .../model-my-watershed.base/tasks/dependencies.yml | 8 ++++---- .../model-my-watershed.celery/defaults/main.yml | 2 +- .../model-my-watershed.tiler/tasks/dependencies.yml | 8 ++++---- 6 files changed, 18 insertions(+), 17 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 060245fa9..09769e964 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -54,7 +54,7 @@ MMW_EXTRA_VARS = { } Vagrant.configure("2") do |config| - config.vm.box = "bento/ubuntu-20.04" + config.vm.box = "bento/ubuntu-22.04" config.vm.define "services" do |services| services.vm.hostname = "services" diff --git a/deployment/ansible/group_vars/all b/deployment/ansible/group_vars/all index 90f8cec67..80845bb39 100644 --- a/deployment/ansible/group_vars/all +++ b/deployment/ansible/group_vars/all @@ -17,12 +17,12 @@ postgresql_password: mmw postgresql_database: mmw postgresql_version: "13" -postgresql_package_version: "13.*.pgdg20.04+1" +postgresql_package_version: "13.*.pgdg22.04+1" postgresql_support_repository_channel: "main" -postgresql_support_libpq_version: "13.*.pgdg20.04+1" +postgresql_support_libpq_version: "13.*.pgdg22.04+1" postgresql_support_psycopg2_version: "2.8.*" postgis_version: "3" -postgis_package_version: "3.4*pgdg20.04+1" +postgis_package_version: "3.4*pgdg22.04+1" daemontools_version: "1:0.76-7" @@ -39,9 +39,10 @@ java_version: "8u*" java_major_version: "8" java_flavor: "openjdk" -docker_version: "5:19.*" +docker_version: "5:26.*" +docker_containerd_version: "1.6.*" docker_python_version: "4.4.*" -docker_compose_version: "1.26.*" +docker_compose_version: "1.29.*" geop_host: "localhost" geop_port: 8090 @@ -59,4 +60,4 @@ llvmlite_version: "0.37.0" numba_version: "0.54.0" phantomjs_version: "2.1.*" -redis_version: "5:5.0.*" +redis_version: "5:6.0.*" diff --git a/deployment/ansible/roles/model-my-watershed.app/tasks/dev-and-test-dependencies.yml b/deployment/ansible/roles/model-my-watershed.app/tasks/dev-and-test-dependencies.yml index 5053fa062..7ab98c70b 100644 --- a/deployment/ansible/roles/model-my-watershed.app/tasks/dev-and-test-dependencies.yml +++ b/deployment/ansible/roles/model-my-watershed.app/tasks/dev-and-test-dependencies.yml @@ -3,4 +3,4 @@ apt: pkg="firefox" state=present - name: Install Xvfb for JavaScript tests - apt: pkg="xvfb=2:1.20.*" state=present + apt: pkg="xvfb" state=present diff --git a/deployment/ansible/roles/model-my-watershed.base/tasks/dependencies.yml b/deployment/ansible/roles/model-my-watershed.base/tasks/dependencies.yml index ac63e46cb..96fc23ee5 100644 --- a/deployment/ansible/roles/model-my-watershed.base/tasks/dependencies.yml +++ b/deployment/ansible/roles/model-my-watershed.base/tasks/dependencies.yml @@ -1,10 +1,10 @@ --- - name: Install Geospatial libraries apt: - pkg: ["binutils=2.34*", - "libproj-dev=6.3.*", - "gdal-bin=3.0.*", - "libgdal-dev=3.0.*"] + pkg: ["binutils=2.38*", + "libproj-dev=8.2.*", + "gdal-bin=3.4.*", + "libgdal-dev=3.4.*"] state: present when: "['tile-servers'] | is_not_in(group_names)" diff --git a/deployment/ansible/roles/model-my-watershed.celery/defaults/main.yml b/deployment/ansible/roles/model-my-watershed.celery/defaults/main.yml index cda11ad84..8799c9cc8 100644 --- a/deployment/ansible/roles/model-my-watershed.celery/defaults/main.yml +++ b/deployment/ansible/roles/model-my-watershed.celery/defaults/main.yml @@ -1,2 +1,2 @@ --- -celery_version: 5.2.7 +celery_version: 5.4.0 diff --git a/deployment/ansible/roles/model-my-watershed.tiler/tasks/dependencies.yml b/deployment/ansible/roles/model-my-watershed.tiler/tasks/dependencies.yml index 000917582..ce8d50bda 100644 --- a/deployment/ansible/roles/model-my-watershed.tiler/tasks/dependencies.yml +++ b/deployment/ansible/roles/model-my-watershed.tiler/tasks/dependencies.yml @@ -2,16 +2,16 @@ - name: Install canvas rendering dependencies apt: pkg: ["libcairo2-dev=1.16.*", - "libpango1.0-dev=1.44.*", + "libpango1.0-dev=1.50.*", "libjpeg8-dev=8c-*", "libgif-dev=5.1.*"] state: present - name: Install Mapnik dependencies apt: - pkg: ["libmapnik3.0=3.0.*", - "libmapnik-dev=3.0.*", - "mapnik-utils=3.0.*"] + pkg: ["libmapnik3.1=3.1.*", + "libmapnik-dev=3.1.*", + "mapnik-utils=3.1.*"] state: present - name: Install Windshaft JavaScript dependencies From 718fb3fb12b006a2f57aec34421f0fabb10498da Mon Sep 17 00:00:00 2001 From: Terence Tuhinanshu Date: Fri, 28 Jun 2024 16:37:04 -0400 Subject: [PATCH 02/15] Upgrade Python to 3.10 Using a branch installation for GWLF-E until https://github.com/WikiWatershed/gwlf-e/pull/95 is published to PyPI. --- deployment/ansible/group_vars/all | 7 +++---- src/mmw/requirements/base.txt | 8 ++++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/deployment/ansible/group_vars/all b/deployment/ansible/group_vars/all index 80845bb39..df0cc271e 100644 --- a/deployment/ansible/group_vars/all +++ b/deployment/ansible/group_vars/all @@ -26,7 +26,7 @@ postgis_package_version: "3.4*pgdg22.04+1" daemontools_version: "1:0.76-7" -python_version: "3.8.*" +python_version: "3.10.*" ansible_python_interpreter: "/usr/bin/python3" yarn_version: "1.19.*" @@ -56,8 +56,7 @@ nginx_cache_dir: "/var/cache/nginx" enabled_features: '' -llvmlite_version: "0.37.0" -numba_version: "0.54.0" -phantomjs_version: "2.1.*" +llvmlite_version: "0.38.*" +numba_version: "0.55.*" redis_version: "5:6.0.*" diff --git a/src/mmw/requirements/base.txt b/src/mmw/requirements/base.txt index 047760261..2ea0941e8 100644 --- a/src/mmw/requirements/base.txt +++ b/src/mmw/requirements/base.txt @@ -15,8 +15,8 @@ cryptography==36.0.1 pyOpenSSL==21.0.0 markdown==3.3.6 tr55==1.3.0 -gwlf-e==3.1.0 -requests[security]==2.26.0 +git+https://github.com/WikiWatershed/gwlf-e.git@tt/94/python-3.10#egg=gwlf-e +requests[security]==2.28.2 rollbar==0.16.2 retry==0.9.2 python-dateutil==2.8.2 @@ -25,8 +25,8 @@ django_celery_results==2.2.0 pandas==1.3.5 ulmo==0.8.8 hs_restclient==1.3.7 -fiona==1.8.20 +fiona==1.8.21 redis<4 -numpy==1.20.3 +numpy==1.21.* dictdiffer==0.9.0 BMPxlsx==3.0.0 From 1da3a8ee447ea8874997bd8dff95190a0bffd7ea Mon Sep 17 00:00:00 2001 From: Terence Tuhinanshu Date: Fri, 28 Jun 2024 16:39:06 -0400 Subject: [PATCH 03/15] Remove PhantomJS dependency This was not used anywhere anymore. --- deployment/ansible/roles.yml | 2 -- deployment/ansible/roles/model-my-watershed.app/meta/main.yml | 1 - 2 files changed, 3 deletions(-) diff --git a/deployment/ansible/roles.yml b/deployment/ansible/roles.yml index b1bdf8f5c..04ebb9683 100644 --- a/deployment/ansible/roles.yml +++ b/deployment/ansible/roles.yml @@ -16,8 +16,6 @@ version: 0.3.0 - src: azavea.redis version: 0.1.0 -- src: azavea.phantomjs - version: 0.1.0 - src: azavea.build-essential version: 0.1.0 - src: azavea.java diff --git a/deployment/ansible/roles/model-my-watershed.app/meta/main.yml b/deployment/ansible/roles/model-my-watershed.app/meta/main.yml index f7eb12483..53b8b58f5 100644 --- a/deployment/ansible/roles/model-my-watershed.app/meta/main.yml +++ b/deployment/ansible/roles/model-my-watershed.app/meta/main.yml @@ -3,6 +3,5 @@ dependencies: - { role: "model-my-watershed.base" } - { role: "azavea.yarn" } - { role: "azavea.nodejs", nodejs_version: "{{ app_nodejs_version }}", nodejs_npm_version: "{{ app_nodejs_npm_version }}" } - - { role: "azavea.phantomjs" } - { role: "model-my-watershed.celery" } - { role: "azavea.nginx", nginx_delete_default_site: True } From 9572af8c949864dc1061dc1aba0043e2ba7a48f5 Mon Sep 17 00:00:00 2001 From: Terence Tuhinanshu Date: Fri, 28 Jun 2024 16:40:53 -0400 Subject: [PATCH 04/15] Switch to Chromium for running JS tests Installing Firefox was difficult in the new Ubuntu VM. Chromium is a better representation of our user base. --- .../tasks/dev-and-test-dependencies.yml | 4 ++-- src/mmw/testem.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/deployment/ansible/roles/model-my-watershed.app/tasks/dev-and-test-dependencies.yml b/deployment/ansible/roles/model-my-watershed.app/tasks/dev-and-test-dependencies.yml index 7ab98c70b..f41c7d641 100644 --- a/deployment/ansible/roles/model-my-watershed.app/tasks/dev-and-test-dependencies.yml +++ b/deployment/ansible/roles/model-my-watershed.app/tasks/dev-and-test-dependencies.yml @@ -1,6 +1,6 @@ --- -- name: Install Firefox for UI tests - apt: pkg="firefox" state=present +- name: Install Chromium for UI tests + apt: pkg="chromium-browser" state=present - name: Install Xvfb for JavaScript tests apt: pkg="xvfb" state=present diff --git a/src/mmw/testem.json b/src/mmw/testem.json index a26e62a66..f94ad71f0 100644 --- a/src/mmw/testem.json +++ b/src/mmw/testem.json @@ -1,6 +1,6 @@ { "launch_in_ci": [ - "Firefox" + "Chromium" ], "test_page": "test.html" } From 1947d97b3f762f5686d65b5b40c91b34d2f63b96 Mon Sep 17 00:00:00 2001 From: Terence Tuhinanshu Date: Fri, 28 Jun 2024 16:50:33 -0400 Subject: [PATCH 05/15] Switch RWD to use direct Docker service The docker_compose module is no longer supported by Ansible, and switching to the docker_compose_v2 module required updating to a new version of Docker which does not work with the v1 Docker Image format of the RWD image. By using a service with inline docker cli commands, we replicate the settings in the docker_compose block, and also bring it more in line with the Geoprocessing service. --- .../model-my-watershed.docker/tasks/main.yml | 9 ++++--- .../model-my-watershed.rwd/handlers/main.yml | 3 +++ .../model-my-watershed.rwd/tasks/app.yml | 25 ++++++------------- .../templates/systemd-rwd.service.j2 | 18 +++++++++++++ 4 files changed, 33 insertions(+), 22 deletions(-) create mode 100644 deployment/ansible/roles/model-my-watershed.rwd/handlers/main.yml create mode 100644 deployment/ansible/roles/model-my-watershed.rwd/templates/systemd-rwd.service.j2 diff --git a/deployment/ansible/roles/model-my-watershed.docker/tasks/main.yml b/deployment/ansible/roles/model-my-watershed.docker/tasks/main.yml index 428ed4e30..7f699ec28 100644 --- a/deployment/ansible/roles/model-my-watershed.docker/tasks/main.yml +++ b/deployment/ansible/roles/model-my-watershed.docker/tasks/main.yml @@ -1,5 +1,6 @@ --- -- name: Install Docker Compose - pip: - name: docker-compose - version: "{{ docker_compose_version }}" +- name: Add mmw user to docker group + user: name=mmw + append=yes + groups=docker + state=present diff --git a/deployment/ansible/roles/model-my-watershed.rwd/handlers/main.yml b/deployment/ansible/roles/model-my-watershed.rwd/handlers/main.yml new file mode 100644 index 000000000..fac7123d4 --- /dev/null +++ b/deployment/ansible/roles/model-my-watershed.rwd/handlers/main.yml @@ -0,0 +1,3 @@ +--- +- name: Restart RWD service + service: name=mmw-rwd state=restarted diff --git a/deployment/ansible/roles/model-my-watershed.rwd/tasks/app.yml b/deployment/ansible/roles/model-my-watershed.rwd/tasks/app.yml index 89c1d0eca..fa34d8b19 100644 --- a/deployment/ansible/roles/model-my-watershed.rwd/tasks/app.yml +++ b/deployment/ansible/roles/model-my-watershed.rwd/tasks/app.yml @@ -4,21 +4,10 @@ state=directory - name: Configure RWD service definition - docker_compose: - project_name: mmw - state: present - definition: - version: "3" - services: - mmw-rwd: - image: "{{ rwd_docker_image }}" - ports: - - "{{ rwd_port }}:{{ rwd_port }}" - volumes: - - "{{ rwd_data_path }}:{{ rwd_data_path }}:ro" - restart: always - userns_mode: "host" - logging: - driver: syslog - options: - tag: mmw-rwd + template: src=systemd-rwd.service.j2 + dest=/etc/systemd/system/mmw-rwd.service + notify: + - Restart RWD service + +- name: Enable RWD service + systemd: name=mmw-rwd.service enabled=yes state=started daemon_reload=yes diff --git a/deployment/ansible/roles/model-my-watershed.rwd/templates/systemd-rwd.service.j2 b/deployment/ansible/roles/model-my-watershed.rwd/templates/systemd-rwd.service.j2 new file mode 100644 index 000000000..0d98e4da2 --- /dev/null +++ b/deployment/ansible/roles/model-my-watershed.rwd/templates/systemd-rwd.service.j2 @@ -0,0 +1,18 @@ +[Unit] +Description=mmw-rwd +After=network.target + +[Service] +User=mmw +WorkingDirectory={{ rwd_data_path }} +ExecStart=docker run --rm --volume "{{ rwd_data_path }}:{{ rwd_data_path }}:ro" --publish "{{ rwd_port }}:{{ rwd_port }}" "{{ rwd_docker_image }}" +StandardOutput=syslog +StandardError=syslog +SyslogIdentifier=mmw-rwd + +[Install] +{% if ['development', 'test'] | some_are_in(group_names) -%} +WantedBy=opt-app.mount +{% else %} +WantedBy=multi-user.target +{% endif %} From 8e1d0ca1331c88f4e89fac05eb39dec8c17beb3e Mon Sep 17 00:00:00 2001 From: Terence Tuhinanshu Date: Fri, 28 Jun 2024 17:02:19 -0400 Subject: [PATCH 06/15] Inline nginx role The Azavea role does not work with Ubuntu 22.04. It tries to add an nginx PPA which is not required in Jammy. --- .../model-my-watershed.app/meta/main.yml | 2 +- .../meta/main.yml | 2 +- .../defaults/main.yml | 3 ++ .../handlers/main.yml | 3 ++ .../model-my-watershed.nginx/tasks/main.yml | 27 +++++++++++++++ .../templates/logrotate_nginx.j2 | 18 ++++++++++ .../templates/nginx.conf.j2 | 34 +++++++++++++++++++ .../model-my-watershed.tiler/meta/main.yml | 2 +- 8 files changed, 88 insertions(+), 3 deletions(-) create mode 100644 deployment/ansible/roles/model-my-watershed.nginx/defaults/main.yml create mode 100644 deployment/ansible/roles/model-my-watershed.nginx/handlers/main.yml create mode 100644 deployment/ansible/roles/model-my-watershed.nginx/tasks/main.yml create mode 100644 deployment/ansible/roles/model-my-watershed.nginx/templates/logrotate_nginx.j2 create mode 100644 deployment/ansible/roles/model-my-watershed.nginx/templates/nginx.conf.j2 diff --git a/deployment/ansible/roles/model-my-watershed.app/meta/main.yml b/deployment/ansible/roles/model-my-watershed.app/meta/main.yml index 53b8b58f5..c0fab2048 100644 --- a/deployment/ansible/roles/model-my-watershed.app/meta/main.yml +++ b/deployment/ansible/roles/model-my-watershed.app/meta/main.yml @@ -4,4 +4,4 @@ dependencies: - { role: "azavea.yarn" } - { role: "azavea.nodejs", nodejs_version: "{{ app_nodejs_version }}", nodejs_npm_version: "{{ app_nodejs_npm_version }}" } - { role: "model-my-watershed.celery" } - - { role: "azavea.nginx", nginx_delete_default_site: True } + - { role: "model-my-watershed.nginx", nginx_delete_default_site: True } diff --git a/deployment/ansible/roles/model-my-watershed.geoprocessing/meta/main.yml b/deployment/ansible/roles/model-my-watershed.geoprocessing/meta/main.yml index 60238dcc6..e59960ad7 100644 --- a/deployment/ansible/roles/model-my-watershed.geoprocessing/meta/main.yml +++ b/deployment/ansible/roles/model-my-watershed.geoprocessing/meta/main.yml @@ -2,4 +2,4 @@ dependencies: - { role: "azavea.java" } - { role: "model-my-watershed.base" } - - { role: "azavea.nginx", nginx_delete_default_site: True } + - { role: "model-my-watershed.nginx", nginx_delete_default_site: True } diff --git a/deployment/ansible/roles/model-my-watershed.nginx/defaults/main.yml b/deployment/ansible/roles/model-my-watershed.nginx/defaults/main.yml new file mode 100644 index 000000000..76614cc54 --- /dev/null +++ b/deployment/ansible/roles/model-my-watershed.nginx/defaults/main.yml @@ -0,0 +1,3 @@ +--- +nginx_version: "stable" +nginx_delete_default_site: False diff --git a/deployment/ansible/roles/model-my-watershed.nginx/handlers/main.yml b/deployment/ansible/roles/model-my-watershed.nginx/handlers/main.yml new file mode 100644 index 000000000..159596ed1 --- /dev/null +++ b/deployment/ansible/roles/model-my-watershed.nginx/handlers/main.yml @@ -0,0 +1,3 @@ +--- +- name: Restart Nginx + service: name=nginx state=restarted diff --git a/deployment/ansible/roles/model-my-watershed.nginx/tasks/main.yml b/deployment/ansible/roles/model-my-watershed.nginx/tasks/main.yml new file mode 100644 index 000000000..69d3d636f --- /dev/null +++ b/deployment/ansible/roles/model-my-watershed.nginx/tasks/main.yml @@ -0,0 +1,27 @@ +--- +- name: Install Nginx + apt: pkg=nginx-full state=present + +- name: Delete default site + file: path=/etc/nginx/sites-enabled/default state=absent + register: delete_default_site + when: nginx_delete_default_site | bool + notify: + - Restart Nginx + +- name: Delete default web root + file: path=/var/www/html state=absent + when: nginx_delete_default_site | bool and delete_default_site is changed + +- name: Check Nginx Upstart service definition exists + stat: path=/etc/init/nginx.conf + register: nginx_upstart + +- name: Configure Nginx log rotation + template: src=logrotate_nginx.j2 dest=/etc/logrotate.d/nginx + when: nginx_upstart.stat.exists + +- name: Configure Nginx + template: src=nginx.conf.j2 dest=/etc/nginx/nginx.conf + notify: + - Restart Nginx diff --git a/deployment/ansible/roles/model-my-watershed.nginx/templates/logrotate_nginx.j2 b/deployment/ansible/roles/model-my-watershed.nginx/templates/logrotate_nginx.j2 new file mode 100644 index 000000000..92e628ec3 --- /dev/null +++ b/deployment/ansible/roles/model-my-watershed.nginx/templates/logrotate_nginx.j2 @@ -0,0 +1,18 @@ +/var/log/nginx/*.log { + weekly + missingok + rotate 52 + compress + delaycompress + notifempty + create 0640 www-data adm + sharedscripts + prerotate + if [ -d /etc/logrotate.d/httpd-prerotate ]; then \ + run-parts /etc/logrotate.d/httpd-prerotate; \ + fi \ + endscript + postrotate + service nginx rotate >/dev/null 2>&1 + endscript +} diff --git a/deployment/ansible/roles/model-my-watershed.nginx/templates/nginx.conf.j2 b/deployment/ansible/roles/model-my-watershed.nginx/templates/nginx.conf.j2 new file mode 100644 index 000000000..541317b03 --- /dev/null +++ b/deployment/ansible/roles/model-my-watershed.nginx/templates/nginx.conf.j2 @@ -0,0 +1,34 @@ +user www-data; +worker_processes {{ ansible_processor_count }}; +pid /run/nginx.pid; + +events { + worker_connections 768; +} + +http { + sendfile on; + tcp_nopush on; + tcp_nodelay on; + keepalive_timeout 65; + types_hash_max_size 2048; + + server_tokens off; + + include /etc/nginx/mime.types; + default_type application/octet-stream; + + access_log /var/log/nginx/access.log; + error_log /var/log/nginx/error.log; + + gzip on; + gzip_vary on; + gzip_proxied any; + gzip_comp_level 6; + gzip_buffers 16 8k; + gzip_http_version 1.1; + gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript; + + include /etc/nginx/conf.d/*.conf; + include /etc/nginx/sites-enabled/*; +} diff --git a/deployment/ansible/roles/model-my-watershed.tiler/meta/main.yml b/deployment/ansible/roles/model-my-watershed.tiler/meta/main.yml index 276dc1fc8..6f1a3e38c 100644 --- a/deployment/ansible/roles/model-my-watershed.tiler/meta/main.yml +++ b/deployment/ansible/roles/model-my-watershed.tiler/meta/main.yml @@ -2,4 +2,4 @@ dependencies: - { role: "model-my-watershed.base" } - { role: "azavea.nodejs", nodejs_version: "{{ tiler_nodejs_version }}", nodejs_npm_version: "{{ tiler_nodejs_npm_version }}" } - - { role: "azavea.nginx", nginx_delete_default_site: True } + - { role: "model-my-watershed.nginx", nginx_delete_default_site: True } From 9605f2e936677e5e8d20030411dc0a8b2f73f322 Mon Sep 17 00:00:00 2001 From: Terence Tuhinanshu Date: Fri, 28 Jun 2024 22:12:29 -0400 Subject: [PATCH 07/15] Upgrade AWS VMs to Ubuntu 22.04 --- deployment/cfn/data_plane.py | 2 +- deployment/packer/driver.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/deployment/cfn/data_plane.py b/deployment/cfn/data_plane.py index 95c3c15d3..12ae37c69 100644 --- a/deployment/cfn/data_plane.py +++ b/deployment/cfn/data_plane.py @@ -195,7 +195,7 @@ def get_recent_bastion_ami(self): bastion_ami_id = self.get_input('BastionHostAMI') except MKUnresolvableInputError: filters = {'name': - 'ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*', + 'ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*', 'architecture': 'x86_64', 'block-device-mapping.volume-type': 'gp2', 'root-device-type': 'ebs', diff --git a/deployment/packer/driver.py b/deployment/packer/driver.py index 8505a31e8..d479bc53b 100644 --- a/deployment/packer/driver.py +++ b/deployment/packer/driver.py @@ -18,7 +18,7 @@ def get_recent_ubuntu_ami(region, aws_profile): """Gets AMI ID for current release in region""" filters = { - 'name': 'ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*', + 'name': 'ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*', 'architecture': 'x86_64', 'root-device-type': 'ebs', 'virtualization-type': 'hvm', From 92755b098dd46bd86a2141ee0a6e9e7a021d34dc Mon Sep 17 00:00:00 2001 From: Terence Tuhinanshu Date: Tue, 2 Jul 2024 21:17:33 -0400 Subject: [PATCH 08/15] Use become instead of sudo This is the recommended way of doing things in Ansible. --- .../roles/model-my-watershed.tiler/tasks/dependencies.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deployment/ansible/roles/model-my-watershed.tiler/tasks/dependencies.yml b/deployment/ansible/roles/model-my-watershed.tiler/tasks/dependencies.yml index ce8d50bda..8e9ab4805 100644 --- a/deployment/ansible/roles/model-my-watershed.tiler/tasks/dependencies.yml +++ b/deployment/ansible/roles/model-my-watershed.tiler/tasks/dependencies.yml @@ -15,7 +15,7 @@ state: present - name: Install Windshaft JavaScript dependencies - command: sudo npm install --unsafe-perm + command: npm install --unsafe-perm args: chdir: "{{ tiler_home }}" - become: False + become: True From 25bc332adaa9cbd75b9700ae513be13fe1dd508d Mon Sep 17 00:00:00 2001 From: Terence Tuhinanshu Date: Tue, 2 Jul 2024 21:17:58 -0400 Subject: [PATCH 09/15] Interpret subprocess output as strings Previously the subprocess output would be reported as byte strings, which in Python 3.10 would add a b'' prefix, interfering with the output. By interpreting them as proper UTF-8 strings, we ensure that the original functionality is restored. --- deployment/packer/driver.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/deployment/packer/driver.py b/deployment/packer/driver.py index d479bc53b..0d68d19a7 100644 --- a/deployment/packer/driver.py +++ b/deployment/packer/driver.py @@ -59,7 +59,9 @@ def get_git_sha(): 'rev-parse', 'HEAD'] - return subprocess.check_output(git_command).rstrip() + return subprocess.check_output( + git_command, + universal_newlines=True).rstrip() def get_git_branch(): @@ -69,7 +71,9 @@ def get_git_branch(): '--abbrev-ref', 'HEAD'] - return subprocess.check_output(git_command).rstrip() + return subprocess.check_output( + git_command, + universal_newlines=True).rstrip() def get_git_desc(): @@ -81,7 +85,9 @@ def get_git_desc(): '--dirty', '--abbrev=40'] - return subprocess.check_output(git_command).rstrip() + return subprocess.check_output( + git_command, + universal_newlines=True).rstrip() def run_packer(mmw_config, machine_types, aws_profile): From fb93bddc330ec9dc9f732a6e74ef30c5b6da979f Mon Sep 17 00:00:00 2001 From: Terence Tuhinanshu Date: Tue, 2 Jul 2024 22:26:40 -0400 Subject: [PATCH 10/15] Use gwlf-e develop as of https://github.com/WikiWatershed/gwlf-e/pull/95 --- src/mmw/requirements/base.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mmw/requirements/base.txt b/src/mmw/requirements/base.txt index 2ea0941e8..a26793e80 100644 --- a/src/mmw/requirements/base.txt +++ b/src/mmw/requirements/base.txt @@ -15,7 +15,7 @@ cryptography==36.0.1 pyOpenSSL==21.0.0 markdown==3.3.6 tr55==1.3.0 -git+https://github.com/WikiWatershed/gwlf-e.git@tt/94/python-3.10#egg=gwlf-e +git+https://github.com/WikiWatershed/gwlf-e.git@develop#egg=gwlf-e requests[security]==2.28.2 rollbar==0.16.2 retry==0.9.2 From 77fe39a2c66c675bf95327dae2190b6521d60ecd Mon Sep 17 00:00:00 2001 From: Terence Tuhinanshu Date: Wed, 3 Jul 2024 13:13:13 -0400 Subject: [PATCH 11/15] Use published gwlf-e Now that the Python 3.10 supporting version of gwlf-e has been published to PyPI, we use that instead of the direct GitHub link. --- src/mmw/requirements/base.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mmw/requirements/base.txt b/src/mmw/requirements/base.txt index a26793e80..923f73907 100644 --- a/src/mmw/requirements/base.txt +++ b/src/mmw/requirements/base.txt @@ -15,7 +15,7 @@ cryptography==36.0.1 pyOpenSSL==21.0.0 markdown==3.3.6 tr55==1.3.0 -git+https://github.com/WikiWatershed/gwlf-e.git@develop#egg=gwlf-e +gwlf-e==3.2.0 requests[security]==2.28.2 rollbar==0.16.2 retry==0.9.2 From e57ef548b22666fc21a41347c51e59fd7bcd8d3d Mon Sep 17 00:00:00 2001 From: Terence Tuhinanshu Date: Wed, 3 Jul 2024 13:15:11 -0400 Subject: [PATCH 12/15] Upgrade python-omgeo to 6.2.2 Similarly, we use the PyPI published version of omgeo. This has no updates since 6.2.1, was necessary as part of the publishing. --- src/mmw/requirements/base.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mmw/requirements/base.txt b/src/mmw/requirements/base.txt index 923f73907..5fabbc51f 100644 --- a/src/mmw/requirements/base.txt +++ b/src/mmw/requirements/base.txt @@ -6,7 +6,7 @@ djangorestframework==3.13.1 django-filter==21.1 django-registration-redux==2.9 django-extensions==3.1.5 -git+https://github.com/azavea/python-omgeo.git@6.2.1#egg=python-omgeo +python-omgeo==6.2.2 rauth==0.7.3 djangorestframework-gis==0.17.0 drf_yasg==1.20.0 From 6710abc0009f44d56317ddc445a5e0261b88b07a Mon Sep 17 00:00:00 2001 From: Terence Tuhinanshu Date: Sat, 6 Jul 2024 20:32:36 -0400 Subject: [PATCH 13/15] Remove extraneous logging configuration syslog has been deprecated in favor of journal, which is used by default. The recommendation is to remove these settings entirely. --- .../templates/systemd-geoprocessing.service.j2 | 3 --- .../model-my-watershed.rwd/templates/systemd-rwd.service.j2 | 3 --- 2 files changed, 6 deletions(-) diff --git a/deployment/ansible/roles/model-my-watershed.geoprocessing/templates/systemd-geoprocessing.service.j2 b/deployment/ansible/roles/model-my-watershed.geoprocessing/templates/systemd-geoprocessing.service.j2 index 2a93bcab4..b0756a278 100644 --- a/deployment/ansible/roles/model-my-watershed.geoprocessing/templates/systemd-geoprocessing.service.j2 +++ b/deployment/ansible/roles/model-my-watershed.geoprocessing/templates/systemd-geoprocessing.service.j2 @@ -10,9 +10,6 @@ Environment="JAVA_WITH_ENV=/usr/bin/envdir /etc/mmw.d/env /usr/bin/java" User=mmw WorkingDirectory={{ geop_home }} ExecStart=/bin/sh -c '${JAVA_WITH_ENV} -jar mmw-geoprocessing-{{ geop_version }}.jar' -StandardOutput=syslog -StandardError=syslog -SyslogIdentifier=geoprocessing [Install] {% if ['development', 'test'] | some_are_in(group_names) -%} diff --git a/deployment/ansible/roles/model-my-watershed.rwd/templates/systemd-rwd.service.j2 b/deployment/ansible/roles/model-my-watershed.rwd/templates/systemd-rwd.service.j2 index 0d98e4da2..c9f5edc56 100644 --- a/deployment/ansible/roles/model-my-watershed.rwd/templates/systemd-rwd.service.j2 +++ b/deployment/ansible/roles/model-my-watershed.rwd/templates/systemd-rwd.service.j2 @@ -6,9 +6,6 @@ After=network.target User=mmw WorkingDirectory={{ rwd_data_path }} ExecStart=docker run --rm --volume "{{ rwd_data_path }}:{{ rwd_data_path }}:ro" --publish "{{ rwd_port }}:{{ rwd_port }}" "{{ rwd_docker_image }}" -StandardOutput=syslog -StandardError=syslog -SyslogIdentifier=mmw-rwd [Install] {% if ['development', 'test'] | some_are_in(group_names) -%} From 16f173160b2df661f8be1657a7d336c97b03a935 Mon Sep 17 00:00:00 2001 From: Terence Tuhinanshu Date: Sun, 7 Jul 2024 09:54:55 -0400 Subject: [PATCH 14/15] Remove Celery Warning This makes explicit the current default behavior which will change in the next version of Celery. --- src/mmw/mmw/settings/base.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mmw/mmw/settings/base.py b/src/mmw/mmw/settings/base.py index 3dae62d6f..94ee52b1b 100644 --- a/src/mmw/mmw/settings/base.py +++ b/src/mmw/mmw/settings/base.py @@ -110,6 +110,7 @@ def get_env_setting(setting): CELERY_BROKER_URL = 'redis://{0}:{1}/2'.format( environ.get('MMW_CACHE_HOST', 'localhost'), environ.get('MMW_CACHE_PORT', 6379)) +CELERY_BROKER_CONNECTION_RETRY_ON_STARTUP = True CELERY_IMPORTS = ( # Submodule task is not always autodiscovered From 362c3c286474d192959f5870cf7285d14f0b866c Mon Sep 17 00:00:00 2001 From: Terence Tuhinanshu Date: Sun, 7 Jul 2024 11:14:03 -0400 Subject: [PATCH 15/15] Upgrade to fixed GWLF-E --- src/mmw/requirements/base.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mmw/requirements/base.txt b/src/mmw/requirements/base.txt index 5fabbc51f..a44baff8f 100644 --- a/src/mmw/requirements/base.txt +++ b/src/mmw/requirements/base.txt @@ -15,7 +15,7 @@ cryptography==36.0.1 pyOpenSSL==21.0.0 markdown==3.3.6 tr55==1.3.0 -gwlf-e==3.2.0 +gwlf-e==3.3.0 requests[security]==2.28.2 rollbar==0.16.2 retry==0.9.2 @@ -27,6 +27,6 @@ ulmo==0.8.8 hs_restclient==1.3.7 fiona==1.8.21 redis<4 -numpy==1.21.* +numpy==1.22.* dictdiffer==0.9.0 BMPxlsx==3.0.0