Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Welcome

ACS (ALMA Common Software) is a framework for implementing a distributed container/component software machine. You can use it to develop and run custom components with some desired functionality. In these tutorial series we will explore ACS main features, from and for someone new to this tool, in order to gain familiarity with the framework. Hopefully we will find some interesting ways of using ACS, coding simple experimental components. ACS may seem big and complex at first, but we will code our way out of this image, in a condensed approach.

Before running the tutorial examples and exercises you will have to install ACS. In the next section we provide instructions to install ACS in a docker container.

References:

In this tutorial we will write and run example ACS modules in Python, Java and C++ inside a Docker container based in a CentOS 7 image, in an Ubuntu 20.04 machine.

Table of Contents

Install dependencies

Code Block
languagebash
sudo apt update

# Git LFS
sudo apt install git-lfs

# SELinux
sudo apt install policycoreutils selinux-utils selinux-basics
sudo selinux-activate
sudo selinux-config-enforcing

# Docker
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
sudo apt install docker-ce

# Docker Compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

Clone repository

https://bitbucket.alma.cl/scm/asw/acs.git

Code Block
languagebash
git clone https://bitbucket.alma.cl/scm/asw/acs.git

Configurations

Edit docker .env file (you can use your favourite editor)

Code Block
languagebash
cd acs/Virtualization/Docker/Dev/
# check current user info
id <my_user>
# edit configuration file
sudo nano .env
Code Block
languagetext
title.env
linenumberstrue
USER_NAME=<my_user>
GROUP_NAME=<my_group>
USER_ID=1000
GROUP_ID=1000
ALMA_DIR=/external/docker/alma
HOME_DIR=/external/docker/home
REPO_DIR=/absolute/path/to/cloned/repo
IMAGE_OS=centos7
CONTAINER_DIR=centos7

Run container

  1. To run a Docker container with ACS:

    Code Block
    languagebash
    sudo docker-compose run --name acs_centos7_env centos7 bash
  2. To open a shell inside the container

    Code Block
    languagebash
    sudo docker exec -it acs_centos7_env bash

Install ACS

Check Installing ACS for full details. TL;DR:

Code Block
languagebash
# set ownership for directories
sudo chown $USER /external/docker/ /external/docker/alma/ /external/docker/home/

# install external products
cd /Repos
source LGPL/acsBUILD/config/.acs/.bash_profile.acs
cd ExtProd/INSTALL
sudo make all

# install ACS
cd ../..
make build

Set INTROOT directory

Visit ACS Directory Structure#INTROOT for full details.

Code Block
languagebash
export INTROOT=~/workspace/introot
getTemplateForDirectory INTROOT $INTROOT

Set IDL

First we create the directory for the IDL:

Code Block
languagebash
getTemplateForDirectory MODROOT_WS idlHelloComp
cd idlHelloComp/src
touch ../idl/HelloComponent.idl
sudo nano ../idl/HelloComponent.idl

We fill the IDL with the following:

Code Block
languagecpp
titleidlHelloComp/idl/HelloComponent.idl
linenumberstrue
#ifndef _HELLOCOMPONENT_IDL_
#define _HELLOCOMPONENT_IDL_

#pragma prefix "acsws"

#include <acscomponent.idl>

module workshop {
    interface HelloComponent : ACS::ACSComponent {
        string printHello();
    };
};

#endif

We modify the Makefile:

Code Block
titleidlHelloComponent/src/Makefile
...
IDL_FILES = HelloComponent
HelloComponentStubs_LIBS = acscomponentStubs
...
COMPONENT_HELPERS=on
...

We then compile and install the IDL definitions:

...

languagebash

...