nicolasritouet / deployd-heroku-demo Goto Github PK
View Code? Open in Web Editor NEWDemo of Deployd on Heroku
Demo of Deployd on Heroku
index.html is really minimal, we need:
I used "request-promise" to create one data, but it failed.
And after I created data with the dashboard , it always be loading, bug "get" was successfully.
{"name":"StatusCodeError","statusCode":400,"message":"400 - {"errors":{"questions":"is required","userId":"is required"},"status":400}","error":"{"errors":{"questions":"is required","userId":"is required"},"status":400}","options":{"uri":"http://127.0.0.1:3000/surveys","data":{"userId":"1801481404f95868","questions":"[]"},"method":"POST","simple":true,"resolveWithFullResponse":false},"response":{"statusCode":400,"body":"{\"errors\":{\"questions\":\"is required","userId":"is required"},"status":400}","headers":{"x-powered-by":"Express","set-cookie":["sid=c437fe6e3ab2937c7b7c79b86e9fa9bf8e1dfc04b6f1361e4033324354098a06b54d0d312222c4291b81b3c28326220152851c6ca7f1257efea5de4347163334; path=/; httponly"],"content-type":"application/json","date":"Mon, 12 Oct 2015 09:21:47 GMT","connection":"close","transfer-encoding":"chunked"},"request":{"uri":{"protocol":"http:","slashes":true,"auth":null,"host":"127.0.0.1:3000","port":"3000","hostname":"127.0.0.1","hash":null,"search":null,"query":null,"pathname":"/surveys","path":"/surveys","href":"http://127.0.0.1:3000/surveys"},"method":"POST","headers":{"content-length":0}}}}
Here is code (server.js) ///////////////////////////////////////////
var express = require('express');
var http = require('http');
var bodyParser = require('body-parser');
var nodeExcel = require('excel-export');
var rp = require('request-promise');
var swig = require('swig');
var serverPort = process.env.PORT || 3000;
var nodeEnv = process.env.NODE_ENV || 'development';
// setup express
var app = exports.app = express();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
extended: true
}));
app.engine('html', swig.renderFile);
app.set('view engine', 'html');
app.set('view cache', false);
var server = http.createServer(app);
// Define a new route
app.get('/hello-express', function (req, res) {
rp.post({
uri: 'http://127.0.0.1:3000/surveys',
formData: {
userId: '1801481404f95868',
questions: "[]"
}
}).then(function (resp) {
return res.send(resp);
})
.catch(function (err) {
return res.send(err);
})
});
// setup deployd
require('deployd').attach(server, {
env: nodeEnv,
db: {
connectionString: 'mongodb://127.0.0.1:27017/web1'
}
});
app.use(server.handleRequest);
// start server
server.listen(serverPort, function() {
var serverAddr = server.address().address == '0.0.0.0' ? 'localhost' : server.address().address;
console.log('Express & Deployd started.\n\nPlease visit http://%s:%s', serverAddr, server.address().port);
});
Please help me!!!
Any updates on this feature?
When you say:
Don't use for production. This will deploy on Heroku in development mode, without any password to the Dashboard. I'm working on a fix.
Is your concern just the dashboard password?
Hello Nicolas
Heroku is giving me the following error log
----> Building dependencies
Installing node modules (package.json)
npm ERR! code ENOPACKAGEJSON
npm ERR! package.json Non-registry package missing package.json: deployd@git://github.com/deployd/deployd.git#v0.8.0-rc.3.
If you can help me
Regards
Arvit
We need to write the key to a file (.dpd/keys.json
) to protect the dashboard. Heroku doesn't allow that.
We need another solution to write the selected key somewhere (env var).
But that would mean modify the core of Deployd.
I was trying to use your example as a guide to deploy my deployd project to heroku, I am using the regular deployd project (deployd would be a node project, not express) I tried to add the server.js file you used and the code was not recognized by the compiler(netBeans) should this example work for any deployd regular project?? The project where I am trying to add the server and user heroku is https://github.com/laugmo/proyectofinal-1.git
I have another option, that would be to use a friend's server, but I would need some help with the project configuration, if you have some practical tips around it it would be much appreciated
Log from heroku attached:
2017-03-12T04:29:34.684675+00:00 app[web.1]: Unhandled rejection TypeError: Cannot read property 'insert' of undefined
2017-03-12T04:29:34.684699+00:00 app[web.1]: at /app/node_modules/deployd/lib/db.js:262:8
2017-03-12T04:29:34.684700+00:00 app[web.1]: at /app/node_modules/deployd/lib/db.js:155:12
2017-03-12T04:29:34.684702+00:00 app[web.1]: at runCallback (timers.js:651:20)
2017-03-12T04:29:34.684702+00:00 app[web.1]: at tryOnImmediate (timers.js:624:5)
2017-03-12T04:29:34.684703+00:00 app[web.1]: at processImmediate [as _immediateCallback] (timers.js:596:5)
2017-03-12T04:29:34.684705+00:00 app[web.1]: From previous event:
2017-03-12T04:29:34.684705+00:00 app[web.1]: at collection (/app/node_modules/deployd/lib/db.js:154:11)
2017-03-12T04:29:34.684706+00:00 app[web.1]: at SessionStore.Store.insert (/app/node_modules/deployd/lib/db.js:261:3)
2017-03-12T04:29:34.684707+00:00 app[web.1]: at SessionStore.createSession (/app/node_modules/deployd/lib/session.js:110:10)
2017-03-12T04:29:34.684708+00:00 app[web.1]: at /app/node_modules/deployd/lib/attach.js:92:23
2017-03-12T04:29:34.684709+00:00 app[web.1]: at /app/node_modules/deployd/lib/util/http.js:64:9
2017-03-12T04:29:34.684709+00:00 app[web.1]: at /app/node_modules/corser/lib/corser.js:99:13
2017-03-12T04:29:34.684710+00:00 app[web.1]: at exports.setup (/app/node_modules/deployd/lib/util/http.js:24:3)
2017-03-12T04:29:34.684711+00:00 app[web.1]: at handleRequest (/app/node_modules/deployd/lib/attach.js:89:5)
2017-03-12T04:29:34.684711+00:00 app[web.1]: at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2017-03-12T04:29:34.684712+00:00 app[web.1]: at trim_prefix (/app/node_modules/express/lib/router/index.js:317:13)
2017-03-12T04:29:34.684713+00:00 app[web.1]: at /app/node_modules/express/lib/router/index.js:284:7
2017-03-12T04:29:34.684713+00:00 app[web.1]: at Function.process_params (/app/node_modules/express/lib/router/index.js:335:12)
2017-03-12T04:29:34.684714+00:00 app[web.1]: at next (/app/node_modules/express/lib/router/index.js:275:10)
2017-03-12T04:29:34.684714+00:00 app[web.1]: at expressInit (/app/node_modules/express/lib/middleware/init.js:40:5)
2017-03-12T04:29:34.684715+00:00 app[web.1]: at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2017-03-12T04:29:34.684716+00:00 app[web.1]: at trim_prefix (/app/node_modules/express/lib/router/index.js:317:13)
2017-03-12T04:29:34.684717+00:00 app[web.1]: at /app/node_modules/express/lib/router/index.js:284:7
2017-03-12T04:29:34.684717+00:00 app[web.1]: at Function.process_params (/app/node_modules/express/lib/router/index.js:335:12)
2017-03-12T04:29:34.684718+00:00 app[web.1]: at next (/app/node_modules/express/lib/router/index.js:275:10)
2017-03-12T04:30:04.652202+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/" host=immense-thicket-85459.herokuapp.com request_id=04e42a3c-af94-4d2b-91b8-6741cdea010a fwd="5.79.156.244" dyno=web.1 connect=1ms service=30000ms status=503 bytes=0 protocol=https
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.