Adaptive Framework 0.9.0

Installation

Installing Adaptive Framework, whether to be used for Development or Deployment, can be done in one of many ways. You may choose to build the framework yourself, install the pre-built binaries from a distributive package, or use Docker to run it.

Using Docker

Docker is a virtualization tool that can be used to quickly install and use products from pre-built images. To pull the images that have already been built and released, please visit the GitHub project repository for the latest Release links. There images that can be used to run a production instance of Adaptive Framework and one for demo purposes. There are two additional images, afw-dev-base and afw-base that are used internally for GitHub workflows, but may also be used to build the first three images from scratch.

ImageDescription
afwfcgiThe afwfcgi image provides the FastCGI Service for processing client requests. This image is useful to configure behind a web server such as Apache or Ngninx, in order to provide RESTful web services.
afw-adminThe afw-admin image provides nginx and the administrative web app for managing an Adaptive Framework application. This web application is general-purpose and allows you to edit object data as well as configure and maintain services, logs, adaptors and authorization handlers.
afw-demoThis image is for demo purposes. It runs both afwfcgi, along with an nginx instance serving the admin interface. Additionally, it has some minimal configuration in place to provide a handful of adaptors in order to demo the framework.
afw-dev-baseThis image contains the full development environment needed to build Adaptive Framework. There are multiple distributions supported, including RockyLinux, Ubuntu, Opensuse and Alpine Linux.
afw-baseThis image contains the minimum requirements to run an instance of Adaptive Framework and serves only as a "base" image for afwfcgi and afw-demo.

Running Docker Images in Production

Running the pre-built Docker images in production requires that you have a Docker Engine available. Docker is available for both Desktop and Server environments. For more information, visit: https://www.docker.com

Using Docker Compose Orchestration

Docker Compose is a simple orchestration tool, which can be used to run multiple containers as services. By grouping multiple containers together, Docker Compose can start and stop them all at once, while also handling any special networking requirements between the containers. This is useful for afwfcgi and afw-admin, which need to be able to communicate with each other.

Below is a sample configuration file docker-compose.yml to run afw-admin and afwfcgi:

version "3.7"
services:

    afwfcgi:
        image: "afwfcgi"
        volumes:
            - afw:/afw

    admin:
        image: "afw-admin"
        ports:
            - "80:80"
        links:
            - afwfcgi

volumes:
    afw

To initialize and start both services in the background:

docker-compose up -d

To stop both services:

docker-compose stop

Building Docker Images

If you wish to not to use officially released Docker images, and would like to build your own from scratch, continue with instructions in this section.

After cloning the source, navigate to the docker/images directory where Dockerfile configurations reside. The examples in this section use Alpine Linux as the base distribution, but you may also use the other platforms available. Alpine Linux is a nice distribution base to use, because it minimizes software packages in order to provide a very compact, secure image.

Building afw-dev-base Image

The afw-dev-base image contains all of the software that Adaptive Framework depends on for building. It includes autotools, gcc compiler, python and other dependency packages.

cd docker/images/builder
# Build an Alpine-based builder image
docker build -t afw-dev-base:alpine -f Dockerfile.alpine .

With the afw-dev-base built, we can now use it for the next step: building from source.

docker run --rm -v /path/to/repo:/input -v /path/to/output:/output afw-dev-base:alpine

This previous step of running the afw-dev-base image will use two mount points: input, output. The input should be the path to the repository and the output can be anywhere in your file system that you want the builder to write out a distribution file (.tar for Alpine, .rpm for RockyLinux, or .deb for Ubuntu). This file is required for the next steps.

Building afwfcgi Image

cd docker/images/afwfcgi 

# Build an Alpine-based image            
docker build --build-arg BIN=<alpine-based .tar file> -t afwfcgi:alpine -f Dockerfile.alpine .

Building from Source

We recommend one of the following platform versions for building from Source:

  • RockyLinux
  • Ubuntu 20.04
  • OpenSUSE Leap 15.3
  • Alpine Linux 3.16

Building on Ubuntu 20.04

Source Build Dependencies

sudo apt-get install -y git autotools-dev autoconf libtool

Fetch Source

# Fetch source for Adaptive Framework
git clone https://github.com/afw-org/afw.git

Install AdaptiveFramework Core dependencies

# Apache Run Time and Apache2 Dev
sudo apt-get install -y libapr1 libapr1-dev apache2-dev

# libxml2
sudo apt-get install -y libxml2 libxml2-dev

# libicu for Unicode support
sudo apt-get install -y libicu-dev

# libunwind and elfutils for stack trace
sudo apt-get install -y libunwind-setjmp0-dev elfutils libdw-dev

Install AdaptiveFramework Adaptor dependencies

# LightningDB Adaptor
sudo apt-get install -y liblmdb-dev

# need OpenSSL and CURL for DynamoDB adaptor dependencies
sudo apt-get install -y libcurl4-openssl-dev libssl-dev

# YAML
sudo apt-get install -y libyaml-dev

Install HTTP stack

# FastCGI library
sudo apt-get install -y libfcgi-dev

# NGNIX
sudo apt-get install -y nginx

Development tools (optional)

# debugging
sudo apt-get install -y gdb
sudo apt-get install -y valgrind
sudo apt-get install -y lsof

# python stuff
pip install -r python-requirements.txt

Building Adaptive Framework

cd afw
./afwdev build --install

TL;DR

sudo apt-get install git autotools-dev autoconf libtool libapr1 libapr1-dev apache2-dev libxml2 libxml2-dev libicu-dev libmysqlclient-dev libdb-dev liblmdb-dev libcurl4-openssl-dev libssl-dev libyaml-dev libfcgi-dev nginx libunwind-setjmp0-dev elfutils libdw-dev
git clone https://github.com/afw-org/afw.git
cd afw
./afwdev build && sudo make install

Building Web Applications

npm install
npm run build

Installation Verification

Installation Verification is a process designed to ensure your installation was done correctly.