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

Dev #640

Merged
merged 34 commits into from
Jul 12, 2024
Merged

Dev #640

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
be95b5b
Bump net.datafaker:datafaker in /software/plugins/open-qm-plugin-demo
dependabot[bot] Jul 1, 2024
6ae7f7a
Bump net.datafaker:datafaker in /software/oqm-core-api
dependabot[bot] Jul 1, 2024
6ebc51a
Bump net.datafaker:datafaker in /software/oqm-core-base-station
dependabot[bot] Jul 1, 2024
109dd8d
Station Captain - Setup framework for selecting plugins
GregJohnStewart Jul 3, 2024
47bb00d
Station Captain - Setup framework for selecting plugins
GregJohnStewart Jul 8, 2024
39cddb2
Core - API - Think resolved multi interacting entity adding issue. Bu…
GregJohnStewart Jul 8, 2024
dedbb08
Core - API - Version bump for dev
GregJohnStewart Jul 9, 2024
26a2635
Station Captain - Fixed package getting utilities
GregJohnStewart Jul 9, 2024
265528f
Merge branch 'dev' into dev.637-fr-allow-selectingdeselecting-plugins…
GregJohnStewart Jul 9, 2024
b457fdc
Merge branch 'dev' into dependabot/gradle/software/oqm-core-base-stat…
GregJohnStewart Jul 9, 2024
89cd5cc
Merge pull request #636 from Epic-Breakfast-Productions/dependabot/gr…
GregJohnStewart Jul 9, 2024
5f5f63b
Bump com.microsoft.playwright:playwright
dependabot[bot] Jul 9, 2024
dd8600f
Bump org.junit.jupiter:junit-jupiter-params
dependabot[bot] Jul 9, 2024
4b36998
Merge pull request #635 from Epic-Breakfast-Productions/dependabot/gr…
GregJohnStewart Jul 9, 2024
ac06c52
Merge branch 'dev' into dependabot/gradle/software/oqm-core-base-stat…
GregJohnStewart Jul 9, 2024
e848f51
Merge pull request #634 from Epic-Breakfast-Productions/dependabot/gr…
GregJohnStewart Jul 9, 2024
31bd6f9
Merge branch 'dev' into dependabot/gradle/software/oqm-core-api/dev/n…
GregJohnStewart Jul 9, 2024
b86d616
Merge pull request #633 from Epic-Breakfast-Productions/dependabot/gr…
GregJohnStewart Jul 9, 2024
b54bf49
Merge branch 'dev' into dependabot/gradle/software/plugins/open-qm-pl…
GregJohnStewart Jul 9, 2024
70d4254
Merge pull request #632 from Epic-Breakfast-Productions/dependabot/gr…
GregJohnStewart Jul 9, 2024
4203bfe
Station Captain - Finished reviewing plugins
GregJohnStewart Jul 10, 2024
8db0352
Merge branch 'dev' into dev.637-fr-allow-selectingdeselecting-plugins…
GregJohnStewart Jul 10, 2024
1ab5b69
Merge pull request #638 from Epic-Breakfast-Productions/dev.637-fr-al…
GregJohnStewart Jul 10, 2024
598ccbd
Added dev notes for kube things
GregJohnStewart Jul 10, 2024
d7d6fb6
Core - API - Renamed base station interacting entity, fixed issue wit…
GregJohnStewart Jul 10, 2024
85a3a38
Core - Base Station - Adjusted qute templates handling interacting en…
GregJohnStewart Jul 10, 2024
e5fd667
Core - Base Station - Light cleanup of build.gradle
GregJohnStewart Jul 10, 2024
d4073a1
Core - Base Station - Fixed printouts with the exception of when ther…
GregJohnStewart Jul 11, 2024
245b857
Core - Base Station - Finally fixed pdf viewing in file view
GregJohnStewart Jul 11, 2024
75853f1
Core - Base Station - Fixed file viewing height
GregJohnStewart Jul 11, 2024
403652b
Core - Base Station - Fixed stored responsive viewing
GregJohnStewart Jul 11, 2024
d549004
Core - Base Station - Expanded file viewing capabilities
GregJohnStewart Jul 11, 2024
ca7615d
Core - Base Station - Version bump
GregJohnStewart Jul 12, 2024
d38b617
Core - Base Station - Fixed accidentally bringing in test dependencie…
GregJohnStewart Jul 12, 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
13 changes: 13 additions & 0 deletions deployment/Kubernetes/argocd/docs/devSetup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Developer Setup

## Argo Setup

