diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..0c5d7c58 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +node_modules +.git +.gitignore +*.md diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..09650cd7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,3 @@ +FROM node:6-onbuild +ENV NPM_CONFIG_LOGLEVEL warn +EXPOSE 8080 diff --git a/README.md b/README.md index af561150..7449fb4d 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,37 @@ Try the [interactive tutorial](http://gun.js.org/think.html) in the browser (**5 If that did not work it is probably because npm installed it to a global directory. To fix that try `mkdir node_modules` in your desired directory and re-run the above commands. You also might have to add `sudo` in front of the commands. +## Quick dev/test Deployments + + - To quickly spin up a Gun test server for your development team, uilize eiher [Heroku](http://heroku.com) or [Docker](http://docker.com) or any variant thereof ([Dokku](http://dokku.viewdocs.io/dokku/), [Flynn.io](http://flynn.io), [now.sh](https://zeit.co/now), etc) + +### Docker + ```bash + git clone https://github.com/amark/gun.git + cd gun + docker build -t myrepo/gundb:v1 . + docker run -p 8080:8080 myrepo/gundb:v1 + ``` + Then visit [http://localhost:8080](http://localhost:8080) in your browser. + +### Hiroku + ```bash + git clone https://github.com/amark/gun.git + cd gun + heroku create + git push -f heroku HEAD:master + ``` + Then visit the URL in the output of the 'heroku create' step, in your browser. + +### Now.sh + ```bash + npm install -g now + git clone https://github.com/amark/gun.git + cd gun + now --npm + ``` + Then visit the URL in the output of the 'now --npm' step, in your browser. + ### Videos - [Fault tolerance](https://www.youtube.com/watch?v=-i-11T5ZI9o&feature=youtu.be) (01:01) - [Saving relational or document based data](https://www.youtube.com/watch?v=cOO6wz1rZVY&feature=youtu.be) (06:59) diff --git a/examples/express.js b/examples/express.js index ac517fb8..59420e51 100644 --- a/examples/express.js +++ b/examples/express.js @@ -1,10 +1,10 @@ console.log("If modules not found, run `npm install` in /example folder!"); // git subtree push -P examples heroku master // OR // git subtree split -P examples master && git push heroku [['HASH']]:master --force -var port = process.env.OPENSHIFT_NODEJS_PORT || process.env.VCAP_APP_PORT || process.env.PORT || process.argv[2] || 80; +var port = process.env.OPENSHIFT_NODEJS_PORT || process.env.VCAP_APP_PORT || process.env.PORT || process.argv[2] || 8080; var express = require('express'); var app = express(); -var Gun = require('gun'); +var Gun = require('../'); var gun = Gun({ file: 'data.json', s3: { @@ -17,4 +17,4 @@ var gun = Gun({ gun.wsp(app); app.use(express.static(__dirname)).listen(port); -console.log('Server started on port ' + port + ' with /gun'); \ No newline at end of file +console.log('Server started on port ' + port + ' with /gun'); diff --git a/examples/hello-world.js b/examples/hello-world.js index 380c8170..23f3f5a7 100644 --- a/examples/hello-world.js +++ b/examples/hello-world.js @@ -1,5 +1,6 @@ -var Gun = require('gun'); +var Gun = require('../'); var gun = Gun({ + file: 'data.json', s3: { key: '', // AWS Access Key secret: '', // AWS Secret Token diff --git a/examples/http.js b/examples/http.js index e3476cf9..06684eba 100644 --- a/examples/http.js +++ b/examples/http.js @@ -1,4 +1,4 @@ -var port = process.env.OPENSHIFT_NODEJS_PORT || process.env.VCAP_APP_PORT || process.env.PORT || process.argv[2] || 80; +var port = process.env.OPENSHIFT_NODEJS_PORT || process.env.VCAP_APP_PORT || process.env.PORT || process.argv[2] || 8080; var Gun = require('../'); var gun = Gun({ diff --git a/examples/package.json b/examples/package.json deleted file mode 100644 index e3eb1358..00000000 --- a/examples/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "examples", - "main": "http.js", - "description": "Example gun apps" -, "version": "0.0.3" -, "engines": { - "node": "~>0.10.x" - } -, "dependencies": { - "express": "~>4.13.4", - "gun": "github:amark/gun#0.5" - } -, "scripts": { - "start": "node http.js", - "test": "mocha" - } -} diff --git a/package.json b/package.json index 9df20e51..18e8b3f1 100644 --- a/package.json +++ b/package.json @@ -50,6 +50,7 @@ }, "devDependencies": { "mocha": "~>1.9.0", + "express": "~>4.13.4", "panic-server": "~>0.3.0", "selenium-webdriver": "~>2.53.2" }