Add Vagrantfile for production-like development VMs

RESOLVED FIXED

Status

()

bugzilla.mozilla.org
Developer Box
RESOLVED FIXED
2 years ago
a year ago

People

(Reporter: dylan, Assigned: dylan)

Tracking

Production

Details

Attachments

(1 attachment)

(Assignee)

Description

2 years ago
Over the holidays I created a vagrant setup that is remarkably complete. This bug is a post-hoc reflection of that work. :)
Depends on: 1329397
(Assignee)

Comment 1

2 years ago
Created attachment 8826212 [details] [review]
Pull Request

Want to get this landed, it's difficult to try out other patches against my fork. I don't think it touches any production code.
Attachment #8826212 - Flags: review?(dkl)
Comment on attachment 8826212 [details] [review]
Pull Request

ASK [configure dovecot] *******************************************************
fatal: [web]: FAILED! => {"changed": false, "failed": true, "msg": "Unable to find 'dovecot.j2' in expected paths."}
	to retry, use: --limit @/Users/dkl/Dropbox/Mozilla/devel/htdocs/1328874/vagrant_support/playbook.retry

PLAY RECAP *********************************************************************
web                        : ok=50   changed=43   unreachable=0    failed=1

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

----

Also you need to switch it and do the Ansible provisioning inside of the VM. This is due to Ansible not working properly on Windows. Windows does not support being an ansible control system. Took me a while of trying get it installed on my Windows box before coming to that conclusion :) Also switching around would remove the need to install Ansible on OSX. Once I installed a more recent version of Vagrant and then brew installed Ansible, I got up to the above error on OSX.

References:
https://www.vagrantup.com/docs/provisioning/ansible_local.html
https://akrabat.com/provisioning-with-ansible-within-the-vagrant-guest/
Attachment #8826212 - Flags: review?(dkl) → review-
(Assignee)

Comment 3

2 years ago
Comment on attachment 8826212 [details] [review]
Pull Request

There were a lot of problems with ansible_local owing to the fact we're running on centos 6. I'd rather switch to that after our infra has switched to centos 7. I have commited the missing dovecot.j2 file.
Attachment #8826212 - Flags: review- → review?(dkl)
non-fatal errors:

TASK [check /opt/bmo] **********************************************************
fatal: [web]: FAILED! => {"changed": true, "cmd": "test -d /opt/bmo && test -f /opt/bmo/local/lib/perl5/Plack.pm", "delta": "0:00:00.003416", "end": "2017-01-16 19:30:46.476061", "failed": true, "rc": 1, "start": "2017-01-16 19:30:46.472645", "stderr": "", "stdout": "", "stdout_lines": [], "warnings": []}
...ignoring

TASK [check bmo config] ********************************************************
fatal: [web]: FAILED! => {"changed": true, "cmd": "/usr/local/bin/bmo-configured", "delta": "0:00:00.006487", "end": "2017-01-16 19:08:37.029018", "failed": true, "rc": 1, "start": "2017-01-16 19:08:37.022531", "stderr": "", "stdout": "wrong file owner: vagrant.vagrant /vagrant/index.cgi", "stdout_lines": ["wrong file owner: vagrant.vagrant /vagrant/index.cgi"], "warnings": []}
...ignoring

For anyone else wanting to use Parallels (needs Business or Pro version) on OSX instead of VirtualBox:

1. $ vagrant plugin install vagrant-parallels
2. Apply the following changes to the Vagrantfile:

diff --git a/Vagrantfile b/Vagrantfile
index 6e93b28df..391cf18b1 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -1,8 +1,8 @@
 # vim: set ft=ruby sw=2 ts=2:
 # -*- mode: ruby -*-

-DB_IP  = '192.168.3.42'
-WEB_IP = '192.168.3.43'
+DB_IP  = '10.211.55.70'
+WEB_IP = '10.211.55.71'

 DB_HOSTNAME  = 'bmo-db.vm'
 WEB_HOSTNAME = 'bmo-web.vm'
@@ -31,7 +31,7 @@ Vagrant.configure("2") do |config|
   end

   config.vm.define "db" do |db|
-    db.vm.box = 'centos/6'
+    db.vm.box = 'parallels/centos-6.8'
     db.vm.hostname = DB_HOSTNAME
     db.vm.network "private_network", ip: DB_IP
     db.vm.synced_folder ".", "/vagrant", disabled: true
@@ -40,7 +40,7 @@ Vagrant.configure("2") do |config|
   config.vm.define "web", primary: true do |web|
     # Every Vagrant development environment requires a box. You can search for
     # boxes at https://atlas.hashicorp.com/search.
-    web.vm.box = "centos/6"
+    web.vm.box = "parallels/centos-6.8"
     web.vm.hostname = WEB_HOSTNAME

     # Create a private network, which allows host-only access to the machine

3: Update /etc/hosts to point bmo-web.vm to the new IP addresses.
Comment on attachment 8826212 [details] [review]
Pull Request

r- for the non-fatal errors and they are confusing to the new-comer. Bonus points for figuring out how to make Parallels work with the same Vagrantfile (not required really).

dkl
Attachment #8826212 - Flags: review?(dkl) → review-
(Assignee)

Comment 6

a year ago
Those errors are intentional, that's how you do conditionals. It looks like I might be able to use failed_when: false
to clean up the output though.

Reference for future me: https://git.lsd.ufcg.edu.br/flaviosr/openstack-ansible-os_ironic/commit/3a62eccb2cbb3b8071bb7b34007ee17d82eae311
(In reply to David Lawrence [:dkl] from comment #2)
> Also you need to switch it and do the Ansible provisioning inside of the VM.
> This is due to Ansible not working properly on Windows. Windows does not
> support being an ansible control system. Took me a while of trying get it
> installed on my Windows box before coming to that conclusion :) Also
> switching around would remove the need to install Ansible on OSX. Once I
> installed a more recent version of Vagrant and then brew installed Ansible,
> I got up to the above error on OSX.

Yeah, supporing Windows would be helpful... Although I can use macOS, I would pretty much prefer using my new Windows machine as it's much more powerful than my old MBP.
(Assignee)

Comment 8

a year ago
Comment on attachment 8826212 [details] [review]
Pull Request

I accounted for the different box images that dkl brought up, and sebastin brought up an issue where on virtualbox the auto-guess-non-conflicting-port-number didn't work. Asking sebastin for final review? as this doesn't impact production code (and has been being used at great inconvenience by him)
Attachment #8826212 - Flags: review- → review?(sebastinssanty)
Comment on attachment 8826212 [details] [review]
Pull Request

r=seban
Attachment #8826212 - Flags: review?(sebastinssanty) → review+
(Assignee)

Updated

a year ago
Summary: Create Vagrantfile for running BMO mirroring SCL3 configuration as much as possible → Add Vagrantfile for production-like development VMs
(Assignee)

Comment 10

a year ago
To git@github.com:mozilla-bteam/bmo.git
   480bbf368..4a130afba  master -> master
Status: NEW → RESOLVED
Last Resolved: a year ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.