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

Make first vagrant up work for a new contributor. #81

Closed
renoirb opened this issue Oct 31, 2014 · 9 comments
Closed

Make first vagrant up work for a new contributor. #81

renoirb opened this issue Oct 31, 2014 · 9 comments

Comments

@renoirb
Copy link

@renoirb renoirb commented Oct 31, 2014

How to resolve

Either

  • Link to possible vagrantbox.es
  • Provide link to customized image

OR

  • Install steps ends up with a fully working independent deployment of FxA
  • (optional) do not require initial database

Building the VM:

Related notes

Initial procedure

Note Progress is described in the comment thread.

This procedure assumes one doesn’t have access to dcoates/fedora20 config.vm.box Vagrant box.

Environment:

  • MacOS X as host
  • Vagrant v1.6.5
  • VirtualBox v4.3.6
  • Installed Ansible through brew on Mac OS X host

Steps

  1. Install Ansible

    brew install ansible
    
  2. Adjust Vagrantfile with:

    config.vm.box = "fedora20"
    config.vm.box_url = "https://dl.dropboxusercontent.com/u/15733306/vagrant/fedora-20-netinst-2014_01_05-minimal-puppet-guestadditions.box"
    
  3. Boot the VM for the first time

    First time it fails, its OK.

      make
    
  4. Fun in the VM the following:

    vagrant ssh
    

    Inside the VM

      sudo -s
      yum update
      yum install -y npm git ansible
    
  5. Halt the VM, restart the process

    exit
    

    Back on the host;

      vagrant halt
      make 
    
  6. Add what’s missing inside the VM

    Inside the VM, as root;

      adduser app
      mkdir /data
      chown -R app:app /data/
      easy_install supervisor
      npm install -g grunt-cli
    
  7. Get the code

    On the host;

      make update-code
    

    Wait.

    It breaks at fxa-auth-server, see npm-debug.log

  8. Breaks halfway

    Here is how /data looks like

      drwxr-xr-x. 10 app app 4096 Dec  3 16:14 fxa-auth-db-server
      drwxr-xr-x.  6 app app 4096 Dec  3 16:11 fxa-auth-mailer
      drwxr-xr-x. 14 app app 4096 Dec  3 16:45 fxa-auth-server
      drwxr-xr-x. 10 app app 4096 Dec  3 16:17 fxa-content-server
      drwxr-xr-x. 10 app app 4096 Dec  3 16:22 fxa-customs-server
    
  9. Delete an try again

    After reading the npm-debug.log. It mentionned to delete and try again.

    Inside the VM;
    rm -rf /root/tmp/npm-

    Trying again from the host;

      make update-code
    

    Got a different error message. It talked about missing gmp.h.

    screen shot 2014-12-03 at 5 19 53 pm

      yum install -y gmp.x86_64 gmp-devel.x86_64
    
  10. Another make update-code attempt

    It worked! /o/

screen shot 2014-12-03 at 5 20 04 pm

  1. ... and a few make update
@renoirb renoirb changed the title Make first vagrant up work for a new contributor. Make first vagrant up work for a new contributor. Oct 31, 2014
@renoirb renoirb changed the title Make first vagrant up work for a new contributor. Make first vagrant up work for a new contributor. Oct 31, 2014
@renoirb
Copy link
Author

@renoirb renoirb commented Oct 31, 2014

Related; I’m to build a Salt Stack recipe to deploy FxA. My environment is using Ubuntu 14.04, and Salt Stack. I’m open to make ways for you to integrate it in your own environment.

@renoirb
Copy link
Author

@renoirb renoirb commented Dec 4, 2014

Here’s a patch of what I changed on this repo.

patchdiff --git i/roles/auth/handlers/main.yml w/roles/auth/handlers/main.yml
index 41a7fe6..61ae762 100644
--- i/roles/auth/handlers/main.yml
+++ w/roles/auth/handlers/main.yml
@@ -13,4 +13,5 @@
 - name: restart fxa-auth-server
   sudo: true
   supervisorctl: name=fxa-auth-server state=restarted
+  ignore_errors: true

diff --git i/roles/authdb/defaults/main.yml w/roles/authdb/defaults/main.yml
index 596655f..44c75f6 100644
--- i/roles/authdb/defaults/main.yml
+++ w/roles/authdb/defaults/main.yml
@@ -4,7 +4,7 @@ authdb_git_repo: https://github.com/mozilla/fxa-auth-db-server.git
 authdb_git_version: master
 authdb_primary_host: 127.0.0.1
 authdb_primary_user: root
