From f78e9d47d152971e0b8b341a7429112d851451e6 Mon Sep 17 00:00:00 2001 From: kevgliss Date: Sun, 19 Jul 2015 19:07:08 -0700 Subject: [PATCH 1/5] Merge pull request #21 from kevgliss/buildfixes Build Fixes --- docs/faq.rst | 11 ++++++++--- docs/production/index.rst | 13 +++++++++++++ docs/quickstart/index.rst | 6 ++++++ gulp/build.js | 12 +++++++++++- lemur/static/app/angular/app.js | 2 +- package.json | 2 +- setup.py | 2 ++ 7 files changed, 42 insertions(+), 6 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 2f788cfa..f3f32a35 100644 --- a/docs/production/index.rst +++ b/docs/production/index.rst @@ -106,7 +106,12 @@ You can make some adjustments to get a better user experience:: } location / { +<<<<<<< HEAD root /apps/lemur/lemur/static/dist; +======= + root /www/lemur/lemur/static/dist; + include mime.types; +>>>>>>> b978435... Merge pull request #21 from kevgliss/buildfixes index index.html; } @@ -171,7 +176,12 @@ sensitive nature of Lemur and what it controls makes this essential. This is a s } location / { +<<<<<<< HEAD root /apps/lemur/lemur/static/dist; +======= + root /www/lemur/lemur/static/dist; + include mime.types; +>>>>>>> b978435... Merge pull request #21 from kevgliss/buildfixes index index.html; } @@ -204,6 +214,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 2e39a645..432b14c3 100644 --- a/docs/quickstart/index.rst +++ b/docs/quickstart/index.rst @@ -148,6 +148,7 @@ Proxying with Nginx You'll use the builtin HttpProxyModule within Nginx to handle proxying:: location / { +<<<<<<< HEAD proxy_pass http://localhost:5000; proxy_redirect off; @@ -155,6 +156,11 @@ You'll use the builtin HttpProxyModule within Nginx to handle proxying:: proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; +======= + root /www/lemur/lemur/static/dist; + include mime.types; + index index.html; +>>>>>>> b978435... Merge pull request #21 from kevgliss/buildfixes } See :doc:`../production/index` for more details on using Nginx. 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 5e07860b..6fe6f23f 100644 --- a/setup.py +++ b/setup.py @@ -80,6 +80,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', From f679392c610c0cb1f7fb61986f30bf8db3c53054 Mon Sep 17 00:00:00 2001 From: kevgliss Date: Sun, 19 Jul 2015 19:28:49 -0700 Subject: [PATCH 2/5] Fixing bad cherry pick --- docs/production/index.rst | 8 -------- docs/quickstart/index.rst | 6 +++--- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/docs/production/index.rst b/docs/production/index.rst index f3f32a35..0e4829bd 100644 --- a/docs/production/index.rst +++ b/docs/production/index.rst @@ -106,12 +106,8 @@ You can make some adjustments to get a better user experience:: } location / { -<<<<<<< HEAD - root /apps/lemur/lemur/static/dist; -======= root /www/lemur/lemur/static/dist; include mime.types; ->>>>>>> b978435... Merge pull request #21 from kevgliss/buildfixes index index.html; } @@ -176,12 +172,8 @@ sensitive nature of Lemur and what it controls makes this essential. This is a s } location / { -<<<<<<< HEAD - root /apps/lemur/lemur/static/dist; -======= root /www/lemur/lemur/static/dist; include mime.types; ->>>>>>> b978435... Merge pull request #21 from kevgliss/buildfixes index index.html; } diff --git a/docs/quickstart/index.rst b/docs/quickstart/index.rst index 432b14c3..5c4943ad 100644 --- a/docs/quickstart/index.rst +++ b/docs/quickstart/index.rst @@ -148,7 +148,6 @@ Proxying with Nginx You'll use the builtin HttpProxyModule within Nginx to handle proxying:: location / { -<<<<<<< HEAD proxy_pass http://localhost:5000; proxy_redirect off; @@ -156,11 +155,12 @@ You'll use the builtin HttpProxyModule within Nginx to handle proxying:: proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; -======= + } + + location / { root /www/lemur/lemur/static/dist; include mime.types; index index.html; ->>>>>>> b978435... Merge pull request #21 from kevgliss/buildfixes } See :doc:`../production/index` for more details on using Nginx. From 13f34fc6001e3433f2d4c0f22edebcc1fa70ab8a Mon Sep 17 00:00:00 2001 From: kevgliss Date: Sun, 19 Jul 2015 19:07:08 -0700 Subject: [PATCH 3/5] Merge pull request #21 from kevgliss/buildfixes Build Fixes --- docs/production/index.rst | 1 - docs/quickstart/index.rst | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/production/index.rst b/docs/production/index.rst index 8bddb99d..c297d786 100644 --- a/docs/production/index.rst +++ b/docs/production/index.rst @@ -187,7 +187,6 @@ sensitive nature of Lemur and what it controls makes this essential. This is a s location / { root /path/to/lemur/static/dist; include mime.types; - index index.html; } diff --git a/docs/quickstart/index.rst b/docs/quickstart/index.rst index 034141fb..52865648 100644 --- a/docs/quickstart/index.rst +++ b/docs/quickstart/index.rst @@ -187,7 +187,7 @@ You'll use the builtin HttpProxyModule within Nginx to handle proxying proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } - + location / { root /www/lemur/lemur/static/dist; include mime.types; From 48f38a8625bc093af181bab76a36f33869b1851b Mon Sep 17 00:00:00 2001 From: kevgliss Date: Sun, 19 Jul 2015 19:28:49 -0700 Subject: [PATCH 4/5] Fixing bad cherry pick --- docs/production/index.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/production/index.rst b/docs/production/index.rst index c297d786..8bddb99d 100644 --- a/docs/production/index.rst +++ b/docs/production/index.rst @@ -187,6 +187,7 @@ sensitive nature of Lemur and what it controls makes this essential. This is a s location / { root /path/to/lemur/static/dist; include mime.types; + index index.html; } From b8720566d776cb3216d7fb9c8055ddcdeaaac53a Mon Sep 17 00:00:00 2001 From: kevgliss Date: Sun, 9 Aug 2015 16:52:14 -0700 Subject: [PATCH 5/5] fixing merge conflict --- docs/production/index.rst | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docs/production/index.rst b/docs/production/index.rst index 5b82c3a3..8bddb99d 100644 --- a/docs/production/index.rst +++ b/docs/production/index.rst @@ -185,11 +185,7 @@ sensitive nature of Lemur and what it controls makes this essential. This is a s } location / { -<<<<<<< HEAD root /path/to/lemur/static/dist; -======= - root /www/lemur/lemur/static/dist; ->>>>>>> f679392c610c0cb1f7fb61986f30bf8db3c53054 include mime.types; index index.html; }