/bouncerscript

Primary LanguagePythonMozilla Public License 2.0MPL-2.0

Bouncerscript README

Build Status Coverage Status

deploy a new version to staging

In order to rollout a new version of bouncerscript for testing, one must roll-out a new version, deploy it within puppet internal pypi mirrors and pin the bouncerworkers to one's environment.

  1. Once your PR is ready for testing, make sure to create a new version like <next-version>.dev0+pr<pr number> under version.txt.
  2. Create wheel with python3 setup.py bdist_wheel and scp that file under puppet
  3. Login in puppet and change directory in your environment (e.g. /etc/puppet/environments/$whoami)
  4. Make sure to have the puppet repo up-to-date there
  5. Tweak the bouncerscript version in the module's requirements.txt to reflect the new value, and also to force all the dev bouncerworkers to be chained to your environment. Something like this:
diff --git a/manifests/moco-nodes.pp b/manifests/moco-nodes.pp
index a8357fb..1982cec 100644
--- a/manifests/moco-nodes.pp
+++ b/manifests/moco-nodes.pp
@@ -977,7 +977,7 @@ node /^bouncerworker-dev.*\.srv\.releng\..*\.mozilla\.com$/ {
     $only_user_ssh       = true
+    $pin_puppet_server = 'releng-puppet2.srv.releng.mdc1.mozilla.com'
+    $pin_puppet_env    = 'mtabara'
     include toplevel::server::bouncerscriptworker
 }

diff --git a/modules/bouncer_scriptworker/files/requirements.txt b/modules/bouncer_scriptworker/files/requirements.txt
--- a/modules/bouncer_scriptworker/files/requirements.txt
+++ b/modules/bouncer_scriptworker/files/requirements.txt
@@ -5,7 +5,7 @@ aiohttp==3.2.1
 PyYAML==3.12
 aiohttp==3.3.2
 arrow==0.12.1
 async_timeout==3.0.0
-bouncerscript==2.0.0  # puppet: nodownload
+bouncerscript==X.X.X # dev version to be tested
 attrs==18.1.0
 certifi==2018.4.16
...
  1. Login to all machines to chain them to your environment and also deploy the newer testing version
# vpn
for i in {1..10}; do
nslookup bouncerworker-dev$i | grep Name: | sed -e 's/Name:\t//'
done > /src/ops/hosts/bouncer-dev
csshX --hosts /src/ops/hosts/bouncer-dev
sudo puppet agent --test --server=releng-puppet2.srv.releng.mdc1.mozilla.com --environment=mtabara # or unpin or w/e

deploy a new version to production

  1. Once your PR is reviewed and passes the tests, have one of the admins review & merge it
  2. Bump to new version in version.txt.
  3. Amend the CHANGELOG.md to reflect the new changes
  4. Commit with a "%VERSION%" message
  5. git tag -s %VERSION%
  6. git push
  7. git push --tags
  8. Create wheel with python3 setup.py bdist_wheel and scp that file under puppet
  9. Wait for that file to be synchronized across all puppet instances (emails arrive to confirm that)
  10. Tweak the bouncerscript version in the module's requirements.txt to reflect the new value
  11. Create a PR for your change and get review
  12. Merge it when approved and tests pass
  13. There are currently a single prod and a single dev bouncerworkers. You can wait for the cron job to run puppet to deploy new changes every 30 mins or so. Alternatively, can wait for the puppet masters to sync the change (~5 minutes, see mail again), and force the puppet run by logging-in to each of the machines:
# vpn
for i in {1..10}; do
nslookup bouncerworker-$i | grep Name: | sed -e 's/Name:\t//'
done > /src/ops/hosts/bouncer-prod
csshX --hosts /src/ops/hosts/bouncer-prod
sudo puppet agent --test