-authdb_primary_password: foobarbaz
+authdb_primary_password: ''
 authdb_replica_host: 127.0.0.1
 authdb_replica_user: root
-authdb_replica_password: foobarbaz
+authdb_replica_password: ''
diff --git i/roles/authdb/handlers/main.yml w/roles/authdb/handlers/main.yml
index 30bc3fd..f95a6ed 100644
--- i/roles/authdb/handlers/main.yml
+++ w/roles/authdb/handlers/main.yml
@@ -18,3 +18,4 @@
 - name: restart fxa-auth-db-server
   sudo: true
   supervisorctl: name=fxa-auth-db-server state=restarted
+  ignore_errors: true
diff --git i/roles/authdb/tasks/main.yml w/roles/authdb/tasks/main.yml
index 335b6f0..ab99307 100644
--- i/roles/authdb/tasks/main.yml
+++ w/roles/authdb/tasks/main.yml
@@ -29,6 +29,7 @@
   sudo_user: app
   template: src=config.json.j2 dest=/data/fxa-auth-db-server/config/stage.json
   notify: restart fxa-auth-db-server
+  ignore_errors: True

 - name: supervise fxa-auth-db-server
   sudo: true
diff --git i/roles/customs/templates/config.json.j2 w/roles/customs/templates/config.json.j2
index 577b6b2..16811cc 100644
--- i/roles/customs/templates/config.json.j2
+++ w/roles/customs/templates/config.json.j2
@@ -7,7 +7,7 @@
     "maxEmails": 3,
     "maxBadLogins": 10,
     "bans": {
-      "region": "{{ region }}",
+      "region": "{{ region|default('') }}",
       "queueUrl": "{{ customs_ban_queue_url }}"
     }
   }
diff --git i/roles/mysql/tasks/main.yml w/roles/mysql/tasks/main.yml
index 9bba7e8..4492b89 100644
--- i/roles/mysql/tasks/main.yml
+++ w/roles/mysql/tasks/main.yml
@@ -7,3 +7,4 @@
 - name: start mysql
   sudo: true
   service: name=mysqld state=started enabled=true
+  ignore_errors: true
diff --git i/roles/oauth/defaults/main.yml w/roles/oauth/defaults/main.yml
index 735cb72..0109fa4 100644
--- i/roles/oauth/defaults/main.yml
+++ w/roles/oauth/defaults/main.yml
@@ -4,7 +4,8 @@ private_protocol: http
 domain_name: "{{ subdomain }}.{{ hosted_zone }}"
 oauth_private_port: 9010
 oauth_db_host: 127.0.0.1
-oauth_db_password:
+# That one below makes the config file write "None" as password if you dont change it to something else.
+oauth_db_password: ''
 oauth_domain_name: "oauth-{{ domain_name }}"
 oauth_git_repo: https://github.com/mozilla/fxa-oauth-server.git
 oauth_git_version: master
diff --git i/roles/rp/handlers/main.yml w/roles/rp/handlers/main.yml
index 5c4db1f..44e7c14 100644
--- i/roles/rp/handlers/main.yml
+++ w/roles/rp/handlers/main.yml
@@ -13,3 +13,4 @@
 - name: restart fxa-rp
   sudo: true
   supervisorctl: name=fxa-rp state=restarted
+  ignore_errors: true
diff --git i/vagrant/Vagrantfile w/vagrant/Vagrantfile
index 9a8bf51..e56fbe3 100644
--- i/vagrant/Vagrantfile
+++ w/vagrant/Vagrantfile
@@ -4,7 +4,8 @@
 VAGRANTFILE_API_VERSION = "2"

 Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
-  config.vm.box = "dannycoates/fedora20"
+  config.vm.box_url = "https://dl.dropboxusercontent.com/u/15733306/vagrant/fedora-20-netinst-2014_01_05-minimal-puppet-guestadditions.box"
+  config.vm.box = "fedora-20"
   config.vm.synced_folder ".", "/vagrant", disabled: true
   config.vm.hostname = 'fxa.local'

diff --git i/vagrant/insecure_private_key w/vagrant/insecure_private_key
old mode 100644
new mode 100755

