The following dependencies must have already been installed on your machine:
- Node.js and npm
- PostgreSQL
- Apache HTTP Server
You can download Node.js and npm from here. After installation, you can check the installed versions using the following commands:
node -v
npm -vTo install PostgreSQL on Ubuntu, use the following commands:
sudo apt update
sudo apt install postgresql postgresql-contribAfter installation, you can check the installed version using the following command:
psql --versionTo install Apache HTTP Server on Ubuntu, use the following commands:
sudo apt update
sudo apt install apache2After installation, you can check the installed version using the following command:
apache2 -vFirst, install the project dependencies:
npm installTo run the development server:
npm run devOpen http://localhost:3000 with your browser to see the result.
To build the project for production:
npm run buildTo start the production server:
npm startCreate a new configuration file for your site in the /etc/apache2/sites-available/ directory:
sudo nano /etc/apache2/sites-available/your-site.confAdd the following content to the file:
<VirtualHost *:80>
ServerName your-site.com
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>Enable the new configuration:
sudo a2ensite your-siteReload Apache to apply the changes:
sudo systemctl reload apache2Open the PostgreSQL prompt:
sudo -u postgres psqlCreate a new database:
CREATE DATABASE your_database;Create a new user:
CREATE USER your_user WITH ENCRYPTED PASSWORD 'your_password';Grant privileges to the user:
GRANT ALL PRIVILEGES ON DATABASE your_database TO your_user;Exit the PostgreSQL prompt:
\qAfter setting up the database and user, you can create the necessary tables and set constraints by executing the SQL script located in prisma/schema.sql.
First, navigate to the directory containing the schema.sql file:
cd prismaThen, execute the SQL script using the psql command:
psql -U your_user -d your_database -f schema.sqlReplace your_user and your_database with your actual PostgreSQL username and database name.
This command will run the SQL commands in the schema.sql file, setting up your database schema as defined in the file.
Update the DATABASE_URL in the .env file with your database information:
DATABASE_URL="postgresql://your_user:your_password@localhost:5432/your_database?schema=public"The .env must be located in the project home directory. If it does not exists, create a new empty file and add the above configuration or copy the prisma/example.env file to .env.
After deploying the app, the JSON file that can be directly plugged in to the Bioquery interface can be generated by navigating to /api/data (e.g. http://localhost:3000/api/data).
Questions and queries can also be uploaded directly via the API by POST requests to the templates API (/api/templates). The format is described and can be further extended here.
If you have existing data in a JSON file that you want to migrate to the database, you can use the provided KNIME workflow (workflows/migrate_data.knwf).
Before executing the workflow, you need to update a couple of things:
-
Update the JSON file path in the JSON Reader node. Double-click on the JSON Reader node and update the file path to point to your JSON file.
-
Update the database connection details in the PostgreSQL Connector node. Double-click on the PostgreSQL Connector node and update the database host, port, database name, username, and password to match your PostgreSQL database setup.
After updating these details, you can execute the workflow (either from the KNIME GUI or using the command below). This will read data from your JSON file, transform it, and insert it into the database.
knime -nosplash -application org.knime.product.KNIME_BATCH_APPLICATION -workflowDir="workflows/migrate_data.knwf"This command assumes that you have KNIME installed and available in your system's PATH. If not, you'll need to replace knime with the full path to your KNIME executable.