Skip to content
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .config/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ export default [
},
},
{
ignores: ['dist/', 'node_modules/', '.astro/', '.netlify/', '.vercel/'],
ignores: ['**/dist/', '**/node_modules/', '.astro/', '.netlify/', '.vercel/'],
},
];
5 changes: 3 additions & 2 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ WHO_API_KEY=''
# PUBLIC_API_TIMEOUT_LIMIT='25000'# Timeout for API requests, in milliseconds
# API_CORS_ORIGIN='*' # Enable CORS, by setting your allowed hostname(s) here
# API_ENABLE_RATE_LIMIT='true' # Enable rate limiting for the API
# REACT_APP_API_ENDPOINT='/api' # The endpoint for the API (can be local or remote)
# PUBLIC_API_ENDPOINT='/api' # The endpoint for the API (can be local or remote)
# APP_STATIC_DIR='' # Override location of the built React app (defaults to ../app/dist)
# BOSS_SERVER='true' # Set on the official public instance only, builds the Astro marketing pages
# ENABLE_ANALYTICS='false' # Enable Plausible hit counter for the frontend
# BOSS_SERVER='false' # Marketing homepage (only used by official instance)
# TRUST_PROXY='1' # Set if running behind a reverse proxy (Traefik, nginx, etc).
# Use a number of hops (e.g. '1'), 'true', or a CIDR list.
11 changes: 6 additions & 5 deletions .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -900,9 +900,9 @@ Install the prerequisites listed in the [Developing](#developing) section, then
```bash
git clone https://github.com/Lissy93/web-check.git # Download the code from GitHub
cd web-check # Navigate into the project dir
yarn install # Install the NPM dependencies
yarn build # Build the app for production
yarn serve # Start the app (API and GUI)
yarn install # Install workspace dependencies
yarn build # Build the api wrappers, app and site
yarn start # Run the Express server (api and GUI)
```

---
Expand Down Expand Up @@ -947,7 +947,8 @@ But there are some optional environmental variables that you can set to give you
| `API_CORS_ORIGIN` | Enable CORS, by setting your allowed hostname(s) here (e.g. `example.com`) |
| `CHROME_PATH` | The path the Chromium executable (e.g. `/usr/bin/chromium`) |
| `DISABLE_GUI` | Disable the GUI, and only serve the API (e.g. `false`) |
| `REACT_APP_API_ENDPOINT` | The endpoint for the API, either local or remote (e.g. `/api`) |
| `PUBLIC_API_ENDPOINT` | The endpoint for the API, either local or remote (e.g. `/api`) |
| `APP_STATIC_DIR` | Override path to the built React app (defaults to `packages/app/dist`) |

All values are optional.

Expand All @@ -964,7 +965,7 @@ Note that keys that are prefixed with `REACT_APP_` are used client-side, and as
3. Install dependencies: `yarn`
4. Start the dev server, with `yarn dev`

You'll need [Node.js](https://nodejs.org/en) (V 18.16.1 or later) installed, plus [yarn](https://yarnpkg.com/getting-started/install) as well as [git](https://git-scm.com/).
You'll need [Node.js](https://nodejs.org/en) (V 22 or later) installed, plus [yarn](https://yarnpkg.com/getting-started/install) as well as [git](https://git-scm.com/).
Some checks also require `chromium`, `traceroute` and `dns` to be installed within your environment. These jobs will just be skipped if those packages aren't present.

---
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bump-and-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
github.rest.pulls.listFiles, { owner, repo, pull_number }
);
const codePatterns = [
/^src\//, /^api\//, /^public\//, /^Dockerfile$/, /^[^/]+\.(js|mjs)$/,
/^packages\//, /^scripts\//, /^Dockerfile$/, /^[^/]+\.(js|mjs)$/,
];
const codeChanged = files.some(f =>
codePatterns.some(p => p.test(f.filename))
Expand Down
16 changes: 12 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,20 @@ jobs:

- name: ✅ Verify Build Output
run: |
if [ ! -d "dist/client" ]; then
echo "❌ Build failed: dist/client directory not created"
if [ ! -f "packages/site/dist/index.html" ]; then
echo "❌ Build failed: site index not found"
exit 1
fi
if [ ! -f "dist/server/entry.mjs" ]; then
echo "❌ Build failed: SSR entry not found"
if [ ! -f "packages/site/dist/check/index.html" ]; then
echo "❌ Build failed: check SPA shell not found"
exit 1
fi
if [ ! -f "packages/app/dist/index.html" ]; then
echo "❌ Build failed: app standalone build not found"
exit 1
fi
if [ "$(ls -1 api/*.js 2>/dev/null | wc -l)" -lt 30 ]; then
echo "❌ Build failed: vercel api wrappers not generated"
exit 1
fi
echo "✅ Build successful"
Expand Down
127 changes: 0 additions & 127 deletions .github/workflows/deploy-aws.yml

This file was deleted.

5 changes: 2 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ on:
tags:
- '*'
paths:
- src/**
- api/**
- public/**
- packages/**
- scripts/**
- Dockerfile

permissions:
Expand Down
4 changes: 1 addition & 3 deletions .yarnrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
# engines.node is pinned to 20.x so @astrojs/vercel@7.x emits a supported
# Vercel runtime for the SSR _render function. Local devs on a different
# Node version can still run yarn install via this flag.
# Allow workspace install to proceed when sub-deps disagree on engine ranges
--install.ignore-engines true
61 changes: 29 additions & 32 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,64 +1,61 @@
# Specify the Node.js version to use
ARG NODE_VERSION=22

# Specify the Debian version to use, the default is "bullseye"
ARG DEBIAN_VERSION=bullseye

# Use Node.js Docker image as the base image, with specific Node and Debian versions
FROM node:${NODE_VERSION}-${DEBIAN_VERSION} AS build

# Set the container's default shell to Bash and enable some options
SHELL ["/bin/bash", "-euo", "pipefail", "-c"]

# Install Chromium browser and Download and verify Google Chrome’s signing key
# Install chromium plus build tooling so puppeteer and friends compile cleanly
RUN apt-get update -qq --fix-missing && \
apt-get -qqy install --allow-unauthenticated gnupg wget && \
wget --quiet --output-document=- https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor > /etc/apt/trusted.gpg.d/google-archive.gpg && \
echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list && \
wget --quiet --output-document=- \
https://dl-ssl.google.com/linux/linux_signing_key.pub | \
gpg --dearmor > /etc/apt/trusted.gpg.d/google-archive.gpg && \
echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" \
> /etc/apt/sources.list.d/google.list && \
apt-get update -qq && \
apt-get -qqy --no-install-recommends install chromium traceroute python make g++ && \
rm -rf /var/lib/apt/lists/*

# Run the Chromium browser's version command and redirect its output to the /etc/chromium-version file
RUN /usr/bin/chromium --no-sandbox --version > /etc/chromium-version
apt-get -qqy --no-install-recommends install \
chromium traceroute python make g++ && \
rm -rf /var/lib/apt/lists/*

# Set the working directory to /app
WORKDIR /app

# Copy package.json and yarn.lock to the working directory
# Copy workspace manifests first so yarn can plan and cache the dependency graph
COPY package.json yarn.lock ./
COPY packages/api/package.json ./packages/api/package.json
COPY packages/app/package.json ./packages/app/package.json
COPY packages/site/package.json ./packages/site/package.json

# Run yarn install to install dependencies and clear yarn cache
RUN apt-get update && \
yarn install --frozen-lockfile --network-timeout 100000 && \
RUN yarn install --frozen-lockfile --network-timeout 100000 && \
rm -rf /app/node_modules/.cache

# Copy all files to working directory
COPY . .
# Copy api and app sources plus the site's shared public assets
# (fonts, icons) which the standalone app build pulls in. Site src is skipped.
COPY packages/api ./packages/api
COPY packages/app ./packages/app
COPY packages/site/public ./packages/site/public

# Run yarn build to build the application
RUN yarn build --production
RUN yarn build:docker

# Final stage
FROM node:${NODE_VERSION}-${DEBIAN_VERSION} AS final
FROM node:${NODE_VERSION}-${DEBIAN_VERSION} AS final

WORKDIR /app

COPY package.json yarn.lock ./
COPY --from=build /app .

RUN apt-get update && \
apt-get install -y --no-install-recommends chromium traceroute && \
chmod 755 /usr/bin/chromium && \
rm -rf /var/lib/apt/lists/* /app/node_modules/.cache
rm -rf /var/lib/apt/lists/* /tmp/*

COPY --from=build /app/package.json /app/yarn.lock ./
COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/packages/api ./packages/api
COPY --from=build /app/packages/app/package.json ./packages/app/package.json
COPY --from=build /app/packages/app/dist ./packages/app/dist

# Exposed container port, the default is 3000, which can be modified through the environment variable PORT
EXPOSE ${PORT:-3000}

# Point Chromium-using libs at the system binary, skip puppeteer's bundled download
ENV CHROME_PATH='/usr/bin/chromium' \
PUPPETEER_EXECUTABLE_PATH='/usr/bin/chromium' \
PUPPETEER_SKIP_DOWNLOAD='true'

# Define the command executed when the container starts and start the server.js of the Node.js application
CMD ["yarn", "start"]
CMD ["node", "packages/api/server.js"]
50 changes: 0 additions & 50 deletions api/_common/aws-webpack.config.js

This file was deleted.

Loading