diff --git a/doc/BUILDING.md b/doc/BUILDING.md index 277b4cbe..98803900 100644 --- a/doc/BUILDING.md +++ b/doc/BUILDING.md @@ -1,31 +1,22 @@ -# Building - -## CMake -Install CMake > 3.20. - -- Build commands: - ```bash - cmake -DCMAKE_BUILD_TYPE=Debug -S . -B $BUILD_DIR - cmake --build $BUILD_DIR - ``` - -- Test commands: - ```bash - cmake --build $BUILD_DIR -t test - ``` - -- Install command: - ```bash - cmake --install $BUILD_DIR --prefix $INSTALL_DIR --component geds - ``` - -## Docker - -`build-docker.sh` builds a docker container with GRPC and a build of GEDS in `/usr/local/opt/geds`. - -## Dependencies - -### MacOS +# Building GEDS + +- [Workflow](#workflow) +- [Instructions for MacOS](#instructions-for-macos) +- [Instructions for Linux](#instructions-for-linux) +- [Deploying via Docker](#deploying-via-docker) +- [Deploying via Ansible](#deploying-via-ansible) + +## Workflow +The general workflow of building GEDS from source is: +1. Pull GEDS repository: `git pull https://github.com/IBM/GEDS.git` +2. Install dependencies, e.g. `cmake` version > 3.20 (check via `cmake --version`) +3. Create `build` and `install` directory in the GEDS folder and set environment variables: `export $BUILD_DIR=~/GEDS/build` & `export $INSTALL_DIR=~/GEDS/bin` +4. Build Boost +5. Build AWS SDK +6. Build GEDS +7. Install GEDS + +## Instructions for MacOS Install the following dependencies through homebrew: @@ -54,23 +45,38 @@ Finally build it with: cmake --build . --target all ``` -### Linux - -Install the following dependencies: +## Instructions for Linux +Install GEDS dependencies: ``` -apt-get install -y \ - clang \ - curl wget \ - build-essential gcc ninja-build \ - openjdk-11-jdk \ - python3.9 python3.9-dev python3-distutils +sudo apt install -y clang curl wget build-essential gcc ninja-build openjdk-11-jdk python3-dev python3-distutils cmake ``` -and a recent version (>= 3.20) of CMake: +CMake version >= 3.20: ``` CMAKE_VERSION=3.22.4 wget --quiet -O cmake.tar.gz https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.tar.gz \ && tar xf cmake.tar.gz --strip-components=1 -C /usr/local/ \ && rm cmake.tar.gz ``` + +Install AWS SDK dependecies: +``` +sudo apt install libcurl4-openssl-dev libssl-de uuid-dev zlib1g-dev libpulse-dev +``` + +Build AWS SDK: `/bin/bash build-aws-sdk.sh` + +Build Boost: `/bin/bash build-boost.sh` + +Build GEDS: +1. Check if environment variables are correctly set via `printenv | grep BUILD_DIR` and `printenv | grep INSTALL_DIR` +2. `cmake -DCMAKE_BUILD_TYPE=Debug -S . -B $BUILD_DIR` +3. `cmake --build $BUILD_DIR -j 4` (-j specifies the number of cores to use) +4. `cmake --install $BUILD_DIR --prefix $INSTALL_DIR --component geds` + +## Deploying via Docker +`build-docker.sh` builds a docker container with GRPC and a build of GEDS in `/usr/local/opt/geds`. + +## Deploying via Ansible +We offer an Ansible playbook to automate GEDS building from source on multiple clients. diff --git a/doc/geds_ansible.yml b/doc/geds_ansible.yml new file mode 100644 index 00000000..cdb19177 --- /dev/null +++ b/doc/geds_ansible.yml @@ -0,0 +1,123 @@ +--- +- hosts: geds + name: Update all apt packages + become: false + vars: + ansible_python_interpreter: /usr/bin/python3 + remote_home: "{{ ansible_env.HOME }}" + + tasks: + - name: Update and upgrade + tags: update + become: true + apt: + upgrade: yes + update_cache: yes + + - name: Reboot + tags: reboot + become: true + reboot: + + - name: Install GEDS dependencies + tags: dependencies + become: true + apt: + pkg: + - clang + - curl + - wget + - build-essential + - gcc + - ninja-build + - openjdk-11-jdk + - python3-dev + - python3-distutils + - cmake + state: latest + update_cache: yes + + - name: Create GEDS directory + tags: git + become: false + file: + path: "{{ remote_home }}/GEDS" + state: directory + + - name: Git clone GEDS + tags: git + become: false + ansible.builtin.git: + repo: "https://github.com/IBM/GEDS.git" + dest: "{{ remote_home }}/GEDS/" + + - name: AWS dependencies + tags: aws + become: true + apt: + pkg: + - libcurl4-openssl-dev + - libssl-dev + - uuid-dev + - zlib1g-dev + - libpulse-dev + state: latest + update_cache: yes + + - name: Build AWS + tags: aws + become: false + ansible.builtin.command: /bin/bash build-aws-sdk.sh + async: 3600 + poll: 30 + args: + chdir: "{{ remote_home }}/GEDS" + + - name: Build boost + tags: boost + become: false + ansible.builtin.command: /bin/bash build-boost.sh + args: + chdir: "{{ remote_home }}/GEDS" + + - name: Create GEDS build directory + tags: geds + become: false + file: + path: "{{ remote_home }}/GEDS/build" + state: directory + + - name: Build GEDS + tags: geds + become: false + ansible.builtin.command: cmake -DCMAKE_BUILD_TYPE=Debug -S . -B $BUILD_DIR + args: + chdir: "{{ remote_home }}/GEDS" + environment: + BUILD_DIR: "{{ remote_home }}/GEDS/build" + + - name: Build GEDS + tags: geds + become: false + ansible.builtin.command: cmake --build $BUILD_DIR -j 4 + args: + chdir: "{{ remote_home }}/GEDS" + environment: + BUILD_DIR: "{{ remote_home }}/GEDS/build" + + - name: Create GEDS install directory + tags: geds + become: false + file: + path: "{{ remote_home }}/GEDS/bin" + state: directory + + - name: Install GEDS + tags: geds + become: false + ansible.builtin.command: cmake --install $BUILD_DIR --prefix $INSTALL_DIR --component geds + args: + chdir: "{{ remote_home }}/GEDS" + environment: + BUILD_DIR: "{{ remote_home }}/GEDS/build" + INSTALL_DIR: "{{ remote_home }}/GEDS/bin"