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

Update Docker provisioning and docker compose command #953

Merged
merged 2 commits into from
Feb 28, 2024

Conversation

KlaasH
Copy link
Contributor

@KlaasH KlaasH commented Feb 26, 2024

Overview

Updates the Docker installation to:

  • Not use the azavea.docker role (which is no longer maintained), inlining the relevant steps instead.
  • Use a newer version
  • Invoke Docker Compose with 'docker compose' (rather than 'docker-compose') since that's how it works in newer Docker versions.

I also updated the Vagrant base box, mainly because we might as well not be out of date if we don't have to be, and renamed the shared 'django' docker-compose config to 'django-common', since apparently docker compose now treats it as a name collision to have services in different files with the same name.

Resolves #952

Notes

I'm not sure where things stand these days with Vagrant/Virtualbox on Mac machines. Possibly most of these changes won't be relevant. Though the docker-compose->docker compose change will likely help if the alternate strategy is to run Docker-on-host.

Testing Instructions

  • Destroy your virtual machine, if you had one (vagrant destroy)
  • Spin up a new one with ./scripts/setup (unless you're doing docker-only, in which case just run ./scripts/update)
  • Start the server (./scripts/server, whether in or out of the VM)
  • Confirm that the local server works (http://localhost:9301/)
  • Optional: import some boundaries (here's a small sample batch file) and run an analysis for one of them.

Checklist

  • Add entry to CHANGELOG.md

Updates the Docker installation to:
- Not use the azavea.docker role (which is no longer maintained), inlining
  the relevant steps instead.
- Use a newer version
- Invoke Docker Compose with 'docker compose' (rather than 'docker-compose')
  since that's how it works in newer Docker versions.

I also updated the Vagrant base box, mainly because we might as well not be
out of date if we don't have to be, and renamed the shared 'django'
docker-compose config to 'django-common', since apparently docker compose now
treats it as a name collision to have services in different files with the
same name.

(Also added a changelog entry for PR #951)

Resolves #952
Copy link
Contributor

@rachelekm rachelekm left a comment

Choose a reason for hiding this comment

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

I'm able to start the server from a docker-only setup 🎉 I'm having issues bringing up the VM to test, but I'm approving since I'm not sure how relevant the Vagrant setup is on Mac now? Either way leaving my notes below! (One note is that I need to run scripts/setup with PFB_SHARED_FOLDER_TYPE=virtualbox to get past mounting errors so not sure if that plays a part.)

The first error I ran into was a conflict with the upgraded base box and ansible version:

==> default: Running provisioner: ansible_local...
    default: Installing Ansible...
    default: Installing pip... (for Ansible installation)
The requested Ansible version (2.10.7) was not found on the guest.
Please check the Ansible installation on your Vagrant guest system (currently: 2.10.17),
or adapt the provisioner `version` option in your Vagrantfile.
See https://docs.vagrantup.com/v2/provisioning/ansible_common.html#version
for more information.

I was able to get past the above by setting ansible_version to "latest" but that seemed to open up other issues with what facts were available in tasks so not quite sure where to take it from here:

TASK [pfb.docker : Configure the Docker APT repository] ************************
fatal: [default]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'docker_repository_arch' is undefined. 'docker_repository_arch' is undefined\n\nThe error appears to be in '/vagrant/deployment/ansible/roles/pfb.docker/tasks/main.yml': line 8, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Configure the Docker APT repository\n  ^ here\n"}

PLAY RECAP *********************************************************************
default                    : ok=8    changed=6    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   

Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.

@KlaasH
Copy link
Contributor Author

KlaasH commented Feb 27, 2024

Ok, the "TASK [pfb.docker : Configure the Docker APT repository]" error was because I forgot to add a new file to git. I meant to do a clean run on a separate checkout to make sure everything was in place, but I guess I forgot to go back and do that after all the changes were in. I pushed a fixup for that error.

The Ansible version error is a little confusing because I did just do scripts/setup on a clean repo and it got past that step just fine. Can you take a look at what version of the base box you have? The third line of my output was:

Checking if box 'bento/ubuntu-22.04' version '202401.31.0' is up to date...

and I believe the answer was yes, since it didn't print a message about a newer version being available. I wonder if you might have an older version of the base box on your machine and it has an older version of Ansible.
Possibly 'latest' would make sense as a plan, but I kind of prefer the idea of keeping it specified if we can.

@KlaasH
Copy link
Contributor Author

KlaasH commented Feb 27, 2024

Ok, my VM build with the fixup for the missed file worked. Could you try it again? Given that your first attempt worked partly and exposed a real bug, I think we should be able to get to the point of confirming that it works for more than just me, which would be nice.

Copy link
Contributor

@rachelekm rachelekm left a comment

Choose a reason for hiding this comment

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

Success! Sort of! I'm still having trouble with that ansible version for some reason. Confirming that it's using the new base box version:

==> default: Importing base box 'bento/ubuntu-22.04'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'bento/ubuntu-22.04' version '202401.31.0' is up to date...

And annoyingly I can see that it should match one of the available distributions:

`...from versions:....2.10.0, 2.10.1, 2.10.2, 2.10.3, 2.10.4, 2.10.5, 2.10.6, 2.10.7, 3.0.0b1...`

I wonder if this is unique to my Vagrant or virtualbox versions? I'm using Vagrant 2.3.4 and VirtualBox 7.0.6.

Tried a couple other explicitly set ansible versions to no avail, so set it to "latest" again just to get through that error and can successfully provision and bring up the server from the VMs.

@KlaasH
Copy link
Contributor Author

KlaasH commented Feb 28, 2024

Ok, I'm going to say that's close enough. It's weird that it says the requested version isn't available then includes it in the list, but if we tried to solve every Vagrant/Virtualbox mystery, we'd never have time for anything else...

@KlaasH KlaasH merged commit 0b75fde into develop Feb 28, 2024
1 check passed
@KlaasH KlaasH deleted the feature/kjh/952-provisioning-errors branch February 28, 2024 17:02
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.

Fix errors in Vagrant and Docker provisioning
2 participants