Closed
Bug 807351
Opened 13 years ago
Closed 13 years ago
Move Mozillians Update Script To /bin/update_site.py
Categories
(Participation Infrastructure :: Phonebook, defect, P1)
Participation Infrastructure
Phonebook
Tracking
(Not tracked)
VERIFIED
FIXED
People
(Reporter: bensternthal, Assigned: nmaul)
Details
Currently the update script for mozillians is maintained on the admin node for the cluster, it is not in a public repository.
We would like to move this into /bin/update_site.py within the project and IT's shell script will just call this.
![]() |
||
Updated•13 years ago
|
OS: Mac OS X → All
Hardware: x86 → All
![]() |
||
Comment 1•13 years ago
|
||
Here are the parts of the shell script that could be moved into the python script
CODE_DIR="/data/genericrhel6-dev/src/mozillians-dev.allizom.org/mozillians"
VENDOR_DIR="$CODE_DIR/vendor"
LOCALE_DIR="$CODE_DIR/locale"
echo -e "Updating code..."
cd $CODE_DIR
git fetch origin -q
checkretval
git checkout -f origin/master -q
git submodule sync -q
git submodule update --init --recursive -q
checkretval
echo -e "Updating vendor..."
cd $VENDOR_DIR
git submodule sync -q
git submodule update --init --recursive -q
checkretval
cd $LOCALE_DIR
find . -name "*.mo" -delete
svn up
checkretval
./compile.sh
checkretval
cd $CODE_DIR
find . -type f -name '.gitignore' -or -name '*.pyc' -delete
checkretval
cd $CODE_DIR
python -W ignore ./manage.py collectstatic --noinput
checkretval
cd $CODE_DIR
python -W ignore ./manage.py compress_assets
checkretval
cd $CODE_DIR
# python vendor/src/schematic/schematic migrations
python -W ignore manage.py syncdb
checkretval
python -W ignore manage.py migrate
checkretval
cd $CODE_DIR
python -W ignore manage.py update_product_details -f 2>&1
checkretval
cd $CODE_DIR
git rev-parse HEAD > $CODE_DIR/media/revision
cd $CODE_DIR
python -W ignore ./manage.py cron index_all_profiles
checkretval
checkretval is a function that confirms each command returns a 0
function checkretval()
{
retval=$?
if [[ $retval -gt 0 ]]
then
$error "Error!!! Exit status of the last command was $retval"
exit $retval
fi
}
This is used by the shell script to abort if anything returns 0, then cron sends an error email
Let us know when you have a version to test on dev
![]() |
Assignee | |
Comment 2•13 years ago
|
||
erm... confusion here, Mozillians is deployed by Chief now, and there's a different (Python) script that handles it.
The simple solution is to just check in the update.py script that Chief uses into your git repo. AMO and SUMO do it this way:
https://github.com/mozilla/kitsune/tree/master/scripts/update
Note that *their* script is not *your* script... that's just an example.
There's a separate commander_settings.py as well, which functions a bit like a settings_local.py file and would not be in git. You can see a sample .dist file in there.
I can send a pull request that gets you started if you like.
![]() |
||
Comment 3•13 years ago
|
||
:solarce thnx for the script
:jakem please help us with a help request!
![]() |
Assignee | |
Comment 4•13 years ago
|
||
![]() |
Assignee | |
Comment 5•13 years ago
|
||
Once that's merged we'll need to update the config for the Chief app to call your script instead of our local copy. We'll also need to put the commander_settings.py config file in place.
Comment 6•13 years ago
|
||
Commits pushed to master at https://github.com/mozilla/mozillians
https://github.com/mozilla/mozillians/commit/c492a6d0b5e1d16a6d7fd3c1e9160b44a8d9e235
[bug 807351] Moving Chief/Commander update scripts into repo.
https://github.com/mozilla/mozillians/commit/a09e25fb31b5806a86930476910c2b4905d41aae
[bug 807351] Add ES index update command.
![]() |
||
Comment 7•13 years ago
|
||
@jakem I merged your pull request and added a function to re-index ES upon merge. I call this function in update().
We have this code now in dev. When we push it to stage we need to create commander_settings.py, right?
![]() |
||
Comment 8•13 years ago
|
||
Jakem:
The update.py script is now on stage. Can you please activate it?
Thanks!
Comment 9•13 years ago
|
||
Commit pushed to master at https://github.com/mozilla/mozillians
https://github.com/mozilla/mozillians/commit/07a968e104d101831f106f680034c0392f2e00d8
[bug 807351] Add collectstatic command.
![]() |
||
Updated•13 years ago
|
Assignee: giorgos → nmaul
![]() |
Reporter | |
Comment 10•13 years ago
|
||
Jake can you activate this on stage.
Pushing new code to stage (and having it pass tests) is dependent on this.
![]() |
||
Comment 11•13 years ago
|
||
How soon can we get this activated on stage? QA is seeing our test suite fail (which appears linked to this bug) - https://bugzilla.mozilla.org/show_bug.cgi?id=816264#c3 - we've xfailed the failing test for the time being.
![]() |
Reporter | |
Comment 12•13 years ago
|
||
Jake, do I need to move this to a server ops bug?
Flags: needinfo?(nmaul)
![]() |
Assignee | |
Comment 13•13 years ago
|
||
This is completed. The commander_settings.py is moved to the proper (new) place, and the Chief config is updated to point to your copy of the update.py script (at scripts/update/update.py).
Leaving open, pending a green light to do the same on prod.
Flags: needinfo?(nmaul) → needinfo?(giorgos)
![]() |
||
Comment 14•13 years ago
|
||
Tried to push to stage and got this error:
"""
Traceback (most recent call last):
File "/usr/bin/commander", line 4, in <module>
main()
File "/usr/lib/python2.6/site-packages/commander/main.py", line 101, in main
cmd_mod = import_cmdfile(cmdfile)
File "/usr/lib/python2.6/site-packages/commander/main.py", line 82, in import_cmdfile
return imp.load_source('cmdfile', cmdfile)
IOError: [Errno 2] No such file or directory
"""
Flags: needinfo?(giorgos)
![]() |
Reporter | |
Comment 15•13 years ago
|
||
Jake can you help us debug the error Giorgos received.
Flags: needinfo?(nmaul)
![]() |
Reporter | |
Comment 16•13 years ago
|
||
Bumping up the priority. We are now blocked from pushing live.
Priority: -- → P1
![]() |
||
Comment 17•13 years ago
|
||
I am looking into
![]() |
Assignee | |
Comment 18•13 years ago
|
||
This is fixed on stage now. Prod is not converted to Chief yet, so if you're in need of a push there rather quickly, let's do that the old-fashioned way and not block on converting it while under duress.
Flags: needinfo?(nmaul)
![]() |
Reporter | |
Comment 19•13 years ago
|
||
Ok thanks, we need to wait for giorgos to double check everything is working properly.
We will not push live/convert under duress.
![]() |
||
Comment 20•13 years ago
|
||
Works as promised on stage, thnx :solarce!
![]() |
Reporter | |
Updated•13 years ago
|
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
![]() |
Reporter | |
Comment 21•13 years ago
|
||
Jake:
Do i need to file a new bug to get this task complete on production or should I re-open this one.
![]() |
Reporter | |
Updated•13 years ago
|
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
![]() |
Reporter | |
Updated•13 years ago
|
Flags: needinfo?(nmaul)
![]() |
||
Comment 22•13 years ago
|
||
(In reply to Jake Maul [:jakem] from comment #18)
> Prod is not converted to Chief yet,
Jake, I'm not sure I understand your comment. We are using Chief on prod already. Can we please activate the same script on production?
Thanks!
Flags: needinfo?(nmaul)
![]() |
Assignee | |
Comment 23•13 years ago
|
||
Sorry, that was poorly worded. I meant to say, prod was not converted over to use *your* update script, and was still using ours.
This has just been completed. Prod is now using scripts/update/update.py, just like stage does.
I haven't run a deploy this way, but I don't expect any trouble. If you have any trouble with it, please let me know.
Status: REOPENED → RESOLVED
Closed: 13 years ago → 13 years ago
Flags: needinfo?(nmaul)
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•