From 882378f6f9ed8ec340bb993539c02b9bd2173337 Mon Sep 17 00:00:00 2001 From: Harvey Kandola Date: Tue, 10 May 2016 15:02:28 -0700 Subject: [PATCH 1/3] null check for dbhash presence --- app/app/services/session.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/app/services/session.js b/app/app/services/session.js index 315c1592..a31a5bcd 100644 --- a/app/app/services/session.js +++ b/app/app/services/session.js @@ -143,8 +143,12 @@ export default Ember.Service.extend({ // Application boot process boot() { let self = this; + let dbhash = ""; + + if (is.not.null(document.head.querySelector("[property=dbhash]"))) { + dbhash = document.head.querySelector("[property=dbhash]").content; + } - let dbhash = document.head.querySelector("[property=dbhash]").content; if (dbhash.length > 0 && dbhash !== "{{.DBhash}}") { self.get('appMeta').set('orgId', "response.orgId"); self.get('appMeta').setSafe('title', "Documize Setup"); From 76986d3ca363ff888ab693b500f57a1ef1304499 Mon Sep 17 00:00:00 2001 From: Elliott Stoneham Date: Wed, 11 May 2016 15:06:50 +0100 Subject: [PATCH 2/3] add go-bindata builds to build.sh --- build.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build.sh b/build.sh index 7474cdb0..be4ed05c 100755 --- a/build.sh +++ b/build.sh @@ -26,6 +26,8 @@ mkdir -p documize/web/bindata/scripts cp -r documize/database/scripts documize/web/bindata echo "Generating in-memory static assets..." +go get github.com/jteeuwen/go-bindata/... +go get github.com/elazarl/go-bindata-assetfs/... cd documize/web go generate From a1e2f8d4dd90ea04aaf52ca1a619925535e9693c Mon Sep 17 00:00:00 2001 From: Elliott Stoneham Date: Wed, 11 May 2016 16:51:38 +0100 Subject: [PATCH 3/3] improve and document set-up process --- README.md | 59 +++++++++++++++++++++++++++++++++++++++++++++++-------- build.sh | 2 ++ 2 files changed, 53 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 0c5a0483..566c32c9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,54 @@ -# To Document / Instructions +# Instructions + +Install the prerequisites: +* Go from https://golang.org (be careful to set the $GOPATH environment variable correctly) +* NPM from https://www.npmjs.com +* Ember from http://emberjs.com/ +* MySQL (v10.7+) from http://dev.mysql.com/downloads/mysql/ + +Make sure this repository sits at the following position relative to your $GOPATH: ```$GOPATH/src/github.com/documize/community``` + +After cloning the repository in the above location, go there and run: ```./build.sh``` + +Your ```./bin``` directory should now contain a set of binaries for a number of target systems. + +Now create an empty database in MySql for Documize to use, making sure that the default collation setting is ```utf8_general_ci``` or some other utf8 variant. + +Run Documize for the first time to set-up the database and your user information +(for example on OSX, using port 5001, MySQL user root/password and database 'documize'): +``` +./bin/documize-darwin-amd64 -port=5001 -db='root:password@tcp(localhost:3306)/documize' +``` +An error message will appear in the log to say your installation is in set-up mode. +Now navigate to http://localhost:5001 and follow the instructions. + +Hopefully you will now have a working Documize instance. + +# Ember + +To run the Ember code using ```ember s``` from the app directory, the Go binary needs to run an SSL server on port 5001. + +If you don't have a valid certification key pair for your machine, you can generate them by doing the following: +``` +cd selfcert +go run generate_cert.go -host localhost +cd .. +``` +...obviously you should never use a self generated certificate in a live environment. + + +To run Documize using those certs (using the set-up above): +``` +./bin/documize-darwin-amd64 -db='root:password@tcp(localhost:3306)/documize' -port=5001 -cert selfcert/cert.pem -key selfcert/key.pem +``` +With this process running in the background, Ember should work. + +If you navigate to https://localhost:5001 and you want to remove the Chrome warning messages about your invalid self-cert +follow the instructions at: https://www.accuweaver.com/2014/09/19/make-chrome-accept-a-self-signed-certificate-on-osx/ + +TODO - document SMTP and Token + +# To Document The build process around go get github.com/elazarl/go-bindata-assetfs @@ -23,10 +73,3 @@ go run generate_cert.go -host demo1.dev port number not required but browser restart is! -## after clone - -- cd app -- npm install -- bower install -- cd .. -- ./build.sh diff --git a/build.sh b/build.sh index be4ed05c..def8429b 100755 --- a/build.sh +++ b/build.sh @@ -5,6 +5,8 @@ echo "Build process started $NOW" echo "Building Ember assets..." cd app +npm install +bower install ember b -o dist-prod/ --environment=production echo "Copying Ember assets..."