Skip to content

osmannkartall/knowzone

Repository files navigation

Knowzone

Backend Unit Tests UI Tests

Knowzone is a knowledge sharing application. Create your custom forms and share with others.

demo

Table of Contents

Using the App

Run docker compose up -d command once and it's ready to go. You can access the application from the browser via http://localhost:3005.

Backup and Restore Application Data

Backup database and file server by running the following command

./backup_restore.sh backup

You can restore your database and file server after docker compose up -d by running the following command

./backup_restore.sh restore

Development

Installations

Running

MongoDB

Caution: This is not production setup. You can refer to Authentication and Deploy Replica Set With Keyfile Authentication for additional information.

Run a mongo db in a docker container with a persistent volume called dev-mongo-data. This will create a single node replica set. This is necessary to run transactions in MongoDB.

./init-db.sh

Optional: Create a connection from MongoDB Compass. Set URI to mongodb://localhost:27017/?replicaSet=rs0&directConnection=true and press the connect button.

Node Express

cd server

Create .env file with the values below. Note: Ideally, this file should not be checked in.

PORT=8000
MONGODB_URI=mongodb://localhost:27017/knowzone?replicaSet=rs0&directConnection=true
REACT_URL=http://localhost:3005
SESSION_SECRET=knowzone-auth-secret
SESSION_NAME=sid
SESSION_LIFETIME=3600000
SESSION_SECURE=false
PUBLIC_UPLOAD_PATH=./uploads
IMAGE_UPLOAD_SUBPATH=images

Note: Install dependencies if you run the application for the first time. Otherwise, you can skip this step.

npm install

Run the application on your development environment.

# This will execute the command corresponding to the dev property
# under the scripts object in server/package.json
npm run dev

See the details of the architecture used in the Node.js project.

React

cd web

Create .env file with the values below.

PORT=3005
ESLINT_NO_DEV_ERRORS=true
REACT_APP_KNOWZONE_BE_URI=http://localhost:8000
REACT_APP_KNOWZONE_FE_URI=http://localhost:3005

Install dependencies.

npm install

Run the application.

npm start

Data Generator

You can generate fake data by using the following command.

cd server

npm run data-generator

Running on Azure Kubernetes Service Cluster or Local Kubernetes Cluster

Please refer the guide inside infra directory.