AOSharedServiceLibrary
|
The AO Shared Service Library is available as a docker image. This allows developers to get a fully functional build environment with a single command, and offers a head-start on making application docker files.
Before we begin, we need to have a few things ready.
If you do not already have Docker installed, please follow the instructions here.
You can create a fully functional build environment for new micro services via Docker, and ssh into that process.
docker run --name aossl -d -P aostreetart/ao-services
Then, you can access the container with the following:
docker exec -i -t aossl /bin/bash
Docker images are also available for many of the external tools connected to within the library.
In times when you need to connect to an instance of Mongo, you can use the docker image (full instructions can be found here).
docker run --name some-mongo -d mongo
In times when you need to connect to an instance of Neo4j, you can use the docker image (full instructions can be found here).
docker run \ --publish=7474:7474 --publish=7687:7687 \ --volume=$HOME/neo4j/data:/data \ neo4j
In times when you need to connect to an instance of Redis, you can use the docker image (full instructions can be found here).
docker run --name some-redis -d redis
In times when you need to connect to an instance of Consul, you can use the docker image (full instructions can be found here)
docker run -d --name=dev-consul consul
Connecting Docker images is done via the network command. First, we start the network:
docker network create my-network
Then, we utilize the –network option when starting containers to connect them to the network:
docker run -d --name=registry --network=my-network consul
When we start another docker container and connect it to my-network, we can access the first container by using it's container name as the hostname. For example, we'd access the consul agent started above from another docker container in the network at the address 'registry:8500'.
Please see the releases page to download the latest release of the library. Once downloaded, unpack the tar/zip file and cd into the main directory. Then, run the following command:
sudo ./easy_install
You will be prompted for your sudo password, after which the script will attempt to install all of the necessary dependencies, and then the library itself. If you prefer, you can simply run:
sudo make install
This will install the library without installing the dependencies. You may execute the install dependencies script separately if desired via:
cd deps && sudo ./build_deps.sh
Or, you may refer to the Dependency Resolution section of the documentation on how to install necessary dependencies manually.
You may uninstall the library by executing:
sudo make uninstall
Alternatively, you may clone the source from git directly and build the library yourself. Note that this is currently only recommended on Unix systems due to OS-level dependencies. Windows users should work with the Dockerfile provided.
Before we begin, we need to build our dependencies and then build the project.
The build_deps.sh script should allow for automatic resolution of dependencies. Run the following commands from within the main folder
mkdir ../aossl_deps sudo cp scripts/deb/build_deps.sh ../aossl_deps cd ../aossl_deps sudo ./build_deps.sh
The build_deps.sh script should allow for automatic resolution of dependencies.
Before using the script, you will need to ensure that you have gcc version 5 or greater installed (By default, CentOS comes with gcc 4.8):
gcc --version
If you do not see version 5 or above, you can likely use the devtoolset to get the latest one:
sudo yum install centos-release-scl sudo yum install devtoolset-7-gcc* scl enable devtoolset-7 bash which gcc gcc --version
Then, run the following commands from within the main folder to resolve the other dependencies
mkdir ../aossl_deps sudo cp scripts/rhel/build_deps.sh ../aossl_deps cd ../aossl_deps sudo ./build_deps.sh
Please refer to the Dependency Resolution section of the documentation.
The project and tests can be built with make on most linux systems.
make
We can clean the build and remove all generated files with:
make clean
The project can be installed on linux systems with:
sudo make install
We can uninstall the libraries with:
sudo make uninstall
Run the following to build the library test executables and the benchmarking apps
make tests make benchmarks
Run the following to build the library test executables and the benchmarking apps
make rhel-test make rhel-benchmarks
Please continue on to the Use section of the documentation to see example uses of the library.