Application Stacks AWS

Apache Answer on AWS User Guide

| Product: Apache Answer on AWS

Overview

This image runs Apache Answer, the open source question and answer platform for teams at any scale. Whether you are running a community forum, a help centre or an internal knowledge management platform, Answer gives you a fast, searchable Q&A experience with questions, answers, accepted solutions, tags, voting, reputation and a full moderation and administration suite.

The Apache Answer binary is installed under /opt/answer and runs as a dedicated unprivileged answer system account under a systemd service that starts it on boot and restarts it on failure. The application data, holding the SQLite database, the uploads directory and the generated configuration, lives at /var/lib/answer, which is a dedicated, independently resizable EBS data volume.

Apache Answer normally presents an interactive web setup wizard on first run. This image completes that setup automatically during the build using Answer's built-in non-interactive install path, so your instance comes up already initialised on a SQLite database with the schema migrated and an administrator account ready. There is no wizard to click through.

The Answer binary binds to the loopback interface only and is never exposed directly. An nginx reverse proxy publishes the Q&A web interface and the same origin REST API on port 80. The administrator password is generated on the first boot of every deployed instance, so two instances launched from the same Amazon Machine Image never share a password. It is written to /root/apache-answer-credentials.txt with mode 0600 so that only the root user can read it.

Prerequisites

Before you deploy this image you need:

  • An Amazon Web Services account where you can launch EC2 instances
  • IAM permissions to launch instances, create security groups, and subscribe to AWS Marketplace products
  • An EC2 key pair in the target Region for SSH access to the instance
  • A VPC and subnet in the target Region, with a security group allowing inbound port 22 from your management network and port 80 for the Q&A web interface and the REST API
  • The AWS CLI (version 2) installed locally if you plan to deploy from the command line

Step 1: Launch the Instance from the AWS Marketplace

Sign in to the AWS Management Console, open the EC2 service, and select Launch instance. Under Application and OS Images choose AWS Marketplace AMIs and search for Apache Answer. Select the cloudimg listing and choose Select, then Continue on the subscription summary.

Pick an instance type of t3.small or larger. Choose your EC2 key pair under Key pair (login). Under Network settings select your VPC and subnet, and either create or select a security group that opens port 22 from your management network and port 80 for the Q&A web interface and the REST API. Leave the root volume at the default size or larger.

Select Launch instance. First boot initialisation takes a few seconds after the instance state becomes Running and the status checks pass.

Step 2: Launch the Instance from the AWS CLI

The following block launches an instance from the cloudimg Apache Answer Marketplace AMI into an existing subnet and security group. Replace <ami-id> with the AMI ID shown on the Marketplace listing, <key-name> with your EC2 key pair name, <subnet-id> with your subnet ID, and <security-group-id> with a security group that opens ports 22 and 80 as described above.

aws ec2 run-instances \
  --image-id <ami-id> \
  --instance-type t3.small \
  --key-name <key-name> \
  --subnet-id <subnet-id> \
  --security-group-ids <security-group-id> \
  --tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=apache-answer}]'

When the instance reaches the Running state and its status checks pass, note its public IP address or DNS name from the EC2 console or with aws ec2 describe-instances.

Step 3: Connect to Your Instance

Connect over SSH using your key pair and the login user for your operating system variant.

OS variant SSH login user
Ubuntu 24.04 ubuntu
ssh -i <key-name>.pem ubuntu@<public-ip>

Step 4: Retrieve the Admin Password

The administrator password is unique to your instance and was generated on first boot. Read it as root:

sudo cat /root/apache-answer-credentials.txt

The file lists the Answer URL, the administrator email and the generated password, along with an example REST API login call. Keep this password somewhere safe.

Step 5: Sign In to the Q&A Web Interface

The Apache Answer web interface is served on port 80 by nginx. In a browser, go to:

http://<instance-public-ip>/

The Q&A home lists the community questions. Select Login and sign in with the administrator email and the password from the credentials file.

The Apache Answer questions list served on port 80

