-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release-v0.27.0' into 'master'
Release 0.27.0 See merge request Scientific-IT-Systems/SampleDB!1050
- Loading branch information
Showing
105 changed files
with
4,051 additions
and
661 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,64 @@ | ||
FROM python:3.11-slim-bookworm | ||
|
||
LABEL maintainer="[email protected]" | ||
LABEL org.opencontainers.image.source=https://github.com/sciapp/sampledb | ||
LABEL org.opencontainers.image.url=https://scientific-it-systems.iffgit.fz-juelich.de/SampleDB/ | ||
LABEL org.opencontainers.image.documentation=https://scientific-it-systems.iffgit.fz-juelich.de/SampleDB/ | ||
LABEL org.opencontainers.image.title="SampleDB" | ||
LABEL org.opencontainers.image.description="A web-based electronic lab notebook with a focus on sample and measurement metadata" | ||
LABEL org.opencontainers.image.licenses=MIT | ||
|
||
# Dockerfile for sampledb | ||
FROM python:3.11-slim-bookworm as builder | ||
|
||
# Install required system packages | ||
# GCC is required to build python dependencies on ARM architectures | ||
# git is required to build python dependencies from git repositories | ||
ARG DEBIAN_FRONTEND=noninteractive | ||
RUN apt-get update && \ | ||
apt-get upgrade -y && \ | ||
apt-get install -y gcc libpangocairo-1.0-0 gettext git | ||
apt-get install -y gcc git | ||
|
||
# Switch to non-root user | ||
# It's important to keep the same path in builder image and final image | ||
RUN useradd -ms /bin/bash sampledb | ||
USER sampledb | ||
WORKDIR /home/sampledb | ||
|
||
ENV PYTHONDONTWRITEBYTECODE=1 | ||
|
||
# Set up virtual environment | ||
ENV VIRTUAL_ENV=/home/sampledb/venv | ||
RUN python3 -m venv $VIRTUAL_ENV | ||
ENV PATH="$VIRTUAL_ENV/bin:$PATH" | ||
RUN pip install --upgrade pip | ||
RUN pip install --upgrade pip | ||
|
||
# Install required Python packages | ||
COPY requirements.txt requirements.txt | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
|
||
# Clean up system packages that are no longer required | ||
USER root | ||
RUN apt-get remove -y gcc && \ | ||
apt-get autoremove -y && \ | ||
# Final image | ||
FROM python:3.11-slim-bookworm | ||
|
||
LABEL maintainer="[email protected]" | ||
LABEL org.opencontainers.image.source=https://github.com/sciapp/sampledb | ||
LABEL org.opencontainers.image.url=https://scientific-it-systems.iffgit.fz-juelich.de/SampleDB/ | ||
LABEL org.opencontainers.image.documentation=https://scientific-it-systems.iffgit.fz-juelich.de/SampleDB/ | ||
LABEL org.opencontainers.image.title="SampleDB" | ||
LABEL org.opencontainers.image.description="A web-based electronic lab notebook with a focus on sample and measurement metadata" | ||
LABEL org.opencontainers.image.licenses=MIT | ||
|
||
# Install required system packages | ||
ARG DEBIAN_FRONTEND=noninteractive | ||
RUN apt-get update && \ | ||
apt-get upgrade -y && \ | ||
apt-get install -y libpangocairo-1.0-0 gettext && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Switch to non-root user | ||
RUN useradd -ms /bin/bash sampledb | ||
USER sampledb | ||
WORKDIR /home/sampledb | ||
|
||
# Python specific config | ||
ENV PYTHONDONTWRITEBYTECODE=1 | ||
ENV PYTHONUNBUFFERED=1 | ||
|
||
# Copy dependencies from builder image | ||
COPY --from=builder --chown=sampledb:sampledb /home/sampledb/venv /home/sampledb/venv | ||
|
||
# Set up virtual environment | ||
ENV VIRTUAL_ENV=/home/sampledb/venv | ||
ENV PATH="$VIRTUAL_ENV/bin:$PATH" | ||
|
||
# Copy sampledb source code | ||
COPY --chown=sampledb:sampledb sampledb sampledb | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
.. _customization: | ||
|
||
Customization | ||
============= | ||
|
||
SampleDB provides several methods for customizing a specific SampleDB instance. | ||
|
||
Configuration | ||
------------- | ||
|
||
There are several :ref:`Configuration Variables <customization_configuration>` which can be used to set the name and description of the SampleDB instance and to set instance-specific links (e.g. to a privacy policy or help page). | ||
|
||
Custom Stylesheets | ||
------------------ | ||
|
||
The file ``sampledb/static/css/custom.css`` can be used to define custom CSS rules to change the appearance of SampleDB. | ||
|
||
To use this while using a Docker container to run SampleDB, you will need to bind mount the file to the path ``/home/sampledb/sampledb/static/css/custom.css``, .e.g using the ``--volume`` parameter for the ``docker run`` command or using a ``volumes`` section in a ``docker-compose.yml`` file. | ||
|
||
Custom Templates | ||
---------------- | ||
|
||
SampleDB uses `Jinja <https://jinja.palletsprojects.com/en/>`_ templates to render its web frontend. While you can, in theory, overwrite those templates to provide your own, this may lead to issues when upgrading the SampleDB version. However, the following templates are explicitly provided to be overwritten for the purpose of customization: | ||
|
||
custom/alerts.html | ||
`````````````````` | ||
|
||
This template is included right above system alerts which usually report success or failure on user actions, e.g. having signed in or having created an object. By introducing custom HTML, you can add alerts to be shown on all pages, or by checking the ``request.endpoint`` variable in Jinja, you can ensure these alerts are only shown on specific pages. | ||
|
||
.. code-block:: html+jinja | ||
:caption: A custom alerts template for alerts on the sign-in page | ||
|
||
{% if request.endpoint == 'frontend.sign_in' %} | ||
<div class="alert alert-info"> | ||
<strong>Note:</strong> Contact an <a href="mailto:[email protected]">administrator</a> to request an account. | ||
</div> | ||
{% endif %} | ||
|
||
custom/head.html | ||
```````````````` | ||
|
||
This template is included in the HTML head section and can be used to include custom stylesheets (in addition to the ``custom.css`` file described above), custom scripts and other elements. Note that SampleDB is configured with a fairly restrictive `Content Security Policy <https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP>`_, which will block inline scripts or stylesheets as well as those from other servers/origins. Place any scripts or stylesheets in the ``sampledb/static/`` folder to make sure they will not be blocked. | ||
|
||
.. code-block:: html+jinja | ||
:caption: A custom head template including a CSS file from the ``sampledb/static`` directory | ||
|
||
<link rel="stylesheet" href="{{ fingerprinted_static('example.css') }}"> | ||
|
||
custom/scripts.html | ||
``````````````````` | ||
|
||
This template is included at the end of the HTML body section, right after scripts for SampleDB have been included, so that jQuery and other scripts are already available. This can be used to include custom scripts and other elements. As noted above, you will need to use the ``sampledb/static/`` folder to make sure the scripts will not be blocked. | ||
|
||
.. code-block:: html+jinja | ||
:caption: A custom scripts template including a JavaScript file from the ``sampledb/static`` directory | ||
|
||
<script src="{{ fingerprinted_static('example.js') }}"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
.. _labels: | ||
|
||
Label Paper Formats | ||
=================== | ||
|
||
The configuration variable ``SAMPLEDB_LABEL_PAPER_FORMATS`` can be used to set available label paper formats for | ||
self-adhesive labels, which can be used when generating QR Code labels. The value of this variable must consist of a list | ||
of JSON objects. Each JSON object represents a label paper format and must contain the following keys: | ||
* ``format_name``: Name of the label paper format which is shown during selection (string or dictionary with language keys (e.g. ``{"en": "Example Format"}``)) | ||
* ``labels_in_row``: Number of labels in a row (positive integer) | ||
* ``labels_in_col``: Number of labels in a column (positive integer) | ||
* ``qr_code_width``: Width of the QR code in mm (positive integer) | ||
* ``label_width``: Width of a single label in mm (positive float) | ||
* ``label_height``: Height of a single label in mm (positive float) | ||
* ``margin_horizontal``: Distance between two labels in horizontal direction in mm (positive float) | ||
* ``margin_vertical``: Distance between two labels in vertical direction in mm (positive float) | ||
* ``paper_format``: Paper format that should be used (integer between 0 and 3) | ||
* 0: DIN A4 Portrait | ||
* 1: DIN A4 Landscape | ||
* 2: Letter Portrait | ||
* 3: Letter Landscape | ||
|
||
By default, no label paper formats are available. (``[]``) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.. _topics: | ||
|
||
Topics | ||
====== | ||
|
||
Actions in |service_name| can be filtered by topics to limit the displayed actions in the action list. | ||
A topic for example could represent a laboratory, actions used in one workflow, or the actions one research group uses. | ||
Multiple topics can be assigned to one action. | ||
Similar to object filters users can save their topic filter selection. | ||
|
||
Similar to action types, topics can be displayed in the navbar and on the frontpage. | ||
Administrators can create new topics. | ||
|
||
.. note:: | ||
An administrator might have disabled this feature (see :ref:`SAMPLEDB_DISABLE_TOPICS <miscellaneous_config>`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.