Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace maestro with edge-resource-manager. #230

Merged
merged 1 commit into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 22 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ be launched manually, for example as an interactive session, or the scripts will
run docker automatically if the argument `--docker` is provided.

It is recommended to use docker since it will provide a clean environment
without interference with local user settings (for example, with user nodejs or
python environments) and does not require setting up local packages repository.
without interference with local user settings (for example, with user python
environments) and does not require setting up local packages repository.

Also, the build will need `sudo` privileges to install standard Ubuntu packages.

Expand Down Expand Up @@ -216,7 +216,7 @@ When `build-all.sh` is run:
and source stage). Container is removed after each element is done:
```
# create and run temporary container
[docker run --rm] pe-nodejs source
[docker run --rm] pe-utils source
# container is automatically removed
# create and run temporary container
[docker run --rm] edge-proxy source
Expand All @@ -229,10 +229,10 @@ uses it for each element:
```
[check if container exists => create if missing]
[if stopped => docker start]
[docker exec] pe-nodejs source
[docker exec] pe-utils source
[docker exec] edge-proxy source
...
[docker exec] pe-nodejs build
[docker exec] pe-utils build
```

- with `-c=clean` removes existing container and creates new one before first
Expand All @@ -243,10 +243,10 @@ use in script:
# create new container
[docker container create]
[docker start]
[docker exec] pe-nodejs source
[docker exec] pe-utils source
[docker exec] edge-proxy source
...
[docker exec] pe-nodejs build
[docker exec] pe-utils build
...
```

Expand All @@ -273,16 +273,19 @@ or
The build scripts provide help information, for example:

```
$ maestro/deb/build.sh --help
Usage: maestro/deb/build.sh [Options]
$ pe-utils/deb/build.sh --help
Usage: pe-utils/deb/build.sh [Options]

Options:
--docker=<dist> Use docker containers (dist can be focal, bionic, buster...).
--docker Use docker containers.
--source Generate source package.
--build Build binary from source generated with --source option.
--verify Verify package conformity to the Debian policy.
--install Install build dependencies.
--arch=<arch> Set target architecture.
--print-target Print target package file path and exit
--print-package-name Print package name (eg. devicejs) and exit
--print-package-version Print package version (eg. devicejs) and exit
--help,-h Print this message.

If none of '--source', '--build' or '--verify' options are specified,
Expand All @@ -292,8 +295,9 @@ Available architectures:
amd64
arm64
armhf
armel

Default mode: maestro/deb/build.sh --arch=amd64 --source --build --verify
Default mode: pe-utils/deb/build.sh --arch=amd64 --source --build --verify
```

These scripts can be used to generate both source and binary packages.
Expand All @@ -306,8 +310,8 @@ run in appropriate containers automatically (using source of build images):
The build scripts for RPM-based distributions are similar to Debian's:

```
$ ./maestro/rpm/build.sh --help
build.sh - builds maestro RPM package
$ pe-utils/rpm/build.sh --help
build.sh - builds pe-utils RPM package

Usage: build.sh [-h|--help] [--install]
-h, --help display this help message.
Expand Down Expand Up @@ -525,22 +529,22 @@ cannot be installed simultaneously.
edge-core.service
edge-proxy.service
kubelet.service
maestro.service
edge-resource-manager.service
mbed-fcc.service
pelion-relay-term.service
pe-terminal.service
wait-for-pelion-identity.service
fluent-bit.service
```

To enable all services, run:
```bash
sudo systemctl enable edge-core.service edge-proxy.service kubelet.service maestro.service mbed-fcc.service pelion-relay-term.service wait-for-pelion-identity.service
sudo systemctl enable edge-core.service edge-proxy.service kubelet.service edge-resorce-manager.service mbed-fcc.service pe-terminal.service wait-for-pelion-identity.service
```

Dependent services are enabled implicitly. For example
`wait-for-pelion-identity.service` is enabled when `maestro.service` is
`wait-for-pelion-identity.service` is enabled when `edge-resource-manager.service` is
enabled; `edge-core.service` is enabled when `wait-for-pelion-identity.service`
is enabled so enabling `maestro.service` will also enable
is enabled so enabling `edge-resource-manager.service` will also enable
`wait-for-pelion-identity.service` and `edge-core.service`.


