Skip to content

Commit

Permalink
Merge pull request #131 from FoxUSA/Fox-Working
Browse files Browse the repository at this point in the history
Fox working
  • Loading branch information
FoxUSA committed Jun 22, 2015
2 parents 6112c02 + 26e41f7 commit f96792b
Show file tree
Hide file tree
Showing 47 changed files with 2,423 additions and 1,151 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/bower_components
/node_modules
/build
/build
/OpenNote/openNote.appcache
23 changes: 19 additions & 4 deletions Doc/Build.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,26 @@ You will need to clone the front end and the backend
https://github.com/FoxUSA/OpenNote
https://github.com/FoxUSA/OpenNoteService-PHP

Most of the buid tasks require the OpenNote and OpenNoteService-PHP to be in the same folder
Most of the buid tasks require the OpenNote and OpenNoteService-PHP to be in the same folder

## Build Requirments
- Bower
- Grunt
For example
In the folder `OpenNote` we expect `openNote`, and `Service` to be sister folders.

I normally have `Service` folder as a symbolic link to `OpenNoteService-PHP/Service`;

Once the `OpenNote` and `OpenNoteService-PHP` project have been cloned you need to build the projects

To do so for the front end project
- Run `npm install` to get the dev dependencies
- Then, you need to run `grunt build` in `OpenNote/`(This runs bower install and builds the less CSS)

In the PHP service you will need too
- You need to run `php ./composer.phar install -v` to install all the PHP dependencies and build the projects autoloading structure

## Build Requirements
- npm
- Bower `npm install -g bower`
- Grunt `npm install -g grunt-cli`
- Composer

## Build
Expand Down
11 changes: 5 additions & 6 deletions Doc/HowToUse.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ How to use
--------------
OpenNote uses a touch to open scheme.
If you want to open something just click it.

## Login
To login simple go to your instance on OpenNote. You will need to have javascript enabled
Then simply click "Login"
Expand All @@ -16,7 +16,7 @@ Once you have some stuff simply click on a folder(Always Green) or browse a tree
![][topLevel]
Eventually you'll find a note(Always blue) that you want to open. Simply click it or touch it.

![][plants]
![][plants]

## Notes
Once you click on a note you'll will be presented with it in a read only view.
Expand All @@ -26,10 +26,9 @@ If you want to edit a note, click on the "Edit" button in the top bar

![][seedsEdit]
This will bring you to the CKEditor. Once you are all done editing, click "Save" to store the note.
Dont worry to much about the changing the content of your notes. The program keeps a history of what you changed.

[login]: https://raw.github.com/FoxUSA/OpenNote/master/Doc/screenShots/login.png
[login]: https://raw.github.com/FoxUSA/OpenNote/master/Doc/screenShots/login.png
[topLevel]: https://raw.github.com/FoxUSA/OpenNote/master/Doc/screenShots/topLevel.png
[plants]: https://raw.github.com/FoxUSA/OpenNote/master/Doc/screenShots/plants.png
[plants]: https://raw.github.com/FoxUSA/OpenNote/master/Doc/screenShots/plants.png
[seedsView]: https://raw.github.com/FoxUSA/OpenNote/master/Doc/screenShots/seedsView.png
[seedsEdit]: https://raw.github.com/FoxUSA/OpenNote/master/Doc/screenShots/seedsEdit.png
[seedsEdit]: https://raw.github.com/FoxUSA/OpenNote/master/Doc/screenShots/seedsEdit.png
89 changes: 73 additions & 16 deletions Doc/Install.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,89 @@
# How To Install
[Download most resent release from here.][Download]

# Using Docker(Full Stack)
Make sure docker in running in daemon mode with restart previously running containers on
`docker -d -r` or you could louse your notes if you do not know what your doing
# HTML5 based new super fancy version
## Web app
Just extract in a HTML5 compatible webserver public directory. Or just use the GitHub hosted version.

