Minify JS in the localserver upgrade tarball.

This moves the list of removed files from .gitattributes to
tools/build-local-server-tarball because static/ and tools/ are
necessary for update-prod-static, and it seemed best to keep the
entire list in one place.

(imported from commit 2a447cbde29e90d776da43bb333650a40d4d363c)
This commit is contained in:
Kevin Mehall 2013-11-01 15:54:41 -04:00
parent ca0848b308
commit 78b45b61fb
5 changed files with 41 additions and 15 deletions

7
.gitattributes vendored
View File

@ -1,7 +0,0 @@
/tools export-ignore
/bots export-ignore
/zilencer export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/templates/.gitignore export-ignore
/puppet/zulip-internal export-ignore

View File

@ -33,6 +33,10 @@ class zulip::local_server {
ensure => 'link', ensure => 'link',
target => '/home/zulip/zulip', target => '/home/zulip/zulip',
} }
file { '/home/zulip/prod-static':
ensure => 'link',
target => '/home/zulip/deployments/current/prod-static/serve',
}
# This is just an empty file. It's used by the app to test if it's running # This is just an empty file. It's used by the app to test if it's running
# on a local server. # on a local server.

View File

@ -52,12 +52,6 @@ subprocess.check_call(["mv", os.path.join(extract_path, "zulip-server"), deploy_
subprocess.check_call(["rmdir", extract_path]) subprocess.check_call(["rmdir", extract_path])
os.chdir(deploy_path) os.chdir(deploy_path)
# Update static files
# TODO: Remove this and replace it with shipping already minified js.
logging.info("Updating static files")
subprocess.check_call(["./tools/update-prod-static", "--prev-deploy",
os.path.join(DEPLOYMENTS_DIR, 'current')])
logging.info("Restarting server...") logging.info("Restarting server...")
subprocess.check_call(["./scripts/restart-server"]) subprocess.check_call(["./scripts/restart-server"])

View File

@ -1,3 +1,35 @@
#!/bin/sh -ex #!/bin/sh -ex
git archive -o /tmp/zulip-server.tar.gz --prefix=zulip-server/ HEAD GITID=$(git rev-parse HEAD)
TMPDIR=$(mktemp -d)
DIR=$TMPDIR/zulip-server/
TARBALL=$TMPDIR/zulip-server.tar.gz
git checkout-index -f -a --prefix $DIR
cd $DIR
# update-prod-static generates the prod-static directory.
# See COLLECTSTATIC in settings.py
./tools/update-prod-static
xargs rm -r <<EOF
assets
bots
static
tools
zilencer
.gitignore
templates/.gitignore
puppet/zulip-internal
EOF
echo $GITID > version_id
mv update-prod-static.log ..
cd ..
tar -czf $TARBALL zulip-server
rm -r zulip-server
echo "Generated $TARBALL"

View File

@ -287,7 +287,10 @@ STATIC_URL = '/static/'
# here so that urls.py can read it. # here so that urls.py can read it.
PIPELINE = not DEBUG PIPELINE = not DEBUG
if DEBUG: # Use prod settings if exporting static files in build-local-server-tarball
COLLECTSTATIC = 'manage.py' in sys.argv[0] and sys.argv[1] == 'collectstatic'
if DEBUG and not COLLECTSTATIC:
STATICFILES_STORAGE = 'pipeline.storage.PipelineStorage' STATICFILES_STORAGE = 'pipeline.storage.PipelineStorage'
STATICFILES_FINDERS = ( STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.AppDirectoriesFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder',