Page MenuHomePhabricator

Set up a staging/testing space for the dashboards (Discovery dashboards beta)
Closed, ResolvedPublic4 Estimated Story Points

Description

We need a second dashboard instance on a new machine that we can use as a test/staging platform. One likely side-effect of this is that we rework the vagrant setup so that it only polls for a new version when it's told to, rather than every N minutes - which honestly is probably a far better approach.

Event Timeline

Ironholds raised the priority of this task from to Needs Triage.
Ironholds updated the task description. (Show Details)
Ironholds added a project: Discovery-ARCHIVED.
Ironholds subscribed.
Deskana subscribed.
Deskana renamed this task from Set up a staging/testing space for the dashboards to Set up a staging/testing space for the dashboards (Discovery dashboards beta).Oct 15 2015, 8:20 PM
Deskana set Security to None.

When @Ironholds has an opportunity, I would like him to show me how to set up forwarding and whatnot so we have beta.discovery.wmflabs.org (for example) pointing somewhere.

Okay, now we have a http://discovery-beta.wmflabs.org/

(Thanks to @Ironholds for showing me how to spin up an instance and make a web proxy!)

Awaiting a +2 on a tiny patch (https://gerrit.wikimedia.org/r/#/c/249599/) that I'll use for testing out a "keep the dashboards always up-to-date" script.

Alright. I've got the following script scheduled to run every 5 minutes (as update-beta.sh in my home directory on that instance. It appears to work as intended (have the latest versions of the dashboards).

cd /srv/dashboards

# We need to check if the dashboards repo has been
# updated (e.g. packages added to setup.sh). Only
# then can we pull latest versions of dashboards.

# Bring remote references up to date:
git fetch origin

# Check if there are remote changes that
# need to be merged in:
MERGES=$(git log HEAD..origin/master --oneline)
if [ ! -z "$MERGES" ]; then
  CHANGES=$(git diff --shortstat)
  if [ ! -z "$CHANGES" ]; then
    # Clean out uncommitted references to dashboards:
    git submodule update --init
    # ^ avoids conflicts when pulling origin/master
  fi
  # Bring this repo up-to-date:
  git pull origin master
  # Do some minor doctoring:
  sed -i 's/\(Discovery Dashboards\)/\1 (Beta)/g' shiny-server/index.html 
  # Re-provision the vagrant container:
  bash setup.sh
fi

# Pull latest version of each dashboard:
git submodule foreach git pull origin master

# Check if newer ver's of dashboards were downloaded...
# ...but first let's ensure we don't get an error:
if [ ! -e '/home/bearloga/submodules_status.txt' ]; then
  touch /home/bearloga/submodules_status.txt
fi
# ...okay, let's actually do the check now:
OLDSTATUS=`cat /home/bearloga/submodules_status.txt`
NEWSTATUS=$(git submodule status)
if [ "$OLDSTATUS" != "$NEWSTATUS" ]; then
  # Restart because different (newer?) dashboards were dl'd:
  service shiny-server restart
  # Save hashes for next checkup:
  git submodule status > /home/bearloga/submodules_status.txt
fi

Oliver and I discussed adding version info on the index page (http://discovery-beta.wmflabs.org/) and I think the best (read: easiest) way to do that would be something similar to where I add "(Beta)" to the header. We can include empty space for it in index.html and then use sed to inject git commit info into it for the dashboards. (This beats installing and configuring apache2/php5 on the instance, but that's just my $.02)