Decentralized science prototype (WIP)
- join our community forum
- connect at our developers' chat
To run and install this application you need:
First, clone this repo.
Then, run:
git submodule init
To install, run
npm install
Before running the server, you have to start the mongoDB service. Check if it is already running:
service mongod status
If it is not, start the service:
sudo service mongod start
Note: It might be mongodb insted of mongod for certain Linux distributions, such as OpenSuse
We use GraphQL Faker to generate mocked data. To use it, first install it globally:
npm install -g graphql-faker
Then, to start the server, run:
npm run mocked
The server is now running on http://localhost:4000. If you want to change the address the clien should connect to, you can set the host and port configuration at src/config.json
.
Instead of using mocked data, you can connect to a real OJS database. To connect to a OJS database, copy server/src/serverConfig.json.example
to server/src/serverConfig.json
and set the database connection configuration variables host
, port
, user
, password
, and database
.
Then, to start the server, run:
npm run server
Now your data is served at port 4000
and can probably be accessed from outside your computer.
To avoid access from outside your computer, you can close the port for external connections:
iptables -A INPUT ! -s 127.0.0.1 -p tcp -m tcp --dport 4000 -j DROP
See Deployment section for instructions on how to password protect the data to allow external usage.
To run the web app, run:
npm start
A browser window should then open, with our web app working and connected to the server's data.
To deploy the app you sould build it and serve it.
- configure your
src/config.json
file, and set the host to your server name, port to433
and path to the path you want to use for your server, for instancegraphql
npm run build
commands builds the solution
To avoid access from outside your computer, you can close the port for external connections:
iptables -A INPUT ! -s 127.0.0.1 -p tcp -m tcp --dport 4000 -j DROP
You can use let's encrypt, and set it up for your system and nginx server using the recommended certbot.
You can use basic .htpaccess protection. For that, install apache2-utils
and set the password for your users
sudo apt-get install apache2-utils
sudo htpasswd -c /etc/apache2/.htpasswd <username>
-
First install
serve
:npm install -g serve
-
Then serve the app:
serve -s build
-
The static files of
npm run build
are atbuild/
folder should be served. For that you can use nginx, with a configuration similar to:
server {
listen 443;
server_name <your_server_name>;
# SSL Configuration using letsencrypt and certbot
ssl on;
ssl_certificate /etc/letsencrypt/live/<your_server_name>/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/<your_server_name>/privkey.pem;
ssl_stapling on;
ssl_stapling_verify on;
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains";
location /decentralized-science {
alias <your_path_to_build/_folder>;
}
location <path_at_your_/src/config.json> {
proxy_pass http://localhost:4000/graphql;
auth_basic "Restricted Area";
auth_basic_user_file /etc/apache2/.htpasswd;
}
Using Bloxgerg's Blockchain peer-review-app
Decentralized Science connects to Bloxberg Blockchain and it's peer reviewing app. In their blockchain, users can register their previous peer reviews, and import their Publons and F1000Research profiles.
Following database configuration instructions, configure your mongodb connection information:
-
Copy sample configuration file:
cp peer-review-app/server/config_template.js peer-review-app/server/config.js
-
Edit the configuration file to include your mongodb connection details, for instance, set
exports.databaseURI
to the default value= 'mongodb://localhost:27017'
.
run npm run bloxberg-server
to start the server
Your can access your password protected Decentralized Science Prototype at https://<your_server_name>/decentralized-science/