UPDATED Patch: Look at the line oauth_db_password note.

@vladikoff
Copy link
Contributor

@vladikoff vladikoff commented Dec 4, 2014

A lot of ignore_errors: true, what are the errors and how problematic are those?

@renoirb
Copy link
Author

@renoirb renoirb commented Dec 4, 2014

As I said in the issue. Its an attempt to setup from an external person who doesn’t have access to Vagrant VM image dcoates/fedora20.

I started from an empty VM, no databases, nothing.

Problem is that Ansible scripts assumes that it will be successful even from a vanilla VM and stops ANY install steps, even non dependent ones unless I make force the ignore.

Its simply incomplete setup and i’m hopeful to make it work.

I’m still compiling all the steps to make it work.

According to supervisord, i’m there now:

[root@fxa fxa-auth-server]# supervisorctl status
elasticsearch                    RUNNING    pid 17636, uptime 0:59:10
fxa-auth-db-server               RUNNING    pid 18116, uptime 0:37:10
fxa-auth-mailer                  FATAL      Exited too quickly (process log may have details)
fxa-auth-server                  FATAL      Exited too quickly (process log may have details)
fxa-content-server               RUNNING    pid 17635, uptime 0:59:10
fxa-customs-server               RUNNING    pid 17631, uptime 0:59:10
fxa-oauth-server                 FATAL      Exited too quickly (process log may have details)
fxa-profile:profile-server       RUNNING    pid 17646, uptime 0:59:10
fxa-profile:profile-static       RUNNING    pid 17642, uptime 0:59:10
fxa-profile:profile-worker       RUNNING    pid 17643, uptime 0:59:10
fxa-rp                           FATAL      Exited too quickly (process log may have details)
hekad                            RUNNING    pid 17649, uptime 0:59:10

I’ll share my rough notes once i’m done.

@renoirb
Copy link
Author

@renoirb renoirb commented Dec 4, 2014

Here’s where I am now.

    supervisorctl status
    elasticsearch                    RUNNING    pid 17636, uptime 1:28:15
    fxa-auth-db-server               RUNNING    pid 18116, uptime 1:06:15
    fxa-auth-mailer                  RUNNING    pid 19400, uptime 0:00:06
    fxa-auth-server                  RUNNING    pid 18872, uptime 0:26:20
    fxa-content-server               RUNNING    pid 17635, uptime 1:28:15
    fxa-customs-server               RUNNING    pid 17631, uptime 1:28:15
    fxa-oauth-server                 RUNNING    pid 18987, uptime 0:18:59
    fxa-profile:profile-server       RUNNING    pid 17646, uptime 1:28:15
    fxa-profile:profile-static       RUNNING    pid 17642, uptime 1:28:15
    fxa-profile:profile-worker       RUNNING    pid 17643, uptime 1:28:15
    fxa-rp                           RUNNING    pid 19277, uptime 0:09:48
    hekad                            RUNNING    pid 17649, uptime 1:28:15

Procedure is here

@renoirb
Copy link
Author

@renoirb renoirb commented Dec 6, 2014

I just updated the Procedure in this gist. Its not yet fully running, but I see progress.

@renoirb renoirb changed the title Make first vagrant up work for a new contributor. Make first vagrant up work for a new contributor. Dec 6, 2014
@renoirb renoirb changed the title Make first vagrant up work for a new contributor. Make first vagrant up work for a new contributor. Dec 6, 2014
@renoirb
Copy link
Author

@renoirb renoirb commented Dec 6, 2014

To answer your question @vladikoff the steps assumes in its current sequence that everything services along the way successfully starts. Unfortunately in some cases, it doesn’t add dependencies as if it was from a new VM.

Its a common problem when we work on deployment scripts. Sometimes we forget to trash the previous VM and try if it still works.

@rfk
Copy link
Member

@rfk rfk commented Mar 9, 2015

I'm going through and cleaning up some of our old bugs. @renoirb do you still have interest in this? IIUC none of the FxA core devs are using the vagrant stuff in this repo any longer.

@rfk
Copy link
Member

@rfk rfk commented Mar 17, 2015

I'm going to close this out since the vagrant stuff in that repo is essentially unmaintaned. We may revisit with e.g. a docker based flow in the future.

@rfk rfk closed this Mar 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants