Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Xenial #1117

Merged

Conversation

flibbertigibbet
Copy link
Contributor

Overview

Upgrade ansible roles to support using Ubuntu Xenial (16.04) as the OS for all three VMs. Mostly, this meant switching services to use systemd instead of upstart.

This is to support upgrading to python 3 and then Django 2.x later; here, python 2 is still in use.

Also makes some minor upgrades to ansible syntax, to resolve deprecation warnings.

Notes

I tried using the gunicorn ansible role instead of installing it within the app role, but ran into issues, so instead upgraded the gunicorn role in place for systemd. As I've added support for the timeout parameter to the gunicorn ansible role, it's possible we could use it in future instead.

For the OTP VM, it was necessary to explicitly install and use python 2, in order to continue to validate GTFS feeds, as the feed validator library does not yet support python 3: google/transitfeed#412

For the python 3 upgrade, we can handle the OTP machine by one of:

  • removing GTFS validation entirely (if using the feed fetcher library, this validation has already happened on download)
  • leaving the machine on python 2 until the validator project upgrades
  • upgrading the validator to python 3 ourselves, which might necessitate forking the project

I would be inclined towards the first option, as the feeds are currently validated outside the VM as part of the current graph update process, and because validating again slows the build process.

Testing Instructions

  • destroy and rebuild all VMs
  • provisioning should complete as expected
  • no ansible deprecated usage warnings should remain for roles that are defined in this project (external roles still have some warnings, particularly postgresql and postgresql-support)
  • site should still function as expected
  • services should start on reboot (site should still work after vagrant reload`)

Closes #1100
Closes #995

@flibbertigibbet
Copy link
Contributor Author

I'll wait for #1119 to go in before destroying the VMs on CI and rebuilding this PR, as it changes the VM base image.

@maurizi
Copy link
Contributor

maurizi commented Jul 18, 2019

The database VM failed to provision with the follow error:

TASK [azavea.postgresql : Install PostgreSQL] **********************************
failed: [database] (item=[u'postgresql-9.6=9.6.*-2.pgdg14.04+1', u'postgresql-server-dev-9.6=9.6.*-2.pgdg14.04+1']) => {"cache_update_time": 1563477629, "cache_updated": false, "changed": false, "item": ["postgresql-9.6=9.6.*-2.pgdg14.04+1", "postgresql-server-dev-9.6=9.6.*-2.pgdg14.04+1"], "msg": "'/usr/bin/apt-get -y -o \"Dpkg::Options::=--force-confdef\" -o \"Dpkg::Options::=--force-confold\"     install 'postgresql-9.6=9.6.*-2.pgdg14.04+1' 'postgresql-server-dev-9.6=9.6.*-2.pgdg14.04+1'' failed: E: Version '9.6.*-2.pgdg14.04+1' for 'postgresql-9.6' was not found\nE: Version '9.6.*-2.pgdg14.04+1' for 'postgresql-server-dev-9.6' was not found\n", "rc": 100, "stderr": "E: Version '9.6.*-2.pgdg14.04+1' for 'postgresql-9.6' was not found\nE: Version '9.6.*-2.pgdg14.04+1' for 'postgresql-server-dev-9.6' was not found\n", "stderr_lines": ["E: Version '9.6.*-2.pgdg14.04+1' for 'postgresql-9.6' was not found", "E: Version '9.6.*-2.pgdg14.04+1' for 'postgresql-server-dev-9.6' was not found"], "stdout": "Reading package lists...\nBuilding dependency tree...\nReading state information...\n", "stdout_lines": ["Reading package lists...", "Building dependency tree...", "Reading state information..."]}
        to retry, use: --limit @/home/local/AZVA-INT/mmaurizi/src/cac-tripplanner/deployment/ansible/database.retry

@flibbertigibbet
Copy link
Contributor Author

The development group_vars I had shared with you separately contained:

postgresql_version: "9.5"
postgresql_package_version: "9.5.*"
postgresql_support_libpq_version: "*"

Where those set?

These variables go in development rather than all, as the production database is usually on a slightly different version.

@maurizi
Copy link
Contributor

maurizi commented Jul 19, 2019

D'oh, I'd updated to the newest Graph but hadn't updated my group_vars. Provisioning succeeded after doing so.

I did see one deprecation warning from Ansible for a role defined in this project:

TASK [cac-tripplanner.otp-data : Copy Built OTP Graph to Host (develop)] *******
[DEPRECATION WARNING]: Using tests as filters is deprecated. Instead of using 
`result|changed` instead use `result is changed`. This feature will be removed 
in version 2.9. Deprecation warnings can be disabled by setting 
deprecation_warnings=False in ansible.cfg.
skipping: [otp]

I'm testing out the site now, but encountered an issue accessing gunicorn after runnning vagrant reload, and investigating seems to chow that the service was not able to start.

@flibbertigibbet
Copy link
Contributor Author

Thanks for testing, @maurizi. I've removed the file share mounting parameters from the Vagrantfile, which has fixed the NFS permissions issues I was seeing using a Linux host, leading to nginx and the gunicorn server to not start properly. Hopefully the change doesn't cause issues for other hosts. I've also addressed the ansible deprecation warning.

@flibbertigibbet flibbertigibbet requested review from maurizi and removed request for KlaasH July 22, 2019 14:58
@flibbertigibbet flibbertigibbet assigned maurizi and unassigned KlaasH Jul 22, 2019
Newer versions support Xenial.
The version available in the Xenial system packages is 9.5.
Fixes issue on linux of version defaulting to 3, although not overridded in environment.
Fixes migrations failing to run.
Necessary because transitfeed package does not support python3 yet.
Use systemd for service.
Also update ansible package install syntax to address deprecation warning.
Update to use systemd for service management.
Fix app fileshare mounting permissions on Linux by reverting to defaults.
Fixes "Using tests as filters is deprecated" in otp-data role.
@flibbertigibbet flibbertigibbet force-pushed the feature/kak/upgrade-otp-xenial branch from 7b9abd2 to a8ac204 Compare July 25, 2019 16:35
Match the package versions in development_template.
@flibbertigibbet
Copy link
Contributor Author

The Jenkins build is passing now. @maurizi could you please take another look?

maurizi added 2 commits July 26, 2019 13:07
Required for nginx to start on boot
Without this in-place, gunicorn would frequently fail to load at
system-start as the Vagrant synced_folder /opt/app wouldn't be ready yet.
PyYAML==5.1.1
requests==2.22.0
troposphere==1.8.1
majorkirby==0.2.1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 great to get this out of Ansible and into a standard requirements.txt!

Copy link
Contributor

@maurizi maurizi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally and things seem to be working great 👍

Feel free to merge once the Jenkins build is green again.

@flibbertigibbet
Copy link
Contributor Author

build again

@flibbertigibbet flibbertigibbet merged commit 28c9e6f into azavea:develop Jul 26, 2019
@flibbertigibbet flibbertigibbet deleted the feature/kak/upgrade-otp-xenial branch July 26, 2019 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade to Ubuntu Xenial Update deprecated ansible usage
3 participants