1. Have minikube running
2. `kubectl create ns argocd`
3. `kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/v2.5.8/manifests/install.yaml`
- Get latest yaml from: https://github.com/argoproj/argo-cd/releases
4. Verify: `kubectl get all -n argocd`
5. Access by: `kubectl port-forward svc/argocd-server -n argocd 8080:443`
- username: `admin`
- pass via: `kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d; echo`
6.
5 changes: 5 additions & 0 deletions deployment/Kubernetes/docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ Prerequisites:
- Working Kubernetes cluster
- Minikube is a good option for local dev

## MiniKube Setup

1. Download minikube from latest docs, install
2. Start cluster with "minikube start"

You now have an operational kube cluster.


## Resources
Expand Down
3 changes: 2 additions & 1 deletion deployment/Single Host/Station-Captain/docs/Features.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ These installers can be used to install the `oqm-captain` management script.

==== First time run

If the Open Quarter Base station package is not installed, the script will prompt the user if they want it installed.
If the Open Quarter Base station package is not installed, the script will prompt the user with a setup wizard. The user
can choose to use this wizard to help them get started.

If no, continue to the menu.

Expand Down
5 changes: 5 additions & 0 deletions deployment/Single Host/Station-Captain/docs/User Guide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ TODO- document better
.. *Plugins* TODO
.. *Uninstall All* TODO

. *Plugins*
.. *Review Available Plugins* +
Select from a list of plugins to install
.. *Select Plugins* +
Select from a list of plugins to uninstall
. *Snapshots* +
Snapshots allow you to take a current state of you system, and save it or back it up for later.