Open a question to read its full body in Markdown alongside its answers. The author of a question can accept the best answer, and any signed in user can vote questions and answers up or down.

An Apache Answer question detail page with an answer

The administration dashboard, reachable from the user menu, is where the administrator manages the site, users, content moderation, tags, themes, login policy and plugins.

The Apache Answer administration dashboard

Step 6: Confirm Apache Answer Is Running

Over SSH, confirm the Answer service and the nginx proxy are active and that the ports are listening:

sudo systemctl is-active answer nginx
sudo ss -tlnp | grep -E ':(80|9080) '

You should see both services reported as active, the Answer binary listening on 127.0.0.1:9080 (loopback only), and nginx listening on port 80.

Step 7: Ask and Answer Questions

Build your knowledge base from the web interface. Select Ask a Question, give it a title and a body in Markdown, add one or more tags, and post it. Other users (or you) answer it, vote on the best contributions, and the question author marks an answer as accepted. Tags organise questions into topics, and the search box queries the whole knowledge base.

You can confirm the bundled REST API is serving by querying the public question list endpoint over loopback on the instance:

curl -s 'http://127.0.0.1:9080/answer/api/v1/question/page?page=1&page_size=5' | head -c 300; echo

Step 8: Use the REST API

Apache Answer exposes a REST API under /answer/api/v1, served same origin on port 80 through nginx, so the same host and port serve both the web interface and the API. Obtain an access token by posting your administrator email and password to the email login endpoint. On the instance you can call it over loopback:

EMAIL=$(sudo grep '^answer.admin.email=' /root/apache-answer-credentials.txt | cut -d= -f2-)
PASS=$(sudo grep '^answer.admin.pass=' /root/apache-answer-credentials.txt | cut -d= -f2-)
curl -s -X POST -H 'Content-Type: application/json' \
  --data "{\"e_mail\":\"${EMAIL}\",\"pass\":\"${PASS}\"}" \
  http://127.0.0.1/answer/api/v1/user/login/email | head -c 300; echo

The response includes an access_token. Pass it as the Authorization header on subsequent API calls. From outside the instance, send the same request to http://<instance-public-ip>/answer/api/v1/user/login/email.

Step 9: The Data Volume

The application data lives on a dedicated EBS volume mounted at /var/lib/answer. This keeps the SQLite database, the uploaded files and the configuration off the operating system disk and lets you resize or snapshot them independently. Confirm the mount with:

df -h /var/lib/answer

The SQLite database is at /var/lib/answer/answer.db, uploaded files are under /var/lib/answer/uploads, and the generated configuration is at /var/lib/answer/conf/config.yaml. To grow the data store, expand the EBS volume in the AWS console, then grow the filesystem on the instance with sudo resize2fs on the underlying device.

Step 10: Enable HTTPS

The Q&A interface and the API are served over plain HTTP on port 80 by nginx. For production use, place them behind TLS. Obtain a certificate for your domain (for example with a managed certificate on an Application Load Balancer in front of the instance, or with Certbot installed on the instance), then configure nginx to listen on 443 with your certificate and proxy to 127.0.0.1:9080 exactly as the bundled site does for port 80. Set the site URL to your HTTPS domain in the Answer admin dashboard under General so generated links use it. Restrict the security group so ports 80 and 443 are reachable only from the networks that use the platform.

Step 11: Backup and Maintenance

Back up the platform by snapshotting the /var/lib/answer EBS volume, which captures the SQLite database, the uploads and the configuration in one consistent image. You can also copy /var/lib/answer/answer.db and the uploads directory while the service is briefly stopped. Apply operating system security updates with sudo apt-get update && sudo apt-get upgrade and reboot when a new kernel is installed; Apache Answer and nginx start automatically on boot.

Support

This image is published and supported by cloudimg. Support covers deployment, site configuration, user and role management, tags and categories, theming, plugins, SMTP and email, backup of the SQLite database and uploads, TLS and reverse proxy tuning. Contact cloudimg through the support channel listed on the AWS Marketplace listing.

All product and company names are trademarks or registered trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.