Deployment guide
We need to add both a test/staging/CI deployment guide and some production deployment guidelines.
Here's a start for the staging deployment:
Deployment a simple staging instance on Ubuntu 20.04
Warning! This method is not suitable for production!
apt-get install postgresql git nodejs npm
Yarn
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
PostgreSQL
postgres=# create database kotahi;
CREATE DATABASE
postgres=# create user kotahi with password 'hijusttesting';
CREATE ROLE
postgres=# grant all privileges on database kotahi to kotahi;
GRANT
If you want to seed things from e.g. the initialState dump, a superuser is currently required.
clone and yarn
git clone https://gitlab.coko.foundation/kotahi/kotahi.git
cd kotahi
yarn
configure ORCID auth
(These can be obtained from ORCID: https://support.orcid.org/hc/en-us/articles/360006897174-Register-a-public-API-client-application)
export ORCID_CLIENT_ID=YOUR_ORCID_CLIENT_ID
export ORCID_CLIENT_SECRET=YOUR_ORCID_CLIENT_SECRET
configure the base url for redirects
It's in config, 'pubsweet-server', and 'baseUrl'.
Creating the admin user
Users are automatically created when logging in with ORCID. You can make users admin by going into the console (using yarn console
) and updating their admin
flag, e.g. await User.query().update({admin: true})
.
Temporary webpack-dev-server-based staging
Use production env, and compress: true in devServer options.
Start docker job runner
E.g.:
docker run -e DATABASE_URL="postgres://username@host.docker.internal/kotahi" -e WAIT_SERVICE_PORT="host.docker.internal:5432" pubsweet/job-xsweet
Start the server and web app comilation
You can run yarn start:server-and-client
in a screen and detatch it, for some super easy staging/development deploy.