mirror of
https://github.com/Cian-H/iform-invenio.git
synced 2026-08-16 16:32:50 +01:00
Updated config for local development
This commit is contained in:
@@ -28,6 +28,8 @@ INVENIO_CELERY_BROKER_URL=redis://cache:6379/5
|
||||
|
||||
# Server settings
|
||||
INVENIO_WSGI_PROXIES=4
|
||||
INVENIO_HTTP_PORT=80
|
||||
INVENIO_HTTPS_PORT=443
|
||||
|
||||
# Invenio-RDM-Records
|
||||
INVENIO_DATACITE_ENABLED=false
|
||||
@@ -60,8 +62,9 @@ INVENIO_GITHUB_APP_CREDENTIALS=""
|
||||
# OAI-PMH
|
||||
INVENIO_OAISERVER_ID_PREFIX=invenio-rdm
|
||||
|
||||
# Invenio-Files-REST
|
||||
INVENIO_FILES_REST_STORAGE_FACTORY=invenio_s3.s3fs_storage_factory
|
||||
# Storage Backend Selection
|
||||
# Set to 'false' for local development to use local disk storage instead of S3
|
||||
INVENIO_USE_S3=true
|
||||
|
||||
# Invenio-Search
|
||||
INVENIO_SEARCH_HOSTS=search:9200
|
||||
|
||||
+2
-2
@@ -151,7 +151,7 @@ def prod_deploy():
|
||||
] & FG
|
||||
docker_compose("up", "-d", "--wait")
|
||||
|
||||
setup_cmd = "invenio db init && invenio db create && invenio alembic upgrade heads && invenio collect -v && invenio index init"
|
||||
setup_cmd = "invenio db init && invenio db create && invenio alembic upgrade heads && (invenio roles create iform_authenticated -d 'Allows uploading research data' || true) && invenio collect -v && invenio index init"
|
||||
docker_compose("exec", "worker", "bash", "-c", setup_cmd)
|
||||
|
||||
logger.success("Production deployment complete!")
|
||||
@@ -195,7 +195,7 @@ def prod_update(
|
||||
# Restart nginx so it picks up the new container IPs for web-ui and web-api
|
||||
docker_compose("restart", "frontend")
|
||||
|
||||
update_cmd = "invenio alembic upgrade heads && invenio collect -v"
|
||||
update_cmd = "invenio alembic upgrade heads && (invenio roles create iform_authenticated -d 'Allows uploading research data' || true) && invenio collect -v"
|
||||
docker_compose("exec", "worker", "bash", "-c", update_cmd)
|
||||
|
||||
try:
|
||||
|
||||
+20
-6
@@ -96,20 +96,34 @@ def test_local():
|
||||
repo_dir = get_repo_dir()
|
||||
|
||||
with local.cwd(repo_dir):
|
||||
docker_compose("down")
|
||||
docker(
|
||||
from plumbum import FG
|
||||
|
||||
docker_compose("down") & FG
|
||||
docker[
|
||||
"build",
|
||||
"-t",
|
||||
config.docker_image_name,
|
||||
"--network",
|
||||
"host",
|
||||
"--no-cache",
|
||||
"--build-arg",
|
||||
"INSTALL_LOCAL_WHEELS=true",
|
||||
".",
|
||||
)
|
||||
docker_compose("up", "-d", "--wait")
|
||||
] & FG
|
||||
docker_compose("up", "-d", "--wait") & FG
|
||||
|
||||
setup_cmd = "invenio db init || true; invenio db create || true; invenio alembic upgrade || true; invenio index init || true"
|
||||
docker_compose("exec", "worker", "bash", "-c", setup_cmd)
|
||||
setup_cmd = "invenio db init || true; invenio db create || true; invenio alembic upgrade || true; invenio index init || true; invenio roles create iform_authenticated -d 'Allows uploading research data' || true"
|
||||
docker_compose("exec", "worker", "bash", "-c", setup_cmd) & FG
|
||||
|
||||
logger.info(
|
||||
"Running webpack buildall inside web-ui to update persistent static volume..."
|
||||
)
|
||||
docker_compose(
|
||||
"exec", "web-ui", "bash", "-c", "uv run invenio webpack buildall"
|
||||
) & FG
|
||||
|
||||
logger.info("Restarting frontend proxy to pick up new container IPs...")
|
||||
docker_compose("restart", "frontend") & FG
|
||||
|
||||
try:
|
||||
curl("-skI", "https://127.0.0.1:8443/")
|
||||
|
||||
+18
-2
@@ -74,10 +74,26 @@ def docker_compose(*args):
|
||||
raise typer.Exit(1)
|
||||
|
||||
if _deploy_env_vars is None:
|
||||
_deploy_env_vars = get_dynamic_s3_credentials()
|
||||
use_s3 = True
|
||||
with open(env_file) as f:
|
||||
for line in f:
|
||||
if line.startswith("INVENIO_USE_S3"):
|
||||
val = line.split("=")[1].strip().lower()
|
||||
use_s3 = val == "true"
|
||||
|
||||
if use_s3:
|
||||
_deploy_env_vars = get_dynamic_s3_credentials()
|
||||
else:
|
||||
logger.info(
|
||||
"INVENIO_USE_S3 is false. Using dummy S3 credentials to prevent production database corruption."
|
||||
)
|
||||
_deploy_env_vars = {
|
||||
"INVENIO_S3_ACCESS_KEY_ID": "CHANGE_ME",
|
||||
"INVENIO_S3_SECRET_ACCESS_KEY": "CHANGE_ME",
|
||||
}
|
||||
|
||||
compose = docker[
|
||||
"compose", "-f", config.docker_compose_file, "--env-file", str(env_file)
|
||||
]
|
||||
with local.env(**_deploy_env_vars):
|
||||
return compose(*args)
|
||||
return compose[*args]
|
||||
|
||||
Reference in New Issue
Block a user