diff --git a/.envs/.production-template/.db-sqlite b/.envs/.production-template/.db-sqlite new file mode 100644 index 00000000..7225f620 --- /dev/null +++ b/.envs/.production-template/.db-sqlite @@ -0,0 +1,10 @@ +# ------------------------ Banco SQL ------------------------ +# ------------------------------------------------------------ +# File name (sqlite) (default: 'opac.sqlite') +OPAC_DATABASE_FILE=opac.sqlite + +# Folder where the database is located (sqlite) (default: '/tmp') +OPAC_DATABASE_DIR=/tmp + +# [optional] SQL database URI (default: 'sqlite:////tmp/opac.sqlite') +OPAC_DATABASE_URI=sqlite:////tmp/opac.sqlite \ No newline at end of file diff --git a/.envs/.production-template/.flask b/.envs/.production-template/.flask index d09db19a..b93205ae 100644 --- a/.envs/.production-template/.flask +++ b/.envs/.production-template/.flask @@ -1,6 +1,6 @@ # -------------- OPAC Application configuration -------------- # ------------------------------------------------------------ -# Possible values: True or False +# enables/disables the app's Debug mode. Possible values: True or False OPAC_DEBUG_MODE=False # Possible values: WARNING, INFO, ERROR, CRITICAL AND DEBUG @@ -9,17 +9,12 @@ OPAC_LOG_LEVEL=WARNING # Possible values: True or False OPAC_MINIFY_PAGE=False -# Name for MongoDB. Ex: opac -OPAC_MONGODB_NAME=opac - # Path to directory app. Ex: /app/data OPAC_DATABASE_DIR=/app/data # Value for key. Ex: nmN73pR6 OPAC_SECRET_KEY=NWhWFn_ScpW6YR9yJKDLxg -# Name for MongoDB host -OPAC_MONGODB_HOST=opac_mongo # Activate/Desactivate the cache of redis (default: True) OPAC_CACHE_ENABLED=False @@ -27,7 +22,35 @@ OPAC_CACHE_ENABLED=False # Interface languages OPAC_LANGUAGES="{'pt_BR': 'Português','en': 'English','es': 'Español'}" +ALERT_MSG_PT= +ALERT_MSG_EN= +ALERT_MSG_ES= + +ACCESSIBILITY_FORM_PT=https://forms.gle/2Vpt2z26uGqHA7yy5 +ACCESSIBILITY_FORM_EN=https://forms.gle/qHwovmddXdZRDxjm7 +ACCESSIBILITY_FORM_ES=https://forms.gle/XZuJurSVMBp4E64j6 + +# enables/disables the presentation of collection metrics data (default: False). Possible values: True or False +OPAC_USE_HOME_METRICS=False + +# Acronym Collection. Consult: https://articlemeta.scielo.org/api/v1/collection/identifiers/ +OPAC_COLLECTION= + +# Application version. Ex: v0.1.0 +OPAC_WEBAPP_VERSION= + +# LOCALZONE +# Default 'America/Sao_Paulo'. Consult: https://gist.github.com/heyalexej/8bf688fd67d7199be4a1682b3eec7568 +LOCAL_ZONE= +# ORCID URL. default: http://orcid.org/ +OPAC_ORCID_URL=http://orcid.org/ + +PREVIOUS_WEBSITE_URI= + +HTML_GENERATOR_VERSION="3.0" + +OPAC_PINGDOM_VISITOR_INSIGHTS_JS_SRC= # -------------------- Journal path ------------------- # ------------------------------------------------------------ @@ -44,9 +67,11 @@ OPAC_JOURNAL_IMAGES_SOURCE_PATH=/app/data/img OPAC_SSM_SCHEME=http OPAC_SSM_DOMAIN=minio OPAC_SSM_PORT=9000 +OPAC_SSM_MEDIA_PATH=/media/assets/ +OPAC_SSM_XML_URL_REWRITE=False -# ----------------- Table of contents sections --------------------- -# ------------------------------------------------------------ +# -------------- Table of contents sections ----------------- +# ----------------------------------------------------------- # This variable active/desactivate the sections on table of contents # Possible values: True or False @@ -55,3 +80,150 @@ OPAC_FILTER_SECTION_ENABLE=True # This variable define a mininal count of study ares on the head of journal page OPAC_FILTER_SECTION_ENABLE_FOR_MIN_STUDY_AREAS=5 + +# ------------------- Sending emails -------------------- +# ------------------------------------------------------- + +# Email account for sending messages from the website +OPAC_DEFAULT_EMAIL=None + +# mail server host (default: localhost) +OPAC_MAIL_SERVER=localhost + +# Serve port email +OPAC_MAIL_PORT=1025 + +# enable/disable sending email with TLS +OPAC_MAIL_USE_TLS=False + +# enable/disable sending email with SSL +OPAC_MAIL_USE_SSL=False + + +# ------------------ Google reCAPTCHA ------------------ +# ------------------------------------------------------ + +# Google reCAPTCHA secret key, used by the backend to validate tokens sent by the client. Ex: 6L***********G7k7************F +OPAC_GOOGLE_RECAPTCHA_SECRET_KEY= + +# Google reCAPTCHA public key used by the frontend to generate and send the reCAPTCHA token to the backend. (Ex: 6L***********9Tk************K) +OPAC_GOOGLE_VERIFY_RECAPTCHA_KEY= + +# Google reCAPTCHA JavaScript URL. (default: //www.google.com/recaptcha/api.js) +OPAC_GOOGLE_RECAPTCHA_URL=//www.google.com/recaptcha/api.js + +# URL de verificação do google (default: https://www.google.com/recaptcha/api/siteverify) +OPAC_GOOGLE_VERIFY_RECAPTCHA_URL=https://www.google.com/recaptcha/api/siteverify + +# --------------------- Google ------------------------ +# ------------------------------------------------------ +OPAC_GOOGLE_SCHOLAR=https://scholar.google.com/scholar?q= +OPAC_GOOGLE=https://www.google.com/search?q= + +# ------------------ Error form ------------------------ +# ------------------------------------------------------ + +# Email accounts to receive interface error messages. +OPAC_EMAIL_ACCOUNTS_RECEIVE_ERRORS= + +# --------------------- CRSF --------------------------- +# ------------------------------------------------------ + +# enables/disables CSRF feature (default: True) +OPAC_WTF_CSRF_ENABLED=True + +# key to security in WTF forms. (default: JGvNWiwBIq2Iig89LWbV) +OPAC_WTF_CSRF_SECRET_KEY=JGvNWiwBIq2Iig89LWbV + +# Forces the use of https in URLs for the OPAC website in Google tags. (default: True) +OPAC_FORCE_USE_HTTPS_GOOGLE_TAGS=True +OPAC_READCUBE_ENABLED=False +# --------------------- Links SciELO ------------------- +# ------------------------------------------------------ +# URL for SciELO.org (default: '//www.scielo.org') +URL_SCIELO_ORG=//www.scielo.org + +# URIs in SciELO.org for specific sessions +SCIELO_ORG_URIS= + +# URL for the SciELO in Perspective Blog. (default: '//blog.scielo.org') +URL_BLOG_SCIELO=//blog.scielo.org + +# URL for Search SciELO. (default: '//search.scielo.org/') +URL_SEARCH=//search.scielo.org/ + +# URL for the SciELO in Perspective Blog Press releases. (default: '//pressreleases.scielo.org') +URL_BLOG_PRESSRELEASE=//pressreleases.scielo.org + +# ----------------- Google Analytics ------------------- +# ------------------------------------------------------ +# google analytics code (go to https://goo.gl/HE77SO to redeem your code) +GA_TRACKING_CODE= + +# ----------------- Upload Images ------------------- +# --------------------------------------------------- +# Absolute path of the folder that will store the images uploaded by users through the admin. +# (default: /[repo dir]/opac/opac/webapp/media/) +OPAC_MEDIA_ROOT= + +# URL to serve images. (default: '/media') +OPAC_MEDIA_URL=/media + +# ------------------ Extensions --------------------- +# --------------------------------------------------- +# Thumbnail height (default: 100) +THUMBNAIL_HEIGHT=100 + +# Thumbnail width (default: 100) +THUMBNAIL_WIDTH=100 + +# -------------- Common Style List --------------------- +# ------------------------------------------------------ +# Path to a .json file with the CSL. +OPAC_COMMON_STYLE_LIST= + + +# ------------------- Site License --------------------- +# ------------------------------------------------------ +# Enables/disables the display of the creative commons logo in the website footer +OPAC_SITE_LICENSE_ENABLE=True + +# License Name (default: "Creative Common - by 4.0") +OPAC_SITE_LICENSE_NAME="Creative Common - by 4.0" + +# License Url (default: https://creativecommons.org/licenses/by-nc/4.0/) +OPAC_SITE_LICENSE_URL=https://creativecommons.org/licenses/by-nc/4.0/ + +# License Image (default: https://licensebuttons.net/l/by/4.0/88x31.png) +OPAC_SITE_LICENSE_IMG_URL=https://licensebuttons.net/l/by/4.0/88x31.png + + +# -------------------- Twitter ---------------------- +# --------------------------------------------------- +# Twitter comuser key (default: 'consum3r-k3y') +OPAC_TWITTER_CONSUMER_KEY= + +# Twitter comuser secret (default: 'consum3r-secr3t') +OPAC_TWITTER_CONSUMER_SECRET= + +# Twitter access token (default: 'acc3ss-tok3n-secr3t') +OPAC_TWITTER_ACCESS_TOKEN= +# Twitter access token (default: 'acc3ss-tok3n-secr3t') +OPAC_TWITTER_ACCESS_TOKEN_SECRET= + +# Twitter screen name (default: 'RedeSciELO') +OPAC_TWITTER_SCREEN_NAME= + +# -------------------- SCIMAGO ---------------------- +# --------------------------------------------------- +SCIMAGO_URL=https://www.scimagojr.com/journalsearch.php?tip=sid&clean=0&q= + +SCIMAGO_ENABLED=True + +# SCImago Institutions Ranking(IR) +SCIMAGO_URL_IR=https://www.scimagoir.com/ + +# -------------------- MathJax ---------------------- +# --------------------------------------------------- +# string with the default mathjax URL; ex: "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML" +OPAC_MATHJAX_CDN_URL=https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML \ No newline at end of file diff --git a/.envs/.production-template/.metrics b/.envs/.production-template/.metrics index 97b59f44..ac80b368 100644 --- a/.envs/.production-template/.metrics +++ b/.envs/.production-template/.metrics @@ -14,9 +14,19 @@ OPAC_DIMENSIONS_URL=https://badge.dimensions.ai/details/doi # Enable PlumX metrics # Possible values: True or False OPAC_USE_PLUMX=True +# URL to PlumX (default: https://plu.mx/a) OPAC_PLUMX_METRICS_URL=https://plu.mx/scielo/a # Enable Altmetric metrics # Possible values: True or False OPAC_USE_ALTMETRIC=True +# Url PlumX OPAC_ALTMETRIC_METRICS_URL=https://www.altmetric.com/details.php +# Url to JS PlumX. (default: //cdn.plu.mx/widget-popup.js) +OPAC_PLUMX_METRICS_JS=//cdn.plu.mx/widget-popup.js + +# Enable SCITE +OPAC_USE_SCITE=False +# URL to SCITE_ +OPAC_SCITE_URL= +OPAC_SCITE_METRICS_URL= \ No newline at end of file diff --git a/.envs/.production-template/.mongo b/.envs/.production-template/.mongo new file mode 100644 index 00000000..4b835124 --- /dev/null +++ b/.envs/.production-template/.mongo @@ -0,0 +1,17 @@ +# ------------------- MongoDB Database -------------------- +# ------------------------------------------------------- + +# Name of Database(default: 'opac') +OPAC_MONGODB_NAME=opac + +# Host of Database (default: 'localhost') +OPAC_MONGODB_HOST=opac_mongo + +# Port of Database(default: 27017) +OPAC_MONGODB_PORT=27017 + +# # (Optional) user to access the bank (default: None) +OPAC_MONGODB_USER= + +# # (Optional) password to access the bank (default: None) +OPAC_MONGODB_PASS= diff --git a/.envs/.production-template/.monitoring b/.envs/.production-template/.monitoring new file mode 100644 index 00000000..0608e5f8 --- /dev/null +++ b/.envs/.production-template/.monitoring @@ -0,0 +1,32 @@ +# ---- APM (Application Performance Monitoring) settings ----- +# ------------------------------------------------------------ +# True or False +OPAC_APM_ENABLED=False + +# Url for APM +OPAC_APM_SERVER_URL= + +# Name for Service. Ex. Website +OPAC_APM_SERVICE_NAME=Website + +# Type of enviroment. Ex: production or local +OPAC_APM_ENVIRONMENT=production +OPAC_APM_SECRET_TOKEN= +OPAC_APM_SERVER_TIMEOUT= +OPAC_APM_HOSTNAME= +OPAC_APM_COLLECT_LOCAL_VARIABLES= +OPAC_APM_LOCAL_VAR_MAX_LENGTH= +OPAC_APM_CAPTURE_BODY= +OPAC_APM_CAPTURE_HEADERS= +OPAC_APM_TRANSACTION_MAX_SPANS= +OPAC_APM_STACK_TRACE_LIMIT= +OPAC_APM_DEBUG= +OPAC_APM_DISABLE_SEND= +OPAC_APM_INSTRUMENT= +OPAC_APM_APM_VERIFY_SERVER_CERT= + +# ------------------------ SENTRY ---------------------------- +# ------------------------------------------------------------ +# True or False +OPAC_USE_SENTRY=False +OPAC_SENTRY_DSN= \ No newline at end of file diff --git a/.envs/.production-template/.monitoring-apm b/.envs/.production-template/.monitoring-apm deleted file mode 100644 index b439fd89..00000000 --- a/.envs/.production-template/.monitoring-apm +++ /dev/null @@ -1,13 +0,0 @@ -# APM (Application Performance Monitoring) settings -# True or False -OPAC_APM_ENABLED=False - -# Url for APM -OPAC_APM_SERVER_URL= - -# Name for Service. Ex. Website -OPAC_APM_SERVICE_NAME=Website - -# Type of enviroment. Ex: production or local -OPAC_APM_ENVIRONMENT=production -OPAC_APM_SECRET_TOKEN= \ No newline at end of file diff --git a/.envs/.production-template/.redis b/.envs/.production-template/.redis index 7f57af54..be2f00f9 100644 --- a/.envs/.production-template/.redis +++ b/.envs/.production-template/.redis @@ -7,15 +7,40 @@ OPAC_RQ_REDIS_HOST=redis-cache # Redis port for cache. Ex: 6379 OPAC_RQ_REDIS_PORT=6379 +# # default cron value for sending emails (default: "0 7 * * *") +# OPAC_MAILING_CRON_STRING="0 7 * * *" + +# #timeout do screduler cron (dafault: 1000). +# OPAC_DEFAULT_SCHEDULER_TIMEOUT=1000 + # --------------------- Cache configuration ------------------ # ------------------------------------------------------------ -# True or False +# Activate/Desactivate the cache of redis (default: False) OPAC_CACHE_ENABLED=True -# Cache timeout (in seconds). Ex: 3600 +# Type of cache backend: 'null', 'redis', outros (default: 'redis') +OPAC_CACHE_TYPE=redis + +#enables/disables display of warnings when CACHE_TYPE is 'null' (default: True) +OPAC_CACHE_NO_NULL_WARNING=True + +# Lifetime of objects in cache (in seconds). Ex: 3600 OPAC_CACHE_DEFAULT_TIMEOUT=3600 -# Redis host for cache. Ex: redis-cache +# Cache Key Prefix. (default: 'opac_cache') +OPAC_CACHE_KEY_PREFIX=opac_cache + +# Redis host for cache. (default: redis-cache) OPAC_CACHE_REDIS_HOST=redis-cache +# Redis Port for cache. (default: 6379) +OPAC_CACHE_REDIS_PORT=6379 + +# Redis server db name that will be used in the cache (integer >= 0). (default: 0) +OPAC_CACHE_REDIS_DB=0 + +# Password of the redis server that will be used in the cache. (default = '') +OPAC_CACHE_REDIS_PASSWORD= + + diff --git a/.envs/.production-template/.server b/.envs/.production-template/.server index d7e7d665..9b447ed3 100644 --- a/.envs/.production-template/.server +++ b/.envs/.production-template/.server @@ -1,8 +1,33 @@ # ----------------- Server Configuration --------------------- # ------------------------------------------------------------ +OPAC_OPAC_SCHEME=https # This set the IP that the app will bind to run, default: 0.0.0.0 -OPAC_SERVER_NAME=0.0.0.0 +OPAC_SERVER_NAME= + +# Domain for the session cookie (default: OPAC_SERVER_NAME) +OPAC_SESSION_COOKIE_DOMAIN= + +# Set flag: httponly of cookie. (defaults to True) +OPAC_SESSION_COOKIE_HTTPONLY=True + +# session cookie name (default: 'opac_session') +OPAC_SESSION_COOKIE_NAME=opac_session + +# path to session cookie: (default: None -> ou seja a raiz /) +OPAC_SESSION_COOKIE_PATH=None + +# sets whether the session cookie should be marked as secure - (default: False) +OPAC_SESSION_COOKIE_SECURE=False + +# enable/disable cookie policy javascript, if yes set to: 'True' otherwise 'False' (default: 'True') +OPAC_COOKIE_POLICY_ENABLED=False + +# Cookie policy script URL (default: https://static.scielo.org/js/cookiePolicy.min.js) +OPAC_COOKIE_POLICY_URL=https://static.scielo.org/js/cookiePolicy.min.js + +# Refresh the cookie on each request (Default: 'False') +OPAC_SESSION_REFRESH_EACH_REQUEST=False # Possible values: True or False OPAC_AUDIT_LOG_NOTIFICATION_ENABLED=False diff --git a/docker-compose.yml b/docker-compose.yml index f88061ae..f8faf960 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -41,11 +41,12 @@ services: expose: - "8000" env_file: - - ./.envs/.production-template/.flask - - ./.envs/.production-template/.redis - - ./.envs/.production-template/.monitoring-apm - - ./.envs/.production-template/.metrics - + - ./.envs/.production/.flask + - ./.envs/.production/.redis + - ./.envs/.production/.monitoring + - ./.envs/.production/.metrics + - ./.envs/.production/.mongo + - ./.envs/.production/.db-sqlite nginx: image: nginx:latest container_name: opac_nginx @@ -73,10 +74,11 @@ services: - opac_mongo:opac-mongo - redis-cache:redis-cache env_file: - - ./.envs/.production-template/.flask - - ./.envs/.production-template/.redis - - ./.envs/.production-template/.server - + - ./.envs/.production/.flask + - ./.envs/.production/.redis + - ./.envs/.production/.server + - ./.envs/.production/.mongo + - ./.envs/.production/.db-sqlite opac-rq-scheduler: image: infrascielo/opac_5 container_name: opac_rq_scheduler_prod @@ -93,9 +95,11 @@ services: - opac_mongo:opac-mongo - redis-cache:redis-cache env_file: - - ./.envs/.production-template/.flask - - ./.envs/.production-template/.redis - - ./.envs/.production-template/.server + - ./.envs/.production/.flask + - ./.envs/.production/.redis + - ./.envs/.production/.server + - ./.envs/.production/.mongo + - ./.envs/.production/.db-sqlite minio: image: 'minio/minio:RELEASE.2024-06-29T01-20-47Z' @@ -105,7 +109,7 @@ services: - '9000:9000' - '9001:9001' env_file: - - ./.envs/.production-template/.minio + - ./.envs/.production/.minio volumes: - '../minio/data:/data' command: server --console-address ":9001" /data \ No newline at end of file diff --git a/opac/webapp/config/default.py b/opac/webapp/config/default.py index 7efc6994..7e2f7993 100644 --- a/opac/webapp/config/default.py +++ b/opac/webapp/config/default.py @@ -361,8 +361,8 @@ ) IMAGES_ALLOWED_EXTENSIONS = ("png", "jpg", "jpeg", "gif", "webp") IMAGES_ALLOWED_EXTENSIONS_RE = tuple("*." + ext for ext in IMAGES_ALLOWED_EXTENSIONS) -THUMBNAIL_HEIGHT = 100 -THUMBNAIL_WIDTH = 100 +THUMBNAIL_HEIGHT = os.environ.get("THUMBNAIL_HEIGHT", 100) +THUMBNAIL_WIDTH = os.environ.get("THUMBNAIL_WIDTH", 100) # scielo.org URL_SCIELO_ORG = os.environ.get("OPAC_URL_SCIELO_ORG", "//www.scielo.org")