Merge pull request #262 from hillct/feature/onboarding

Examples Cleanup & Quick deployments with Heroku, Docker etc.
This commit is contained in:
Mark Nadal 2016-11-13 10:58:51 -08:00 committed by GitHub
commit e39eda74f4
8 changed files with 45 additions and 22 deletions

4
.dockerignore Normal file
View File

@ -0,0 +1,4 @@
node_modules
.git
.gitignore
*.md

3
Dockerfile Normal file
View File

@ -0,0 +1,3 @@
FROM node:6-onbuild
ENV NPM_CONFIG_LOGLEVEL warn
EXPOSE 8080

View File

@ -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)

View File

@ -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');
console.log('Server started on port ' + port + ' with /gun');

View File

@ -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

View File

@ -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({

View File

@ -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"
}
}

View File

@ -50,6 +50,7 @@
},
"devDependencies": {
"mocha": "~>1.9.0",
"express": "~>4.13.4",
"panic-server": "~>0.3.0",
"selenium-webdriver": "~>2.53.2"
}