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

Isolation of FTS to fts user #128

Draft
wants to merge 79 commits into
base: 120-update-nodered-to-31
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
46ce5fb
provide common function to create fts user and move fts.venv from /ro…
phreed Apr 5, 2024
94e9494
activate create-fts-user.yml
phreed Apr 5, 2024
1896839
install package as fts
phreed Apr 12, 2024
901dd90
install package as fts
phreed Apr 22, 2024
76b5abb
allow group write permission
phreed Apr 22, 2024
1048de5
update --check logic and nodered version compatibility
phreed May 14, 2024
fa26617
update --check logic and nodered version compatibility
phreed May 14, 2024
a2e6729
The default is to proceed following a warning.
phreed Jul 5, 2024
4625756
provide common function to create fts user and move fts.venv from /ro…
phreed Apr 5, 2024
ac66907
activate create-fts-user.yml
phreed Apr 5, 2024
f662d4a
install package as fts
phreed Apr 12, 2024
32a04fb
install package as fts
phreed Apr 22, 2024
956ae47
allow group write permission
phreed Apr 22, 2024
f9bd7bb
update --check logic and nodered version compatibility
phreed May 14, 2024
4244f73
The default is to proceed following a warning.
phreed Jul 5, 2024
8204fb6
Merge remote-tracking branch 'origin/issue_118' into issue_118
phreed Sep 23, 2024
dd0eea3
introduce devcontainer.json
phreed Sep 24, 2024
5234246
update devcontainer.json
phreed Sep 28, 2024
c65ad7d
update to use distrobox for testing
phreed Sep 28, 2024
bd316d3
introduce distrobox as a test environment
phreed Sep 28, 2024
a289fe1
provide common function to create fts user and move fts.venv from /ro…
phreed Apr 5, 2024
b4a93dc
activate create-fts-user.yml
phreed Apr 5, 2024
5273366
install package as fts
phreed Apr 12, 2024
e308ff5
install package as fts
phreed Apr 22, 2024
30db9cf
allow group write permission
phreed Apr 22, 2024
91f2803
The default is to proceed following a warning.
phreed Jul 5, 2024
0f04b43
introduce devcontainer.json
phreed Sep 24, 2024
098496f
cause clean up to be less aggressive
phreed Sep 30, 2024
dd07a22
update node-red and worldmap version
phreed Oct 8, 2024
74a2fe1
ignore apt so files and merge error files
phreed Oct 8, 2024
6b01b86
enabled devcontainer
phreed Oct 8, 2024
eb73b15
use more current version of nodejs
phreed Oct 8, 2024
00735d9
invoke the nodejs environment function
phreed Oct 8, 2024
b457749
Update example-compose ui definition
RadioAndrea Mar 7, 2024
56ad582
Added volume version of yaml file
RadioAndrea Mar 24, 2024
2c2982c
Updated readme documentation
RadioAndrea Mar 24, 2024
e5fa925
Docker: Add env vars to compose files
stephendade Apr 25, 2024
5bb989b
Update compose files so that containers can find each other
RadioAndrea Sep 1, 2024
e449d23
Docker: Add env vars to compose files
stephendade Apr 25, 2024
d79b711
Docker: Add env vars to compose files
stephendade Apr 25, 2024
f7597ae
Update compose files so that containers can find each other
RadioAndrea Sep 1, 2024
79a592c
Docker: Add env vars to compose files
stephendade Apr 25, 2024
be09151
Docker: Add env vars to compose files
stephendade Apr 25, 2024
63c2619
Update compose files so that containers can find each other
RadioAndrea Sep 1, 2024
f5438b5
Docker: Add env vars to compose files
stephendade Apr 25, 2024
c282e5f
Update compose files so that containers can find each other
RadioAndrea Sep 1, 2024
d9015d7
Docker: Add env vars to compose files
stephendade Apr 25, 2024
cbfca2d
Update compose files so that containers can find each other
RadioAndrea Sep 1, 2024
55d3007
Docker: Add env vars to compose files
stephendade Apr 25, 2024
122bb37
Update compose files so that containers can find each other
RadioAndrea Sep 1, 2024
d490e14
Docker: Add env vars to compose files
stephendade Apr 25, 2024
05eeb0e
Docker: Add env vars to compose files
stephendade Apr 25, 2024
a8e637f
Update compose files so that containers can find each other
RadioAndrea Sep 1, 2024
0fc4657
Docker: Add env vars to compose files
stephendade Apr 25, 2024
679acf8
Docker: Add env vars to compose files
stephendade Apr 25, 2024
b60c23b
Update compose files so that containers can find each other
RadioAndrea Sep 1, 2024
f488123
update --check logic and nodered version compatibility
phreed May 14, 2024
25b5071
ignore apt so files and merge error files
phreed Oct 8, 2024
26fc64e
enabled devcontainer
phreed Oct 8, 2024
e0bcee7
use more current version of nodejs
phreed Oct 8, 2024
0ec2063
invoke the nodejs environment function
phreed Oct 8, 2024
2104692
Docker: Add env vars to compose files
stephendade Apr 25, 2024
d43fdde
Docker: Add env vars to compose files
stephendade Apr 25, 2024
4667ddd
Docker: Add env vars to compose files
stephendade Apr 25, 2024
a0503bb
Update compose files so that containers can find each other
RadioAndrea Sep 1, 2024
2670825
Docker: Add env vars to compose files
stephendade Apr 25, 2024
45b3657
Docker: Add env vars to compose files
stephendade Apr 25, 2024
5af1711
Update compose files so that containers can find each other
RadioAndrea Sep 1, 2024
1c53e68
Docker: Add env vars to compose files
stephendade Apr 25, 2024
29f629c
Update compose files so that containers can find each other
RadioAndrea Sep 1, 2024
7edd977
Docker: Add env vars to compose files
stephendade Apr 25, 2024
9af9c0e
Docker: Add env vars to compose files
stephendade Apr 25, 2024
13b5313
Update compose files so that containers can find each other
RadioAndrea Sep 1, 2024
1b6299e
Docker: Add env vars to compose files
stephendade Apr 25, 2024
2cd46eb
Docker: Add env vars to compose files
stephendade Apr 25, 2024
416fd89
Update compose files so that containers can find each other
RadioAndrea Sep 1, 2024
3fc76da
Merge remote-tracking branch 'refs/remotes/origin/issue_120' into iss…
phreed Oct 8, 2024
1a83783
match upstream main
phreed Oct 8, 2024
8bb946e
Merge branch 'issue_120' into issue_118
phreed Oct 8, 2024
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
4 changes: 4 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM mcr.microsoft.com/devcontainers/base:ubuntu-22.04
RUN apt-get update \
&& apt-get install -y python3 python3-pip \
&& pip3 install --upgrade pip
51 changes: 51 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// For format details, see https://aka.ms/devcontainer.json.
// For config options, see the README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
{
"name": "FTS-Install",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"build": {
// Path is relative to the devcontainer.json file.
"dockerfile": "Dockerfile",
"context": "."
},

// Features to add to the dev container. ore info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {
"installZsh": "true",
"username": "vscode",
"userUid": "1000",
"userGid": "1000",
"upgradePackages": "true"
},
"ghcr.io/devcontainers/features/git:1": {
"version": "latest",
"ppa": "false"
}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "uname -a",

