mirror of
https://github.com/amark/gun.git
synced 2025-11-28 00:03:41 +00:00
Merge pull request #262 from hillct/feature/onboarding
Examples Cleanup & Quick deployments with Heroku, Docker etc.
This commit is contained in:
commit
e39eda74f4
4
.dockerignore
Normal file
4
.dockerignore
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
node_modules
|
||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
*.md
|
||||||
3
Dockerfile
Normal file
3
Dockerfile
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
FROM node:6-onbuild
|
||||||
|
ENV NPM_CONFIG_LOGLEVEL warn
|
||||||
|
EXPOSE 8080
|
||||||
31
README.md
31
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.
|
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
|
### Videos
|
||||||
- [Fault tolerance](https://www.youtube.com/watch?v=-i-11T5ZI9o&feature=youtu.be) (01:01)
|
- [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)
|
- [Saving relational or document based data](https://www.youtube.com/watch?v=cOO6wz1rZVY&feature=youtu.be) (06:59)
|
||||||
|
|||||||
@ -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
|
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 express = require('express');
|
||||||
var app = express();
|
var app = express();
|
||||||
|
|
||||||
var Gun = require('gun');
|
var Gun = require('../');
|
||||||
var gun = Gun({
|
var gun = Gun({
|
||||||
file: 'data.json',
|
file: 'data.json',
|
||||||
s3: {
|
s3: {
|
||||||
@ -17,4 +17,4 @@ var gun = Gun({
|
|||||||
gun.wsp(app);
|
gun.wsp(app);
|
||||||
app.use(express.static(__dirname)).listen(port);
|
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');
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
var Gun = require('gun');
|
var Gun = require('../');
|
||||||
var gun = Gun({
|
var gun = Gun({
|
||||||
|
file: 'data.json',
|
||||||
s3: {
|
s3: {
|
||||||
key: '', // AWS Access Key
|
key: '', // AWS Access Key
|
||||||
secret: '', // AWS Secret Token
|
secret: '', // AWS Secret Token
|
||||||
|
|||||||
@ -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 = require('../');
|
||||||
var gun = Gun({
|
var gun = Gun({
|
||||||
|
|||||||
@ -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"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -50,6 +50,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"mocha": "~>1.9.0",
|
"mocha": "~>1.9.0",
|
||||||
|
"express": "~>4.13.4",
|
||||||
"panic-server": "~>0.3.0",
|
"panic-server": "~>0.3.0",
|
||||||
"selenium-webdriver": "~>2.53.2"
|
"selenium-webdriver": "~>2.53.2"
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user