Apache Answer

Apache Answer

Apache Answer is an open-source question-and-answer (Q&A) platform software developed by the Apache Software Foundation. This platform is designed to help teams of all sizes build communities, help centers, or knowledge management platforms.

Key Features of Apache Answer:

  • Integrated Q&A Experience: Allows users to ask and answer questions easily, with real-time previews using Markdown compatible with CommonMark.
  • Easy Community Management: Provides admin, moderator, and user roles for optimal access management, an intuitive tagging system for content organization, and open collaborative editing with transparent revision history.
  • Healthy Community Development: Supports voting systems, reputation, notifications, and user profiles to encourage active participation and meaningful interaction within the community.
  • Customization and Plugins: Enables theme and layout customization, as well as plugin integration to add features as needed, such as third-party login, caching, and search functionality.
  • Privacy and Security: Offers login and content access controls to ensure a safe and protected community environment.

Apache Answer supports multiple languages, responsive layouts for access from various devices, and a dark mode for personalized user experiences. With an architecture that separates the front-end and back-end, the platform provides flexibility for further development and customization.

1. System Requirements

System requirements for running Apache Answer 1.4:

  • Docker with Docker Compose
  • MySQL/MariaDB or PostgreSQL database
  • Nginx for reverse proxy
  • Certbot for SSL Let’s Encrypt

Before starting deployment, prepare:

  • VPS or server with Ubuntu 24.04 LTS OS
  • SSH access to the server
  • A domain already pointed to the server

2. Server Preparation

Update the system

sudo apt update
sudo apt upgrade -y

Install Docker

sudo sh -c "$(curl -fsSL https://get.docker.com/)"

Install MariaDB

sudo apt install mariadb-server -y

Log in to MariaDB

sudo mysql

Create the database

CREATE DATABASE apache_answer;
CREATE USER 'apache_answer'@'localhost' IDENTIFIED BY 'rahasia';
GRANT ALL PRIVILEGES ON apache_answer.* TO 'apache_answer'@'localhost';
FLUSH PRIVILEGES;
exit

Install Nginx

sudo apt install nginx -y

Install Certbot for Nginx

sudo apt install certbot python3-certbot-nginx -y

3. Install Apache Answer

Create a directory

mkdir apache-answer
cd apache-answer

Create the docker-compose.yaml file

nano docker-compose.yml

Enter the configuration

services:
  answer:
    image: apache/answer
    ports:
      - "9080:80"
    depends_on:
      - mariadb
    environment:
      - DB_HOST=mariadb
      - DB_USER=apache_answer
      - DB_PASSWORD=rahasia
      - DB_NAME=apache_answer
    volumes:
      - ./answer-data:/data
    networks:
      - answer
    restart: on-failure  
  mariadb:
    image: mariadb
    ports:
      - ":3306"
    environment:
      - MYSQL_ROOT_PASSWORD=rahasia
      - MYSQL_DATABASE=apache_answer
      - MYSQL_USER=apache_answer
      - MYSQL_PASSWORD=rahasia
    volumes:
      - ./mariadb-data:/var/lib/mysql
    networks: 
      - answer
    restart: on-failure

networks:
  answer:

Run docker compose

sudo docker compose up -d

Access http://SERVER-IP:9080 for installation

  1. Select language, choose English, then Next
  2. Select database engine, MariaDB/MySQL, enter username, password, database, and host mariadb:3306, then Next
  3. Create config.yml, Next
  4. Enter Site Information and Admin Account, then Next
  5. Your site is ready, installation complete, click Done

4. Nginx Configuration

Create an Nginx configuration for reverse proxying the Docker container

sudo nano /etc/nginx/sites-available/forum.contoh.com.conf

Enter the configuration

server {
    listen 80;
    server_name forum.contoh.com;

    location / {
        proxy_pass http://localhost:9080;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

}

Activate the configuration

sudo ln -s /etc/nginx/sites-available/forum.contoh.com.conf /etc/nginx/sites-enabled/

Restart Nginx

sudo systemctl restart nginx

Request SSL certificate

sudo certbot --non-interactive \
    -m [email protected] \
    --agree-tos \
    --no-eff-email \
    --nginx -d forum.contoh.com \
    --redirect	

Access https://forum.contoh.com, Apache Answer is ready to use.