-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
165 additions
and
184 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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
alembic/* | ||
alembic.ini |
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,19 @@ | ||
FROM python:3.11 | ||
|
||
RUN pip install --no-cache-dir --upgrade "git+https://github.com/simonsobs/librarian.git@librarian-v2" | ||
RUN pip install --no-cache-dir --upgrade "psycopg[binary,pool]" | ||
|
||
COPY ./server_config.json server_config.json | ||
COPY ./background_config.json background_config.json | ||
COPY ./alembic.ini alembic.ini | ||
COPY ./alembic alembic | ||
COPY ./setup_vars.sh setup_vars.sh | ||
|
||
RUN mkdir -p /tmp/store/libstore/store | ||
RUN mkdir -p /tmp/store/libstore/staging | ||
RUN mkdir -p /tmp/store/libclone/store | ||
RUN mkdir -p /tmp/store/libclone/staging | ||
RUN mkdir -p /volumes/database | ||
|
||
CMD ["librarian-server-start"] | ||
|
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,13 @@ | ||
{ | ||
"create_local_clone": [ | ||
{ | ||
"task_name": "Local cloner", | ||
"every": "00:05:00", | ||
"age_in_days": 7, | ||
"clone_from": "store", | ||
"clone_to": "clone" | ||
} | ||
] | ||
} | ||
|
||
|
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,61 @@ | ||
version: "3.11" | ||
|
||
services: | ||
librarian-database: | ||
image: postgres:16 | ||
restart: always | ||
container_name: "librarian-database" | ||
user: postgres | ||
volumes: | ||
- "database:/var/lib/postgresql/data" | ||
environment: | ||
POSTGRES_USER: "postgres" | ||
POSTGRES_PASSWORD: "secret" | ||
POSTGRES_DB: "librarian" | ||
expose: | ||
- 5432 | ||
networks: | ||
- "librarian-network" | ||
healthcheck: | ||
test: ["CMD-SHELL", "pg_isready"] | ||
interval: 3s | ||
timeout: 5s | ||
retries: 5 | ||
|
||
librarian-server: | ||
hostname: "example-librarian-hostname" | ||
build: | ||
context: "." | ||
dockerfile: "Dockerfile" | ||
container_name: "librarian-postgres" | ||
ports: | ||
- 127.0.0.1:21108:21108 | ||
stdin_open: true | ||
tty: true | ||
volumes: | ||
- "database:/volumes/database" | ||
- type: "bind" | ||
source: "/tmp/store" | ||
target: "/tmp/store" | ||
environment: | ||
- LIBRARIAN_CONFIG_PATH=server_config.json | ||
- LIBRARIAN_SERVER_DATABASE_USER=postgres | ||
- LIBRARIAN_SERVER_DATABASE_PASSWORD=secret | ||
- LIBRARIAN_BACKGROUND_CONFIG=background_config.json | ||
- LIBRARIAN_SERVER_DATABASE_DRIVER=sqlite | ||
- LIBRARIAN_SERVER_DATABASE=/volumes/database/database.db | ||
- LIBRARIAN_SERVER_PORT=21108 | ||
depends_on: | ||
librarian-database: | ||
condition: service_healthy | ||
networks: | ||
- "librarian-network" | ||
|
||
volumes: | ||
database: | ||
|
||
networks: | ||
librarian-network: | ||
|
||
|
||
|
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,5 @@ | ||
# We need to copy in the alembic to here, so we can run the | ||
# database migration. | ||
|
||
cp -r ../../alembic . | ||
cp ../../alembic.ini . |
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,47 @@ | ||
{ | ||
"database_driver": "postgresql+psycopg", | ||
"database_port": "5432", | ||
"database": "librarian", | ||
"database_host": "librarian-database", | ||
"log_level": "DEBUG", | ||
"displayed_site_name": "Docker Example", | ||
"displayed_site_description": "An example docker deployment of the librarian.", | ||
"add_stores": [ | ||
{ | ||
"store_name": "store", | ||
"store_type": "local", | ||
"ingestable": true, | ||
"store_data": { | ||
"staging_path": "/tmp/store/libstore/staging", | ||
"store_path": "/tmp/store/libstore/store" | ||
}, | ||
"transfer_manager_data": { | ||
"local": { | ||
"available": true, | ||
"hostnames": [ | ||
"borrowj-adapter.physics.upenn.edu", | ||
"example-librarian-hostname" | ||
] | ||
} | ||
} | ||
}, | ||
{ | ||
"store_name": "clone", | ||
"store_type": "local", | ||
"ingestable": false, | ||
"store_data": { | ||
"staging_path": "/tmp/store/libclone/staging", | ||
"store_path": "/tmp/store/libclone/store" | ||
}, | ||
"transfer_manager_data": { | ||
"local": { | ||
"available": true, | ||
"hostnames": [ | ||
"borrowj-adapter.physics.upenn.edu", | ||
"example-librarian-hostname" | ||
] | ||
} | ||
} | ||
} | ||
] | ||
} |
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,2 @@ | ||
export LIBRARIAN_SERVER_DATABASE_USER="postgres" | ||
export LIBRARIAN_SERVER_DATABASE_PASSWORD="secret" |
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 @@ | ||
This is a very simple setup for the librarian, using a local SQLite database | ||
as the core librarian database. Production setups may want to use the | ||
postgres container. | ||
|
||
A few things to keep in mind when deploying the librarian: | ||
|
||
- This is inherently not secure by default; you will need to change the administrator | ||
password for the librarian and potentially provision further accounts. | ||
|
||
- You will need to mark both the hostname of the docker container and of your | ||
local machine as available for local transfers. | ||
|
||
- You will need to make sure that the local store locations are mounted | ||
transparently by the docker container (i.e. you should have /path/to/store | ||
the same inside and outside of the container). |
This file was deleted.
Oops, something went wrong.
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