Introduction:

Habitica is an open-source habit-building program that treats your life as a role-playing game. When you successfully achieve the goals you set, your character will level up. If you fail, your character will lose HP in the game. You can also earn money to purchase weapons and armor by forming habits. This program not only helps you build and stick to habits but also brings you the fun and sense of accomplishment of gaming.

Note:

It's not recommended for individuals to deploy this themselves. Official apps are available for Android and IOS. Self-deployment cannot be linked (but can interact with the web version).

Preview:


System Requirements:

Memory >= 4GB

Deployment Method:

Step One: Update the source and install dependencies

apt update -y && apt upgrade -y   
apt install git -y 

Step Two: Set up swap

For physical memory between 4-8GB, set SWAP equal to the memory size. For physical memory between 8-64GB, set SWAP to 8GB.

curl -L https://raw.githubusercontent.com/spiritLHLS/addswap/main/addswap.sh -o addswap.sh && chmod +x addswap.sh && bash addswap.sh

Step Three: Install build tools

sudo apt-get install build-essential

Step Four: Install Node 14 and npm 6

  1. First, check if you have installed an incompatible version:

    node --version
    npm --version

    If you have installed the wrong version, uninstall it:

    sudo apt-get purge nodejs -y
    sudo apt-get purge node -y
  2. Then install the correct version:

    curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
    sudo apt-get install -y nodejs

    Check if the correct version has been successfully installed:

    node --version
    npm --version

    Step Five: Install Mocha

    sudo npm install -g mocha

    Step Six: Create a new user and log in with the new user

    adduser user
    exit

    Step Seven: Clone the repository

    git clone https://github.com/HabitRPG/habitica.git
    cd habitica

    Step Eight: Initialize Habitica configuration

    cp config.json.example config.json

    Step Nine: Install dependencies

    npm install

    Step Ten: Launch Habitica Web server

  3. In the first command prompt:
    Use npm run mongo:dev to start Habitica's own Mongo DB instance. Wait until you see "Started replica set on "mongodb://localhost:27017?replicaSet=rs" before proceeding to the next step. (The first time you run it, it will download and install MongoDB in the Habitica directory, so this will take a few minutes.) Do not perform any operations in this terminal before the Mongo command completes.
  4. In the second command prompt or terminal window, use the following command to launch the Habitica Web server:
    npm start
  5. In the third command prompt or terminal window, use the following command to build the website client:
    npm run client:dev

    Step Eleven: Reverse proxy to the domain

    Here, we use a very simple method: Origin Rules provided by Cloudflare.
    Configuration is as follows:

    Change the Field to Hostname, Value to the full domain you choose, and Rewrite to as 8080.

    Remember to resolve your subdomain to the server IP:
    Use an A record, Name as the domain prefix, and Content as the server address.

Relevant Links:

GitHub address: https://github.com/HabitRPG/habitica
Demo: https://habitica.com
Official tutorial address: https://habitica.fandom.com/wiki/Setting_up_Habitica_Locally_on_Linux

Acknowledgements:

Thanks to the blogger Testcharon for providing the server for testing.

Tag:Configure, Games, Habit Formation, Habitica

Original link:http://enblog.fuyiran.link/Technology/43.html

Copyright: All posts on this blog, unless otherwise stated, are published using theCC BY-NC-SA 4.0 license agreement. Please indicate the source for reprinting Fu Speaking (enblog.fuyiran.link)

Only one comment.

  1. gusetguset guset

    great

Add a new comment.