Skip to content

Commit

Permalink
Minify JS in the localserver upgrade tarball.
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
Kevin Mehall committed Nov 4, 2013
1 parent ca0848b commit 78b45b6
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 15 deletions.
7 changes: 0 additions & 7 deletions .gitattributes

This file was deleted.

4 changes: 4 additions & 0 deletions puppet/zulip/manifests/local_server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
ensure => 'link',
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
# on a local server.
Expand Down
6 changes: 0 additions & 6 deletions scripts/upgrade-zulip
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,6 @@ subprocess.check_call(["mv", os.path.join(extract_path, "zulip-server"), deploy_
subprocess.check_call(["rmdir", extract_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...")
subprocess.check_call(["./scripts/restart-server"])

Expand Down
34 changes: 33 additions & 1 deletion tools/build-local-server-tarball
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
#!/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"
5 changes: 4 additions & 1 deletion zproject/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,10 @@
# here so that urls.py can read it.
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_FINDERS = (
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
Expand Down

0 comments on commit 78b45b6

Please sign in to comment.