From 8e0e22d49dd1473ac8d9810ff3d474dd5880685c Mon Sep 17 00:00:00 2001 From: kevgliss Date: Sun, 19 Jul 2015 19:03:04 -0700 Subject: [PATCH 1/2] Fixing issue where nginx was not sending the right mimetype for CSS files. --- docs/faq.rst | 11 ++++++++--- docs/production/index.rst | 5 +++++ docs/quickstart/index.rst | 1 + 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/docs/faq.rst b/docs/faq.rst index 115d319f..4354ab9e 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -4,9 +4,14 @@ Frequently Asked Questions Common Problems --------------- -In my startup logs I see *'Aborting... Lemur cannot locate db encryption key, is ENCRYPTION_KEY set?'* - You likely have not correctly configured **ENCRYPTION_KEY**. See - :doc:`administration/configuration` for more information. +In my startup logs I see *'Aborting... Lemur cannot locate db encryption key, is LEMUR_ENCRYPTION_KEY set?'* + You likely have not correctly configured **LEMUR_ENCRYPTION_KEY**. See + :doc:`administration/index` for more information. + + +I am seeing Lemur's javascript load in my browser but not the CSS. + Ensure that you are placing *include mime.types;* to your Nginx static file location. See + :doc:`production/index` for example configurations. How do I diff --git a/docs/production/index.rst b/docs/production/index.rst index c1d8f4ae..0e4829bd 100644 --- a/docs/production/index.rst +++ b/docs/production/index.rst @@ -107,6 +107,7 @@ You can make some adjustments to get a better user experience:: location / { root /www/lemur/lemur/static/dist; + include mime.types; index index.html; } @@ -172,6 +173,7 @@ sensitive nature of Lemur and what it controls makes this essential. This is a s location / { root /www/lemur/lemur/static/dist; + include mime.types; index index.html; } @@ -204,6 +206,9 @@ An example apache config:: Also included in the configurations above are several best practices when it comes to deploying SSL. Things like enabling HSTS, disabling vulnerable ciphers are all good ideas when it comes to deploying Lemur into a production environment. +.. note:: + This is a rather incomplete apache config for running Lemur (needs mod_wsgi etc.,), if you have a working apache config please let us know! + .. seealso:: `Mozilla SSL Configuration Generator `_ diff --git a/docs/quickstart/index.rst b/docs/quickstart/index.rst index 60afa6dd..c63bacee 100644 --- a/docs/quickstart/index.rst +++ b/docs/quickstart/index.rst @@ -147,6 +147,7 @@ You'll use the builtin HttpProxyModule within Nginx to handle proxying location / { root /www/lemur/lemur/static/dist; + include mime.types; index index.html; } From 5ce3f9427b4351f1d81cf882bed784b9e07f5e77 Mon Sep 17 00:00:00 2001 From: kevgliss Date: Sun, 19 Jul 2015 19:04:42 -0700 Subject: [PATCH 2/2] Fixed issue where hardcoded localhost:port combination existed in Javascript, added another step to setup.py 'package' that removes such instances and creates a more agnostic javascript blob. --- gulp/build.js | 12 +++++++++++- lemur/static/app/angular/app.js | 2 +- package.json | 2 +- setup.py | 2 ++ 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/gulp/build.js b/gulp/build.js index 9326d6be..4346a6de 100644 --- a/gulp/build.js +++ b/gulp/build.js @@ -26,7 +26,7 @@ var gulp = require('gulp'), imagemin = require('gulp-imagemin'), minifyHtml = require('gulp-minify-html'), bowerFiles = require('main-bower-files'), - replace = require('gulp-replace-task'); + replace = require('gulp-replace'); gulp.task('default', ['clean'], function () { @@ -227,5 +227,15 @@ gulp.task('build:images', function () { .pipe(size()); }); +gulp.task('package:strip', function () { + return gulp.src(['lemur/static/dist/scripts/main*']) + .pipe(replace('http:\/\/localhost:5000', '')) + .pipe(replace('http:\/\/localhost:3000', '')) + .pipe(useref()) + .pipe(revReplace()) + .pipe(gulp.dest('lemur/static/dist/scripts')) + .pipe(size()); +}); gulp.task('build', ['build:ngviews', 'build:inject', 'build:images', 'build:fonts', 'build:html', 'build:extras']); +gulp.task('package', ['package:strip']); diff --git a/lemur/static/app/angular/app.js b/lemur/static/app/angular/app.js index af4957f9..3ed03188 100644 --- a/lemur/static/app/angular/app.js +++ b/lemur/static/app/angular/app.js @@ -62,7 +62,7 @@ lemur.controller('datePickerController', function ($scope, $timeout){ lemur.factory('LemurRestangular', function (Restangular, $location, $auth) { return Restangular.withConfig(function (RestangularConfigurer) { - RestangularConfigurer.setBaseUrl('http://127.0.0.1:5000/api/1'); + RestangularConfigurer.setBaseUrl('http://localhost:5000/api/1'); RestangularConfigurer.setDefaultHttpFields({withCredentials: true}); RestangularConfigurer.addResponseInterceptor(function (data, operation, what, url, response, deferred) { diff --git a/package.json b/package.json index ee027237..b66140e1 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "gulp-plumber": "^0.6.4", "gulp-print": "^1.1.0", "gulp-protractor": "0.0.11", - "gulp-replace": "~0.4.0", + "gulp-replace": "~0.5.3", "gulp-replace-task": "~0.1.0", "gulp-rev": "^1.0.0", "gulp-rev-replace": "^0.3.0", diff --git a/setup.py b/setup.py index 93803b95..3685cb62 100644 --- a/setup.py +++ b/setup.py @@ -81,6 +81,8 @@ class BuildStatic(Command): log.info("running [gulp buld]") check_output([os.path.join(ROOT, 'node_modules', '.bin', 'gulp'), 'build'], cwd=ROOT) + log.info("running [gulp package]") + check_output([os.path.join(ROOT, 'node_modules', '.bin', 'gulp'), 'package'], cwd=ROOT) setup( name='lemur',