Skip to content
This repository has been archived by the owner on Mar 2, 2022. It is now read-only.

Latest commit

 

History

History
56 lines (42 loc) · 1.51 KB

DEPLOY.md

File metadata and controls

56 lines (42 loc) · 1.51 KB

Deploying Metahkg

Prerequisites

  • x86_64 debian linux (only tested on ubuntu)
  • mongodb (either locally or remotely)
  • mailgun key (for sending emails, obviously)
  • hcaptcha site key and secret pair (for anti-spamming)
  • a publicily accessible s3 bucket

Set up

Run ./setup.sh for a fast setup. It will install all the dependencies for you. However, you will still need to configure the env variables. Alternatively, use the following step-by-step guide. It assumes that you have installed all the dependencies.

Mongodb

$ mongoimport -d=metahkg-threads templates/server/category.json
$ mongosh
test> use metahkg-threads
metahkg-threads> db.hottest.createIndex({ "createdAt": 1 }, { expireAfterSeconds: 172800 })
metahkg-threads> db.summary.createIndex({ "op": "text", "title": "text" }) //for text search
metahkg-threads> use metahkg-users
metahkg-users> db.limit.createIndex({ "createdAt": 1 }, { expireAfterSeconds: 86400 })
metahkg-users> db.verification.createIndex({ "createdAt": 1 }, { expireAfterSeconds: 300 })
metahkg-users> exit

Environmental variables

cp templates/template.env .env

Then edit values in the .env file.

Build the React app

yarn install
yarn run build

Deploying backend

# run at the repository root
yarn install
yarn run start

You must need a domain. If you don't have one and deploys it locally only, use metahkg.test.wcyat.me which points to localhost. Config nginx to do this (proxy_pass http://localhost:(the port you choose in .env)).