Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-webui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-webui
Commits
16be41f1
Verified
Commit
16be41f1
authored
1 month ago
by
Daniel Hornung
Browse files
Options
Downloads
Patches
Plain Diff
BUILD: Better install-sss.sh and copy_into_docker.py (was: .sh)
parent
ab390145
No related branches found
No related tags found
No related merge requests found
Pipeline
#62863
failed
1 month ago
Stage: setup
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
install-sss.sh
+34
-5
34 additions, 5 deletions
install-sss.sh
tools/copy_into_docker.py
+158
-0
158 additions, 0 deletions
tools/copy_into_docker.py
tools/copy_into_docker.sh
+3
-1
3 additions, 1 deletion
tools/copy_into_docker.sh
with
195 additions
and
6 deletions
install-sss.sh
+
34
−
5
View file @
16be41f1
#!/bin/bash
SRC_DIR
=
$1
INSTALL_DIR
=
$2
mkdir
-p
$INSTALL_DIR
# from here on do your module-wise installing
# Install always ##############################################################
# Scripts for which the whole directory shall be installed
INSTALL_FULL_DIR
=
"
ext_query_to_xlsx
"
# Scripts for which only *.py files shall be installed
INSTALL_PY_FILES
=
"
ext_file_download
"
# #############################################################################
# Default implementation follows ##############################################
echo
"Installing to
$INSTALL_DIR
"
for
src
in
$INSTALL_FULL_DIR
;
do
cp
-r
"
$SRC_DIR
/
$src
"
"
$INSTALL_DIR
/"
echo
"Installed
$src
"
done
for
src
in
$INSTALL_PY_FILES
;
do
mkdir
-p
"
$INSTALL_DIR
/
$src
"
cp
"
$SRC_DIR
/
$src
/"
*
.py
"
$INSTALL_DIR
/
$src
/"
echo
"Installed
$src
"
done
# Module specific installations ###############################################
# ext_table_preview
if
[
"
${
BUILD_MODULE_EXT_BOTTOM_LINE_TABLE_PREVIEW
}
"
==
"ENABLED"
]
;
then
...
...
@@ -11,7 +43,4 @@ if [ "${BUILD_MODULE_EXT_BOTTOM_LINE_TABLE_PREVIEW}" == "ENABLED" ]; then
cp
$SRC_DIR
/ext_table_preview/
*
.py
$INSTALL_DIR
/ext_table_preview/
echo
"installed all server-side scripts for ext_table_preview"
fi
# ext_file_download; should always be installed - No build variable
mkdir
-p
$INSTALL_DIR
/ext_file_download
cp
$SRC_DIR
/ext_file_download/
*
.py
$INSTALL_DIR
/ext_file_download/
echo
"installed all server-side scripts for ext_file_download"
This diff is collapsed.
Click to expand it.
tools/copy_into_docker.py
0 → 100755
+
158
−
0
View file @
16be41f1
#!/usr/bin/env python3
# This file is a part of the LinkAhead project.
#
# Copyright (C) 2025 IndiScale GmbH <www.indiscale.com>
# Copyright (C) 2025 Daniel Hornung <d.hornung@indiscale.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
"""
import
argparse
import
os
from
pathlib
import
Path
from
subprocess
import
run
from
typing
import
Optional
,
Union
class
DockerManager
:
def
__init__
(
self
,
container
:
Optional
[
str
]
=
None
,
webui_root
:
Optional
[
str
]
=
None
,
basename
:
Optional
[
str
]
=
None
,
):
"""
Manages a Docker container.
Parameters
----------
container : str, default=
"
linkahead
"
The container name
webui_root : str, default=
"
/opt/caosdb/git/caosdb-server/caosdb-webui
"
The root directory for the webui on the server.
basename : str, default=
"
caosdb-webui
"
Base name of this repository.
"""
if
not
container
:
container
=
"
linkahead
"
if
not
webui_root
:
webui_root
=
"
/opt/caosdb/git/caosdb-server/caosdb-webui
"
if
not
basename
:
basename
=
"
caosdb-webui
"
self
.
container_name
=
container
self
.
webui_root
=
webui_root
self
.
basename
=
basename
def
copy
(
self
,
src
:
Union
[
str
,
Path
]):
"""
Copy ``src`` into the Docker container.
This method tries to guess the correct target inside the webui
'
s root dir.
Parameters
----------
src : Union[str, Path]
The directory or file to copy.
"""
if
isinstance
(
src
,
str
):
src
=
Path
(
src
)
src
=
src
.
resolve
()
relative_path
=
Path
(
*
src
.
parts
[
src
.
parts
.
index
(
self
.
basename
)
+
1
:])
target
=
Path
(
self
.
webui_root
)
/
relative_path
if
src
.
is_dir
():
target
=
target
.
parent
command
=
[
"
docker
"
,
"
cp
"
,
str
(
src
),
f
"
{
self
.
container_name
}
:
{
target
}
"
]
run
(
command
,
check
=
True
)
def
make
(
self
):
"""
Run ``make`` inside the container.
"""
command
=
[
"
docker
"
,
"
exec
"
,
"
-u0:0
"
,
"
-ti
"
,
"
-w
"
,
self
.
webui_root
,
self
.
container_name
,
"
make
"
]
run
(
command
)
def
_mangle_sources
(
sources
:
list
[
str
])
->
list
[
str
]:
"""
Handle special cases of the sources given on the commandline.
Parameters
----------
sources : list[str]
The sources to mangle
Returns
-------
out : list[str]
The mangled list.
"""
if
"
ALL
"
in
sources
and
len
(
sources
)
>
1
:
raise
ValueError
(
"
If ALL is given, this must be the only source.
"
)
if
"
ALL
"
in
sources
:
base
=
Path
(
__file__
).
parents
[
1
]
result
=
[]
for
default
in
(
"
build.properties.d
"
,
"
conf
"
,
"
libs
"
,
"
node_modules
"
,
"
src
"
,
):
result
.
append
(
str
(
base
/
default
))
return
result
return
sources
.
copy
()
def
_parse_arguments
():
"""
Parse the arguments.
"""
parser
=
argparse
.
ArgumentParser
(
description
=
"
Copy stufff into the Docker container, then run the Makefile.
"
)
parser
.
add_argument
(
"
source
"
,
type
=
str
,
nargs
=
"
+
"
,
help
=
"""
The thing(s) to copy.
Special case:
"
ALL
"
copies everything that may be useful.
"""
)
parser
.
add_argument
(
'
--container
'
,
type
=
str
,
required
=
False
,
help
=
"
Container name. Default is
'
linkahead
'
.
"
)
parser
.
add_argument
(
'
--webui-root
'
,
type
=
str
,
required
=
False
,
help
=
"
Webui root in the container. Default is
"
"'
/opt/caosdb/git/caosdb-server/caosdb-webui
'
.
"
)
parser
.
add_argument
(
'
--repo-basename
'
,
type
=
str
,
required
=
False
,
help
=
"
Basename of this repository. Default is
"
"'
caosdb-webui
'
.
"
)
return
parser
.
parse_args
()
def
main
():
"""
The main function of this script.
"""
args
=
_parse_arguments
()
mgr
=
DockerManager
(
container
=
args
.
container
,
webui_root
=
args
.
webui_root
,
basename
=
args
.
repo_basename
)
sources
=
args
.
source
sources
=
_mangle_sources
(
sources
)
for
src
in
sources
:
mgr
.
copy
(
src
)
mgr
.
make
()
if
__name__
==
"
__main__
"
:
main
()
This diff is collapsed.
Click to expand it.
tools/copy_into_docker.sh
+
3
−
1
View file @
16be41f1
...
...
@@ -28,8 +28,10 @@ set -e
# Copy just the publicly accessible files
core_dir
=
"
$(
dirname
$0
)
/../src/core"
container
=
"linkahead"
docker_webui_root
=
"/opt/caosdb/git/
linkahead-server/linkahead
-webui"
docker_webui_root
=
"/opt/caosdb/git/
caosdb-server/caosdb
-webui"
docker_dir
=
"
${
docker_webui_root
}
/src/core/"
docker
cp
"
${
core_dir
}
/."
"
$container
:
$docker_dir
"
docker
exec
-ti
-w
"
$docker_webui_root
"
"
$container
"
make
echo
-e
"
\n
This script is deprecated, use the Python script instead."
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment