Skip to content

Commit

Permalink
deploy shell script!
Browse files Browse the repository at this point in the history
@kylewm mind trying this out when you get a chance? not urgent.
  • Loading branch information
snarfed committed Jan 28, 2016
1 parent f129f6c commit 793899d
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 9 deletions.
10 changes: 1 addition & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,7 @@ ln -s <path to webmention-tools>/webmentiontools \
The symlinks are necessary because App Engine's `vendor` module evidently
doesn't follow `.egg-link` or `.pth` files. :/

This command runs the tests, pushes any changes in your local repo, and
deploys to App Engine:

```shell
cd ../oauth-dropins && source local/bin/activate.csh && python -m unittest discover && \
cd ../granary && source local/bin/activate.csh && python -m unittest discover && \
cd ../bridgy && source local/bin/activate.csh && python -m unittest discover && \
git push && md5sum -c keys.md5 && ~/google_appengine/appcfg.py update .
```
To deploy to App Engine, run [`scripts/deploy.sh`](https://github.com/snarfed/bridgy/blob/master/scripts/deploy.sh).

[`remote_api_shell`](https://cloud.google.com/appengine/docs/python/tools/remoteapi#using_the_remote_api_shell)
is a useful interactive Python shell that can interact with the production app's
Expand Down
38 changes: 38 additions & 0 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash
#
# Checks pre-deploy safeguards - tests, app keys, package versions - then deploys.
#
# Expects that your local bridgy, granary, and oauth-dropins repos are all in
# the same directory, and that you have the App Engine SDK installed.
#
# TODO: check that granary, oauth-dropins, and webutil are up to date.

set -e
src=`dirname $0`/../..

# run unit tests
cd $src/oauth-dropins && source local/bin/activate
python -m unittest discover

cd $src/granary && source local/bin/activate
python -m unittest discover

cd $src/bridgy && source local/bin/activate
python -m unittest discover

# check silo app keys (aka client ids)
md5sum -c keys.md5

# check package versions
missing=`pip freeze -q -r requirements.freeze.txt | join --nocheck-order -v 2 - requirements.freeze.txt`
if [[ "$missing" != "" ]]; then
echo 'ERROR: Package version mismatch! Expected:'
echo $missing
exit 1
fi

echo 'Package versions OK.'

# push commits and deploy!
git push
appcfg.py update .

3 comments on commit 793899d

@kylewm
Copy link
Contributor

@kylewm kylewm commented on 793899d Jan 28, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohh this looks great, will test soon!

@bear
Copy link

@bear bear commented on 793899d Jan 28, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question about the package version check. The order of the two file inputs to join seem wrong (at least from what I run) -- comparing my working environment where blinker is a new package to the frozen file...

$ pip freeze -q -r requirements.freeze.txt | join --nocheck-order -v 2 requirements.freeze.txt -
## The following requirements were added by pip freeze:
blinker==1.4

bear@opus ~/circleci/python_testing/tenki (master %)
$ pip freeze -q -r requirements.freeze.txt | join --nocheck-order -v 2 - requirements.freeze.txt

@snarfed
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

huh, that's odd. i definitely get the opposite behavior. ie i want to find anything in the frozen file (the second arg) that isn't in the first, hence -v 2.

hell:~/src/bridgy{master}> pip freeze -q -r requirements.freeze.txt | join --nocheck-order -v 2 - requirements.freeze.txt
hell:~/src/bridgy{master}> echo blinker==1.4 >> requirements.freeze.txt
hell:~/src/bridgy{master}> pip freeze -q -r requirements.freeze.txt | join --nocheck-order -v 2 - requirements.freeze.txt
blinker==1.4
hell:~/src/bridgy{master}> 

i wonder what we're missing.

Please sign in to comment.