Local HPC Simulator Deployment Expert Guide
The following text describes how to deploy HEAppE Middleware and connect it to the Local Simulator of the HPC. The Local Simulator runs at Docker container and consists of the scripts that simulate the HPC environment to test the HEAppE Middleware.
Step 1: HEAppE environment setup - Prerequisites
Local Environment (deploy on user machine)
For running a test instance of HEAppE Middleware is necessary to have an operating system with Docker support and the computer must have at least 2 GB of free RAM.
- Software installation
2. HEAppE environment setup
These steps do as sudo user (recommended). In case of a misunderstanding of folder structure, please move to the end of this chapter and see folder validation scheme.
- Create the HEAppE Middleware directory structure
Copy the following bash script to the server and execute it. This script sets up the necessary directory structure for the HEAppE Middleware.
Download the script here:
HEAppE-dir-structure.shGrant execution permissions to the script.
chmod +x HEAppE-dir-structure.sh
Run the script with the project name argument as a sudo user.
./HEAppE-dir-structure.sh LocalHPCSimulatorHEAppENote
The script creates the following directory structure:
/opt/heappe ├── confs └── projects └── LocalHPCSimulatorHEAppE ├── app │ ├── keys │ ├── logs │ └── confs ├── ssh_agent │ └── keys └── docker_configurations
- Prepare .env file for docker containers
Copy the following .env file into the directory
/opt/heappe/projects/LocalHPCSimulatorHEAppE/docker_configurations/.You can modify the file according to your needs - set container names, database master password, etc.
Download the .env file here:
.envcp .env /opt/heappe/projects/LocalHPCSimulatorHEAppE/docker_configurations/
- Add docker compose specification for Local HPC Simulator
If you want to use this HEAppE instace via the Local HPC simulator, please add
/opt/heappe/projects/LocalHPCSimulatorHEAppE/docker_configurations/docker-compose.override.ymlconfiguration file with these specification:services: heappe: extra_hosts: - "host.docker.internal:host-gateway" networks: - localhpc_network localhpc: container_name: ${HOST_LOCAL_NAME} build: context: ./../heappe-scripts/LocalHPC/ dockerfile: Dockerfile ports: - ${HOST_LOCAL_PORT}:22 networks: - localhpc_network - external_network networks: localhpc_network: internal: true
- Get the release of HEAppE Middleware official repository and copy docker-compose files
cd /opt/heappe/projects/LocalHPCSimulatorHEAppE/ git clone https://github.com/It4innovations/HEAppE.git heappe-core cp /opt/heappe/projects/LocalHPCSimulatorHEAppE/docker_configuration/.env heappe-core cp /opt/heappe/projects/LocalHPCSimulatorHEAppE/docker_configuration/docker-compose.override.yml heappe-core git clone https://github.com/It4innovations/HEAppE-scripts.git mv HEAppE-scripts/LocalHPC heappe-core rm -rf HEAppE-scripts
3. HEAppE configuration files preparation
In order to configure the HEAppE environment, some additional setup files need to be prepared (appsettings.json, appsettings-data.json and seed.njon).
The first mandatory configuration file is appsettings.json, which includes key values about user domain parameters, business logic,
or HPC connection framework. For instance, the template of the configuration file is stored at HEAppE/RestApi/appsettings.example.json.
The following section describes appsettings.json in detail. The configuration code is divided into separate blocks and explained
individually.
appsettings.json configuration
The HEAppE database connection string is an important setting. A database connection string is a string that specifies information about a data source and the means of connecting to it (see the below example for the Microsoft SQL Server connection string).
"ConnectionStrings": { "MiddlewareContext": "Server=mssql;Database=heappe;User=SA;Password=<mssql_password>;TrustServerCertificate=true;", "Logging": "" }Note
Store
appsettings.jsoninto the directory/opt/heappe/projects/LocalHPCSimulatorHEAppE/app/confs.More information about other sections of the configuration file is available at the REST API configuration.
Warning
Please check the password policy of the Microsoft SQL Server. The password must meet the requirements of the SQL Server password policy.
appsettings-data.json configuration
For the HEAppE Middleware Data Staging API configuration, you need to prepare the
appsettings-data.jsonfile. You need to specify same database connection string as in theappsettings.jsonfile and also specifyAuthenticationTokenat ApplicationAPIConfiguration section of the file."ConnectionStrings": { "MiddlewareContext": "Server=mssql;Database=heappe;User=SA;Password=<mssql_password>;TrustServerCertificate=true;" }"ApplicationAPIConfiguration": { "AuthenticationToken": "<token>" }Note
Store
appsettings-data.jsoninto the directory/opt/heappe/projects/LocalHPCSimulatorHEAppE/app/confs.More information about other sections of the configuration file is available at the Data Staging API configuration.
seed.njson configuration
Another requirement for seamless functionality of the HEAppE Middleware is seed.njson file creation (database seed setup). When HEAppE is starting up database seed is applied.
An example template for HPC Cluster mode configuration seed is presented at the URL address HEAppE/RestApi/seed.localcomputing.example.njson
Note
Store
seed.njsoninto the directory/opt/heappe/projects/LocalHPCSimulatorHEAppE/app/confs.Warning
If you want to use specific configuration, you can modify the
seed.njsonfile according to your needs. You can find more information aboutseed.njsonfile at the Database seed.
4. HEAppE Middleware instance launching
Build Docker containers
For building containers (HEAppE, Database, etc..) use docker compose tool (multi-container Docker is specified in docker-compose.yml file).
$ cd /opt/heappe/heappe-core $ docker compose build
Init and unseal Credentials Vault
Before the HEAppE Middleware deployment, the Vault needs to be initialized and unsealed. Initialization is a one-time process that sets up the Vault’s encryption keys and other configuration settings. During initialization, the Vault generates the initial root token and unseal keys, which are required to unseal the Vault.
The docker service
vault_initwhich is part of the docker compose can be also used for unsealing the Vault when it is sealed and already initialized, usage is the same as for initialization.Procedure is automatically invoked by docker compose by service named
vault_init.
Start Docker containers
Use the code below to start the HEAppE Middleware running containers. Running containers start listening on ports defined in
.envfile.$ cd /opt/heappe/heappe-core $ docker compose --profile initVault --profile db --profile heappe --profile vault --profile vaultagent --profile sshagent --profile staging up -dCheck of running containers
$ docker ps
Shutdown Docker containers
Use the code below to shutdown the HEAppE Middleware running containers.
$ cd /opt/heappe/heappe-core $ docker compose --profile db --profile heappe --profile vault --profile vaultagent --profile sshagent --profile staging downCheck if containers are not running
$ docker ps -a
Note
If everything is successfully deployed, HEAppE is available at http://localhost:5000.
Local HPC simulator container is accessible by SSH over docker network or directly from the terminal. To get IP address of the docker container with Local HPC Simulator please run this command:
docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' LocalHPC . Then you can ssh heappeclient@<IP>, password is pass.