## CouchDB Install
If you want sync your notes with a server, you will need to install CouchDB.
[CouchDB Download page](http://couchdb.apache.org/)

You will need to enable CORS in CouchDB
The easiest way to do this is to use `add-cors-to-couchdb`
```shell
npm install -g add-cors-to-couchdb
add-cors-to-couchdb
```

Pull the current docker image
`docker pull foxusa/opennote`
Run the commands below substituting `http://127.0.0.1:5984/` with the url of your server
```shell
# Create DB
curl -X PUT http://127.0.0.1:5984/opennote

# Set permissions on opennote database
curl -X PUT http://localhost:5984/opennote/_security \
-u admin:password \
-H "Content-Type: application/json" \
-d '{"admins": { "names": ["admin"], "roles": [] }, "members": { "names": ["admin"], "roles": [] } }'

# SSL
curl -X PUT http://localhost:5984/_config/daemons/httpsd \
-u admin:password \
-H "Content-Type: application/json" \
-d '"{couch_httpd, start_link, [https]}"'

mkdir /etc/couchdb/cert
openssl genrsa > /etc/couchdb/cert/privkey.pem
openssl req -new -x509 -key /etc/couchdb/cert/privkey.pem -out /etc/couchdb/cert/mycert.pem -days 1095

curl -X PUT http://127.0.0.1:5984/_config/ssl/cert_file \
-u admin:password \
-H "Content-Type: application/json" \
-d '"/etc/couchdb/cert/mycert.pem"'

curl -X PUT http://127.0.0.1:5984/_config/ssl/key_file \
-u admin:password \
-H "Content-Type: application/json" \
-d '"/etc/couchdb/cert/privkey.pem"'

# Default SSL port 6984
```

and run it on port 80
`sudo docker run -d -p 80:80 -p 443:443 foxusa/opennote`
Now in `/OpenNote/#/settings/database/` put the following connection string in the `Replication url` field `https://admin:password@127.0.0.1:6984/opennote`

or if port 80 is in use
`sudo docker run -d -p 8080:80 -p 8443:443 foxusa/opennote`
To import a database from older versions check out `/OpenNote/#/settings/legacy/`

# Automatic(Wizard Based Install)
# Legacy service
The legacy service is still included to migrate data to the new data structure.
All write endpoints have been hidden with the exception of the file upload api's.

### Automatic(Wizard Based Install)
To run the installer open
`<install path>/Service/install.php`

Make sure you delete `install.php` and `Config.template`.

### Security Note
#### Security Note
Be default we put the sqlite databse in the web folder. This is not a good idea. We solved this by putting in a htaccess file to not allow the database to be downloaded.

Still, you should move this file out of the webserver directory and change the location in `Config.php`

## Manual
###MYSql
### Using Docker(Full Stack)
Make sure docker in running in daemon mode with restart previously running containers on
`docker -d -r` or you could louse your notes if you do not know what your doing

Pull the current docker image
`docker pull foxusa/opennote`

and run it on port 80
`sudo docker run -d -p 80:80 -p 443:443 foxusa/opennote`

or if port 80 is in use
`sudo docker run -d -p 8080:80 -p 8443:443 foxusa/opennote`

### Manual
####MYSql
- Create a MYSQL database named "OpenNote"
- Download and extract OpenNote into a folder on your php web-server called "OpenNote"
- Open up the `Service/model/sql` folder and run `notebook.sql` in your OpenNote database
Expand All @@ -38,10 +95,10 @@ These are stored in the following lines of code in `/OpenNote/Config.php`:
$dbServer = "127.0.0.1";
$dbName = "notebook";
```

- Now the site install is complete. You can now open the site by going to your webserver url +/OpenNote

###SQLite
####SQLite
- Download and extract OpenNote into a folder on your php web-server called "OpenNote"
- Create a SQLite database file and execute the SQL DDL from `Service/model/sql` and run `notebook.sqlite.sql`.
- Change the database connection settings inside of `Service/Config.php` to match your db settings.
Expand All @@ -59,7 +116,7 @@ Comment the following lines in the dbConfig function:
```php
$dbName = "../<relative path>/OpenNote.sqlite";
```

- Now the site install is complete. You can now open the site by going to your webserver url +/OpenNote

[Download]: https://github.com/FoxUSA/OpenNote/releases
14 changes: 11 additions & 3 deletions Doc/Upgrade.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# How to upgrade

##Upgrading from 14.xx(Locomotive) to 15.07.01
All you need to do is merge your existing deployment with the release folder while keeping your config files (`openNote\openNote.config.js` and `\Service\Config.php`).
Make sure to backup your old folder and database.

There have been major changes in this release.
You will need to follow the CouchDB instructions in the Install documentation.


##Docker(14.07.01 to 14.07.02)
Find the container id of your running container by doing a `docker ps` or `docker ps -l` if the OpenNote conatiner was the last one you stopped.
You should see output like this
Expand Down Expand Up @@ -40,7 +48,7 @@ Commit it
Get another new long containerID
`cf77323ed72659b3462073763e9115ff16bb4ae64ce406176703bbc781011ccb`

and run that with published ports
and run that with published ports
`sudo docker run -d -p 80:80 -p 443:443 cf77323ed72659b3462073763e9115ff16bb4ae64ce406176703bbc781011ccb /run.sh`

or if port 80 is in use
Expand All @@ -51,8 +59,8 @@ All done

##Manual installs

##Upgrading from 14.07(Locomotive) to 14.07.01(Steam Locomotive) or 14.07.01(Steam Locomotive) to 14.07.02 (Diesel Locomotive).
All you need to do is merge your existing deployment with the release folder while keeping your config files (`openNote\openNote.config.js` and `\Service\Config.php`).
##Upgrading from 14.07(Locomotive) to 14.07.01(Steam Locomotive) or 14.07.01(Steam Locomotive) to 14.07.02 (Diesel Locomotive).
All you need to do is merge your existing deployment with the release folder while keeping your config files (`openNote\openNote.config.js` and `\Service\Config.php`).

###MySQL(Recomended)
- Make sure you make a copy of you database and the OpenNote directory
Expand Down
56 changes: 39 additions & 17 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = function(grunt) {
//Initializing the configuration object
grunt.initConfig({
grunt.initConfig({
//Style
less: {
devDark: {
Expand All @@ -15,12 +15,12 @@ module.exports = function(grunt) {
"OpenNote/openNote/style/invert/dark/note.css": "OpenNote/openNote/style/invert/note.less",
"OpenNote/openNote/style/invert/dark/alertify.css": "OpenNote/openNote/style/invert/alertify.less",
"OpenNote/openNote/style/invert/dark/intojs.css": "OpenNote/openNote/style/invert/introjs.less",

"OpenNote/openNote/style/simplicity/dark/style.css": "OpenNote/openNote/style/simplicity/style.less",
"OpenNote/openNote/style/simplicity/dark/note.css": "OpenNote/openNote/style/simplicity/note.less",
"OpenNote/openNote/style/simplicity/dark/alertify.css": "OpenNote/openNote/style/simplicity/alertify.less",
"OpenNote/openNote/style/simplicity/dark/intojs.css": "OpenNote/openNote/style/simplicity/introjs.less"

}
},
devLight: {
Expand All @@ -35,7 +35,7 @@ module.exports = function(grunt) {
"OpenNote/openNote/style/invert/light/note.css": "OpenNote/openNote/style/invert/note.less",
"OpenNote/openNote/style/invert/light/alertify.css": "OpenNote/openNote/style/invert/alertify.less",
"OpenNote/openNote/style/invert/light/intojs.css": "OpenNote/openNote/style/invert/introjs.less",

"OpenNote/openNote/style/simplicity/light/style.css": "OpenNote/openNote/style/simplicity/style.less",
"OpenNote/openNote/style/simplicity/light/note.css": "OpenNote/openNote/style/simplicity/note.less",
"OpenNote/openNote/style/simplicity/light/alertify.css": "OpenNote/openNote/style/simplicity/alertify.less",
Expand All @@ -55,12 +55,12 @@ module.exports = function(grunt) {
"OpenNote/openNote/style/invert/dark/note.css": "OpenNote/openNote/style/invert/note.less",
"OpenNote/openNote/style/invert/dark/alertify.css": "OpenNote/openNote/style/invert/alertify.less",
"OpenNote/openNote/style/invert/dark/intojs.css": "OpenNote/openNote/style/invert/introjs.less",

"OpenNote/openNote/style/simplicity/dark/style.css": "OpenNote/openNote/style/simplicity/style.less",
"OpenNote/openNote/style/simplicity/dark/note.css": "OpenNote/openNote/style/simplicity/note.less",
"OpenNote/openNote/style/simplicity/dark/alertify.css": "OpenNote/openNote/style/simplicity/alertify.less",
"OpenNote/openNote/style/simplicity/dark/intojs.css": "OpenNote/openNote/style/simplicity/introjs.less"

}
},
prodLight: {
Expand Down Expand Up @@ -102,15 +102,15 @@ module.exports = function(grunt) {
tasks: ["karma:unit:run"]
}
},
shell: {
bowerInstall: {
shell: {
bowerInstall: {
command: [ "cd OpenNote",
"bower install" ].join("&&")
},
clean:{
command: [ "rm -rf build",
"cd OpenNote",
"rm -rf bower_components",
"rm -rf bower_components",
"cd openNote/style/invert/",
"rm -rf dark",
"rm -rf light"].join("&&")
Expand All @@ -122,28 +122,50 @@ module.exports = function(grunt) {
"cp -r ../../OpenNoteService-PHP/Service ./",
"cp -r ../../OpenNoteService-PHP/vendor ./"].join("&&")
}
}
},
//HTML 5
manifest: {
generate: {
options: {
basePath: "OpenNote/",
exclude: ["openNote.appcache", "Service", "bower_components/intro.js"],
verbose: true,
timestamp: true,
hash: true,
master: ["index.html"]
},
src: [
"**/*.js",
"**/*.css",
"**/*.html",
"**/*.png",
"**/*.jpg"
],
dest: "openNote/openNote.appcache"
}
}
});

//Plugin loading
grunt.loadNpmTasks("grunt-contrib-less");
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.loadNpmTasks("grunt-karma");
grunt.loadNpmTasks("grunt-shell");

grunt.loadNpmTasks("grunt-manifest");

//Task definition
//css
grunt.registerTask("buildDevCSS", ["less:devDark","less:devLight"]);
grunt.registerTask("buildProdCSS", ["less:prodDark","less:prodLight"]);

//deployment
grunt.registerTask("clean", ["shell:clean"]);
grunt.registerTask("build", ["shell:bowerInstall", "buildDevCSS"]);
// you can run individual command using the plug-in command syntax suck as manifest:generate or shell:clean
grunt.registerTask("build", ["shell:bowerInstall", "buildDevCSS", "manifest:generate"]);
grunt.registerTask("default", ["build"]);
grunt.registerTask("deploy", ["clean", "shell:bowerInstall", "buildProdCSS", "shell:phpPackage"]);
grunt.registerTask("deploy", ["shell:clean", "shell:bowerInstall", "buildProdCSS", "manifest:generate", "shell:phpPackage"]);

//testing
grunt.registerTask("devmode", ["karma:unit", "watch"]);
grunt.registerTask("test", ["karma:travis"])
grunt.registerTask("ci", ["build","karma:travis"])
};
};
4 changes: 4 additions & 0 deletions OpenNote.Test/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@ module.exports = function(config){
config.set({
basePath : "../",
files : [
"node_modules/es5-shim/es5-shim.min.js",
"OpenNote/bower_components/angular/angular.js",
"OpenNote/bower_components/angular-mocks/angular-mocks.js",
"OpenNote/bower_components/angular-route/angular-route.js",
"OpenNote/bower_components/angular-resource/angular-resource.js",
"OpenNote/bower_components/angular-sanitize/angular-sanitize.js",
"OpenNote/bower_components/angular-animate/angular-animate.js",
"OpenNote/bower_components/angular-ui-tree/dist/angular-ui-tree.js",
"OpenNote/bower_components/ng-file-upload/ng-file-upload-shim.min.js",
"OpenNote/bower_components/ng-file-upload/ng-file-upload.min.js",
"OpenNote/bower_components/pouchdb/dist/pouchdb.min.js",
"OpenNote/bower_components/jquery/jquery.js",
"OpenNote/openNote/openNote.js",
"OpenNote/openNote/**/*.js",
Expand Down
Loading

0 comments on commit f96792b

Please sign in to comment.