Introduction

Ackee is a self-hosted, open-source, privacy focused, analytics platform that provides useful insights into your website’s traffic.

By running Ackee in a Docker container, you can easily deploy and manage it on your own server.

In this guide, I’ll talk you through the process of creating an Ackee Docker container and setting it up using Docker Compose.

Prerequisites

Before you start, ensure you have the following:

  • Docker installed on your server.

  • Docker Compose installed on your server.

  • Basic knowledge of working with Docker and Docker Compose.

Create a Docker Compose File

Open your text editor and create a new file named docker-compose.yml.

In this file, we define the configuration for the Ackee Docker container.

Define the Docker Compose Configuration

Copy and paste the following configuration into your docker-compose.yml file:

version: '3'
services:
  ackee:
    image: electerious/ackee
    container_name: ackee
    restart: always
    ports:
      - "3000:3000"
    environment:
      - WAIT_HOSTS=mongodb:27017
      - DATABASE_URI=mongodb://mongo:27017/ackee
    depends_on:
      - mongo
  mongo:
    image: mongo
    container_name: mongo
    restart: always
    ports:
      - '27017:27017'
    volumes:
      - ackee-mongo:/data/db
volumes:
  ackee-mongo:

This configuration defines two services: ackee and mongo.

The ackee service uses the electerious/ackee Docker image, exposes port 3000, sets the DATABASE_URI environment variable to connect to the MongoDB instance, and depends on the mongo service.

The mongo service uses the mongo Docker image and mounts a volume to persist MongoDB data.

Save the Docker Compose File

Save the docker-compose.yml file in your desired directory on your server. Make sure you remember the location as we’ll use it in the next step.

Start the Ackee Docker Container

Open a terminal or command prompt and navigate to the directory where you saved the docker-compose.yml file.

Run the following command to start the Ackee Docker container:

docker-compose up -d

Docker Compose will download the necessary Docker images and start the Ackee and MongoDB containers in detached mode.

Access Ackee in your Web Browser

Open your web browser and enter the following URL:

http://localhost:3000

You should now see the Ackee login page.

Create a new user account and log in to the Ackee dashboard.

You have now successfully created an Ackee Docker container and set it up using Docker Compose. You can now start analyzing your website’s traffic using Ackee’s powerful analytics features.

Additional Configuration Options

If you want to use a different port for Ackee, you can modify the ports section in the docker-compose.yml file:

ports:
    - "3000:3000"

To allow your domains to connect to Ackee, you can set the ACKEE_ALLOW_ORIGIN environment variable and list your domains:

ACKEE_ALLOW_ORIGIN=https://domain1.com,https://domain2.com

You can specify your username and password in the docker-compose.yml file with the environment variables:

- ACKEE_USERNAME=username
- ACKEE_PASSWORD=password 

Remember to regularly update the docker-compose.yml file to use the latest version of Ackee and MongoDB images to benefit from the latest features and security patches.

Summary

With Docker Compose, managing your Ackee deployment becomes seamless, allowing you to focus on gaining valuable insights from your website’s analytics data.

If you want to look further in to any of the above tools, do take a look at my previous posts and read the official documentation from the following sites:

Ackee
Docker Docker Compose

Related Posts