Skip to content

Commit dd56494

Browse files
authored
feat: add anyvlm database (#28)
close #23 * Started some docs work for #25
1 parent e577e12 commit dd56494

File tree

23 files changed

+737
-1
lines changed

23 files changed

+737
-1
lines changed

.env.example

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
###############
2+
# BASIC SETUP #
3+
###############
4+
5+
# Storage configuration -- see "Configuration" -> "Object Storage" in the docs
6+
ANYVLM_STORAGE_URI=postgresql://anyvlm:anyvlm-pw@localhost:5435/anyvlm
7+
8+
############
9+
# OPTIONAL #
10+
############
11+
12+
## Testing - see "Contributing" -> "Testing" in the docs
13+
ANYVLM_TEST_STORAGE_URI=postgresql://anyvlm_test:anyvlm-test-pw@localhost:5436/anyvlm_test

.github/workflows/python-package.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ jobs:
4747
run: uv run pytest
4848
env:
4949
ANYVLM_ANYVAR_TEST_STORAGE_URI: postgresql://postgres:postgres@localhost:5432/postgres
50+
ANYVLM_TEST_STORAGE_URI: postgresql://postgres:postgres@localhost:5432/postgres
5051
lint:
5152
name: lint
5253
runs-on: ubuntu-latest

compose.test.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
services:
2+
anyvlm_test_db:
3+
image: postgres:17
4+
tmpfs:
5+
- /var/lib/postgresql/data
6+
ports:
7+
- 127.0.0.1:5436:5432
8+
environment:
9+
- POSTGRES_DB=anyvlm_test
10+
- POSTGRES_USER=anyvlm_test
11+
- POSTGRES_PASSWORD=anyvlm-test-pw

compose.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
services:
2+
anyvlm_db:
3+
image: postgres:17
4+
volumes:
5+
- anyvlm_vol:/var/lib/postgresql/data
6+
ports:
7+
- 127.0.0.1:5435:5432
8+
environment:
9+
- POSTGRES_DB=anyvlm
10+
- POSTGRES_USER=anyvlm
11+
- POSTGRES_PASSWORD=anyvlm-pw
12+
13+
volumes:
14+
anyvlm_vol:
15+
external: true

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/source/conf.py

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# For the full list of built-in configuration values, see the documentation:
4+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
5+
6+
# -- Project information -----------------------------------------------------
7+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
8+
9+
project = "anyvlm"
10+
author = "GenomicMedLab"
11+
html_title = "AnyVLM"
12+
13+
# -- General configuration ---------------------------------------------------
14+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
15+
16+
extensions = [
17+
"sphinx_rtd_theme",
18+
"sphinx.ext.autodoc",
19+
"sphinx_autodoc_typehints",
20+
"sphinx.ext.linkcode",
21+
"sphinx_copybutton",
22+
"sphinx.ext.autosummary",
23+
"sphinx_github_changelog",
24+
]
25+
26+
templates_path = ["_templates"]
27+
exclude_patterns = []
28+
29+
# -- Options for HTML output -------------------------------------------------
30+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
31+
32+
html_theme = "sphinx_rtd_theme"
33+
html_theme_options = {
34+
"collapse_navigation": False,
35+
}
36+
37+
# -- autodoc things ----------------------------------------------------------
38+
import os
39+
import sys
40+
41+
sys.path.insert(0, os.path.abspath("../../"))
42+
autodoc_preserve_defaults = True
43+
44+
# -- get version -------------------------------------------------------------
45+
from anyvlm import __version__ # noqa: E402
46+
47+
version = release = __version__
48+
49+
50+
# -- linkcode ----------------------------------------------------------------
51+
def linkcode_resolve(domain, info):
52+
if domain != "py":
53+
return None
54+
if not info["module"]:
55+
return None
56+
filename = info["module"].replace(".", "/")
57+
return f"https://github.com/genomicmedlab/anyvlm/blob/main/src/{filename}.py"
58+
59+
60+
# -- code block style --------------------------------------------------------
61+
pygments_style = "default"
62+
pygements_dark_style = "monokai"
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Configuring Docker Compose
2+
!!!!!!!!!!!!!!!!!!!!!!!!!!
3+
4+
This page describes how to use the provided ``compose.yaml`` file to start AnyVLM alongside its dependencies, and highlights some configuration options you can customize for your environment.
5+
6+
Overview
7+
--------
8+
9+
The compose file defines one main service:
10+
11+
* ``anyvlm_db`` - PostgreSQL database for AnyVLM
12+
13+
It also defines a Docker volume:
14+
15+
* ``anyvlm_vol`` - storage for the AnyVLM PostgreSQL data directory
16+
17+
This volume is declared as ``external: true``, so it must exist before
18+
you run ``docker compose up``. For example:
19+
20+
.. code-block:: bash
21+
22+
docker volume create anyvlm_vol
23+
24+
Running the stack
25+
-----------------
26+
27+
After creating the external volumes and configuring any optional environment variables, you can start the stack with:
28+
29+
.. code-block:: bash
30+
31+
docker compose up
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Example .env File
2+
!!!!!!!!!!!!!!!!!
3+
4+
.. literalinclude:: ../../../.env.example
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Configuration
2+
!!!!!!!!!!!!!
3+
4+
This section details AnyVLM configuration. It is broken down into the following subsections:
5+
6+
* :doc:`Object Storage <storage>`: define database connection
7+
* :doc:`Example .env file <dotenv_example>`: use a ``.env`` file to declare environment variables when running REST API service
8+
* :doc:`Docker Compose <docker_compose>`: edit the provided Docker Compose file to tailor it to your needs
9+
10+
.. toctree::
11+
:maxdepth: 2
12+
:hidden:
13+
14+
Storage<storage>
15+
Example .env file<dotenv_example>
16+
Docker Compose<docker_compose>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Object Storage Configuration
2+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!
3+
4+
Storage Connection
5+
==================
6+
7+
Use the ``ANYVLM_STORAGE_URI`` environment variable to pass a `libpq connection string <https://www.postgresql.org/docs/current/libpq.html>`_ to the PostgreSQL connection constructor.
8+
9+
.. list-table::
10+
:widths: 30 70
11+
:header-rows: 1
12+
13+
* - Environment Variable
14+
- Default Value
15+
* - ``ANYVLM_STORAGE_URI``
16+
- ``"postgresql://postgres@localhost:5432/anyvlm"``

0 commit comments

Comments
 (0)