Difference between a buildpack and a dockerfile?

I understand a dockerfile to be a comprehensive set of instructions to completely build an application’s production (and development for that matter) environment from scratch (or at least from a bare linux distribution).

I understand a buildpack to be something responsible for retrieving and installing collections of dependencies and (similarly to docker) merging these to provide the app’s running environment. I also see from here:

Buildpacks were first conceived by Heroku in 2011. Since then, they have been adopted by Cloud Foundry and other PaaS such as Google App Engine, Gitlab, Knative, Deis, Dokku, and Drie.

But I wonder what are the differences then? E.g.

  • Are dockerfiles allowing more options than heroku buildpacks?
  • Do both have the same capabilities in terms of permissions and users?
  • Are they as versatile as eachother? (I know docker images can be run almost anywhere there is docker, is the same true of buildpacks?)
  • What other differences are there?

Go to Source
Author: stevec

Dynamically generating files on heroku

I want to create sketch-files dynamically and make them downloadable. I want to use sketch-constructor (here is an example that is working on my computer).

The code runs on heroku and the is even the console.log() of the fulfilled promise but i can’t see neither the directory nor the sketchfile itself.

Thanks for your help!

Go to Source
Author: bepArt

Application Error on Heroku after deploying

After deploying an app on Heroku, I’m getting an application error. Then I checked the logs which showed the following error:

2020-06-07T05:47:43.079647+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/" host=damp-thicket-34530.herokuapp.com request_id=cf32b3b0-0291-42d7-924e-aa36cafb03e1 fwd="203.190.9.142" dyno=web.1 connect=0ms service=30000ms status=503 bytes=0 protocol=https

I’m not sure what’s this error is about. Here is my app.js file:

require('dotenv').config();
var createError = require('http-errors');
var express = require('express');
var path = require('path');
var cookieParser = require('cookie-parser');
var logger = require('morgan');
const connectDB = require('./config/db');

var usersRouter = require('./routes/api/users');
var moviesRouter = require('./routes/api/movies');

var app = express();

// connect database
connectDB();

app.use(logger('dev'));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));

app.use('/api/users', usersRouter);
app.use('/api/movies', moviesRouter);

if (process.env.NODE_ENV === 'production') {
  app.use(express.static('client/build'));
  app.get('*', (req, res) => {
    res.sendFile(path.resolve('client', 'build', 'index.html'));
  });
}

const PORT = process.env.PORT || 5000;

app.listen(PORT, () => console.log(`Server started on port ${PORT}`));

I will highly appreciate any suggestions. Thanks in advance.

Go to Source
Author: sam13

How to make page url like this: ‘…/games/firstGame’ where games is a parent page

I am trying to build a node.js following the heroku tutorial. I currently have this:

const express = require('express')
const path = require('path')
const PORT = process.env.PORT || 5000

express()
    .use(express.static(path.join(__dirname, 'public')))
    .set('views', path.join(__dirname, 'views'))
    .set('view engine', 'ejs')
    .get('/game', (req, res) => res.render('pages/game/game'))
    **.get('/game/firstGame', (req, res) => res.render('pages/game/game-firstGame'))**
    .listen(PORT, () => console.log(`Listening on ${ PORT }`))

However, this does not work because everytime I access this page with the window location directed to

https://.../game/firstGame

The heroku app will give me: Internal Server Error

Plus, the Firefox browser tells that I lack the file firstGame although I specified to render the file game-firstGame file

Go to Source
Author: Emma Wang