From c00a32b866ffc04e8e83da9e00598721fdb534a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Katja=20Su=CC=88ss?= Date: Fri, 1 Nov 2024 10:45:24 +0100 Subject: [PATCH] :sparkles: add dev backend --- Makefile | 79 +--- backend/.dockerignore | 14 - backend/.editorconfig | 54 --- backend/.flake8 | 22 -- backend/.gitignore | 51 --- backend/CONTRIBUTORS.md | 3 - backend/Dockerfile | 41 --- backend/Dockerfile.acceptance | 43 --- backend/LICENSE.GPL | 339 ------------------ backend/MANIFEST.in | 20 -- backend/Makefile | 117 +----- backend/README.md | 31 -- backend/constraints.txt | 1 - backend/dockerfiles/.env | 1 - .../dockerfiles/backend/Dockerfile.acceptance | 2 +- .../Dockerfile.acceptance.multilingual | 2 +- .../backend/Dockerfile.dev.monolingual | 47 +++ ...erfile.dev => Dockerfile.dev.multilingual} | 12 +- .../backend/requirements-docker.txt | 5 +- ...pose.yml => docker-compose-acceptance.yml} | 2 +- backend/dockerfiles/docker-compose-dev.yml | 146 ++++++++ backend/instance.yaml | 3 - backend/mx.ini | 17 - backend/news/.changelog_template.jinja | 15 - backend/news/.gitkeep | 1 - backend/pyproject.toml | 170 --------- backend/requirements-docker.txt | 1 - backend/requirements.txt | 1 - backend/scripts/create_site.py | 72 ---- backend/tox.ini | 212 ----------- backend/variables.mk | 2 +- 31 files changed, 243 insertions(+), 1283 deletions(-) delete mode 100644 backend/.dockerignore delete mode 100644 backend/.editorconfig delete mode 100644 backend/.flake8 delete mode 100644 backend/.gitignore delete mode 100644 backend/CONTRIBUTORS.md delete mode 100644 backend/Dockerfile delete mode 100644 backend/Dockerfile.acceptance delete mode 100644 backend/LICENSE.GPL delete mode 100644 backend/MANIFEST.in delete mode 100644 backend/constraints.txt create mode 100644 backend/dockerfiles/backend/Dockerfile.dev.monolingual rename backend/dockerfiles/backend/{Dockerfile.dev => Dockerfile.dev.multilingual} (73%) rename backend/dockerfiles/{docker-compose.yml => docker-compose-acceptance.yml} (98%) create mode 100644 backend/dockerfiles/docker-compose-dev.yml delete mode 100644 backend/instance.yaml delete mode 100644 backend/mx.ini delete mode 100644 backend/news/.changelog_template.jinja delete mode 100644 backend/news/.gitkeep delete mode 100644 backend/pyproject.toml delete mode 100644 backend/requirements-docker.txt delete mode 100644 backend/requirements.txt delete mode 100644 backend/scripts/create_site.py delete mode 100644 backend/tox.ini diff --git a/Makefile b/Makefile index 8bb7b3a5..9008f85d 100644 --- a/Makefile +++ b/Makefile @@ -22,72 +22,31 @@ YELLOW=`tput setaf 3` GIT_FOLDER=$(CURRENT_DIR)/.git PRE_COMMIT=pipx run --spec 'pre-commit==3.7.1' pre-commit -PLONE_VERSION=6 -DOCKER_IMAGE=plone/server-dev:${PLONE_VERSION} -# DOCKER_IMAGE_ACCEPTANCE=plone/server-acceptance:${PLONE_VERSION} -# TODO use build image with c.e.plone -DOCKER_IMAGE_ACCEPTANCE=plone/server-acceptance:${PLONE_VERSION} - ADDON_NAME='volto-searchkit-block' + .PHONY: help help: ## Show this help @echo -e "$$(grep -hE '^\S+:.*##' $(MAKEFILE_LIST) | sed -e 's/:.*##\s*/:/' -e 's/^\(.\+\):\(.*\)/\\x1b[36m\1\\x1b[m:\2/' | column -c2 -t -s :)" - ########################################### -# Backend +# dev backend ########################################### -.PHONY: backend-install -backend-install: ## Create virtualenv and install Plone - $(MAKE) -C "./backend/" install - $(MAKE) backend-create-site - -.PHONY: backend-build -backend-build: ## Build Backend - $(MAKE) -C "./backend/" install - -.PHONY: backend-create-site -backend-create-site: ## Create a Plone site with default content - $(MAKE) -C "./backend/" create-site - -.PHONY: backend-update-example-content -backend-update-example-content: ## Export example content inside package - $(MAKE) -C "./backend/" update-example-content - -.PHONY: backend-start -backend-start: ## Start Plone Backend - $(MAKE) -C "./backend/" start - -.PHONY: backend-test -backend-test: ## Test backend codebase - @echo "Test backend" - $(MAKE) -C "./backend/" test - -# .PHONY: install -# install: ## Install -# @echo "Install Backend & Frontend" -# if [ -d $(GIT_FOLDER) ]; then $(PRE_COMMIT) install; else echo "$(RED) Not installing pre-commit$(RESET)";fi -# $(MAKE) backend-install -# $(MAKE) frontend-install - -# .PHONY: start -# start: ## Start -# @echo "Starting application" -# $(MAKE) backend-start -# $(MAKE) frontend-start - -# .PHONY: clean -# clean: ## Clean installation -# @echo "Clean installation" -# $(MAKE) -C "./backend/" clean -# $(MAKE) -C "./frontend/" clean - -# .PHONY: check -# check: ## Lint and Format codebase -# @echo "Lint and Format codebase" -# $(PRE_COMMIT) run -a + +.PHONY: dev-backend-start-monolingual +dev-backend-start-monolingual: ## Start backend dev server + export INDEX_PASSWORD=paraDiesli,17 + export PLONE_PASSWORD=admin + export PLONE_SITE_PREFIX_PATH=Plone + $(MAKE) -C "./backend/" dev-backend-start-monolingual + +.PHONY: dev-backend-start-multilingual +dev-backend-start-multilingual: ## Start backend dev server + export INDEX_PASSWORD=paraDiesli,17 + export PLONE_PASSWORD=admin + export PLONE_SITE_PREFIX_PATH=Plone + $(MAKE) -C "./backend/" dev-backend-start-multilingual ########################################### @@ -157,11 +116,6 @@ ci-test: ## Run unit tests in CI VOLTOCONFIG=$(pwd)/volto.config.js pnpm --filter @plone/volto i18n CI=1 RAZZLE_JEST_CONFIG=$(CURRENT_DIR)/jest-addon.config.js pnpm --filter @plone/volto test -- --passWithNoTests -# .PHONY: backend-docker-start -# backend-docker-start: ## Starts a Docker-based backend for development -# @echo "$(GREEN)==> Start Docker-based Plone Backend$(RESET)" -# docker run -it --rm --name=backend -p 8080:8080 -e SITE=Plone $(DOCKER_IMAGE) - ## Storybook .PHONY: storybook-start storybook-start: ## Start Storybook server on port 6006 @@ -174,6 +128,7 @@ storybook-build: ## Build Storybook mkdir -p $(CURRENT_DIR)/.storybook-build pnpm run storybook-build -o $(CURRENT_DIR)/.storybook-build + ########################################### # Acceptance monolingual ########################################### diff --git a/backend/.dockerignore b/backend/.dockerignore deleted file mode 100644 index e9e94ffc..00000000 --- a/backend/.dockerignore +++ /dev/null @@ -1,14 +0,0 @@ -.editorconfig -.gitattributes -bin -Dockerfile -Dockerfile.acceptance -include -instance -instance.yaml -lib -lib64 -Makefile -pyvenv.cfg -var -.venv diff --git a/backend/.editorconfig b/backend/.editorconfig deleted file mode 100644 index 8ae05aaa..00000000 --- a/backend/.editorconfig +++ /dev/null @@ -1,54 +0,0 @@ -# Generated from: -# https://github.com/plone/meta/tree/master/config/default -# See the inline comments on how to expand/tweak this configuration file -# -# EditorConfig Configuration file, for more details see: -# http://EditorConfig.org -# EditorConfig is a convention description, that could be interpreted -# by multiple editors to enforce common coding conventions for specific -# file types - -# top-most EditorConfig file: -# Will ignore other EditorConfig files in Home directory or upper tree level. -root = true - - -[*] # For All Files -# Unix-style newlines with a newline ending every file -end_of_line = lf -insert_final_newline = true -trim_trailing_whitespace = true -# Set default charset -charset = utf-8 -# Indent style default -indent_style = space -# Max Line Length - a hard line wrap, should be disabled -max_line_length = off - -[*.{py,cfg,ini}] -# 4 space indentation -indent_size = 4 - -[*.{yml,zpt,pt,dtml,zcml}] -# 2 space indentation -indent_size = 2 - -[*.{json,jsonl,js,jsx,ts,tsx,css,less,scss,html}] # Frontend development -# 2 space indentation -indent_size = 2 -max_line_length = 80 - -[{Makefile,.gitmodules}] -# Tab indentation (no size specified, but view as 4 spaces) -indent_style = tab -indent_size = unset -tab_width = unset - - -## -# Add extra configuration options in .meta.toml: -# [editorconfig] -# extra_lines = """ -# _your own configuration lines_ -# """ -## diff --git a/backend/.flake8 b/backend/.flake8 deleted file mode 100644 index 7ef4f64d..00000000 --- a/backend/.flake8 +++ /dev/null @@ -1,22 +0,0 @@ -# Generated from: -# https://github.com/plone/meta/tree/master/config/default -# See the inline comments on how to expand/tweak this configuration file -[flake8] -doctests = 1 -ignore = - # black takes care of line length - E501, - # black takes care of where to break lines - W503, - # black takes care of spaces within slicing (list[:]) - E203, - # black takes care of spaces after commas - E231, - -## -# Add extra configuration options in .meta.toml: -# [flake8] -# extra_lines = """ -# _your own configuration lines_ -# """ -## diff --git a/backend/.gitignore b/backend/.gitignore deleted file mode 100644 index 6a1e51f3..00000000 --- a/backend/.gitignore +++ /dev/null @@ -1,51 +0,0 @@ -# Generated from: -# https://github.com/plone/meta/tree/master/config/default -# See the inline comments on how to expand/tweak this configuration file -# python related -*.egg-info -*.pyc -*.pyo - -# tools related -build/ -.coverage -coverage.xml -dist/ -docs/_build -__pycache__/ -.tox -.vscode/ -node_modules/ - -# venv / buildout related -bin/ -develop-eggs/ -eggs/ -.eggs/ -etc/ -.installed.cfg -include/ -lib/ -lib64 -.mr.developer.cfg -parts/ -pyvenv.cfg -var/ - -# mxdev -/instance/ -/.make-sentinels/ -/*-mxdev.txt -/reports/ -/sources/ -/venv/ -.installed.txt -.lock - -## -# Add extra configuration options in .meta.toml: -# [gitignore] -# extra_lines = """ -# _your own configuration lines_ -# """ -## diff --git a/backend/CONTRIBUTORS.md b/backend/CONTRIBUTORS.md deleted file mode 100644 index 5a1aabd6..00000000 --- a/backend/CONTRIBUTORS.md +++ /dev/null @@ -1,3 +0,0 @@ -# Contributors - -- Plone Foundation [collective@plone.org] diff --git a/backend/Dockerfile b/backend/Dockerfile deleted file mode 100644 index 99da983f..00000000 --- a/backend/Dockerfile +++ /dev/null @@ -1,41 +0,0 @@ -# syntax=docker/dockerfile:1 -ARG PLONE_VERSION=6.0.13 -FROM plone/server-builder:${PLONE_VERSION} as builder - -WORKDIR /app - - -# Add local code -COPY scripts/ scripts/ -COPY . src - -# Install local requirements and pre-compile mo files -RUN < - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/backend/MANIFEST.in b/backend/MANIFEST.in deleted file mode 100644 index 45aae324..00000000 --- a/backend/MANIFEST.in +++ /dev/null @@ -1,20 +0,0 @@ -graft src/searchkit -graft docs -graft news -graft tests -graft scripts -include *.acceptance -include .coveragerc -include .dockerignore -include .editorconfig -include *.txt -include *.yml -include *.md -exclude *-mxdev.txt -exclude Dockerfile -exclude mx.ini -exclude Makefile -recursive-exclude frontend * -exclude instance.yaml -global-exclude *.pyc -global-exclude .DS_Store diff --git a/backend/Makefile b/backend/Makefile index 8b025f44..7419a7cc 100644 --- a/backend/Makefile +++ b/backend/Makefile @@ -39,7 +39,6 @@ endif PLONE_SITE_ID=Plone BACKEND_FOLDER=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) -PLONE_VERSION=$(shell cat $(BACKEND_FOLDER)/version.txt) EXAMPLE_CONTENT_FOLDER=${BACKEND_FOLDER}/src/searchkit/block/setuphandlers/examplecontent GIT_FOLDER=$(BACKEND_FOLDER)/.git @@ -47,16 +46,19 @@ VENV_FOLDER=$(BACKEND_FOLDER)/.venv BIN_FOLDER=$(VENV_FOLDER)/bin -BACKEND_ADDONS='collective.elastic.plone ${KGS} $(TESTING_ADDONS)' -DEV_COMPOSE=dockerfiles/docker-compose.yml -ACCEPTANCE_COMPOSE=dockerfiles/docker-compose.yml -CMD_ENVS=CURRENT_DIR=${CURRENT_DIR} PLONE_VERSION=${PLONE_VERSION} BACKEND_ADDONS=${BACKEND_ADDONS} -CMD=${CMD_ENVS} docker compose -DOCKER_COMPOSE=${CMD} -p ${PROJECT_NAME} -f ${DEV_COMPOSE} -ACCEPTANCE_MONOLINGUAL=${CMD} -p ${PROJECT_NAME}-acceptance-monolingual -f ${ACCEPTANCE_COMPOSE} -ACCEPTANCE_MULTILINGUAL=${CMD} -p ${PROJECT_NAME}-acceptance-multilingual -f ${ACCEPTANCE_COMPOSE} +ACCEPTANCE_BACKEND_ADDONS='collective.elastic.plone ${KGS} $(TESTING_ADDONS)' +ACCEPTANCE_COMPOSE_FILE=dockerfiles/docker-compose-acceptance.yml +CMD_ENVS=CURRENT_DIR=${CURRENT_DIR} PLONE_VERSION=${PLONE_VERSION} +ACCEPTANCE_CMD=${CMD_ENVS} BACKEND_ADDONS=${ACCEPTANCE_BACKEND_ADDONS} docker compose +ACCEPTANCE_COMPOSE_MONOLINGUAL=${ACCEPTANCE_CMD} -p ${PROJECT_NAME}-acceptance-monolingual -f ${ACCEPTANCE_COMPOSE_FILE} +ACCEPTANCE_COMPOSE_MULTILINGUAL=${ACCEPTANCE_CMD} -p ${PROJECT_NAME}-acceptance-multilingual -f ${ACCEPTANCE_COMPOSE_FILE} + +DEV_BACKEND_ADDONS='collective.elastic.plone ${KGS}' +DEV_COMPOSE_FILE=dockerfiles/docker-compose-dev.yml +DEV_CMD=${CMD_ENVS} BACKEND_ADDONS=${DEV_BACKEND_ADDONS} docker compose +DEV_COMPOSE_MONOLINGUAL=${DEV_CMD} -p ${PROJECT_NAME}-dev-monolingual -f ${DEV_COMPOSE_FILE} +DEV_COMPOSE_MULTILINGUAL=${DEV_CMD} -p ${PROJECT_NAME}-dev-multilingual -f ${DEV_COMPOSE_FILE} -all: build # Add the following 'help' target to your Makefile # And add help text after each target name starting with '\#\#' @@ -64,101 +66,18 @@ all: build help: ## This help message @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' -# $(BIN_FOLDER)/pip $(BIN_FOLDER)/tox $(BIN_FOLDER)/pipx $(BIN_FOLDER)/uv $(BIN_FOLDER)/mxdev: -# @echo "$(GREEN)==> Setup Virtual Env$(RESET)" -# $(PYTHON) -m venv $(VENV_FOLDER) -# $(BIN_FOLDER)/pip install -U "pip" "uv" "wheel" "pipx" "mxdev" "tox" "pre-commit" -# if [ -d $(GIT_FOLDER) ]; then $(BIN_FOLDER)/pre-commit install; else echo "$(RED) Not installing pre-commit$(RESET)";fi - -# instance/etc/zope.ini: $(BIN_FOLDER)/pip ## Create instance configuration -# @echo "$(GREEN)==> Create instance configuration$(RESET)" -# $(BIN_FOLDER)/pipx run cookiecutter -f --no-input --config-file instance.yaml gh:plone/cookiecutter-zope-instance - -# .PHONY: config -# config: instance/etc/zope.ini - -# .PHONY: build-dev -# build-dev: config ## Install Plone packages -# @echo "$(GREEN)==> Setup Build$(RESET)" -# $(BIN_FOLDER)/mxdev -c mx.ini -# $(BIN_FOLDER)/uv pip install -r requirements-mxdev.txt - -# .PHONY: install -# install: build-dev ## Install Plone - -# .PHONY: build -# build: build-dev ## Install Plone - -# .PHONY: clean -# clean: ## Clean environment -# @echo "$(RED)==> Cleaning environment and build$(RESET)" -# rm -rf $(VENV_FOLDER) pyvenv.cfg .installed.cfg instance .tox .venv .pytest_cache - -# .PHONY: start -# start: ## Start a Plone instance on localhost:8080 -# PYTHONWARNINGS=ignore $(BIN_FOLDER)/runwsgi instance/etc/zope.ini - -# .PHONY: console -# console: instance/etc/zope.ini ## Start a console into a Plone instance -# PYTHONWARNINGS=ignore $(BIN_FOLDER)/zconsole debug instance/etc/zope.conf - -# .PHONY: create-site -# create-site: instance/etc/zope.ini ## Create a new site from scratch -# PYTHONWARNINGS=ignore $(BIN_FOLDER)/zconsole run instance/etc/zope.conf ./scripts/create_site.py - -# # Example Content -# .PHONY: update-example-content -# update-example-content: $(BIN_FOLDER)/tox ## Export example content inside package -# @echo "$(GREEN)==> Export example content into $(EXAMPLE_CONTENT_FOLDER) $(RESET)" -# if [ -d $(EXAMPLE_CONTENT_FOLDER)/content ]; then rm -r $(EXAMPLE_CONTENT_FOLDER)/* ;fi -# $(BIN_FOLDER)/plone-exporter instance/etc/zope.conf $(PLONE_SITE_ID) $(EXAMPLE_CONTENT_FOLDER) - - -# .PHONY: check -# check: $(BIN_FOLDER)/tox ## Check and fix code base according to Plone standards -# @echo "$(GREEN)==> Format codebase$(RESET)" -# $(BIN_FOLDER)/tox -e lint - -# # i18n -# $(BIN_FOLDER)/i18ndude: $(BIN_FOLDER)/pip -# @echo "$(GREEN)==> Install translation tools$(RESET)" -# $(BIN_FOLDER)/uv pip install i18ndude - -# .PHONY: i18n -# i18n: $(BIN_FOLDER)/i18ndude ## Update locales -# @echo "$(GREEN)==> Updating locales$(RESET)" -# $(BIN_FOLDER)/update_locale - -# # Tests -# .PHONY: test -# test: $(BIN_FOLDER)/tox ## run tests -# $(BIN_FOLDER)/tox -e test - -# .PHONY: test-coverage -# test-coverage: $(BIN_FOLDER)/tox ## run tests with coverage -# $(BIN_FOLDER)/tox -e coverage - -# # Build Docker images -# .PHONY: build-image -# build-image: ## Build Docker Images -# @DOCKER_BUILDKIT=1 docker build . -t $(IMAGE_NAME_PREFIX)-backend:$(IMAGE_TAG) -f Dockerfile --build-arg PLONE_VERSION=$(PLONE_VERSION) - -# TODO development backend (and OpenSearch and ingest containers) +.PHONY: dev-backend-start-monolingual +dev-backend-start-monolingual: ## Start dev containers (backend and OpenSearch) + ${DEV_COMPOSE_MONOLINGUAL} --profile monolingual up -d --force-recreate +.PHONY: dev-backend-start-multilingual +dev-backend-start-multilingual: ## Start dev containers (backend and OpenSearch) + ${DEV_COMPOSE_MULTILINGUAL} --profile multilingual up -d --force-recreate # ######################################################################## # Acceptance monolingual # ######################################################################## -# # Acceptance tests -# .PHONY: acceptance-backend-start -# acceptance-backend-start: ## Start backend acceptance server -# ZSERVER_HOST=0.0.0.0 ZSERVER_PORT=55001 LISTEN_PORT=55001 APPLY_PROFILES="collective.elastic.plone:default" CONFIGURE_PACKAGES="plone.restapi,plone.volto,plone.volto.cors,collective.elastic.plone" $(BIN_FOLDER)/robot-server plone.app.robotframework.testing.VOLTO_ROBOT_TESTING - -# .PHONY: acceptance-image-build -# acceptance-image-build: ## Build Docker Images -# @DOCKER_BUILDKIT=1 docker build . -t $(IMAGE_NAME_PREFIX)-backend-acceptance:$(IMAGE_TAG) -f Dockerfile.acceptance --build-arg PLONE_VERSION=$(PLONE_VERSION) - .PHONY: acceptance-backend-start-monolingual acceptance-backend-start-monolingual: ## Start acceptance containers (backend and OpenSearch) ${ACCEPTANCE_MONOLINGUAL} --profile monolingual up -d --force-recreate diff --git a/backend/README.md b/backend/README.md index 88351384..124d68b0 100644 --- a/backend/README.md +++ b/backend/README.md @@ -1,33 +1,2 @@ # backend with collective.elastic.plone and ElasticSearch -A new project using Plone 6. - -## Features - -TODO: List our awesome features - -## Installation - -Install searchkit.block with `pip`: - -```shell -pip install searchkit.block -``` -And to create the Plone site: - -```shell -make create_site -``` - -## Contribute - -- [Issue Tracker](https://github.com/rohberg/searchkit.block/issues) -- [Source Code](https://github.com/rohberg/searchkit.block/) - -## License - -The project is licensed under GPLv2. - -## Credits and Acknowledgements 🙏 - -Crafted with care by **This was generated by [cookiecutter-plone](https://github.com/plone/cookieplone-templates/backend_addon) on 2024-10-26 11:06:16**. A special thanks to all contributors and supporters! diff --git a/backend/constraints.txt b/backend/constraints.txt deleted file mode 100644 index 3bb2e326..00000000 --- a/backend/constraints.txt +++ /dev/null @@ -1 +0,0 @@ --c https://dist.plone.org/release/6.0.13/constraints.txt diff --git a/backend/dockerfiles/.env b/backend/dockerfiles/.env index dd00a54d..e2cc5dfa 100644 --- a/backend/dockerfiles/.env +++ b/backend/dockerfiles/.env @@ -7,7 +7,6 @@ export INDEX_LOGIN=admin export CELERY_BROKER=redis://redis:6379/0 export CELERY_LOGLEVEL=info -export PLONE_SERVICE=http://backend-acceptance:55001 export PLONE_SITE_PREFIX_PATH=plone export PLONE_USER=admin diff --git a/backend/dockerfiles/backend/Dockerfile.acceptance b/backend/dockerfiles/backend/Dockerfile.acceptance index 8a15b7bb..6fec5d10 100644 --- a/backend/dockerfiles/backend/Dockerfile.acceptance +++ b/backend/dockerfiles/backend/Dockerfile.acceptance @@ -6,7 +6,7 @@ ARG PLONE_VERSION=6.0 ARG SEED=7 -FROM plone/server-builder:${PLONE_VERSION} as builder +FROM plone/server-builder:${PLONE_VERSION} AS builder WORKDIR /app diff --git a/backend/dockerfiles/backend/Dockerfile.acceptance.multilingual b/backend/dockerfiles/backend/Dockerfile.acceptance.multilingual index 2c870933..fa42f5a9 100644 --- a/backend/dockerfiles/backend/Dockerfile.acceptance.multilingual +++ b/backend/dockerfiles/backend/Dockerfile.acceptance.multilingual @@ -6,7 +6,7 @@ ARG PLONE_VERSION=6.0 ARG SEED=6 -FROM plone/server-builder:${PLONE_VERSION} as builder +FROM plone/server-builder:${PLONE_VERSION} AS builder WORKDIR /app diff --git a/backend/dockerfiles/backend/Dockerfile.dev.monolingual b/backend/dockerfiles/backend/Dockerfile.dev.monolingual new file mode 100644 index 00000000..48a7eba9 --- /dev/null +++ b/backend/dockerfiles/backend/Dockerfile.dev.monolingual @@ -0,0 +1,47 @@ +# syntax=docker/dockerfile:1 +# The language is set here: +# PROFILES … rohberg.volto:monolingual +ARG SEED=1000 +ARG PLONE_VERSION=6.0 +FROM plone/plone-backend:${PLONE_VERSION} + + +LABEL maintainer="Plone Foundation " \ + org.label-schema.name="searchkit-backend" \ + org.label-schema.description="searchkit backend image." \ + org.label-schema.vendor="Rohberg" + +# Add local code +COPY ./backend . + +# # Install local requirements and fix permissions +# RUN <=68.2"] - -[tool.towncrier] -directory = "news/" -filename = "CHANGES.md" -start_string = "\n" -title_format = "## {version} ({project_date})" -template = "news/.changelog_template.jinja" -underlines = ["", "", ""] - -[[tool.towncrier.type]] -directory = "breaking" -name = "Breaking changes:" -showcontent = true - -[[tool.towncrier.type]] -directory = "feature" -name = "New features:" -showcontent = true - -[[tool.towncrier.type]] -directory = "bugfix" -name = "Bug fixes:" -showcontent = true - -[[tool.towncrier.type]] -directory = "internal" -name = "Internal:" -showcontent = true - -[[tool.towncrier.type]] -directory = "documentation" -name = "Documentation:" -showcontent = true - -[[tool.towncrier.type]] -directory = "tests" -name = "Tests" -showcontent = true - -## -# Add extra configuration options in .meta.toml: -# [pyproject] -# towncrier_extra_lines = """ -# extra_configuration -# """ -## - -[tool.isort] -profile = "plone" - -## -# Add extra configuration options in .meta.toml: -# [pyproject] -# isort_extra_lines = """ -# extra_configuration -# """ -## - -[tool.black] -target-version = ["py38"] - -## -# Add extra configuration options in .meta.toml: -# [pyproject] -# black_extra_lines = """ -# extra_configuration -# """ -## - -[tool.codespell] -ignore-words-list = "discreet,vew" -skip = "*.po,*.min.js" -## -# Add extra configuration options in .meta.toml: -# [pyproject] -# codespell_ignores = "foo,bar" -# codespell_skip = "*.po,*.map,package-lock.json" -## - -[tool.dependencychecker] -Zope = [ - # Zope own provided namespaces - 'App', 'OFS', 'Products.Five', 'Products.OFSP', 'Products.PageTemplates', - 'Products.SiteAccess', 'Shared', 'Testing', 'ZPublisher', 'ZTUtils', - 'Zope2', 'webdav', 'zmi', - # ExtensionClass own provided namespaces - 'ExtensionClass', 'ComputedAttribute', 'MethodObject', - # Zope dependencies - 'AccessControl', 'Acquisition', 'AuthEncoding', 'beautifulsoup4', 'BTrees', - 'cffi', 'Chameleon', 'DateTime', 'DocumentTemplate', - 'MultiMapping', 'multipart', 'PasteDeploy', 'Persistence', 'persistent', - 'pycparser', 'python-gettext', 'pytz', 'RestrictedPython', 'roman', - 'soupsieve', 'transaction', 'waitress', 'WebOb', 'WebTest', 'WSGIProxy2', - 'z3c.pt', 'zc.lockfile', 'ZConfig', 'zExceptions', 'ZODB', 'zodbpickle', - 'zope.annotation', 'zope.browser', 'zope.browsermenu', 'zope.browserpage', - 'zope.browserresource', 'zope.cachedescriptors', 'zope.component', - 'zope.configuration', 'zope.container', 'zope.contentprovider', - 'zope.contenttype', 'zope.datetime', 'zope.deferredimport', - 'zope.deprecation', 'zope.dottedname', 'zope.event', 'zope.exceptions', - 'zope.filerepresentation', 'zope.globalrequest', 'zope.hookable', - 'zope.i18n', 'zope.i18nmessageid', 'zope.interface', 'zope.lifecycleevent', - 'zope.location', 'zope.pagetemplate', 'zope.processlifetime', 'zope.proxy', - 'zope.ptresource', 'zope.publisher', 'zope.schema', 'zope.security', - 'zope.sequencesort', 'zope.site', 'zope.size', 'zope.structuredtext', - 'zope.tal', 'zope.tales', 'zope.testbrowser', 'zope.testing', - 'zope.traversing', 'zope.viewlet' -] -'Products.CMFCore' = [ - 'docutils', 'five.localsitemanager', 'Missing', 'Products.BTreeFolder2', - 'Products.GenericSetup', 'Products.MailHost', 'Products.PythonScripts', - 'Products.StandardCacheManagers', 'Products.ZCatalog', 'Record', - 'zope.sendmail', 'Zope' -] -'plone.base' = [ - 'plone.batching', 'plone.registry', 'plone.schema','plone.z3cform', - 'Products.CMFCore', 'Products.CMFDynamicViewFTI', -] -python-dateutil = ['dateutil'] -pytest-plone = ['pytest', 'plone.testing', 'plone.app.testing'] -ignore-packages = ['plone.app.iterate', 'plone.app.upgrade', 'plone.volto', 'zestreleaser.towncrier', 'zest.releaser', 'pytest-cov'] - -## -# Add extra configuration options in .meta.toml: -# [pyproject] -# dependencies_ignores = "['zestreleaser.towncrier']" -# dependencies_mappings = [ -# "gitpython = ['git']", -# "pygithub = ['github']", -# ] -## - -[tool.check-manifest] -ignore = [ - ".editorconfig", - ".flake8", - ".meta.toml", - ".pre-commit-config.yaml", - "dependabot.yml", - "mx.ini", - "tox.ini", - -] - -## -# Add extra configuration options in .meta.toml: -# [pyproject] -# check_manifest_ignores = """ -# "*.map.js", -# "*.pyc", -# """ -# check_manifest_extra_lines = """ -# ignore-bad-ideas = [ -# "some/test/file/PKG-INFO", -# ] -# """ -## - - -## -# Add extra configuration options in .meta.toml: -# [pyproject] -# extra_lines = """ -# _your own configuration lines_ -# """ -## diff --git a/backend/requirements-docker.txt b/backend/requirements-docker.txt deleted file mode 100644 index da443200..00000000 --- a/backend/requirements-docker.txt +++ /dev/null @@ -1 +0,0 @@ --c constraints.txt diff --git a/backend/requirements.txt b/backend/requirements.txt deleted file mode 100644 index da443200..00000000 --- a/backend/requirements.txt +++ /dev/null @@ -1 +0,0 @@ --c constraints.txt diff --git a/backend/scripts/create_site.py b/backend/scripts/create_site.py deleted file mode 100644 index 4dceb2d2..00000000 --- a/backend/scripts/create_site.py +++ /dev/null @@ -1,72 +0,0 @@ -from AccessControl.SecurityManagement import newSecurityManager -from Products.CMFPlone.factory import _DEFAULT_PROFILE -from Products.CMFPlone.factory import addPloneSite -from Products.GenericSetup.tool import SetupTool -from collective.elastic.plone.interfaces import ICollectiveEsPloneLayer -from Testing.makerequest import makerequest -from zope.interface import directlyProvidedBy -from zope.interface import directlyProvides - -import os -import transaction - - -truthy = frozenset(("t", "true", "y", "yes", "on", "1")) - - -def asbool(s): - """Return the boolean value ``True`` if the case-lowered value of string - input ``s`` is a :term:`truthy string`. If ``s`` is already one of the - boolean values ``True`` or ``False``, return it.""" - if s is None: - return False - if isinstance(s, bool): - return s - s = str(s).strip() - return s.lower() in truthy - - -DELETE_EXISTING = asbool(os.getenv("DELETE_EXISTING")) -EXAMPLE_CONTENT = asbool( - os.getenv("EXAMPLE_CONTENT", "1") -) # Create example content by default - -app = makerequest(globals()["app"]) - -request = app.REQUEST - -ifaces = [ICollectiveEsPloneLayer] + list(directlyProvidedBy(request)) - -directlyProvides(request, *ifaces) - -admin = app.acl_users.getUserById("admin") -admin = admin.__of__(app.acl_users) -newSecurityManager(None, admin) - -site_id = "Plone" -payload = { - "title": "Searchkit Block", - "profile_id": _DEFAULT_PROFILE, - "extension_ids": [ - "collective.elastic.plone:default", - ], - "setup_content": False, - "default_language": "en", - "portal_timezone": "UTC", -} - -if site_id in app.objectIds() and DELETE_EXISTING: - app.manage_delObjects([site_id]) - transaction.commit() - app._p_jar.sync() - -if site_id not in app.objectIds(): - site = addPloneSite(app, site_id, **payload) - transaction.commit() - if EXAMPLE_CONTENT: - portal_setup: SetupTool = site.portal_setup - portal_setup.runAllImportStepsFromProfile( - "collective.elastic.plone:initial" - ) - transaction.commit() - app._p_jar.sync() diff --git a/backend/tox.ini b/backend/tox.ini deleted file mode 100644 index 842da822..00000000 --- a/backend/tox.ini +++ /dev/null @@ -1,212 +0,0 @@ -# Generated from: -# https://github.com/plone/meta/tree/master/config/default -# See the inline comments on how to expand/tweak this configuration file -[tox] -# We need 4.4.0 for constrain_package_deps. -min_version = 4.4.0 -envlist = - lint - test - dependencies - - -## -# Add extra configuration options in .meta.toml: -# [tox] -# envlist_lines = """ -# my_other_environment -# """ -# config_lines = """ -# my_extra_top_level_tox_configuration_lines -# """ -## - -[testenv] -skip_install = true -allowlist_externals = - echo - false -# Make sure typos like `tox -e formaat` are caught instead of silently doing nothing. -# See https://github.com/tox-dev/tox/issues/2858. -commands = - echo "Unrecognized environment name {envname}" - false - -[testenv:init] -description = Prepare environment -skip_install = true -deps = - mxdev -commands = - mxdev -c mx.ini - echo "Initial setup for mxdev" - - -[testenv:format] -description = automatically reformat code -skip_install = true -deps = - pre-commit -commands = - pre-commit run -a pyupgrade - pre-commit run -a isort - pre-commit run -a black - pre-commit run -a zpretty - -[testenv:lint] -description = run linters that will help improve the code style -skip_install = true -deps = - pre-commit -commands = - # Run pre-commit without chdir to the root of the git repository - python -c "from pre_commit import main; main._adjust_args_and_chdir = lambda args: None; raise SystemExit(main.main())" run -a - -[testenv:dependencies] -description = check if the package defines all its dependencies -skip_install = true -deps = - build - z3c.dependencychecker==2.11 -commands = - python -m build --sdist --no-isolation - dependencychecker - -[testenv:dependencies-graph] -description = generate a graph out of the dependencies of the package -skip_install = false -allowlist_externals = - sh -deps = - pipdeptree==2.5.1 - graphviz # optional dependency of pipdeptree -commands = - sh -c 'pipdeptree --exclude setuptools,wheel,pipdeptree,zope.interface,zope.component --graph-output svg > dependencies.svg' - -[testenv:test] -description = run the distribution tests -use_develop = true -skip_install = false -constrain_package_deps = true -set_env = - ROBOT_BROWSER=headlesschrome - -## -# Specify extra test environment variables in .meta.toml: -# [tox] -# test_environment_variables = """ -# PIP_EXTRA_INDEX_URL=https://my-pypi.my-server.com/ -# """ -# -# Set constrain_package_deps .meta.toml: -# [tox] -# constrain_package_deps = false -## -deps = - pytest-plone - pytest - -c https://dist.plone.org/release/6.0-dev/constraints.txt - -## -# Specify additional deps in .meta.toml: -# [tox] -# test_deps_additional = """ -# -esources/plonegovbr.portal_base[test] -# """ -# -# Specify a custom constraints file in .meta.toml: -# [tox] -# constraints_file = "https://my-server.com/constraints.txt" -## -commands = - pytest --disable-warnings {posargs} {toxinidir}/tests -extras = - test - - -[testenv:coverage] -description = get a test coverage report -use_develop = true -skip_install = false -constrain_package_deps = true -set_env = - ROBOT_BROWSER=headlesschrome - -## -# Specify extra test environment variables in .meta.toml: -# [tox] -# test_environment_variables = """ -# PIP_EXTRA_INDEX_URL=https://my-pypi.my-server.com/ -# """ -# -# Set constrain_package_deps .meta.toml: -# [tox] -# constrain_package_deps = "false" -## -deps = - pytest-plone - pytest - coverage - -c https://dist.plone.org/release/6.0-dev/constraints.txt - -commands = - coverage run --source searchkit.block -m pytest {posargs} --disable-warnings {toxinidir}/tests - coverage report -m --format markdown - coverage xml -extras = - test - - -[testenv:release-check] -description = ensure that the distribution is ready to release -skip_install = true -deps = - twine - build - towncrier - -c https://dist.plone.org/release/6.0-dev/constraints.txt - -commands = - # fake version to not have to install the package - # we build the change log as news entries might break - # the README that is displayed on PyPI - towncrier build --version=100.0.0 --yes - python -m build --sdist --no-isolation - twine check dist/* - -[testenv:circular] -description = ensure there are no cyclic dependencies -use_develop = true -skip_install = false -set_env = - -## -# Specify extra test environment variables in .meta.toml: -# [tox] -# test_environment_variables = """ -# PIP_EXTRA_INDEX_URL=https://my-pypi.my-server.com/ -# """ -## -allowlist_externals = - sh -deps = - pipdeptree - pipforester - -c https://dist.plone.org/release/6.0-dev/constraints.txt - -commands = - # Generate the full dependency tree - sh -c 'pipdeptree -j > forest.json' - # Generate a DOT graph with the circular dependencies, if any - pipforester -i forest.json -o forest.dot --cycles - # Report if there are any circular dependencies, i.e. error if there are any - pipforester -i forest.json --check-cycles -o /dev/null - - -## -# Add extra configuration options in .meta.toml: -# [tox] -# extra_lines = """ -# _your own configuration lines_ -# """ -## diff --git a/backend/variables.mk b/backend/variables.mk index 73df2ab1..d3536111 100644 --- a/backend/variables.mk +++ b/backend/variables.mk @@ -1,4 +1,4 @@ -PLONE_VERSION=6 +PLONE_VERSION=6.0.13 PROJECT_NAME='volto-searchkit-block' # KGS=plone.restapi==9.4.2 plone.volto==4.3.0 plone.rest==4.1.3 KGS=