I'm not at liberty to share the Ansible scripts that I run, sorry about
that.
The actual installation of ReviewBoard was pretty easy:
# Install ReviewBoard itself
- name: Install ReviewBoard
easy_install: name="ReviewBoard==2.0.15"
sudo: yes
register: reviewboard_install
That's the simple part! (Note the use of the "reviewboard_install"
registered variable - later in my Ansible task list, I make a complete
backup of the database if this is true, so that in the case of a real
upgrade, the data is automatically backed up.)
In general, I've found success with Ansible by going one step at a time. In
my case, I created a clone of my production server by way of building out
an Ansible script executing against a VM. Then I could restore my VM state
and re-run my Ansible playbook as many times as I wanted, tweaking it as
needed.
What this script looks like will vary based on your target OS, how you
configure Apache, and many other details. In my case, I tried to use as
many of the packages from the system package manager, and only use the ones
installed by easy_install when the OS-provided package was insufficient.
To make it easy to test against production data, I put this in my Ansible
script:
- name: Copy database backup file to machine
copy: src="{{ rb_database_backup }}" dest=/root/toimport.sql
sudo: yes
when: rb_database_backup is defined
- name: Import existing machine data
shell: mysql -u root -p{{ mysql_root_password }} < /root/toimport.sql
when: rb_database_backup is defined
sudo: yes
So if I invoke the Ansible script with
"--extra-vars=rb_database_backup=/path/to/export/of/production/data", then
I end up with a complete working copy of the production system, with all of
its data (from when I did the backup).
The other trick, which works nicely with ReviewBoard is the installation &
upgrade part. Ansible is built running idempotent operations, and the
structure of ReviewBoard management tasks is such that they (mostly) just
work in that context. Which means you can get away with something like this
(I've edited this to remove information specific to my company, so this
script won't work as-is).
- name: Create databases
mysql_db: name="rbdatabase"
sudo: yes
- name: Grant privileges
mysql_user: name=rbuser append_privs="yes" priv="rbdatabase.*:ALL"
sudo: yes
- name: Create RB instances
command: rb-site install --noinput "--domain-name={{ machine_host_name
}}.{{ machine_domain_name }}" "--site-root=/rbinstance/" --db-type=mysql
"--db-name=rbdatabase" --db-host=localhost --db-user=rbuser "--db-pass={{
mysql_rbuser_password }}" --cache-type=memcached
"--cache-info=localhost:11211" --web-server-type=apache
--web-server-port=80 --python-loader=wsgi "--admin-user=superuser"
"--admin-password={{ mysql_rbuser_password }}" "--company=__________"
"--admin-email=________@_______.com"
/var/www/___________/instances/rbinstance
sudo: yes
args:
creates: /var/www/________/instances/rbinstance
- name: Set permissions on ReviewBoard directories
file: path=/var/www/_______/instances/rbinstance/{{ item }} owner=apache
group=apache recurse=yes
sudo: yes
with_items:
- 'data'
- 'htdocs/media/uploaded'
- 'htdocs/media/ext'
- name: Upgrade ReviewBoard instance
command: rb-site upgrade /var/www/________/instances/rbinstance
sudo: yes
Also, Ansible is elegant in that you simply switch the "inventory" file
when you're ready to deploy to production. In my case "-i testing" becomes
"-i production". So I got my script completely ready, generating a
fully-functional clone running in a VM, then I ran against production. If I
did my scripting right, that made minimal to no changes.
At which point I was free to then revisit the easy_install script task, and
bump the version of ReviewBoard (on my VM). Then iterate a few times fixing
up issues, each time resetting the clone VM to matching production state.
Then, once it executes flawlessly, run the script against production. It
executed relatively quickly, with almost no downtime.
Hope that helps.
Eric.
On Tuesday, June 23, 2015 at 12:46:34 AM UTC-7, Noopur Sankhere wrote:
>
>
> Hi,
>
> Can you please post here the steps for this? How did you do it? I need to
> do the same.
>
> On Tuesday, May 19, 2015 at 10:29:46 PM UTC+5:30, Eric Johnson wrote:
>>
>> Usually you get support requests on this mailing list.
>>
>> Thought I should toss in a email of gratitude.
>>
>> Deployed an upgrade from 1.7.28 --> 2.0.15 over the weekend.
>>
>> It pretty much just worked, once I fixed the minor issues in my Ansible
>> scripts.
>>
>> And then I started hearing from grateful users, who like the upgrade.
>>
>> Eric.
>>
>>
--
Supercharge your Review Board with Power Pack:
https://www.reviewboard.org/powerpack/
Want us to host Review Board for you? Check out RBCommons:
https://rbcommons.com/
Happy user? Let us know! https://www.reviewboard.org/users/
---
You received this message because you are subscribed to the Google Groups
"reviewboard" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.