Skip to content

Commit dd2a6f2

Browse files
committed
update dabian base image version
Add decision document for node version
1 parent a1d3c33 commit dd2a6f2

File tree

3 files changed

+89
-1
lines changed

3 files changed

+89
-1
lines changed

docs/decisions/021-node-version.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Node.js LTS
2+
3+
Date: 2023-07-03
4+
5+
Status: accepted
6+
7+
## Context
8+
9+
Node.js has a regular release cycle which is documented in the
10+
[release schedule](https://nodejs.org/en/about/releases/). At the time of this
11+
writing, there are 5 stable maintained releases: 14, 16, 18, 19, 20. I'll refer
12+
you to that documentation to understand how the release cycle works.
13+
14+
Deciding which version of Node.js to use for a project is a trade-off between
15+
using the latest features and stability.
16+
17+
The Epic Stack is more focused on stabling shipping web apps than experimenting
18+
with the latest features which is where the Active Long-Term Support (LTS)
19+
version really shines.
20+
21+
We deploy our apps in Docker containers, and there are various base images we
22+
can use as options which you can find on
23+
[the Node.js Docker Hub](https://hub.docker.com/_/node). Aside from the version,
24+
there flavors of the base image which are based on the Linux distribution used.
25+
Feel free to read more about the different flavors on Docker Hub. One of the
26+
goals for us here is to not ship more than we need in production.
27+
28+
An additional consideration we'll add as context here is what version of Linux
29+
to have our base image built on. With the same pragmatic approach as the Node.js
30+
version we want to balance latest features with stability. We'll use the
31+
[Debian release cycle](https://wiki.debian.org/DebianReleases) as a guide for
32+
this.
33+
34+
## Decision
35+
36+
Use and current LTS version of Node.js as the default in the starter.
37+
38+
We'll use the `slim` flavor of the node.js images.
39+
40+
We'll use the `bookworm` flavor of the node.js images (which is the current
41+
stable version of Dabian: v12).
42+
43+
## Consequences
44+
45+
Folks should hopefully run into few compatibility issues. It's possible they
46+
will need features that are not back-ported to the current active LTS version,
47+
however it's trivial to update the Node.js version. Added documentation to the
48+
[managing updates](../managing-updates.md) docs should help people manage this.
49+
50+
We'll need to update the Node.js version in the starter whenever the active LTS
51+
version changes.
52+
53+
Folks who need a bunch more out of their operating system packages will need to
54+
switch from the `slim` flavor which only involves updating the `Dockerfile`. It
55+
is possible some will not realize they need more than `slim` until they run the
56+
Docker image (which many people will only do in production). However the
57+
likelihood of this impacting anyone is pretty low.

docs/managing-updates.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,36 @@
11
# Managing updates
22

3+
## Updating Node.js
4+
5+
The Epic Stack runs a long-running Node.js server. It defaults to the current
6+
active LTS version of node
7+
([read the Node.js version decision document](./decisions/021-node-version.md)).
8+
9+
If you wish to change the Node.js version, you can do so by updating the
10+
`engines.node` property in the `package.json` file.
11+
12+
```json
13+
{
14+
"engines": {
15+
"node": "20.3.1"
16+
}
17+
}
18+
```
19+
20+
Make certain you do not use a version range here because this is used in the
21+
`./other/build-server.ts` to compile the express server code.
22+
23+
You will also want to update the `Dockerfile` to use the same version of Node.js
24+
as the `package.json` file.
25+
26+
```diff
27+
- FROM node:18-bookworm-slim as base
28+
+ FROM node:20.3.1-bookworm-slim as base
29+
```
30+
31+
You'll find the
32+
[Node.js versions available on Docker Hub](https://hub.docker.com/_/node).
33+
334
## Within the Epic Stack
435

536
When you create a new project with the Epic Stack, a bunch of code is generated

other/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This file is moved to the root directory before building the image
22

33
# base node image
4-
FROM node:18-bullseye-slim as base
4+
FROM node:18-bookworm-slim as base
55

66
# set for base and all layer that inherit from it
77
ENV NODE_ENV production

0 commit comments

Comments
 (0)