Skip to content

phdccltd/phdcc-papers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

phdcc-papers

CircleCI Coverage Status SonarCloud

Papers: PHDCC journal/conference abstract and paper submission and review system.

To be used in conjuction with phdcc-papers-api. Please read the full set up instructions there.

Runtime environment

Run papers server

server .env

Create a .env text file in the root directory of this component with the following secrets:

API='https://papers.example.org/api'
SITE='https://papers.example.org/'
RECAPTCHA_SITE_KEY='recaptcha site key'

Optionally add all these variables to send a mail when the production server is started:

STARTUP_EMAIL='to@example.com'
STARTUP_SUBJECT='Papers nuxt restarted'
STARTUP_FROM='from@example.com'

If running in a dev environment at localhost that calls a website server API, specify the server API RECAPTCHA_BYPASS to bypass the authenication recaptcha. Do not put RECAPTCHA_BYPASS on your production site.

Note: any values you put in this .env file WILL BE INCLUDED in the compiled code sent to the user.

server shell command

Also create a shell file such as runpapers.sh:

./node_modules/.bin/cross-env PORT=1234 node .output/server/index.mjs

Run as static website

Papers can be run as a static website without pm2 provided nginx, for example, is set up to server 200.html if any page is not found, eg include this in your config file in /etc/nginx/sites-available:

  root /var/www/.output/public;
  index index.html index.htm;
  location / {
		try_files $uri $uri/ =404;
	}
  error_page 404 /200.html;

In this case you simply need to run npm run generate instead of npm run update to restart the server.

Build Setup

# Grab the code
git clone https://github.com/phdccltd/phdcc-papers.git
cd phdcc-papers

# install dependencies
npm install

# serve with hot reload at eg localhost:1234
npm run dev

# For simple production use:
npm run build
node .output/server/index.mjs

# For production in PM2, create an ecosystem file or start
npm run build
pm2 start runpapers.sh --name papers -- start

Updating

An existing installation had best do a full install rather than an update:

git pull
rm package-lock.json
rm -r node_modules
npm install
npm run build

Then restart eg using pm2.

Testing

This code has Cypress End to End tests which generate coverage of the JavaScript/TypeScript in vue js and ts files.

The clienttest instance of this app must be run alongside the forclient instance of the Papers API code.

  • Papers API forclient: runs using Sqlite3 in-memory database listening on a localhost port: npm run forclient
  • Papers client clienttest: builds with coverage and runs at a local port access the API on its localhost port: npm run clienttest

You can then run Cypress interactively using npx cypress open or using command: npm run cypress. Coverage output is generated in \coverage.

CYPRESS_COVERAGE='true'
NUXT_PORT=3000
NUXT_PUBLIC_SITE='https://example.com'
NUXT_PUBLIC_API='http://localhost:9000/api'
RECAPTCHA_SITE_KEY=''

Used with thanks

Thanks to all the developers who produced the open-source modules that are used, including

Sponsors

This development has kindly been supported by IRCOBI.

License

MIT