8

I'm used to deploying HTTPS Node apps on DigitalOcean servers using Docker, the Express framework and the https package like this:

const https = require('https');

const app = express();

// ...

const ssl = {
  key: fs.readFileSync(process.env.PRIVATE_KEY),
  cert: fs.readFileSync(process.env.CERT),
  ca: fs.readFileSync(process.env.CHAIN),
};

const server = https.createServer(ssl, app);
server.listen({ port }, () => {
  // ...
});

My app is inside a Docker container, but I expose the certicates that are on the droplet with the "v" option when I do docker run, like this:

-v /etc/letsencrypt/:/etc/letsencrypt

Finally, my Docker container is passed environment variables so that my Node app can know the paths to the various certificates files. For example,

CHAIN=/etc/letsencrypt/live/mydomain.com/chain.pem

And now, my Node app can read the certificates and create an HTTPS server with them.

I don't know if this setup is ideal, but it works well.


Now, I'm wondering how to do the same using the DigitalOcean App Platform.
So far, what I've done is this:

But I can't get it to work with the certificates and therefore, have my HTTPS app work.
Does anyone here have an idea?

samdouble
  • 452
  • 4
  • 12

0 Answers0