// Configure tool-specific properties.
"customizations" : {
"jetbrains" : {
"backend" : "IntelliJ"
}
},
"runArgs": [
"--net", "host",
"-e", "DISPLAY=:0",
"-e", "XAUTHORITY=/tmp/.Xauthority",
"-v", "${localEnv:HOME}/.Xauthority:/tmp/.Xauthority"
],
"containerEnv": {
"DISPLAY": "unix:0"
},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
4 changes: 2 additions & 2 deletions .github/workflows/pending/compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ jobs:
uses: actions/cache@v2
with:
path: ~/.vagrant.d/boxes
key: ${{ runner.os }}-vagrant-${{ hashFiles('Vagrantfile') }}
key: "${{ runner.os }}-vagrant-${{ hashFiles('Vagrantfile') }}"
restore-keys: |
${{ runner.os }}-vagrant-
"${{ runner.os }}-vagrant-"

- name: Run vagrant up
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pending/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ jobs:
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
key: "${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}"
restore-keys: |
${{ runner.os }}-pip-
"${{ runner.os }}-pip-"

- name: Install test dependencies
run: pip3 install yamllint
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pending/molecule_all_on_one.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ jobs:
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
key: "${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}"
restore-keys: |
${{ runner.os }}-pip-
"${{ runner.os }}-pip-"

- name: Install test dependencies
run: pip3 install ansible molecule[docker] docker
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pending/molecule_fts_core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ name: FTS CORE (DOCKER)
- '**.md'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

jobs:
Expand Down Expand Up @@ -69,9 +69,9 @@ jobs:
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
key: "${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}"
restore-keys: |
${{ runner.os }}-pip-
"${{ runner.os }}-pip-"

- name: Install test dependencies
run: pip3 install ansible molecule[docker] docker
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pending/molecule_multiple.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ jobs:
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
key: "${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}"
restore-keys: |
${{ runner.os }}-pip-
"${{ runner.os }}-pip-"

- name: Install test dependencies
run: pip3 install ansible molecule[docker] docker
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pending/molecule_mumble.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ jobs:
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
key: "${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}"
restore-keys: |
${{ runner.os }}-pip-
"${{ runner.os }}-pip-"

- name: Install test dependencies
run: pip3 install ansible molecule[docker] docker
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pending/molecule_noderedserver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ jobs:
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
key: "${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}"
restore-keys: |
${{ runner.os }}-pip-
"${{ runner.os }}-pip-"

- name: Install test dependencies
run: pip3 install ansible molecule[docker] docker
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pending/molecule_videoserver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ jobs:
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
key: "${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}"
restore-keys: |
${{ runner.os }}-pip-
"${{ runner.os }}-pip-"

