Skip to content
Draft
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
3 changes: 3 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ services:
image: "${OPENC3_REGISTRY}/${OPENC3_NAMESPACE}/openc3-buckets${OPENC3_IMAGE_SUFFIX}:${OPENC3_TAG}"
volumes:
- "openc3-object-v:/data"
- "openc3-object-versions-v:/versions"
- "./cacert.pem:/devel/cacert.pem:z"
restart: "unless-stopped"
logging:
Expand All @@ -34,6 +35,7 @@ services:
ROOT_SECRET_KEY: "${OPENC3_BUCKET_PASSWORD}"
OPENC3_SR_BUCKET_USERNAME: "${OPENC3_SR_BUCKET_USERNAME}"
OPENC3_SR_BUCKET_PASSWORD: "${OPENC3_SR_BUCKET_PASSWORD}"
VGW_VERSIONING_DIR: "/versions"
SSL_CERT_FILE: "/devel/cacert.pem"
CURL_CA_BUNDLE: "/devel/cacert.pem"
REQUESTS_CA_BUNDLE: "/devel/cacert.pem"
Expand Down Expand Up @@ -326,6 +328,7 @@ volumes:
openc3-redis-v: {}
openc3-redis-ephemeral-v: {}
openc3-object-v: {}
openc3-object-versions-v: {}
openc3-gems-v: {}
openc3-cmd-tlm-api-tmp-v: {}
openc3-script-runner-api-tmp-v: {}
Expand Down
6 changes: 3 additions & 3 deletions openc3-buckets/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ RUN apk update && \
chmod +x /usr/bin/docker-entrypoint.sh && \
addgroup -g ${GROUP_ID} -S ${IMAGE_GROUP} && \
adduser -u ${USER_ID} -G ${IMAGE_GROUP} -s /bin/ash -S ${IMAGE_USER} && \
mkdir /data && \
chown -R ${USER_ID}:${IMAGE_GROUP} /data && \
chmod -R 777 /data
mkdir /data /versions && \
chown -R ${USER_ID}:${IMAGE_GROUP} /data /versions && \
chmod -R 777 /data /versions

# Switch to user
USER ${USER_ID}:${GROUP_ID}
Expand Down
6 changes: 3 additions & 3 deletions openc3-buckets/Dockerfile-ubi
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ RUN microdnf update -y && \
microdnf clean all && \
rm -rf /var/cache/yum && \
chmod +x /usr/bin/docker-entrypoint.sh && \
mkdir -p /data && \
chown 1001:1001 /data && \
chmod -R 777 /data
mkdir -p /data /versions && \
chown 1001:1001 /data /versions && \
chmod -R 777 /data /versions

USER 1001
EXPOSE 9000
Expand Down
17 changes: 15 additions & 2 deletions openc3-buckets/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ if [ "${1}" = "versitygw" ] || [ "${1#-}" != "$1" ]; then
# Create IAM directory if it doesn't exist
mkdir -p "${VGW_IAM_DIR}"

# versitygw posix backend requires the versioning dir to live OUTSIDE the
# data root (it errors with "the root directory contains the directory ..."
# otherwise), so this must be a separately mounted path.
if [ -n "${VGW_VERSIONING_DIR}" ]; then
mkdir -p "${VGW_VERSIONING_DIR}"
fi

# Pre-create ScriptRunner user account if credentials are provided and different from root
# versitygw expects accounts in a users.json file with accessAccounts structure
if [ -n "${OPENC3_SR_BUCKET_USERNAME}" ] && [ -n "${OPENC3_SR_BUCKET_PASSWORD}" ]; then
Expand Down Expand Up @@ -55,9 +62,15 @@ EOF
fi