Expand Down
2 changes: 1 addition & 1 deletion deployment/Single Host/Station-Captain/properties.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"packageName":"oqm-manager-station+captain",
"version":"2.2.2",
"version":"2.3.0",
"description":"Utility for setting up and maintaining an instance of Open QuarterMaster.",
"maintainer": {
"name":"EBP"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def packageLogs() -> (bool, str):
sysInfoFile.write(LogManagement.getSystemInfo())

with open(compilingDir + "/01-installed.txt", "w") as sysInfoFile:
sysInfoFile.write(PackageManagement.getInstalledPackages())
sysInfoFile.write(PackageManagement.getOqmPackagesStr(installed=True, notInstalled=False))

logging.info("Writing log messages.")
result, services = ServiceUtils.getServiceNames()
Expand Down
126 changes: 118 additions & 8 deletions deployment/Single Host/Station-Captain/src/lib/PackageManagement.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import logging
import platform

from ServiceUtils import *

class PackageManagement:
"""
Expand All @@ -16,6 +17,7 @@ class PackageManagement:
"""
BASE_STATION_PACKAGE = "oqm-core-base+station"
ALL_OQM = "oqm-*"
OQM_PLUGINS = "oqm-plugin-*"
SYSTEM_PACKAGE_MANAGER = None

@staticmethod
Expand All @@ -25,7 +27,8 @@ def getSystemPackageManager() -> str:
logging.debug("Determining the system's package manager.")

systemReleaseInfo = platform.freedesktop_os_release()
if ("ID_LIKE" in systemReleaseInfo and systemReleaseInfo['ID_LIKE'].casefold() == "debian".casefold()) or systemReleaseInfo['ID'].casefold() == "Debian".casefold():
if ("ID_LIKE" in systemReleaseInfo and systemReleaseInfo['ID_LIKE'].casefold() == "debian".casefold()) or \
systemReleaseInfo['ID'].casefold() == "Debian".casefold():
PackageManagement.SYSTEM_PACKAGE_MANAGER = "apt"

logging.info("Determined system using %s", PackageManagement.SYSTEM_PACKAGE_MANAGER)
Expand All @@ -51,8 +54,37 @@ def coreInstalled() -> bool:
logging.debug("Error Output of listing core components: " + result.stderr)
return "installed" in result.stdout

@staticmethod
def installPackages(packages:list) -> (bool, str):
logging.info("Installing packages: %s", packages)
command:list = ["apt-get", "install", "-y"]
command.extend(packages)
result = subprocess.run(
command,
shell=False, capture_output=True, text=True, check=False
)
if result.returncode != 0:
logging.error("Failed to run install packages command: %s", result.stderr)
return False, result.stderr
return True

@staticmethod
def removePackages(packages:list) -> (bool, str):
logging.info("Removing packages: %s", packages)
command:list = ["apt-get", "remove", "-y", "--purge"]
command.extend(packages)
result = subprocess.run(
command,
shell=False, capture_output=True, text=True, check=False
)
if result.returncode != 0:
logging.error("Failed to run remove packages command: %s", result.stderr)
return False, result.stderr
return True

@staticmethod
def installCore():
# TODO:: update to use new install, package get features
# TODO:: update with error handling, return
logging.info("Installing core components.")
# TODO:: will likely need updated for yum
Expand All @@ -72,7 +104,8 @@ def updateSystem() -> (bool, str):
return False, result.stderr
logging.debug("Upgrading apt packages.")
subprocess.run(["clear"], shell=False, capture_output=False, text=True, check=False)
result = subprocess.run(["apt-get", "dist-upgrade"], shell=False, capture_output=False, text=True, check=False)
result = subprocess.run(["apt-get", "dist-upgrade"], shell=False, capture_output=False, text=True,
check=False)
if result.returncode != 0:
logging.error("Failed to run upgrade command: %s", result.stderr)
return False, result.stderr
Expand All @@ -90,21 +123,98 @@ def updateSystem() -> (bool, str):
def promptForAutoUpdates() -> (bool, str):
if "Ubuntu" in platform.version():
logging.debug("Prompting user through unattended-upgrades.")
subprocess.run(["dpkg-reconfigure", "-plow", "unattended-upgrades"], shell=False, capture_output=False, text=True, check=True)
subprocess.run(["dpkg-reconfigure", "-plow", "unattended-upgrades"], shell=False, capture_output=False,
text=True, check=True)
logging.info("Done.")
# TODO:: doublecheck automatic restart, setting alert email
else:
return False, "Unsupported OS to setup auto updates on."
return True, None

@staticmethod
def getInstalledPackages() -> (bool, str):
logging.debug("Ensuring core components are installed.")
# TODO:: will likely need updated for yum
result = PackageManagement.runPackageCommand("list", PackageManagement.ALL_OQM, "-qq")
def getOqmPackagesStr(filter: str = ALL_OQM, installed: bool = True, notInstalled: bool = True):
logging.debug("Getting OQM packages.")
result = PackageManagement.runPackageCommand("list", filter, "-qq")
logging.debug("Output of listing core components: " + result.stdout)
logging.debug("Error Output of listing core components: " + result.stderr)

result = os.linesep.join([s for s in result.stdout.splitlines() if "installed" in s])
result = result.stdout
output = []
for curLine in result.splitlines():
if installed and notInstalled:
output.append(curLine)
continue
if installed:
if "installed" in curLine:
output.append(curLine)
continue
if notInstalled:
if not "installed" in curLine:
output.append(curLine)
return os.linesep.join(output)

@staticmethod
def getPluginDisplayName(package:str):
# print("Package: " + package)
return package.split("-")[2].replace("+", " ")

@staticmethod
def getPackageInfo(package:str) -> (bool, str):
output = {}
packageShow = subprocess.run(['apt-cache', 'show', package], shell=False, capture_output=True, text=True, check=False).stdout
packageShow = packageShow.splitlines()

for curLine in packageShow:
if not curLine.strip():
continue
split = curLine.split(": ", 1)
name = split[0]
value = split[1]
output[name] = value
return output

@staticmethod
def packageLineToArray(curLine:str) -> (dict):
output = {}
# print("cur line: ", curLine)
output['package'] = curLine.split("/")[0]
output['displayName'] = PackageManagement.getPluginDisplayName(output['package'])
lineParts = curLine.split(" ")
# print("lineParts: ", lineParts)
output['version'] = lineParts[1]
output['installed'] = "installed" in curLine

packageInfo = PackageManagement.getPackageInfo(output['package'])
# print(packageInfo)
output['description'] = packageInfo['Description']
output['fullInfo'] = packageInfo

return output

@staticmethod
def getOqmPackagesList(filter: str = ALL_OQM, installed: bool = True, notInstalled: bool = True):
logging.debug("Getting OQM packages.")
result = PackageManagement.getOqmPackagesStr(filter, installed, notInstalled)
# print("Package list str: " + result)
result = result.splitlines()
result = map(PackageManagement.packageLineToArray,result)
# TODO:: debug
# print("Package list: ", list(result))
return result

@staticmethod
def ensureOnlyPluginsInstalled(pluginList:list) -> (bool, str):
logging.debug("Ensuring only plugins in list installed.")

allInstalledPlugins = map(
lambda i: i['package'],
PackageManagement.getOqmPackagesList(PackageManagement.OQM_PLUGINS, installed=True)
)
pluginsToRemove = [i for i in allInstalledPlugins if i not in pluginList]

# TODO Try to figure out how to remove unwanted plugins while not bouncing dependency plugins
# TODO:: error check
PackageManagement.removePackages(pluginsToRemove)
PackageManagement.installPackages(pluginList)

ServiceUtils.doServiceCommand(ServiceStateCommand.restart, ServiceUtils.SERVICE_ALL)
Loading
Loading