Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
@JsonSubTypes.Type(value = ExistingSnhSetupConfig.class, name = "EXISTING"),
})
public abstract class SnhConnector<C extends SnhSetupConfig> implements Closeable {

protected C getSetupConfig() {
try {
//noinspection unchecked
Expand All @@ -49,20 +49,20 @@ protected C getSetupConfig() {
throw new RuntimeException("FAILED to cast config as appropriate.", e);
}
}

public void init(boolean install) {
this.setupForInstall();
if (install) {
this.installOqm(true);
}
}

public abstract SnhType getType();

public abstract CommandResult runCommand(String... command);

public abstract void copyToHost(String destination, InputStream input);

public void copyToHost(String remoteFile, File source) {
try(
FileInputStream is = new FileInputStream(source);
Expand All @@ -72,20 +72,20 @@ public void copyToHost(String remoteFile, File source) {
throw new RuntimeException(e);
}
}

public void copyToHost(String destinationDir, Collection<File> localFiles) {
log.info("Copying files to host into {}: {}", destinationDir, (Object) localFiles);
for (File curFile : localFiles) {
this.copyToHost(destinationDir + curFile.getName(), curFile);
}
}

public void copyToHost(String destinationDir, File... localFiles) {
this.copyToHost(destinationDir, localFiles);
}
Comment thread
GregJohnStewart marked this conversation as resolved.

public abstract void copyFromHost(String remoteFile, OutputStream destination);

public void copyFromHost(String remoteFile, File destination) {
try(
FileOutputStream os = new FileOutputStream(destination);
Expand All @@ -95,14 +95,14 @@ public void copyFromHost(String remoteFile, File destination) {
throw new RuntimeException(e);
}
}


public void setupForInstall() {
switch (this.getSetupConfig().getInstallTypeConfig().getType()){
case REPO -> {
log.info("Setting up host for repo install.");
RepoInstallTypeConfig config = (RepoInstallTypeConfig) this.getSetupConfig().getInstallTypeConfig();

String setupUrl = "https://deployment.openquartermaster.com/repos/"+config.getRepoBranch()+"/"+config.getInstallerType().name()+"/setup-repo.sh";
log.debug("Setup script url: {}", setupUrl);
CommandResult result = this.runCommand("wget", "-q", "-O", "/tmp/repoSetup.sh", setupUrl);
Expand All @@ -123,8 +123,9 @@ public void setupForInstall() {
log.info("Building installers.");
CommandResult.from(new ProcessBuilder("../Station-Captain/makeInstallers.sh")).assertSuccess("Build Station Captain Installers");
CommandResult.from(new ProcessBuilder("../Infrastructure/makeInstallers.sh")).assertSuccess("Build Infrastructure Installers");
CommandResult.from(new ProcessBuilder("../../../software/core/oqm-core-api/makeInstallers.sh")).assertSuccess("Build Base Station Installers");
CommandResult.from(new ProcessBuilder("../../../software/core/oqm-core-api/makeInstallers.sh")).assertSuccess("Build Core API Installers");
CommandResult.from(new ProcessBuilder("../../../software/core/oqm-core-base-station/makeInstallers.sh")).assertSuccess("Build Base Station Installers");
CommandResult.from(new ProcessBuilder("../../../software/core/oqm-core-characteristics/makeInstallers.sh")).assertSuccess("Build Characteristics Installers");
CommandResult.from(new ProcessBuilder("../../../software/plugins/external-item-search/makeInstallers.sh")).assertSuccess("Build External Item Search Installers");
log.info("Done building installers.");
} catch(IOException | InterruptedException e) {
Expand All @@ -134,23 +135,24 @@ public void setupForInstall() {
installers.addAll(List.of(new File("../Station-Captain/bin/").listFiles((FileFilter) new WildcardFileFilter("oqm-*."+ this.getSetupConfig().getInstallTypeConfig().getInstallerType().name()))));
installers.addAll(List.of(new File("../Infrastructure/build/").listFiles((FileFilter) new WildcardFileFilter("oqm-*."+ this.getSetupConfig().getInstallTypeConfig().getInstallerType().name()))));
installers.addAll(List.of(new File("../../../software/core/oqm-core-api/build/installers/").listFiles((FileFilter) new WildcardFileFilter("oqm-*."+ this.getSetupConfig().getInstallTypeConfig().getInstallerType().name()))));
installers.addAll(List.of(new File("../../../software/core/oqm-core-characteristics/build/installers/").listFiles((FileFilter) new WildcardFileFilter("oqm-*."+ this.getSetupConfig().getInstallTypeConfig().getInstallerType().name()))));
Comment thread
GregJohnStewart marked this conversation as resolved.
installers.addAll(List.of(new File("../../../software/core/oqm-core-base-station/build/installers/").listFiles((FileFilter) new WildcardFileFilter("oqm-*."+ this.getSetupConfig().getInstallTypeConfig().getInstallerType().name()))));
installers.addAll(List.of(new File("../../../software/plugins/external-item-search/build/installers/").listFiles((FileFilter) new WildcardFileFilter("oqm-*."+ this.getSetupConfig().getInstallTypeConfig().getInstallerType().name()))));
log.info("Installers to add to host: {}", installers);

this.runCommand("mkdir", "-p", "/tmp/oqm-installers/").assertSuccess("List uploaded installers.");
this.runCommand("rm", "-rf", "/tmp/oqm-installers/*").assertSuccess("Remove previously uploaded installers.");
this.runCommand("chmod", "777", "/tmp/oqm-installers").assertSuccess("Adjust permissions of installer upload dir.");
log.info("Prepared destination directory.");
this.copyToHost("/tmp/oqm-installers/", installers);
log.info("Copied all files to host.");

CommandResult result = this.runCommand("ls", "/tmp/oqm-installers/").assertSuccess("List uploaded installers.");
log.info("Installers on remote box: {}", result.getStdOut());
}
}
}

public CommandResult installOqm(boolean verify) {
CommandResult output = null;
switch (this.getSetupConfig().getInstallTypeConfig().getInstallerType()) {
Expand All @@ -176,7 +178,7 @@ public CommandResult installOqm(boolean verify) {
}
return output;
}

public void uninstallOqm(){
log.info("Uninstalling OQM");
switch (this.getSetupConfig().getInstallTypeConfig().getInstallerType()){
Expand All @@ -194,12 +196,12 @@ public void uninstallOqm(){
}
this .runCommand("rm", "-rf", "/etc/oqm", "/tmp/oqm", "/data/oqm").assertSuccess("Remove OQM directories");
}


@Override
public void close() throws IOException {
}

public static SnhConnector<?> fromConfig() throws IOException {
switch (ConfigReader.getTestRunConfig().getSetupConfig().getType()){
case EXISTING -> {
Expand Down
11 changes: 11 additions & 0 deletions docs/documentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Documentation Guide

## Sphinx

```
python3-sphinx
```
Comment thread
GregJohnStewart marked this conversation as resolved.

```
sphinx-build -M html ./source/ ./build/
```
2 changes: 2 additions & 0 deletions docs/sphinx/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build/
.venv/
20 changes: 20 additions & 0 deletions docs/sphinx/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
35 changes: 35 additions & 0 deletions docs/sphinx/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
1 change: 1 addition & 0 deletions docs/sphinx/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sphinx
Comment thread
GregJohnStewart marked this conversation as resolved.
65 changes: 65 additions & 0 deletions docs/sphinx/source/_static/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions docs/sphinx/source/components.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.. Open QuarterMaster documentation master file, created by
sphinx-quickstart on Sun May 24 11:57:35 2026.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.

Components
#############################

Open QuarterMaster is a modular system, and has a few different components. Listed below are the different components and links to their individual documentation.

Core Components
===============

These are the components that make up the core functionalities of the system. Any OQM system is expected to include these.

* `Core API <https://docs.openquartermaster.com/components/software/core/api/>`_ - The Core service in charge of handling all inventory management tasks
* `Characteristics <https://github.com/Epic-Breakfast-Productions/OpenQuarterMaster/tree/main/software/core/oqm-core-characteristics>`_ - Service for disseminating characteristics about a system, including who runs it, custom logos, etc.
* `Base Station <https://github.com/Epic-Breakfast-Productions/OpenQuarterMaster/tree/main/software/core/oqm-core-base-station>`_ - The main frontend of the OQM system. Intended as a close to 1:1 feature parity for the core api backend.

Plugins
=======

Plugins are how we achieve our modular system. They add onto the core functionalities and enhance the experience with tailored experiences and tools.

* `External Item Search <https://github.com/Epic-Breakfast-Productions/OpenQuarterMaster/tree/main/software/plugins/external-item-search>`_ - A tool to get information about items from external sources.
* `Storagotchi <https://github.com/Epic-Breakfast-Productions/OpenQuarterMaster/tree/main/software/plugins/storagotchi>`_ - A fun virtual pet to encourage inventory management.
Loading
Loading