- name: Install test dependencies
run: pip3 install ansible molecule[docker] docker
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,9 @@ ansible.cfg
/.vagrant/*
/.byebug_history
/docs/DEV.md

apt_inst.so
apt_pkg.so

git-error-*

24 changes: 24 additions & 0 deletions .justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

default:
@just --list

MY_WD := `pwd`
MY_IPA := `ip -4 addr show docker0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}'`
MY_BRANCH := 'issue_118'
NO_COLOR := `TRUE`

alias dbox-act := dbox-activate

dbox-activate:
-distrobox rm -f fts
distrobox create --image docker.io/library/ubuntu:22.04 --name fts --yes \
--init --additional-packages "systemd libpam-systemd pipewire-audio-client-libraries vim snapd"

distrobox enter --name fts
sudo snap install just --edge --classic


dbox-install:
echo "My IPA: {{MY_IPA}}, WD: {{MY_WD}}, ISSUE: {{MY_BRANCH}}"
sudo bash {{MY_WD}}/scripts/easy_install.sh --repo file://{{MY_WD}}/.git --branch {{MY_BRANCH:-main}} --ip-addr {{MY_IPA}}

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
21 changes: 21 additions & 0 deletions docs/configs/fts-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
description: "a VM for testing FTS"
version: "24.4.0"

# see https://doc.qt.io/qt-5/qsysinfo.html#currentCpuArchitecture
runs-on:
- x86_64

instances:
fts-test:
image: 22.04
limits:
min-cpu: 2
min-mem: 4G
min-disk: 10G
# timeout: <int> # maximum time for the instance to launch, and separately for cloud-init to complete
# cloud-init:
# vendor-data: | # cloud-init vendor data
# <string>
# a health-check shell script ran by integration tests
health-check: |
lsb_release -a
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
102 changes: 102 additions & 0 deletions docs/ubuntu-test-container.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@

# Testing FTS Zero Touch Installer on Ubuntu

Obviously, the ZTI can be tested in a clean native Ubuntu environment.
However, setting up such an environment can consume time.
So, while in a production environment, running FTS on dedicated hardware is the correct choice,
in a test environment it is more appropriate to use a container.

## Setting up the container

The test container can be constructed with any number of technologies.

[Distrobox](https://wiki.archlinux.org/title/Distrobox)
[Ptyrix](https://flathub.org/apps/app.devsuite.Ptyxis)
[Boxbuddy](https://flathub.org/apps/io.github.dvlv.boxbuddyrs)

We will want to specify a specific Ubuntu version we want `v22.04`.
```shell
distrobox create --image ubuntu:22.04 --name fts --yes \
--init --additional-packages "systemd libpam-systemd pipewire-audio-client-libraries"
```

Enter the container
```shell
distrobox enter --name fts
```

## Use Zero Touch Intallation (ZTI)

Note: The following steps may be modified to accommodate your situation.

### The Working Repository

The project working directory is mounted into the distrobox.
The following is an example:
```bash
cd ./Projects/fts-install
export MY_WD=$(pwd)
```

Your test will probably need the locally known IP address.
You may change the configured IP address later,
but it is easiest to handle it now.
It is likely you will want the host interface the example here instead uses `docker0`.
```bash
export MY_IPA=$(ip -4 addr show docker0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')
```

You opened a branch for your issue.
```bash
export MY_BRANCH=issue_118
```

```bash
echo "My IPA: ${MY_IPA}, WD: ${MY_WD}, ISSUE: ${MY_BRANCH}"
```

Install FTS using the candidate ZTI.
The `--verbose` is optional.

#### Use a Committed Branch from a Git Repository
Notice that in the following command the `easy_install.sh` is taken from
a working tree, while the branch is from the committed repository.

```bash
sudo bash ${MY_WD}/scripts/easy_install.sh -- --verbose --repo file://${MY_WD}/.git --branch ${MY_BRANCH:-main} --ip-addr ${MY_IPA}
```
If you want to use Python packages from the https://test.pypi.org repository.
```bash
cat ${MY_WD}/scripts/easy_install.sh | sudo bash -s -- --verbose --repo file://${MY_WD}/.git --branch ${MY_BRANCH:-main} --ip-addr ${MY_IPA} --pypi https://test.pypi.org
```

### Configuration

The official configuration instructions are
[available in the user guide](https://freetakteam.github.io/FreeTAKServer-User-Docs/Installation/Operation/).
Those instructions will not be duplicated here.

## Running Installation Tests (smoke test)

[Smoke testing](https://en.wikipedia.org/wiki/Smoke_testing_(software))
is performed with the installation validation instructions.
The official installation validation instructions are
[available in the user guide](https://freetakteam.github.io/FreeTAKServer-User-Docs/Installation/Troubleshooting/InstallationCheck/).
Those instructions will not be duplicated here.

## Resetting the `distrobox`

### Hard Reset
The distrobox can be deleted and recreated.

```shell
distrobox rm fts
```

### Soft Reset

The soft reset creates a new distrobox from a previous box.
(You did make a snapshot, right?)
```shell
distrobox create --clone fts --name fts-test
```
Loading
Loading