diff --git a/.dockerignore b/.dockerignore
index cfdff5982..a2047d9fd 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1,7 +1,6 @@
node_modules/
dist/
build/
-.env
.env.example
.travis.yml
.docker-compose.yml
diff --git a/README.md b/README.md
index da240c428..db9d8d7fb 100755
--- a/README.md
+++ b/README.md
@@ -38,19 +38,28 @@ Launches Jest test runner.
Launches TestCafe test runner and performs browser tests on headless chrome.
### `npm run browserTestCLI`
-Launches the application using `node dist` command and then launches TestCafe test runner in headless mode. Mainly used by Travis CI.
+Launches the application using `node dist` command and then launches TestCafe test runner in headless mode. Mainly used in GitHub Actions.
## How to use
For development:
- Make sure npm packages are installed by running `npm install --legacy-peer-deps`in project root.
- Make sure you have environment variables set. `.env.example` should have all required values so you can copy it to `.env`.
- Then you can start development server using `npm run dev`. Which watches files and updates on code changes.
+- Open the application by loading `localhost:2048` in the browser
To run in production mode:
- Make sure npm packages are installed by running `npm install --legacy-peer-deps`in project root.
- Make sure you have environment variables set. `.env.example` should have all required values so you can copy it to `.env`.
- Build files by running `npm run build`
-- Then you can just run the app with `npm start`
+- Then you can run the app with `npm start`
+- Open the application by loading `localhost:2048` in the browser
+
+To run with docker compose:
+- Install Docker if not installed, check that port `2048` is free, not occupied by running server.
+- Make sure you have environment variables set. `.env.example` should have all required values so you can copy it to `.env`.
+- Run `docker compose up`
+- Open the application by loading `localhost:2048` in the browser
+
## Environment variables
This is a documentation (some day hopefully exhaustive) of environment variables and how to use them.
diff --git a/docker-compose.yml b/docker-compose.yml
index 11aa61080..6e75a31eb 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,6 +1,5 @@
-version: "3.8"
services:
- web:
+ app:
build: .
ports:
- "2048:2048"
diff --git a/package-lock.json b/package-lock.json
index 3f4643926..49a9bd448 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -16437,9 +16437,9 @@
}
},
"node_modules/nanoid": {
- "version": "3.3.7",
- "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz",
- "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==",
+ "version": "3.3.8",
+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz",
+ "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==",
"funding": [
{
"type": "github",
diff --git a/server/server.js b/server/server.js
index b0ee473be..0864a8bce 100644
--- a/server/server.js
+++ b/server/server.js
@@ -52,7 +52,7 @@ const setupTests = () => {
setupTests();
// Handle sitemap creation
- if (sitemapActive()) {
+if (sitemapActive()) {
// Generate sitemap on start
generateSitemap();
// Update sitemap every monday
@@ -70,10 +70,6 @@ const supportedLanguages = config.supportedLanguages;
// This is required for proxy setups to work in production
app.set('trust proxy', true);
-// The request handler must be the first middleware on the app
-if (Sentry) {
- app.use(Sentry.Handlers.requestHandler());
-}
// Add static folder
app.use(express.static(path.resolve(__dirname, 'src')));
@@ -151,9 +147,9 @@ app.get('/*', (req, res, next) => {
res.end(htmlTemplate(req, reactDom, preloadedState, css, cssString, emotionCss, locale, helmet, customValues));
});
-// The error handler must be before any other error middleware
+// Setup Sentry error handler
if (Sentry) {
- app.use(Sentry.Handlers.errorHandler());
+ Sentry.setupExpressErrorHandler(app);
}
console.log('Application version tag:', GIT_TAG, 'commit:', GIT_COMMIT);
console.log(`Starting server on port ${process.env.PORT || 2048}`);