heroku buildpacks:set https://github.com/ddollar/heroku-buildpack-multi.git
- .buildpacks
- Aptfile
buildpack側ではなく、デプロイ対象のプロジェクト直下に.fontsディレクトリを作成。 ここに、
TakaoExGothic.ttf
TakaoExMincho.ttf
TakaoGothic.ttf
TakaoMincho.ttf
TakaoPGothic.ttf
TakaoPMincho.ttf
fonts-japanese-gothic.ttf
fonts-japanese-mincho.ttf
など、Linux(正確にはherokuのfontconfig)でつかえる日本語フォントを コピーして、これをデプロイ
mkdir .fonts
heroku run bash
xvfb-run --server-args="-screen 0 640x480x16 -ac" xlogo&
DISPLAY=:99 xwd -root >dump.xwd
convert dump.xwd dump.png
scp dump.png jibunno@mac.local:dump.png
heroku run bash
xvfb-run --server-args="-screen 0 1024x768x24" slimerjs ./cap3d.js http://jsrun.it/kjunichi/bnJXg
scp public/webglcap.png jibunno@mac.local:cap.png
*:jibunno@mac.local is your host/account.
/**
* Module dependencies.
*/
var spawn = require('child_process').spawn;
var express = require('express');
var logfmt = require('logfmt');
var fs = require('fs');
var app = express();
// all environments
app.use(logfmt.requestLogger());
app.use(express.static(__dirname + '/public'));
app.get('/a', function(req, res) {
res.send('Hello, world!');
});
app.get('/c',function(req,res) {
var url=""
if(!req.query.u || req.query.u.length==0) {
url = "http://jsrun.it/kjunichi/bnJXg";
} else {
url = req.query.u;
}
var cmd = 'xvfb-run --server-args="-screen 0 1024x768x24" slimerjs ./cap3d.js '+ url;
function shspawn(command) {
return spawn('sh', ['-c', command]);
}
var child = shspawn(cmd);
var buf="";
child.stdout.on('data',function(data){
buf=buf+data;
});
child.stderr.on('data',function (data){
console.log('exec error: '+data);
});
child.on('close',function(code) {
var img = fs.readFileSync('public/webglcap.png');
//res.send('buf = '+ buf);
//res.send('Hi!');
res.writeHead(200, {'Content-Type': 'image/png' });
res.end(img);
});
});
var port = process.env.PORT || 5000;
app.listen(port,function(){
console.log('Listening port on ' + port);
});