Metahkg Docs
Docker
Visit Metahkg Docs on GitLab
Set theme to dark (⇧+D)

Setup mongodb

NOTE: This is no longer necessary as mongodb is now automatically setup by metahkg-server.

Assuming you configured mongodb to run on port 30000.

Start mongodb

You must start mongodb before following the steps.

$ cd docker
# switch to the docker directory

$ docker-compose up metahkg-mongo -d --build
# start mongodb

Configure the databases

<username> and <password> must be the same username and password you configured in Environmental variables .

Script

Create a .env file at the root of the repository.

# .env
DB_URI=mongodb://<username>:<password>@localhost:30000

Run:

$ yarn run setup
# or npm run setup

Manually

$ mongoimport --uri=mongodb://<username>:<password>@localhost:30000 -d=metahkg metahkg-server/templates/server/category.json
# import categories

$ mongosh mongodb://<username>:<password>@localhost:30000
# log into mongodb
test> use metahkg
// switch to metahkg

metahkg> db.viral.createIndex({ "createdAt": 1 }, { expireAfterSeconds: 172800 })
// expire viral collections after two days
metahkg> db.summary.createIndex({ "op": "text", "title": "text" }) 
// for text search
metahkg> db.limit.createIndex({ "createdAt": 1 }, { expireAfterSeconds: 86400 })
// expire limit collections after a day
metahkg> db.verification.createIndex({ "createdAt": 1 }, { expireAfterSeconds: 604800 })
// expire verification collections after 7 days
metahkg> exit