# If no arguments provided, use defaults with IAM enabled
# Note: --iam-dir is a global option that must come BEFORE the backend command
# Note: --iam-dir is a global option that must come BEFORE the backend command;
# --versioning-dir is a posix backend flag, so it goes after "posix" and before
# the data dir argument.
if [ $# -eq 0 ]; then
set -- versitygw --iam-dir "${VGW_IAM_DIR}" "${VGW_BACKEND}" "${VGW_BACKEND_ARG}"
if [ "${VGW_BACKEND}" = "posix" ] && [ -n "${VGW_VERSIONING_DIR}" ]; then
set -- versitygw --iam-dir "${VGW_IAM_DIR}" "${VGW_BACKEND}" --versioning-dir "${VGW_VERSIONING_DIR}" "${VGW_BACKEND_ARG}"
else
set -- versitygw --iam-dir "${VGW_IAM_DIR}" "${VGW_BACKEND}" "${VGW_BACKEND_ARG}"
fi
else
set -- versitygw "$@"
fi
Expand Down
7 changes: 6 additions & 1 deletion openc3-cosmos-cmd-tlm-api/app/controllers/info_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@
rescue LoadError
class InfoController < ApplicationController
def info
render json: { version: OPENC3_VERSION, license: 'OpenC3', enterprise: false }
render json: {
version: OPENC3_VERSION,
license: 'OpenC3',
enterprise: false,
local_mode: !ENV['OPENC3_LOCAL_MODE'].to_s.empty?
}
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
<v-icon v-if="showDisconnect" class="mt-2" color="red">
mdi-connection
</v-icon>
<div class="d-flex align-center mr-1">
<div v-if="localMode" class="d-flex align-center mr-1">
<v-tooltip :open-delay="600" location="top">
<template #activator="{ props }">
<v-btn
Expand All @@ -139,8 +139,7 @@
@click="backToNewScript"
/>
</template>
<span v-if="!scriptId"> Reload File </span>
<span v-else> Back to New Script </span>
<span v-if="!scriptId">Reload File</span>
</v-tooltip>
</div>
<v-tooltip
Expand Down Expand Up @@ -618,6 +617,13 @@
:persistent="true"
@status="promptDialogCallback"
/>
<script-version-history-dialog
v-if="showVersionHistory"
v-model="showVersionHistory"
:filename="filename"
:current-body="editor ? editor.getValue() : ''"
@restored="onVersionRestored"
/>
<!-- Command Editor Dialog -->
<v-dialog
v-model="commandEditor.show"
Expand Down Expand Up @@ -713,6 +719,7 @@ import ScriptEnvironmentDialog from '@/tools/scriptrunner/Dialogs/ScriptEnvironm
import CommandEditor from '@/components/CommandEditor.vue'
import SuiteRunner from '@/tools/scriptrunner/SuiteRunner.vue'
import ScriptLogMessages from '@/tools/scriptrunner/ScriptLogMessages.vue'
import ScriptVersionHistoryDialog from '@/tools/scriptrunner/ScriptVersionHistoryDialog.vue'
import {
CmdCompleter,
TlmCompleter,
Expand Down Expand Up @@ -750,6 +757,7 @@ export default {
SuiteRunner,
RunningScripts,
ScriptLogMessages,
ScriptVersionHistoryDialog,
CriticalCmdDialog,
CommandEditor,
},
Expand Down Expand Up @@ -835,6 +843,8 @@ export default {
fileOpen: false,
lockedBy: null,
showEditingToast: false,
showVersionHistory: false,
localMode: false,
showSaveAs: false,
areYouSure: false,
subscription: null,
Expand Down Expand Up @@ -1239,6 +1249,20 @@ export default {
this.deleteAllBreakpoints()
},
},
{
divider: true,
},
{
label: 'Version History',
icon: 'mdi-history',
disabled:
this.scriptId ||
!this.filename ||
this.filename === NEW_FILENAME,
command: () => {
this.showVersionHistory = true
},
},
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than a hidden menu option should this be a front and center history icon?

],
},
]
Expand Down Expand Up @@ -1312,6 +1336,14 @@ export default {

this.updateOverridesCount()

Api.get('/openc3-api/info')
.then((response) => {
this.localMode = !!response.data?.local_mode
})
.catch(() => {
this.localMode = false
})

// Make NEW_FILENAME available to the template
this.NEW_FILENAME = NEW_FILENAME

Expand Down Expand Up @@ -3074,6 +3106,9 @@ class TestSuite(Suite):
return Api.post(`/script-api/scripts/${this.filename}/lock`)
}
},
onVersionRestored: function () {
this.reloadFile()
},
unlockFile: function () {
if (
this.filename !== NEW_FILENAME &&
Expand Down
Loading
Loading