How to Install Countly Community Edition on nixOS Latest

Countly is an open-source analytics platform that helps businesses and mobile app developers to delve deeper into their data and gain insights about their audience. The steps mentioned below explain how to install Countly Community Edition on nixOS latest.

Prerequisites:

Before you proceed with the installation process of Countly Community Edition on nixOS, make sure that you have the following prerequisites:

  1. A working nixOS latest installation.
  2. A user with administrative privileges.

Step 1: Update the System

Make sure to update your system before starting the installation process. Open the terminal window and type the following command:

sudo nix-env -iA nixos.pkgs.<package>

Step 2: Install MongoDB

MongoDB is a NoSQL document-oriented database. Countly uses MongoDB as its primary database. Install MongoDB by typing the following command in the terminal:

sudo nix-env -iA nixos.mongodb3

Step 3: Install the Countly Server

Run the following command in the terminal to install the Countly server:

sudo nix-env -iA nixos.countly-server

Step 4: Create a Countly Configuration File

Create a new configuration file by running the following command:

sudo nano /etc/countly/api/config.js

Copy and paste the following contents into the file:

var CountlyConfig = {
    mongodb: {
        host: "localhost",
        db: "countly",
        port:"27017",
        max_pool_size: 500,
        batch_size: 1000
    },
    api: {
        workers: 0,
        port: 3001, //processes will listen on these ports for incoming requests
        max_sockets: 1024,
    },
    logging: {
        info: ["jobs"],
        default: "warn",
    },
    web: {
        port: 6001,
        host: "localhost",
    },
    path: "",
    security: {
        password_secret: "<%= secretkey %>",
        api_key: "<%= api_key %>",
        use_cdn: true,
        ssl: false,
        enable_signup: true,
        session_duration_limit:120000,
        require_anonymous: false,
        password_min_length: 8,
        password_expiration: 0,
        password_lockout: 0,
        password_lockout_duration: 300,
        max_tries: 3,
        max_messengers: 3,
        registration_invite: false,
        delete_user_data: true,
        com_session_secret: "<%= secretkey2 %>"
    }
};

module.exports = CountlyConfig;

Please replace the <%= secretkey %>, <%= api_key %>, and <%= secretkey2 %> placeholders within the above code with your own chosen values.

Step 5: Start Countly Server

Start Countly server by running the following command:

sudo countly start

After running the above command, Countly will be running on Server Port 6001. You can access the Countly server on this port by navigating to http://localhost:6001 in your web browser.

Congratulations! You have successfully installed Countly Community Edition on nixOS.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!