Expand Down
2 changes: 1 addition & 1 deletion build-env/bin/deb2tar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ fetch_deps() {
'/^pe-utils/d'
'/^edge-proxy/d'
'/^mbed-edge-core-devmode/d'
'/^maestro/d'
'/^edge-resource-manager/d'
'/^containernetworking-plugins/d'
'/^debconf/d'
'/^dpkg/d'
Expand Down
16 changes: 2 additions & 14 deletions build-env/bin/pelion-build-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,13 @@ source "${ROOT_DIR}"/build-env/docker/common/create-repo-lib.sh
# variables are evaluated in selected environment (eg. docker)
DEPENDS=(
'${GO_COMPILER_PACKAGE-golang-providers/golang-virtual}'
'pe-nodejs'
)

# TODO: do not duplicate for amd64 only build
PACKAGES=(
'pe-nodejs'
'edge-proxy'
'global-node-modules'
'kubelet'
'maestro'
'edge-resource-manager'
'mbed-edge-core'
'mbed-edge-core-devmode'
'mbed-edge-core-byocmode'
Expand Down Expand Up @@ -222,16 +219,7 @@ if $PELION_PACKAGE_SOURCE; then
echo ">> Source creation started"
for p in "${PACKAGES[@]}"; do
echo "Generating source package of '$p'"
if [ "$p" == "pe-nodejs" ]; then
# pe-nodejs is just a debian package of pre-built # source.
# We need to pass the arch here so we know what binary tarball
# architecture to download.
for arch in "${PELION_ARCHS[@]}"; do
"$SCRIPT_DIR"/../../"$p"/deb/build.sh $PELION_BUILD_OPT --arch="$arch" --source
done
else
"$SCRIPT_DIR"/../../"$p"/deb/build.sh $PELION_BUILD_OPT --source
fi
"$SCRIPT_DIR"/../../"$p"/deb/build.sh $PELION_BUILD_OPT --source
done
echo ">> Source creation finished"
fi
Expand Down
5 changes: 1 addition & 4 deletions build-env/target/common/debian_packages.conf.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
# build dependencies
DEPENDS=(
'golang-providers/golang-virtual'
'pe-nodejs'
)

PACKAGES=(
'pe-nodejs'
'edge-proxy'
'pe-terminal'
'global-node-modules'
'kubelet'
'maestro'
'edge-resource-manager'
'mbed-edge-core'
'mbed-edge-core-devmode'
'mbed-edge-core-byocmode'
Expand Down
1 change: 0 additions & 1 deletion build-env/target/debian/bullseye/packages.conf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ source $ENV_TARGET_ROOT/common/debian_packages.conf.sh

DEPENDS=(
'golang-providers/pe-golang-bin'
'pe-nodejs'
)

ENV_OS_NAME=bullseye
Expand Down
1 change: 0 additions & 1 deletion build-env/target/debian/buster/packages.conf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ source $ENV_TARGET_ROOT/common/debian_packages.conf.sh

DEPENDS=(
'golang-providers/pe-golang-bin'
'pe-nodejs'
)

ENV_OS_NAME=buster
Expand Down
6 changes: 0 additions & 6 deletions build-env/target/rhel/8/packages.conf.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
# build dependencies
# variables are evaluated in selected environment (eg. docker)
DEPENDS=(
'pe-nodejs'
)

PACKAGES=(
'pe-nodejs'
'edge-proxy'
'global-node-modules'
'golang-github-containernetworking-plugins'
'kubelet'
'maestro'
'mbed-edge-core'
'mbed-edge-core-devmode'
'mbed-edge-core-byocmode'
Expand Down
1 change: 0 additions & 1 deletion build-env/target/ubuntu/bionic/packages.conf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ source $ENV_TARGET_ROOT/common/debian_packages.conf.sh

DEPENDS=(
'golang-providers/pe-golang-bin'
'pe-nodejs'
)

ENV_OS_NAME=bionic
Expand Down
6 changes: 4 additions & 2 deletions maestro/deb/build.sh → edge-resource-manager/deb/build.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/bin/bash

# Internal variables
PELION_PACKAGE_NAME="maestro"
PELION_PACKAGE_NAME="edge-resource-manager"
PELION_PACKAGE_DIR=$(cd "`dirname \"$0\"`" && pwd)

PELION_PACKAGE_PRE_BUILD_CALLBACK='select_python 3'

declare -A PELION_PACKAGE_COMPONENTS=(
["https://github.com/PelionIoT/maestro.git"]="718a61ce09dabc60075322e1c255c345aa7927e6")
["https://github.com/PelionIoT/edge-resource-manager.git"]="v1.0.0")

source "$PELION_PACKAGE_DIR"/../../build-env/inc/build-common.sh

Expand Down
17 changes: 17 additions & 0 deletions edge-resource-manager/deb/debian/auto_build
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

set -e

export CC="${DEB_HOST_GNU_TYPE}"-gcc
export CXX="${DEB_HOST_GNU_TYPE}"-g++
export PKG_CONFIG="${DEB_HOST_GNU_TYPE}"-pkg-config

export CONFIG_OPTIONS="--host=${DEB_HOST_GNU_TYPE}"

export CGO_ENABLED=1
export GOPATH="`pwd`/go-workspace"

eval `debian/goflags.guess ${DEB_HOST_ARCH}`

mkdir -p bin
go build -o bin/edge-resource-manager -buildmode=pie --tags debug edge-resource-manager.go
5 changes: 5 additions & 0 deletions edge-resource-manager/deb/debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
edge-resource-manager (1.0.0-1) unstable; urgency=medium

* New component.

-- Pete Dyer <pete.dyer@izumanetworks.com> Mon, 18 Mar 2024 09:44:06 +0000
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
Source: maestro
Source: edge-resource-manager
Section: utils
Priority: optional
Maintainer: Vasily Smirnov <vasilii.smirnov@globallogic.com>
Build-Depends: debhelper (>=9), pe-golang:native, libuv1-dev
Build-Depends: debhelper (>=9), pe-golang:native,
autoconf (>=2.69), automake (>=1:1.15), libtool (>=2.4.6),
libc6, libstdc++6, libunwind-dev, libuv1-dev
Standards-Version: 3.9.6
Homepage: https://www.pelion.com
Homepage: https://www.izumanetworks.com

Package: maestro
Package: edge-resource-manager
Architecture: any
Multi-Arch: foreign
Depends: libnss-myhostname, pe-utils, edge-proxy, ${shlibs:Depends}
Depends: ${misc:Depends}, ${shlibs:Depends}, libnss-myhostname, pe-utils, edge-proxy
Recommends: resolvconf
Description: system manager (logging, dhcp, cloud connector)
Maestro is a replacement for a number of typical system utilities and
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: maestro
Source: https://github.com/PelionIoT/maestro
Upstream-Name: edge-resource-manager
Source: https://github.com/PelionIoTedge-resource-manager

Files: *
Copyright: 2019, Travis McCollum <Travis.McCollum@arm.com>
Copyright: 2024, Pete Dyer <pete.dyer@izumanetworks.com>
License: Apache-2.0
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Empty file.
14 changes: 14 additions & 0 deletions edge-resource-manager/deb/debian/edge-resource-manager.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[Unit]
Description=edge-resource-manager: Adds gateway capability resources.
Requires=edge-proxy.service
After=edge-proxy.service

[Service]
Restart=always
RestartSec=5s
ExecStart=/usr/bin/edge-resource-manager -config /etc/edge/izuma-base-config.yaml
StandardOutput=journal
StandardError=journal

[Install]
WantedBy=multi-user.target
3 changes: 3 additions & 0 deletions edge-resource-manager/deb/debian/install
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
debian/izuma-base-config.yaml etc/edge

bin/edge-resource-manager usr/bin
17 changes: 17 additions & 0 deletions edge-resource-manager/deb/debian/izuma-base-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
var_defs:
- key: "TMP_DIR"
value: "/tmp"
edge_capabilities:
edge_core_socketpath: "/tmp/edge.sock"
lwm2m_objectid: 33457
edge_resources:
- name: "urn:fid:pelion.com:log:1.0.0"
enable: true
config_filepath: "/etc/edge/fluent-bit.conf"
- name: "urn:fid:pelion.com:terminal:1.0.0"
enable: true
config_filepath: "/etc/edge/pe-terminal.conf.json"
- name: "urn:fid:pelion.com:kaas:1.0.0"
enable: true
config_filepath: "/etc/edge/kubeconfig"
config_end: true
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@ override_dh_auto_build:
override_dh_auto_clean:
-rm -rf go-workspace

override_dh_makeshlibs:
dh_makeshlibs --no-scripts

override_dh_installinit:
dh_installinit --no-scripts

override_dh_installlogrotate:
dh_installlogrotate --name=maestro-runtime maestro-runtime.logrotate

override_dh_systemd_enable:
dh_systemd_enable --name=maestro maestro.service
dh_systemd_enable --name=edge-resource-manager edge-resource-manager.service

27 changes: 0 additions & 27 deletions global-node-modules/deb/build.sh

This file was deleted.

11 changes: 0 additions & 11 deletions global-node-modules/deb/debian/changelog

This file was deleted.

Loading