From 4f0ab3e41d3a759028ceea99751ee7feb82ff74d Mon Sep 17 00:00:00 2001 From: Dimitrie Stefanescu Date: Mon, 4 Jan 2021 14:00:23 +0200 Subject: [PATCH 1/2] fix(server): remote hotfix: correctly serving frontend in production from server --- packages/server/app.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/server/app.js b/packages/server/app.js index edc2a2d67..4fe3622fe 100644 --- a/packages/server/app.js +++ b/packages/server/app.js @@ -9,6 +9,7 @@ const compression = require( 'compression' ) const appRoot = require( 'app-root-path' ) const logger = require( 'morgan-debug' ) const bodyParser = require( 'body-parser' ) +const path = require( 'path' ) const debug = require( 'debug' ) const Sentry = require( '@sentry/node' ) @@ -112,10 +113,10 @@ exports.startHttp = async ( app ) => { // Production mode -> serve things statically. else { - app.use( '/', express.static( `${appRoot}/../packages/frontend/dist` ) ) + app.use( '/', express.static( path.resolve( `${appRoot}/../packages/frontend/dist` ) ) ) app.all( '*', async ( req, res ) => { - res.sendFile( `${appRoot}/../packages/frontend/dist/app.html` ) + res.sendFile( path.resolve( `${appRoot}/../packages/frontend/dist/app.html` ) ) } ) } From 7bf880d093faf71741d57c7c4819f40b4cdc5f6a Mon Sep 17 00:00:00 2001 From: Dimitrie Stefanescu Date: Mon, 4 Jan 2021 14:04:21 +0200 Subject: [PATCH 2/2] chore(docs/ci): fixed minor formatting in readme, added todos in circle ci yaml --- .circleci/config.yml | 11 +++++++++-- packages/server/readme.md | 4 ++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 78d8a8de9..52013f8d1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,13 +1,19 @@ version: 2.1 +# TODO: +# add build workflow for frontend +# rename server test workflow +# add linting jobs +# run jobs/workflows on correct package changes (not all...) + workflows: version: 2.1 build: jobs: - - test + - test_server jobs: - test: + test_server: docker: - image: 'circleci/node:12' - image: 'circleci/redis:6' @@ -24,6 +30,7 @@ jobs: SESSION_SECRET: 'keyboard cat' STRATEGY_LOCAL: true CANONICAL_URL: 'http://localhost:3000' + # Note: some of these commands need to be run in the server package folder. steps: - checkout - run: diff --git a/packages/server/readme.md b/packages/server/readme.md index 25134f3fb..796640e8a 100644 --- a/packages/server/readme.md +++ b/packages/server/readme.md @@ -25,7 +25,7 @@ You can customise your local deployment by editing and filling in a `.env` file. - copy the `.env-example` file to `.env` - open and edit the `.env` file. -## Developing +## Developing The server consists of several semi-related components, or modules. These can be found in `/modules`. Module composition: - an `index.js` file that exposes two functions, `init` and `finalize` (mandatory) @@ -33,7 +33,7 @@ The server consists of several semi-related components, or modules. These can be ## Server & Apps -### Frontend +### Frontend - In **development** mode, the Speckle Server will proxy the frontend from `localhost:8080` to `localhost:3000`. If you don't see anything, ensure you've run `npm run dev` in the frontend package.