Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: merge release v4.37.1 into master #413

Merged
merged 15 commits into from
Oct 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
434 changes: 226 additions & 208 deletions CHANGELOG.md

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions Dockerfile.development
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:12.18.0-alpine3.11
FROM node:12.18.4-alpine3.12
LABEL maintainer=FormSG<[email protected]>

WORKDIR /opt/formsg
Expand All @@ -8,12 +8,15 @@ ENV NODE_ENV=development
RUN apk update && apk upgrade && \
# Build dependencies for node_modules
apk add --virtual native-deps \
g++ gcc libgcc libstdc++ linux-headers autoconf automake make nasm python git curl \
# Python version must be specified starting in alpine3.12
g++ gcc libgcc libstdc++ linux-headers autoconf automake make nasm python3 git curl \
# Runtime dependencies
# Note that each alpine version supports a specific version of chromium
# Note that chromium and puppeteer-core are released together and it is the only version
# that is guaranteed to work. Upgrades must be done in lockstep.
# https://github.com/puppeteer/puppeteer/blob/master/docs/troubleshooting.md#running-on-alpine
chromium=81.0.4044.113-r0 \
# https://www.npmjs.com/package/puppeteer-core?activeTab=versions for corresponding versions
chromium=83.0.4103.116-r0 \
nss \
freetype \
freetype-dev \
Expand Down
26 changes: 15 additions & 11 deletions Dockerfile.production
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
FROM node:12.18.0-alpine3.11 AS node-modules-builder
FROM node:12.18.4-alpine3.12 AS node-modules-builder
# node-modules-builder stage installs/compiles the node_modules folder
# Python version must be specified starting in alpine3.12
RUN apk update && apk upgrade && \
apk --no-cache add --virtual native-deps \
g++ gcc libgcc libstdc++ linux-headers autoconf automake make nasm python git curl && \
g++ gcc libgcc libstdc++ linux-headers autoconf automake make nasm python3 git curl && \
npm install --quiet node-gyp -g
WORKDIR /opt/formsg
COPY package* /opt/formsg/
RUN npm ci
COPY . /opt/formsg

# This stage builds the final container
FROM node:12.18.0-alpine3.11
FROM node:12.18.4-alpine3.12
LABEL maintainer=FormSG<[email protected]>
WORKDIR /opt/formsg

Expand All @@ -19,17 +20,20 @@ COPY --from=node-modules-builder /opt/formsg /opt/formsg

# Install chromium from official docs
# https://github.com/puppeteer/puppeteer/blob/master/docs/troubleshooting.md#running-on-alpine
# Note that each alpine version supports a specific version of chromium
# Note that chromium and puppeteer-core are released together and it is the only version
# that is guaranteed to work. Upgrades must be done in lockstep.
# https://www.npmjs.com/package/puppeteer-core?activeTab=versions for corresponding versions

RUN apk add --no-cache \
chromium=81.0.4044.113-r0 \
nss \
freetype \
freetype-dev \
harfbuzz \
ca-certificates \
ttf-freefont \
tini
chromium=83.0.4103.116-r0 \
nss \
freetype \
freetype-dev \
harfbuzz \
ca-certificates \
ttf-freefont \
tini
# This package is needed to render Chinese characters in autoreply PDFs
RUN echo @edge http://nl.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories && apk add wqy-zenhei@edge
ENV CHROMIUM_BIN=/usr/bin/chromium-browser
Expand Down
39 changes: 39 additions & 0 deletions docs/DEPLOYMENT_SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,45 @@ The following env variables are set in Travis:

#### Banners

These environment variables allow us to set notification banners in the
application without a full redeployment of the application. Note the hierarchy
of the banner content.

In addition, you can change the color of the banner by adding a type encoding in
the environment variable string. The default banner type will be `info` if no encoding is
provided.

The possible banner type prefixes are: `info:`, `warn:`, and `error:`. Other
prefixes will not work and the invalid prefixes will be shown in the banner
text.

Examples:

```
SITE_BANNER_CONTENT=info:This is an info banner. You can also add links in the text like https://example.com. There is also a dismiss button to the right of the text.
```

![Info banner
example](https://user-images.githubusercontent.com/22133008/93852946-8a867780-fce5-11ea-929f-a0ce1c6796b9.png)

```
SITE_BANNER_CONTENT=warn:This is a warning banner. You can also add links in the text like https://example.com
```

![Warning banner example](https://user-images.githubusercontent.com/22133008/93852559-cec54800-fce4-11ea-9376-9b2802e8ac62.png)

```
SITE_BANNER_CONTENT=error:This is an error banner. You can also add links in the text like https://example.com
```

![Error banner example](https://user-images.githubusercontent.com/22133008/93852689-1055f300-fce5-11ea-956d-d5966cbe86d8.png)

```
SITE_BANNER_CONTENT=hello:This is an invalid banner type, and the full text will be shown. The default banner type of `info` will used.
```

![Invalid banner default example](https://user-images.githubusercontent.com/22133008/93853306-392ab800-fce6-11ea-9891-f752bdad236e.png)

| Variable | Description |
| :----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `SITE_BANNER_CONTENT` | If set, displays a banner message on both private routes that `ADMIN_BANNER_CONTENT` covers **and** public form routes that `IS_GENERAL_MAINTENANCE` covers. Overrides all other banner environment variables |
Expand Down
5 changes: 1 addition & 4 deletions docs/TROUBLESHOOTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ A list of common issues that developers face and how to resolve them.

This could happen if node modules were compiled with a different version of node, or if node modules fail to compile due to other configuration errors.

### [Configuration Errors](https://stackoverflow.com/questions/21656420/failed-to-load-c-bson-extension)

Some modules such as `node-gyp` require Python 2.x and if your system's Python points to 3.x, it will fail to compile bson, without warning. Fix this by setting Python 2.x to be the default on your system or ensuring that the Python global key in your npm config points to the 2.x executable on your system.

### [Node Versioning Error](https://stackoverflow.com/questions/28486891/uncaught-error-module-did-not-self-register)

Run the following commands to set the node version and then re-install the node modules:
Expand All @@ -21,4 +17,5 @@ npm install
```

## JavaScript out of memory error

On your Docker application, go to Preferences > Resources and increase the amount of memory allocated for Docker.
146 changes: 55 additions & 91 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading