Skip to content

Commit

Permalink
Fix dev backend
Browse files Browse the repository at this point in the history
  • Loading branch information
ksuess committed Nov 12, 2022
1 parent 69c9d9a commit 2ff2e60
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 4 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,9 @@ volumes/var/

addon-testing-project
addon-testing-project_cypress

api/venv/
api/instance/
api/sources/
api/constraints-mxdev.txt
api/requirements-mxdev.txt
12 changes: 8 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Yeoman Volto App development
# TODO testing searchkitblock: docker containers with backend, elasticsearch, redis, celery

### Defensive settings for make:
# https://tech.davis-hansson.com/p/make/
Expand Down Expand Up @@ -70,12 +71,15 @@ start-test: ## Start Test
@echo "$(GREEN)==> Start Test$(RESET)"
(cd addon-testing-project && yarn cypress:open)


# Development
##########################

.PHONY: start-backend-docker
start-backend-docker: ## Starts a Docker-based backend
@echo "$(GREEN)==> Start Docker-based Plone Backend$(RESET)"
docker run -it --rm --name=plone -p 8080:8080 -e SITE=Plone -e ADDONS="plone.volto" -e ZCML="plone.volto.cors" plone
.PHONY: dev-start-backend
dev-start-backend: ## Start a local dev backend
@echo "$(GREEN)==> Start local Plone Backend$(RESET)"
$(MAKE) -C "./api/" start


.PHONY: help
help: ## Show this help.
Expand Down
46 changes: 46 additions & 0 deletions api/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
### Defensive settings for make:
# https://tech.davis-hansson.com/p/make/
SHELL:=bash
.ONESHELL:
.SHELLFLAGS:=-xeu -o pipefail -O inherit_errexit -c
.SILENT:
.DELETE_ON_ERROR:
MAKEFLAGS+=--warn-undefined-variables
MAKEFLAGS+=--no-builtin-rules

# We like colors
# From: https://coderwall.com/p/izxssa/colored-makefile-for-golang-projects
RED=`tput setaf 1`
GREEN=`tput setaf 2`
RESET=`tput sgr0`
YELLOW=`tput setaf 3`

.PHONY: all
all: build

# Add the following 'help' target to your Makefile
# And add help text after each target name starting with '\#\#'
.PHONY: help
help: .SHELLFLAGS:=-eu -o pipefail -O inherit_errexit -c
help: ## This help message
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'


bin/pip:
@echo "$(GREEN)==> Setup Virtual Env$(RESET)"
python -m venv venv
venv/bin/pip install -U "pip" "wheel" "cookiecutter" "mxdev"

instance/etc/zope.ini: bin/pip
@echo "$(GREEN)==> Install Plone and create instance$(RESET)"
venv/bin/cookiecutter -f --no-input --config-file instance.yaml https://github.com/plone/cookiecutter-zope-instance

.PHONY: build
build: instance/etc/zope.ini ## pip install Plone packages
@echo "$(GREEN)==> Setup Build$(RESET)"
venv/bin/mxdev -c mx.ini
venv/bin/pip install -r requirements-mxdev.txt

.PHONY: start
start: build ## Start a Plone instance on localhost:8080
PYTHONWARNINGS=ignore venv/bin/runwsgi -d instance/etc/zope.ini

0 comments on commit 2ff2e60

Please sign in to comment.